зеркало из https://github.com/mozilla/gecko-dev.git
Bug 683218 - Disable __noSuchMethod__ support. r=jorendorff
This commit is contained in:
Родитель
8d74976282
Коммит
fa74c41137
|
@ -2794,6 +2794,15 @@ GetLcovInfo(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
EnableNoSuchMethod(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
cx->runtime()->options().setNoSuchMethod(true);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool
|
||||
SetRNGState(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
@ -3260,6 +3269,10 @@ gc::ZealModeHelpText),
|
|||
" Generate LCOV tracefile for the given compartment. If no global are provided then\n"
|
||||
" the current global is used as the default one.\n"),
|
||||
|
||||
JS_FN_HELP("enableNoSuchMethod", EnableNoSuchMethod, 0, 0,
|
||||
"enableNoSuchMethod()",
|
||||
" Enables the deprecated, non-standard __noSuchMethod__ feature.\n"),
|
||||
|
||||
#ifdef DEBUG
|
||||
JS_FN_HELP("setRNGState", SetRNGState, 1, 0,
|
||||
"setRNGState(seed)",
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
if (getJitCompilerOptions()["ion.forceinlineCaches"])
|
||||
setJitCompilerOption("ion.forceinlineCaches", 0);
|
||||
|
||||
enableNoSuchMethod();
|
||||
|
||||
Array.prototype.__proto__ = Proxy.create({
|
||||
getPropertyDescriptor: function(name) {
|
||||
return (560566);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
enableNoSuchMethod();
|
||||
|
||||
var count = 0;
|
||||
var a = {__noSuchMethod__: function() { count++; } }
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
enableNoSuchMethod();
|
||||
gczeal(2,1);
|
||||
var count = 0;
|
||||
var a = {__noSuchMethod__: function() { count++; } }
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
enableNoSuchMethod();
|
||||
|
||||
var res = 0;
|
||||
var o = {};
|
||||
o.__noSuchMethod__ = function(x) { res += x; };
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
enableNoSuchMethod();
|
||||
|
||||
(function() {
|
||||
let(z) {
|
||||
for each(b in [{}]) { ({
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
enableNoSuchMethod();
|
||||
|
||||
function testStuff(x, y) {
|
||||
for (var i = 0; i < 60; i++) {
|
||||
x[y]();
|
||||
|
|
|
@ -1156,7 +1156,8 @@ class JS_PUBLIC_API(RuntimeOptions) {
|
|||
asyncStack_(true),
|
||||
werror_(false),
|
||||
strictMode_(false),
|
||||
extraWarnings_(false)
|
||||
extraWarnings_(false),
|
||||
noSuchMethod_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1238,6 +1239,12 @@ class JS_PUBLIC_API(RuntimeOptions) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool noSuchMethod() const { return noSuchMethod_; }
|
||||
RuntimeOptions& setNoSuchMethod(bool flag) {
|
||||
noSuchMethod_ = flag;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
bool baseline_ : 1;
|
||||
bool ion_ : 1;
|
||||
|
@ -1248,6 +1255,7 @@ class JS_PUBLIC_API(RuntimeOptions) {
|
|||
bool werror_ : 1;
|
||||
bool strictMode_ : 1;
|
||||
bool extraWarnings_ : 1;
|
||||
bool noSuchMethod_ : 1;
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(RuntimeOptions&)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// |reftest| skip-if(!xulRuntime.shell)
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* 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
|
||||
|
@ -9,6 +10,8 @@ var summary = '__noSuchMethod__ handler';
|
|||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
enableNoSuchMethod();
|
||||
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// |reftest| skip-if(!xulRuntime.shell)
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
|
@ -12,8 +13,8 @@ var summary = '__noSuchMethod__ when property exists';
|
|||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
enableNoSuchMethod();
|
||||
test();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// |reftest| skip-if(!xulRuntime.shell)
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* 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
|
||||
|
@ -11,6 +12,7 @@ var expect = '';
|
|||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
enableNoSuchMethod();
|
||||
test();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// |reftest| skip-if(!xulRuntime.shell)
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
enableNoSuchMethod();
|
||||
|
||||
var sym = Symbol("method");
|
||||
var hits = 0;
|
||||
var obj = {
|
||||
|
|
|
@ -169,6 +169,9 @@ static const Class js_NoSuchMethodClass = {
|
|||
bool
|
||||
js::OnUnknownMethod(JSContext* cx, HandleObject obj, Value idval_, MutableHandleValue vp)
|
||||
{
|
||||
if (!cx->runtime()->options().noSuchMethod())
|
||||
return true;
|
||||
|
||||
RootedValue idval(cx, idval_);
|
||||
|
||||
RootedValue value(cx);
|
||||
|
|
Загрузка…
Ссылка в новой задаче