mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1126105 - Remove wrap() builtin and mark wrapWithProto() as non-fuzzing-safe to avoid impossible overrecursion in tests. (r=Waldo)
This commit is contained in:
parent
20e889d173
commit
542bc8536a
@ -3,7 +3,7 @@
|
||||
// Binary: cache/js-dbg-64-b84d0be52070-linux
|
||||
// Flags:
|
||||
//
|
||||
var x = wrap.call(x, Function);
|
||||
var x = new Proxy(Function, {});
|
||||
if (x.__proto__ = x) {
|
||||
print(x);
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
// Binary: cache/js-dbg-64-f5e128da7b5f-linux
|
||||
// Flags:
|
||||
//
|
||||
x = Proxy.createFunction((function () {}), Uint16Array, wrap)
|
||||
try { new(wrap(x)) } catch(exc1) {}
|
@ -1,4 +1,4 @@
|
||||
// Binary: cache/js-dbg-32-7b8898c9b54c-linux
|
||||
// Flags:
|
||||
//
|
||||
wrap(this)
|
||||
new Proxy(this,{})
|
||||
|
@ -14,7 +14,7 @@ var _var_ = o;
|
||||
}
|
||||
for(var i1=0; i1<6; i1++) {
|
||||
f4(f3);
|
||||
f4 = wrap(f7);
|
||||
f4 = new Proxy(f7, {});
|
||||
}
|
||||
f4(f0);
|
||||
|
||||
|
@ -5,7 +5,7 @@ var o9 = Function.prototype;
|
||||
var o13 = Array;
|
||||
function f5(o) {
|
||||
o.watch('p3', function() {});
|
||||
ox1 = wrap(o);
|
||||
ox1 = new Proxy(o, {});
|
||||
}
|
||||
f5(o9);
|
||||
f5(o13);
|
||||
|
@ -1,4 +1,9 @@
|
||||
// Binary: cache/js-dbg-64-1da11a2bc5db-linux
|
||||
// Flags:
|
||||
//
|
||||
new Int32Array(wrap(new Uint8ClampedArray))
|
||||
|
||||
try {
|
||||
new Int32Array(new Proxy(new Uint8ClampedArray, {}))
|
||||
throw new Error("Hey! you made .length work on proxies! Congrats!" +
|
||||
"Remove the try catch for karma points. :)");
|
||||
} catch (e) { }
|
||||
|
@ -5,7 +5,7 @@ evalcx("\
|
||||
} catch(a) {\
|
||||
x = a;\
|
||||
} \
|
||||
wrap(x);\
|
||||
new Proxy(x, {});\
|
||||
", s);
|
||||
evalcx("\
|
||||
n = x;\
|
||||
|
@ -1,5 +1,5 @@
|
||||
function f() {
|
||||
"use strict";
|
||||
}
|
||||
g = wrap(f);
|
||||
g = new Proxy(f, {});
|
||||
Object.defineProperty(g, "arguments", {set: function(){}});
|
||||
|
@ -1,2 +1,2 @@
|
||||
obj = wrap(Number.bind());
|
||||
obj = new Proxy(Number.bind(), {});
|
||||
Object.defineProperty(obj, "caller", {set: function () {}});
|
||||
|
@ -1,4 +0,0 @@
|
||||
function f() {}
|
||||
g = wrap(f);
|
||||
g.__defineGetter__('toString', f.toString);
|
||||
g.toString;
|
@ -1 +0,0 @@
|
||||
"".match(wrap(evalcx("/x/",newGlobal())));
|
@ -1,5 +0,0 @@
|
||||
var b = new ArrayBuffer(4);
|
||||
var dv = new DataView(b);
|
||||
dv.setInt32(0, 42);
|
||||
var w = wrap(dv);
|
||||
assertEq(DataView.prototype.getInt32.call(w, 0), 42);
|
@ -3,14 +3,6 @@
|
||||
assertEq((new (Proxy.createFunction({},
|
||||
function(){ this.x = 1 },
|
||||
function(){ this.x = 2 }))).x, 2);
|
||||
try {
|
||||
x = Proxy.createFunction((function () {}), Uint16Array, wrap)
|
||||
new(wrap(x))
|
||||
throw "Should not be reached"
|
||||
}
|
||||
catch (e) {
|
||||
assertEq(String(e.message).indexOf('is not a constructor') === -1, false);
|
||||
}
|
||||
// proxies can return the callee
|
||||
var x = Proxy.createFunction({}, function (q) { return q; });
|
||||
assertEq(new x(x), x);
|
||||
|
@ -1,12 +1,14 @@
|
||||
// |jit-test| error: is not a function
|
||||
function f() { (e)
|
||||
} (x = Proxy.createFunction((function(x) {
|
||||
function f() {
|
||||
(e)
|
||||
}
|
||||
(x = Proxy.createFunction((function(x) {
|
||||
return {
|
||||
get: function(r, b) {
|
||||
return x[b]
|
||||
}
|
||||
}
|
||||
})(/x/), wrap))
|
||||
})(/x/), Function))
|
||||
for (z = 0; z < 100; x.unwatch(), z++)
|
||||
for (e in [0]) {
|
||||
gczeal(2)
|
||||
|
@ -3927,26 +3927,6 @@ ThisFilename(JSContext *cx, unsigned argc, Value *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
Wrap(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
Value v = args.get(0);
|
||||
if (v.isPrimitive()) {
|
||||
args.rval().set(v);
|
||||
return true;
|
||||
}
|
||||
|
||||
RootedObject obj(cx, v.toObjectOrNull());
|
||||
JSObject *wrapped = Wrapper::New(cx, obj, &obj->global(),
|
||||
&Wrapper::singleton);
|
||||
if (!wrapped)
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*wrapped);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
WrapWithProto(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
@ -4564,14 +4544,6 @@ static const JSFunctionSpecWithHelp shell_functions[] = {
|
||||
"thisFilename()",
|
||||
" Return the filename of the current script"),
|
||||
|
||||
JS_FN_HELP("wrap", Wrap, 1, 0,
|
||||
"wrap(obj)",
|
||||
" Wrap an object into a noop wrapper."),
|
||||
|
||||
JS_FN_HELP("wrapWithProto", WrapWithProto, 2, 0,
|
||||
"wrapWithProto(obj)",
|
||||
" Wrap an object into a noop wrapper with prototype semantics."),
|
||||
|
||||
JS_FN_HELP("newGlobal", NewGlobal, 1, 0,
|
||||
"newGlobal([options])",
|
||||
" Return a new global object in a new compartment. If options\n"
|
||||
@ -4698,6 +4670,12 @@ static const JSFunctionSpecWithHelp fuzzing_unsafe_functions[] = {
|
||||
" might be asked for the source code of compilations that |fun|\n"
|
||||
" performed, and which, presumably, only |hook| knows how to find.\n"),
|
||||
|
||||
JS_FN_HELP("wrapWithProto", WrapWithProto, 2, 0,
|
||||
"wrapWithProto(obj)",
|
||||
" Wrap an object into a noop wrapper with prototype semantics.\n"
|
||||
" Note: This is not fuzzing safe because it can be used to construct\n"
|
||||
" deeply nested wrapper chains that cannot exist in the wild."),
|
||||
|
||||
JS_FS_HELP_END
|
||||
};
|
||||
|
||||
|
@ -183,14 +183,6 @@ function runNormalTests(global)
|
||||
assertEq(setImmutablePrototype(indirectFunctionProxy), true);
|
||||
assertEq(Object.getPrototypeOf(indirectFunctionProxy), global.Function.prototype);
|
||||
checkPrototypeMutationFailure(indirectFunctionProxy, "indirectFunctionProxy");
|
||||
|
||||
// more-hated wrap()
|
||||
|
||||
var wrappedTarget = {};
|
||||
var wrappedProxy = global.wrap(wrappedTarget);
|
||||
|
||||
assertEq(setImmutablePrototype(wrappedProxy), true);
|
||||
checkPrototypeMutationFailure(wrappedProxy, "wrapped proxy");
|
||||
}
|
||||
|
||||
var global = this;
|
||||
|
Loading…
Reference in New Issue
Block a user