1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xslt/tests/buster/buster-statics.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +// helper function to shortcut component creation 1.10 +function doCreate(aContract, aInterface) 1.11 +{ 1.12 + return Components.classes[aContract].createInstance(aInterface); 1.13 +} 1.14 + 1.15 +// for the items, loading a text file 1.16 +const IOSERVICE_CTRID = "@mozilla.org/network/io-service;1"; 1.17 +const nsIIOService = Components.interfaces.nsIIOService; 1.18 +const SIS_CTRID = "@mozilla.org/scriptableinputstream;1" 1.19 +const nsISIS = Components.interfaces.nsIScriptableInputStream; 1.20 + 1.21 +// rdf foo, onload handler 1.22 +const kRDFSvcContractID = "@mozilla.org/rdf/rdf-service;1"; 1.23 +const kRDFInMemContractID = 1.24 + "@mozilla.org/rdf/datasource;1?name=in-memory-datasource"; 1.25 +const kRDFContUtilsID = "@mozilla.org/rdf/container-utils;1"; 1.26 +const kRDFXMLSerializerID = "@mozilla.org/rdf/xml-serializer;1"; 1.27 +const kIOSvcContractID = "@mozilla.org/network/io-service;1"; 1.28 +const kStandardURL = Components.classes["@mozilla.org/network/standard-url;1"]; 1.29 +const nsIURL = Components.interfaces.nsIURL; 1.30 +const nsIStandardURL = Components.interfaces.nsIStandardURL; 1.31 +const nsIFilePicker = Components.interfaces.nsIFilePicker; 1.32 +const nsIXULTreeBuilder = Components.interfaces.nsIXULTreeBuilder; 1.33 +const nsIXULTemplateBuilder = Components.interfaces.nsIXULTemplateBuilder; 1.34 +const kIOSvc = Components.classes[kIOSvcContractID] 1.35 + .getService(Components.interfaces.nsIIOService); 1.36 +const nsIRDFService = Components.interfaces.nsIRDFService; 1.37 +const nsIRDFDataSource = Components.interfaces.nsIRDFDataSource; 1.38 +const nsIRDFRemoteDataSource = Components.interfaces.nsIRDFRemoteDataSource; 1.39 +const nsIRDFPurgeableDataSource = 1.40 + Components.interfaces.nsIRDFPurgeableDataSource; 1.41 +const nsIRDFResource = Components.interfaces.nsIRDFResource; 1.42 +const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral; 1.43 +const nsIRDFInt = Components.interfaces.nsIRDFInt; 1.44 +const nsIRDFContainerUtils = Components.interfaces.nsIRDFContainerUtils; 1.45 +const nsIRDFXMLSerializer = Components.interfaces.nsIRDFXMLSerializer; 1.46 +const nsIRDFXMLSource = Components.interfaces.nsIRDFXMLSource; 1.47 +const kRDFSvc = 1.48 + Components.classes[kRDFSvcContractID].getService(nsIRDFService); 1.49 +const krTypeCat = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#category"); 1.50 +const krTypeFailCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#failCount"); 1.51 +const krTypeName = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#name"); 1.52 +const krTypeSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succ"); 1.53 +const krTypeOrigSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_succ"); 1.54 +const krTypeOrigFailCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_failCount"); 1.55 +const krTypeOrigSuccCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_succCount"); 1.56 +const krTypePath = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#path"); 1.57 +const krTypeParent = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#parent"); 1.58 +const krTypePurp = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#purp"); 1.59 +const krTypeSuccCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succCount"); 1.60 +const kGood = kRDFSvc.GetLiteral("yes"); 1.61 +const kBad = kRDFSvc.GetLiteral("no"); 1.62 +const kMixed = kRDFSvc.GetLiteral("+-"); 1.63 +const kContUtils = doCreate(kRDFContUtilsID, nsIRDFContainerUtils); 1.64 + 1.65 +function doCreateRDFFP(aTitle, aMode) 1.66 +{ 1.67 + var fp = doCreate("@mozilla.org/filepicker;1", nsIFilePicker); 1.68 + fp.init(window, aTitle, aMode); 1.69 + fp.appendFilter('*.rdf', '*.rdf'); 1.70 + fp.appendFilters(nsIFilePicker.filterAll); 1.71 + return fp; 1.72 +} 1.73 + 1.74 +function goDoCommand(aCommand) 1.75 +{ 1.76 + try { 1.77 + var controller = 1.78 + top.document.commandDispatcher.getControllerForCommand(aCommand); 1.79 + if (controller && controller.isCommandEnabled(aCommand)) 1.80 + controller.doCommand(aCommand); 1.81 + } 1.82 + catch(e) { 1.83 + dump("An error "+e+" occurred executing the "+aCommand+" command\n"); 1.84 + } 1.85 +} 1.86 + 1.87 +function registerController(aController) 1.88 +{ 1.89 + top.controllers.appendController(aController); 1.90 +}