dom/xslt/tests/XSLTMark/XSLTMark-static.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xslt/tests/XSLTMark/XSLTMark-static.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     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 +const enablePrivilege = netscape.security.PrivilegeManager.enablePrivilege;
    1.10 +const IOSERVICE_CTRID = "@mozilla.org/network/io-service;1";
    1.11 +const nsIIOService    = Components.interfaces.nsIIOService;
    1.12 +const SIS_CTRID       = "@mozilla.org/scriptableinputstream;1";
    1.13 +const nsISIS          = Components.interfaces.nsIScriptableInputStream;
    1.14 +const nsIFilePicker   = Components.interfaces.nsIFilePicker;
    1.15 +const STDURL_CTRID    = "@mozilla.org/network/standard-url;1";
    1.16 +const nsIURI          = Components.interfaces.nsIURI;
    1.17 +
    1.18 +var gStop = false;
    1.19 +
    1.20 +function loadFile(aUriSpec)
    1.21 +{
    1.22 +    enablePrivilege('UniversalXPConnect');
    1.23 +    var serv = Components.classes[IOSERVICE_CTRID].
    1.24 +        getService(nsIIOService);
    1.25 +    if (!serv) {
    1.26 +        throw Components.results.ERR_FAILURE;
    1.27 +    }
    1.28 +    var chan = serv.newChannel(aUriSpec, null, null);
    1.29 +    var instream = 
    1.30 +        Components.classes[SIS_CTRID].createInstance(nsISIS);
    1.31 +    instream.init(chan.open());
    1.32 +
    1.33 +    return instream.read(instream.available());
    1.34 +}
    1.35 +
    1.36 +function dump20(aVal)
    1.37 +{
    1.38 +    const pads = '                    ';
    1.39 +    if (typeof(aVal)=='string')
    1.40 +        out = aVal;
    1.41 +    else if (typeof(aVal)=='number')
    1.42 +        out = Number(aVal).toFixed(2);
    1.43 +    else
    1.44 +        out = new String(aVal);
    1.45 +    dump(pads.substring(0, 20 - out.length));
    1.46 +    dump(out);
    1.47 +}

mercurial