mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 813901 - Throw COW exceptions in the wrapper's scope. r=mrbkap
This commit is contained in:
parent
b30851b4a2
commit
58fb47e8e1
@ -304,6 +304,13 @@ IsInSandbox(JSContext *cx, JSObject *obj)
|
||||
return !strcmp(js::GetObjectJSClass(global)->name, "Sandbox");
|
||||
}
|
||||
|
||||
static void
|
||||
EnterAndThrow(JSContext *cx, JSObject *wrapper, const char *msg)
|
||||
{
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
JS_ReportError(cx, msg);
|
||||
}
|
||||
|
||||
bool
|
||||
ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper::Action act)
|
||||
{
|
||||
@ -369,7 +376,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper:
|
||||
return false;
|
||||
|
||||
if (!exposedProps.isObject()) {
|
||||
JS_ReportError(cx, "__exposedProps__ must be undefined, null, or an Object");
|
||||
EnterAndThrow(cx, wrapper, "__exposedProps__ must be undefined, null, or an Object");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -385,7 +392,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper:
|
||||
return false;
|
||||
|
||||
if (!JSVAL_IS_STRING(desc.value)) {
|
||||
JS_ReportError(cx, "property must be a string");
|
||||
EnterAndThrow(cx, wrapper, "property must be a string");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -399,7 +406,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper:
|
||||
switch (chars[i]) {
|
||||
case 'r':
|
||||
if (access & READ) {
|
||||
JS_ReportError(cx, "duplicate 'readable' property flag");
|
||||
EnterAndThrow(cx, wrapper, "duplicate 'readable' property flag");
|
||||
return false;
|
||||
}
|
||||
access = Access(access | READ);
|
||||
@ -407,20 +414,20 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper:
|
||||
|
||||
case 'w':
|
||||
if (access & WRITE) {
|
||||
JS_ReportError(cx, "duplicate 'writable' property flag");
|
||||
EnterAndThrow(cx, wrapper, "duplicate 'writable' property flag");
|
||||
return false;
|
||||
}
|
||||
access = Access(access | WRITE);
|
||||
break;
|
||||
|
||||
default:
|
||||
JS_ReportError(cx, "properties can only be readable or read and writable");
|
||||
EnterAndThrow(cx, wrapper, "properties can only be readable or read and writable");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (access == NO_ACCESS) {
|
||||
JS_ReportError(cx, "specified properties must have a permission bit set");
|
||||
EnterAndThrow(cx, wrapper, "specified properties must have a permission bit set");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user