mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 832014 part 9. Switch AccessCheck to using the generated LocationBinding::IsPermitted method. r=bholley
This commit is contained in:
parent
7a44e33e2c
commit
7bf5a529d9
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
|
#include "mozilla/dom/LocationBinding.h"
|
||||||
#include "mozilla/dom/WindowBinding.h"
|
#include "mozilla/dom/WindowBinding.h"
|
||||||
#include "nsIDOMWindowCollection.h"
|
#include "nsIDOMWindowCollection.h"
|
||||||
#include "nsJSUtils.h"
|
#include "nsJSUtils.h"
|
||||||
@ -90,13 +91,6 @@ AccessCheck::getPrincipal(JSCompartment *compartment)
|
|||||||
return GetCompartmentPrincipal(compartment);
|
return GetCompartmentPrincipal(compartment);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NAME(ch, str, cases) \
|
|
||||||
case ch: if (!strcmp(name, str)) switch (propChar0) { cases }; break;
|
|
||||||
#define PROP(ch, actions) case ch: { actions }; break;
|
|
||||||
#define RW(str) if (JS_FlatStringEqualsAscii(prop, str)) return true;
|
|
||||||
#define R(str) if (!set && JS_FlatStringEqualsAscii(prop, str)) return true;
|
|
||||||
#define W(str) if (set && JS_FlatStringEqualsAscii(prop, str)) return true;
|
|
||||||
|
|
||||||
// Hardcoded policy for cross origin property access. This was culled from the
|
// Hardcoded policy for cross origin property access. This was culled from the
|
||||||
// preferences file (all.js). We don't want users to overwrite highly sensitive
|
// preferences file (all.js). We don't want users to overwrite highly sensitive
|
||||||
// security policies.
|
// security policies.
|
||||||
@ -109,9 +103,9 @@ IsPermitted(const char *name, JSFlatString *prop, bool set)
|
|||||||
|
|
||||||
jschar propChar0 = JS_GetFlatStringCharAt(prop, 0);
|
jschar propChar0 = JS_GetFlatStringCharAt(prop, 0);
|
||||||
switch (name[0]) {
|
switch (name[0]) {
|
||||||
NAME('L', "Location",
|
case 'L':
|
||||||
PROP('h', W("href"))
|
if (!strcmp(name, "Location"))
|
||||||
PROP('r', R("replace")))
|
return dom::LocationBinding::IsPermitted(prop, propChar0, set);
|
||||||
case 'W':
|
case 'W':
|
||||||
if (!strcmp(name, "Window"))
|
if (!strcmp(name, "Window"))
|
||||||
return dom::WindowBinding::IsPermitted(prop, propChar0, set);
|
return dom::WindowBinding::IsPermitted(prop, propChar0, set);
|
||||||
@ -120,11 +114,6 @@ IsPermitted(const char *name, JSFlatString *prop, bool set)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef NAME
|
|
||||||
#undef RW
|
|
||||||
#undef R
|
|
||||||
#undef W
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
IsFrameId(JSContext *cx, JSObject *objArg, jsid idArg)
|
IsFrameId(JSContext *cx, JSObject *objArg, jsid idArg)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user