dom/xslt/tests/buster/buster-statics.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 // helper function to shortcut component creation
michael@0 7 function doCreate(aContract, aInterface)
michael@0 8 {
michael@0 9 return Components.classes[aContract].createInstance(aInterface);
michael@0 10 }
michael@0 11
michael@0 12 // for the items, loading a text file
michael@0 13 const IOSERVICE_CTRID = "@mozilla.org/network/io-service;1";
michael@0 14 const nsIIOService = Components.interfaces.nsIIOService;
michael@0 15 const SIS_CTRID = "@mozilla.org/scriptableinputstream;1"
michael@0 16 const nsISIS = Components.interfaces.nsIScriptableInputStream;
michael@0 17
michael@0 18 // rdf foo, onload handler
michael@0 19 const kRDFSvcContractID = "@mozilla.org/rdf/rdf-service;1";
michael@0 20 const kRDFInMemContractID =
michael@0 21 "@mozilla.org/rdf/datasource;1?name=in-memory-datasource";
michael@0 22 const kRDFContUtilsID = "@mozilla.org/rdf/container-utils;1";
michael@0 23 const kRDFXMLSerializerID = "@mozilla.org/rdf/xml-serializer;1";
michael@0 24 const kIOSvcContractID = "@mozilla.org/network/io-service;1";
michael@0 25 const kStandardURL = Components.classes["@mozilla.org/network/standard-url;1"];
michael@0 26 const nsIURL = Components.interfaces.nsIURL;
michael@0 27 const nsIStandardURL = Components.interfaces.nsIStandardURL;
michael@0 28 const nsIFilePicker = Components.interfaces.nsIFilePicker;
michael@0 29 const nsIXULTreeBuilder = Components.interfaces.nsIXULTreeBuilder;
michael@0 30 const nsIXULTemplateBuilder = Components.interfaces.nsIXULTemplateBuilder;
michael@0 31 const kIOSvc = Components.classes[kIOSvcContractID]
michael@0 32 .getService(Components.interfaces.nsIIOService);
michael@0 33 const nsIRDFService = Components.interfaces.nsIRDFService;
michael@0 34 const nsIRDFDataSource = Components.interfaces.nsIRDFDataSource;
michael@0 35 const nsIRDFRemoteDataSource = Components.interfaces.nsIRDFRemoteDataSource;
michael@0 36 const nsIRDFPurgeableDataSource =
michael@0 37 Components.interfaces.nsIRDFPurgeableDataSource;
michael@0 38 const nsIRDFResource = Components.interfaces.nsIRDFResource;
michael@0 39 const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
michael@0 40 const nsIRDFInt = Components.interfaces.nsIRDFInt;
michael@0 41 const nsIRDFContainerUtils = Components.interfaces.nsIRDFContainerUtils;
michael@0 42 const nsIRDFXMLSerializer = Components.interfaces.nsIRDFXMLSerializer;
michael@0 43 const nsIRDFXMLSource = Components.interfaces.nsIRDFXMLSource;
michael@0 44 const kRDFSvc =
michael@0 45 Components.classes[kRDFSvcContractID].getService(nsIRDFService);
michael@0 46 const krTypeCat = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#category");
michael@0 47 const krTypeFailCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#failCount");
michael@0 48 const krTypeName = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#name");
michael@0 49 const krTypeSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succ");
michael@0 50 const krTypeOrigSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_succ");
michael@0 51 const krTypeOrigFailCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_failCount");
michael@0 52 const krTypeOrigSuccCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#orig_succCount");
michael@0 53 const krTypePath = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#path");
michael@0 54 const krTypeParent = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#parent");
michael@0 55 const krTypePurp = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#purp");
michael@0 56 const krTypeSuccCount = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succCount");
michael@0 57 const kGood = kRDFSvc.GetLiteral("yes");
michael@0 58 const kBad = kRDFSvc.GetLiteral("no");
michael@0 59 const kMixed = kRDFSvc.GetLiteral("+-");
michael@0 60 const kContUtils = doCreate(kRDFContUtilsID, nsIRDFContainerUtils);
michael@0 61
michael@0 62 function doCreateRDFFP(aTitle, aMode)
michael@0 63 {
michael@0 64 var fp = doCreate("@mozilla.org/filepicker;1", nsIFilePicker);
michael@0 65 fp.init(window, aTitle, aMode);
michael@0 66 fp.appendFilter('*.rdf', '*.rdf');
michael@0 67 fp.appendFilters(nsIFilePicker.filterAll);
michael@0 68 return fp;
michael@0 69 }
michael@0 70
michael@0 71 function goDoCommand(aCommand)
michael@0 72 {
michael@0 73 try {
michael@0 74 var controller =
michael@0 75 top.document.commandDispatcher.getControllerForCommand(aCommand);
michael@0 76 if (controller && controller.isCommandEnabled(aCommand))
michael@0 77 controller.doCommand(aCommand);
michael@0 78 }
michael@0 79 catch(e) {
michael@0 80 dump("An error "+e+" occurred executing the "+aCommand+" command\n");
michael@0 81 }
michael@0 82 }
michael@0 83
michael@0 84 function registerController(aController)
michael@0 85 {
michael@0 86 top.controllers.appendController(aController);
michael@0 87 }

mercurial