From e4a3586a14996bbece3b26c9e3b7704ea6af8615 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Sat, 28 Nov 2015 15:24:36 -0600 Subject: LibreJS upgraded to 6.0.10 --- .../node_modules/pathfinder/lib/scheme/resource.js | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scheme/resource.js (limited to 'data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scheme/resource.js') diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scheme/resource.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scheme/resource.js new file mode 100644 index 0000000..81a4061 --- /dev/null +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scheme/resource.js @@ -0,0 +1,43 @@ +/*jshint asi:true globalstrict:true*/ +'use strict'; + +const { Cc, Ci } = require('chrome') +const ioService = Cc['@mozilla.org/network/io-service;1']. + getService(Ci.nsIIOService); +const resourceHandler = ioService.getProtocolHandler('resource'). + QueryInterface(Ci.nsIResProtocolHandler) + +function get(root) { + /** + Gets the substitution for the `root` key. + **/ + try { + return resourceHandler.getSubstitution(root).spec; + } + catch (error) {} + return null; +} +exports.get = get; + +function has(root) { + /** + Returns `true` if the substitution exists and `false` otherwise. + **/ + return resourceHandler.hasSubstitution(root); +} +exports.has = has; + +function set(root, uri) { + /** + Sets the substitution for the root key: + + resource://root/path ==> baseURI.resolve(path) + + A `null` `uri` removes substitution. A root key should + always be lowercase. However, this may not be enforced. + **/ + uri = !uri ? null : + uri instanceof Ci.nsIURI ? uri : ioService.newURI(uri, null, null); + resourceHandler.setSubstitution(root, uri); +} +exports.set = set; -- cgit v1.2.3