зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1858146 - Make more global properties available for sjs files. r=necko-reviewers,jesup
There are a couple of example removals to show it works, bug 1858148 will handle the rest. Differential Revision: https://phabricator.services.mozilla.com/D190603
This commit is contained in:
Родитель
edae79f296
Коммит
28b01ddf72
|
@ -11,7 +11,6 @@
|
|||
* ?p=http%3A%2F%2Fexample.org%2Fbrowser%2Fbrowser%2Fbase%2Fcontent%2Ftest%2Fgeneral%2Frefresh_meta.sjs&d=200
|
||||
*/
|
||||
function handleRequest(request, response) {
|
||||
Cu.importGlobalProperties(["URLSearchParams"]);
|
||||
let query = new URLSearchParams(request.queryString);
|
||||
|
||||
let page = query.get("p");
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
Cu.importGlobalProperties(["TextEncoder"]);
|
||||
|
||||
let gTimer;
|
||||
|
||||
function handleRequest(req, resp) {
|
||||
|
|
|
@ -2875,11 +2875,19 @@ ServerHandler.prototype = {
|
|||
// If you update the list of imports, please update the list in
|
||||
// tools/lint/eslint/eslint-plugin-mozilla/lib/environments/sjs.js
|
||||
// as well.
|
||||
var s = Cu.Sandbox(Cu.getGlobalForObject({}));
|
||||
var s = Cu.Sandbox(Cu.getGlobalForObject({}), {
|
||||
wantGlobalProperties: [
|
||||
"atob",
|
||||
"btoa",
|
||||
"ChromeUtils",
|
||||
"IOUtils",
|
||||
"PathUtils",
|
||||
"TextEncoder",
|
||||
"URLSearchParams",
|
||||
"URL",
|
||||
],
|
||||
});
|
||||
s.importFunction(dump, "dump");
|
||||
s.importFunction(atob, "atob");
|
||||
s.importFunction(btoa, "btoa");
|
||||
s.importFunction(ChromeUtils, "ChromeUtils");
|
||||
s.importFunction(Services, "Services");
|
||||
|
||||
// Define a basic key-value state-preservation API across requests, with
|
||||
|
|
|
@ -101,6 +101,7 @@ module.exports = {
|
|||
browser: false,
|
||||
"mozilla/privileged": false,
|
||||
"mozilla/sjs": true,
|
||||
"mozilla/specific": false,
|
||||
},
|
||||
files: ["**/*.sjs"],
|
||||
rules: {
|
||||
|
|
|
@ -14,8 +14,18 @@ module.exports = {
|
|||
// https://searchfox.org/mozilla-central/rev/26a1b0fce12e6dd495a954c542bb1e7bd6e0d548/netwerk/test/httpserver/httpd.js#2879
|
||||
atob: false,
|
||||
btoa: false,
|
||||
Cc: false,
|
||||
ChromeUtils: false,
|
||||
Ci: false,
|
||||
Components: false,
|
||||
Cr: false,
|
||||
Cu: false,
|
||||
dump: false,
|
||||
IOUtils: false,
|
||||
PathUtils: false,
|
||||
TextEncoder: false,
|
||||
URLSearchParams: false,
|
||||
URL: false,
|
||||
getState: false,
|
||||
setState: false,
|
||||
getSharedState: false,
|
||||
|
|
Загрузка…
Ссылка в новой задаче