Bug 1215937 - Remove use of expression closure from js/xpconnect/. r=bholley

This commit is contained in:
Tooru Fujisawa 2015-10-19 00:01:58 +09:00
parent f99022e1a1
commit 4fa469296d
5 changed files with 17 additions and 13 deletions

View File

@ -144,7 +144,9 @@ this.XPCOMUtils = {
countRef.value = _interfaces.length;
return _interfaces;
},
getScriptableHelper: function XPCU_getScriptableHelper() null,
getScriptableHelper: function XPCU_getScriptableHelper() {
return null;
},
contractID: classInfo.contractID,
classDescription: classInfo.classDescription,
classID: classInfo.classID,

View File

@ -24,8 +24,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
}
var sandbox = new Components.utils.Sandbox("about:blank");
sandbox.importFunction(function() "PASS", "foo");
sandbox.importFunction(function bar() "PASS");
sandbox.importFunction(function() { return "PASS"; }, "foo");
sandbox.importFunction(function bar() { return "PASS"; });
sandbox.importFunction(checkWrapped);
is(Components.utils.evalInSandbox("foo()", sandbox), "PASS", "importFunction works");
is(Components.utils.evalInSandbox("bar()", sandbox), "PASS", "importFunction works");

View File

@ -6,7 +6,9 @@ var gTS = window.location.toString;
var gGHR = Object.getOwnPropertyDescriptor(window.location, 'href').get;
function getTests(fromOuter) {
function loc() fromOuter ? window.location : location;
function loc() {
return fromOuter ? window.location : location;
}
return {
getLocationImplicit: function() {
return loc() + "";
@ -35,14 +37,14 @@ function getTests(fromOuter) {
function mungeNames(obj, suffix) {
var rv = {};
Object.getOwnPropertyNames(obj)
.forEach(function (name) rv[name + suffix] = obj[name]);
.forEach(name => rv[name + suffix] = obj[name]);
return rv;
}
function mergeObjects(a, b) {
var rv = {};
Object.getOwnPropertyNames(a).forEach(function(name) rv[name] = a[name]);
Object.getOwnPropertyNames(b).forEach(function(name) rv[name] = b[name]);
Object.getOwnPropertyNames(a).forEach(name => rv[name] = a[name]);
Object.getOwnPropertyNames(b).forEach(name => rv[name] = b[name]);
return rv;
}

View File

@ -24,19 +24,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=478438
catch (e) { onAllow.opposite("unable " + infinitive, ": " + e) }
}
testOne(function() iwin.focus, pass,
testOne(() => iwin.focus, pass,
"to resolve/get allAccess property iwin.focus");
testOne(function() iwin.focus(), pass,
testOne(() => iwin.focus(), pass,
"to call allAccess method iwin.focus");
testOne(function() iwin.alert, fail,
testOne(() => iwin.alert, fail,
"to resolve/get restricted property iwin.alert");
testOne(function() iwin.alert(), fail,
testOne(() => iwin.alert(), fail,
"to call restricted method iwin.alert");
testOne(function() iwin.location.toString(), fail,
testOne(() => iwin.location.toString(), fail,
"to call restricted method iwin.location.toString");
testOne(function() { iwin.location = "http://example.org" }, pass,

View File

@ -21,7 +21,7 @@ function run_test() {
for (var i = 0; i < 8; ++i)
new Uint8Array(sb.ab)[i] = i * 10;
sb.ta = [];
TypedArrays.forEach(function(f) sb.ta.push(new f(sb.ab)));
TypedArrays.forEach(f => sb.ta.push(new f(sb.ab)));
sb.dv = new DataView(sb.ab);
/* Things that should throw. */