Bug 1035395, r=bholley,smaug

--HG--
extra : rebase_source : 478200a62a5073177ae3c782e252fa9a804e5b01
This commit is contained in:
Steve Fink 2014-07-18 09:37:42 -07:00
parent 0d52026d61
commit f8bc213b2f
4 changed files with 6 additions and 6 deletions

View File

@ -872,8 +872,6 @@ nsScriptSecurityManager::ScriptAllowed(JSObject *aGlobal)
{
MOZ_ASSERT(aGlobal);
MOZ_ASSERT(JS_IsGlobalObject(aGlobal) || js::IsOuterObject(aGlobal));
AutoJSContext cx;
JS::RootedObject global(cx, js::UncheckedUnwrap(aGlobal, /* stopAtOuter = */ false));
// Check the bits on the compartment private.
return xpc::Scriptability::Get(aGlobal).Allowed();

View File

@ -1479,8 +1479,10 @@ static nsresult
CheckForOutdatedParent(nsINode* aParent, nsINode* aNode)
{
if (JSObject* existingObjUnrooted = aNode->GetWrapper()) {
JSRuntime* runtime = JS_GetObjectRuntime(existingObjUnrooted);
JS::Rooted<JSObject*> existingObj(runtime, existingObjUnrooted);
AutoJSContext cx;
JS::Rooted<JSObject*> existingObj(cx, existingObjUnrooted);
nsIGlobalObject* global = aParent->OwnerDoc()->GetScopeObject();
MOZ_ASSERT(global);

View File

@ -2229,13 +2229,14 @@ Navigator::HasWifiManagerSupport(JSContext* /* unused */,
bool
Navigator::HasNFCSupport(JSContext* /* unused */, JSObject* aGlobal)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
// Do not support NFC if NFC content helper does not exist.
nsCOMPtr<nsISupports> contentHelper = do_GetService("@mozilla.org/nfc/content-helper;1");
if (!contentHelper) {
return false;
}
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
return win && (CheckPermission(win, "nfc-read") ||
CheckPermission(win, "nfc-write"));
}

View File

@ -1679,12 +1679,11 @@ InterfaceToJsval(nsPIDOMWindow* aWindow,
NS_ENSURE_TRUE(unrootedScopeObj, JS::NullValue());
JSRuntime *runtime = JS_GetObjectRuntime(unrootedScopeObj);
JS::Rooted<JS::Value> someJsVal(runtime);
JS::Rooted<JSObject*> scopeObj(runtime, unrootedScopeObj);
nsresult rv;
{ // Protect someJsVal from moving GC in ~JSAutoCompartment
AutoJSContext cx;
JS::Rooted<JSObject*> scopeObj(cx, unrootedScopeObj);
JSAutoCompartment ac(cx, scopeObj);
rv = nsContentUtils::WrapNative(cx, aObject, aIID, &someJsVal);