зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1487167 - Various DOM rooting issues. r=bz
--HG-- extra : amend_source : dc5bf09193860ac7a3f01071132284ed10423e97
This commit is contained in:
Родитель
27f15e7950
Коммит
1554c31d8c
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ContentFrameMessageManager.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -13,12 +14,15 @@ using namespace mozilla::dom;
|
|||
JSObject*
|
||||
ContentFrameMessageManager::GetOrCreateWrapper()
|
||||
{
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JS::RootedValue val(RootingCx());
|
||||
{
|
||||
// Scope to run ~AutoJSAPI before working with a raw JSObject*.
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
|
||||
JS::RootedValue val(jsapi.cx());
|
||||
if (!GetOrCreateDOMReflectorNoWrap(jsapi.cx(), this, &val)) {
|
||||
return nullptr;
|
||||
if (!GetOrCreateDOMReflectorNoWrap(jsapi.cx(), this, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(val.isObject());
|
||||
return &val.toObject();
|
||||
|
|
|
@ -114,13 +114,17 @@ ContentProcessMessageManager::WrapObject(JSContext* aCx,
|
|||
JSObject*
|
||||
ContentProcessMessageManager::GetOrCreateWrapper()
|
||||
{
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JS::RootedValue val(RootingCx());
|
||||
{
|
||||
// Scope to run ~AutoJSAPI before working with a raw JSObject*.
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
|
||||
JS::RootedValue val(jsapi.cx());
|
||||
if (!GetOrCreateDOMReflectorNoWrap(jsapi.cx(), this, &val)) {
|
||||
return nullptr;
|
||||
if (!GetOrCreateDOMReflectorNoWrap(jsapi.cx(), this, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(val.isObject());
|
||||
return &val.toObject();
|
||||
}
|
||||
|
||||
|
|
|
@ -752,7 +752,7 @@ int32_t
|
|||
CustomElementRegistry::InferNamespace(JSContext* aCx,
|
||||
JS::Handle<JSObject*> constructor)
|
||||
{
|
||||
JSObject* XULConstructor = XULElement_Binding::GetConstructorObject(aCx);
|
||||
JS::Rooted<JSObject*> XULConstructor(aCx, XULElement_Binding::GetConstructorObject(aCx));
|
||||
|
||||
JS::Rooted<JSObject*> proto(aCx, constructor);
|
||||
while (proto) {
|
||||
|
|
|
@ -105,6 +105,9 @@ CheckDOMProxy(JSObject* proxy)
|
|||
MOZ_ASSERT(!js::gc::EdgeNeedsSweepUnbarriered(&proxy));
|
||||
nsISupports* native = UnwrapDOMObject<nsISupports>(proxy);
|
||||
nsWrapperCache* cache;
|
||||
// QI to nsWrapperCache cannot GC for very non-obvious reasons; see
|
||||
// https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/js/xpconnect/src/XPCWrappedJSClass.cpp#521,545-548
|
||||
JS::AutoSuppressGCAnalysis nogc;
|
||||
CallQueryInterface(native, &cache);
|
||||
MOZ_ASSERT(cache->GetWrapperPreserveColor() == proxy);
|
||||
#endif
|
||||
|
|
|
@ -87,11 +87,11 @@ ServiceWorkerContainer::IsEnabled(JSContext* aCx, JSObject* aGlobal)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (IsSecureContextOrObjectIsFromSecureContext(aCx, aGlobal)) {
|
||||
if (IsSecureContextOrObjectIsFromSecureContext(aCx, global)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool isTestingEnabledInWindow = IsServiceWorkersTestingEnabledInWindow(aGlobal);
|
||||
const bool isTestingEnabledInWindow = IsServiceWorkersTestingEnabledInWindow(global);
|
||||
const bool isTestingEnabledByPref = StaticPrefs::dom_serviceWorkers_testing_enabled();
|
||||
const bool isTestingEnabled = isTestingEnabledByPref || isTestingEnabledInWindow;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче