aboutsummaryrefslogtreecommitdiff
path: root/tools/addon-sdk-1.12/lib/sdk/loader/sandbox.js
diff options
context:
space:
mode:
authorGravatar Trevor Elliott <trevor@galois.com>2013-06-07 16:42:11 -0700
committerGravatar Trevor Elliott <trevor@galois.com>2013-06-07 16:48:17 -0700
commit8b5d3c6b75744cf5938f253d20f367999e92b1a7 (patch)
treeb516a82c5b198fd080d265e56b3edf19d1180f10 /tools/addon-sdk-1.12/lib/sdk/loader/sandbox.js
parentf37588f9a4c7c6b418c64f03d82d48ecd14da217 (diff)
Remove the addon-sdk from the repo, and download it on demand
Diffstat (limited to 'tools/addon-sdk-1.12/lib/sdk/loader/sandbox.js')
-rw-r--r--tools/addon-sdk-1.12/lib/sdk/loader/sandbox.js50
1 files changed, 0 insertions, 50 deletions
diff --git a/tools/addon-sdk-1.12/lib/sdk/loader/sandbox.js b/tools/addon-sdk-1.12/lib/sdk/loader/sandbox.js
deleted file mode 100644
index 3c085aa..0000000
--- a/tools/addon-sdk-1.12/lib/sdk/loader/sandbox.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-module.metadata = {
- "stability": "experimental"
-};
-
-const { Cc, Ci, CC, Cu } = require('chrome');
-const systemPrincipal = CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')();
-const scriptLoader = Cc['@mozilla.org/moz/jssubscript-loader;1'].
- getService(Ci.mozIJSSubScriptLoader);
-
-/**
- * Make a new sandbox that inherits given `source`'s principals. Source can be
- * URI string, DOMWindow or `null` for system principals.
- */
-function sandbox(target, options) {
- return Cu.Sandbox(target || systemPrincipal, options || {});
-}
-exports.sandbox = sandbox
-
-/**
- * Evaluates given `source` in a given `sandbox` and returns result.
- */
-function evaluate(sandbox, code, uri, line, version) {
- return Cu.evalInSandbox(code, sandbox, version || '1.8', uri || '', line || 1);
-}
-exports.evaluate = evaluate;
-
-/**
- * Evaluates code under the given `uri` in the given `sandbox`.
- *
- * @param {String} uri
- * The URL pointing to the script to load.
- * It must be a local chrome:, resource:, file: or data: URL.
- */
-function load(sandbox, uri) {
- if (uri.indexOf('data:') === 0) {
- let source = uri.substr(uri.indexOf(',') + 1);
-
- return evaluate(sandbox, decodeURIComponent(source), '1.8', uri, 0);
- } else {
- return scriptLoader.loadSubScript(uri, sandbox, 'UTF-8');
- }
-}
-exports.load = load; \ No newline at end of file