Bug 673569 - Let each frame script have its own anonymous scope (r=smaug,Waldo,mrbkap,bsmedberg)

This commit is contained in:
Bill McCloskey 2013-11-23 21:32:45 -08:00
parent 1f12e761e1
commit a54b870bbc
11 changed files with 191 additions and 83 deletions

View File

@ -332,7 +332,7 @@ HiddenBrowser.prototype = {
// Load all default frame scripts attached to the target window.
let mm = aTab.linkedBrowser.messageManager;
let scripts = win.messageManager.getDelayedFrameScripts();
Array.forEach(scripts, script => mm.loadFrameScript(script, true));
Array.forEach(scripts, ([script, runGlobal]) => mm.loadFrameScript(script, true, runGlobal));
// Remove the browser, it will be recreated by a timer.
this._removeBrowser();

View File

@ -359,7 +359,7 @@ interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
[notxpcom] nsIContent getOwnerContent();
};
[scriptable, builtinclass, uuid(ecebfb8c-ff51-11e2-9d65-7af553959281)]
[scriptable, builtinclass, uuid(6fb78110-45ae-11e3-8f96-0800200c9a66)]
interface nsIFrameScriptLoader : nsISupports
{
/**
@ -369,7 +369,8 @@ interface nsIFrameScriptLoader : nsISupports
* remote frame becomes available. Otherwise the script will be loaded
* only if the frame is already available.
*/
void loadFrameScript(in AString aURL, in boolean aAllowDelayedLoad);
void loadFrameScript(in AString aURL, in boolean aAllowDelayedLoad,
[optional] in boolean aRunInGlobalScope);
/**
* Removes aURL from the list of scripts which support delayed load.
@ -377,10 +378,12 @@ interface nsIFrameScriptLoader : nsISupports
void removeDelayedFrameScript(in AString aURL);
/**
* Returns a list of all delayed scripts that will be loaded once
* a (remote) frame becomes available.
* Returns all delayed scripts that will be loaded once a (remote)
* frame becomes available. The return value is a list of pairs
* [<URL>, <WasLoadedInGlobalScope>].
*/
nsIDOMDOMStringList getDelayedFrameScripts();
[implicit_jscontext]
jsval getDelayedFrameScripts();
};
[scriptable, builtinclass, uuid(b37821ff-df79-44d4-821c-6d6ec4dfe1e9)]

View File

@ -1687,7 +1687,8 @@ nsFrameLoader::MaybeCreateDocShell()
if (mMessageManager) {
mMessageManager->LoadFrameScript(
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
/* allowDelayedLoad = */ true);
/* allowDelayedLoad = */ true,
/* aRunInGlobalScope */ true);
}
}
@ -2188,16 +2189,16 @@ nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
}
bool
nsFrameLoader::DoLoadFrameScript(const nsAString& aURL)
nsFrameLoader::DoLoadFrameScript(const nsAString& aURL, bool aRunInGlobalScope)
{
mozilla::dom::PBrowserParent* tabParent = GetRemoteBrowser();
if (tabParent) {
return tabParent->SendLoadRemoteScript(nsString(aURL));
return tabParent->SendLoadRemoteScript(nsString(aURL), aRunInGlobalScope);
}
nsRefPtr<nsInProcessTabChildGlobal> tabChild =
static_cast<nsInProcessTabChildGlobal*>(GetTabChildGlobalAsEventTarget());
if (tabChild) {
tabChild->LoadFrameScript(aURL);
tabChild->LoadFrameScript(aURL, aRunInGlobalScope);
}
return true;
}

View File

@ -185,7 +185,8 @@ public:
/**
* MessageManagerCallback methods that we override.
*/
virtual bool DoLoadFrameScript(const nsAString& aURL) MOZ_OVERRIDE;
virtual bool DoLoadFrameScript(const nsAString& aURL,
bool aRunInGlobalScope) MOZ_OVERRIDE;
virtual bool DoSendAsyncMessage(JSContext* aCx,
const nsAString& aMessage,
const mozilla::dom::StructuredCloneData& aData,

View File

@ -394,15 +394,18 @@ nsFrameMessageManager::RemoveWeakMessageListener(const nsAString& aMessage,
NS_IMETHODIMP
nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
bool aAllowDelayedLoad)
bool aAllowDelayedLoad,
bool aRunInGlobalScope)
{
if (aAllowDelayedLoad) {
if (IsGlobal() || IsWindowLevel()) {
// Cache for future windows or frames
mPendingScripts.AppendElement(aURL);
mPendingScriptsGlobalStates.AppendElement(aRunInGlobalScope);
} else if (!mCallback) {
// We're frame message manager, which isn't connected yet.
mPendingScripts.AppendElement(aURL);
mPendingScriptsGlobalStates.AppendElement(aRunInGlobalScope);
return NS_OK;
}
}
@ -411,7 +414,8 @@ nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
#ifdef DEBUG_smaug
printf("Will load %s \n", NS_ConvertUTF16toUTF8(aURL).get());
#endif
NS_ENSURE_TRUE(mCallback->DoLoadFrameScript(aURL), NS_ERROR_FAILURE);
NS_ENSURE_TRUE(mCallback->DoLoadFrameScript(aURL, aRunInGlobalScope),
NS_ERROR_FAILURE);
}
for (int32_t i = 0; i < mChildManagers.Count(); ++i) {
@ -420,7 +424,7 @@ nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
if (mm) {
// Use false here, so that child managers don't cache the script, which
// is already cached in the parent.
mm->LoadFrameScript(aURL, false);
mm->LoadFrameScript(aURL, false, aRunInGlobalScope);
}
}
return NS_OK;
@ -429,12 +433,18 @@ nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
NS_IMETHODIMP
nsFrameMessageManager::RemoveDelayedFrameScript(const nsAString& aURL)
{
mPendingScripts.RemoveElement(aURL);
for (uint32_t i = 0; i < mPendingScripts.Length(); ++i) {
if (mPendingScripts[i] == aURL) {
mPendingScripts.RemoveElementAt(i);
mPendingScriptsGlobalStates.RemoveElementAt(i);
break;
}
}
return NS_OK;
}
NS_IMETHODIMP
nsFrameMessageManager::GetDelayedFrameScripts(nsIDOMDOMStringList** aList)
nsFrameMessageManager::GetDelayedFrameScripts(JSContext* aCx, JS::Value* aList)
{
// Frame message managers may return an incomplete list because scripts
// that were loaded after it was connected are not added to the list.
@ -444,13 +454,26 @@ nsFrameMessageManager::GetDelayedFrameScripts(nsIDOMDOMStringList** aList)
return NS_ERROR_NOT_IMPLEMENTED;
}
nsRefPtr<nsDOMStringList> scripts = new nsDOMStringList();
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, mPendingScripts.Length(), nullptr));
NS_ENSURE_TRUE(array, NS_ERROR_OUT_OF_MEMORY);
for (uint32_t i = 0; i < mPendingScripts.Length(); ++i) {
scripts->Add(mPendingScripts[i]);
JS::Rooted<JSString*> url(aCx);
url = JS_NewUCStringCopyN(aCx, mPendingScripts[i].get(), mPendingScripts[i].Length());
NS_ENSURE_TRUE(url, NS_ERROR_OUT_OF_MEMORY);
JS::Value pairElts[] = { JS::StringValue(url),
JS::BooleanValue(mPendingScriptsGlobalStates[i]) };
JS::Rooted<JSObject*> pair(aCx, JS_NewArrayObject(aCx, 2, pairElts));
NS_ENSURE_TRUE(pair, NS_ERROR_OUT_OF_MEMORY);
JS::Rooted<JS::Value> pairVal(aCx, JS::ObjectValue(*pair));
NS_ENSURE_TRUE(JS_SetElement(aCx, array, i, &pairVal),
NS_ERROR_OUT_OF_MEMORY);
}
scripts.forget(aList);
*aList = JS::ObjectValue(*array);
return NS_OK;
}
@ -1049,11 +1072,13 @@ nsFrameMessageManager::AddChildManager(nsFrameMessageManager* aManager,
if (mParentManager) {
nsRefPtr<nsFrameMessageManager> globalMM = mParentManager;
for (uint32_t i = 0; i < globalMM->mPendingScripts.Length(); ++i) {
aManager->LoadFrameScript(globalMM->mPendingScripts[i], false);
aManager->LoadFrameScript(globalMM->mPendingScripts[i], false,
globalMM->mPendingScriptsGlobalStates[i]);
}
}
for (uint32_t i = 0; i < mPendingScripts.Length(); ++i) {
aManager->LoadFrameScript(mPendingScripts[i], false);
aManager->LoadFrameScript(mPendingScripts[i], false,
mPendingScriptsGlobalStates[i]);
}
}
}
@ -1074,7 +1099,7 @@ nsFrameMessageManager::SetCallback(MessageManagerCallback* aCallback, bool aLoad
}
if (aLoadScripts) {
for (uint32_t i = 0; i < mPendingScripts.Length(); ++i) {
LoadFrameScript(mPendingScripts[i], false);
LoadFrameScript(mPendingScripts[i], false, mPendingScriptsGlobalStates[i]);
}
}
}
@ -1304,7 +1329,7 @@ NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)
return CallQueryInterface(mm, aResult);
}
nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>*
nsDataHashtable<nsStringHashKey, nsFrameScriptObjectExecutorHolder*>*
nsFrameScriptExecutor::sCachedScripts = nullptr;
nsScriptCacheCleaner* nsFrameScriptExecutor::sScriptCacheCleaner = nullptr;
@ -1314,7 +1339,7 @@ nsFrameScriptExecutor::DidCreateGlobal()
NS_ASSERTION(mGlobal, "Should have mGlobal!");
if (!sCachedScripts) {
sCachedScripts =
new nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>;
new nsDataHashtable<nsStringHashKey, nsFrameScriptObjectExecutorHolder*>;
nsRefPtr<nsScriptCacheCleaner> scriptCacheCleaner =
new nsScriptCacheCleaner();
@ -1324,11 +1349,16 @@ nsFrameScriptExecutor::DidCreateGlobal()
static PLDHashOperator
CachedScriptUnrooter(const nsAString& aKey,
nsFrameJSScriptExecutorHolder*& aData,
void* aUserArg)
nsFrameScriptObjectExecutorHolder*& aData,
void* aUserArg)
{
JSContext* cx = static_cast<JSContext*>(aUserArg);
JS_RemoveScriptRoot(cx, &(aData->mScript));
if (aData->mScript) {
JS_RemoveScriptRoot(cx, &aData->mScript);
}
if (aData->mFunction) {
JS_RemoveObjectRoot(cx, &aData->mFunction);
}
delete aData;
return PL_DHASH_REMOVE;
}
@ -1351,31 +1381,53 @@ nsFrameScriptExecutor::Shutdown()
}
void
nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL,
bool aRunInGlobalScope)
{
if (!mGlobal || !sCachedScripts) {
return;
}
nsFrameJSScriptExecutorHolder* holder = sCachedScripts->Get(aURL);
if (!holder) {
TryCacheLoadAndCompileScript(aURL, EXECUTE_IF_CANT_CACHE);
holder = sCachedScripts->Get(aURL);
AutoSafeJSContext cx;
JS::Rooted<JSScript*> script(cx);
JS::Rooted<JSObject*> funobj(cx);
nsFrameScriptObjectExecutorHolder* holder = sCachedScripts->Get(aURL);
if (holder && holder->WillRunInGlobalScope() == aRunInGlobalScope) {
script = holder->mScript;
funobj = holder->mFunction;
} else {
// Don't put anything in the cache if we already have an entry
// with a different WillRunInGlobalScope() value.
bool shouldCache = !holder;
TryCacheLoadAndCompileScript(aURL, aRunInGlobalScope,
shouldCache, &script, &funobj);
}
if (holder) {
AutoSafeJSContext cx;
JS::Rooted<JSObject*> global(cx, mGlobal->GetJSObject());
if (global) {
JSAutoCompartment ac(cx, global);
(void) JS_ExecuteScript(cx, global, holder->mScript, nullptr);
JS::Rooted<JSObject*> global(cx, mGlobal->GetJSObject());
if (global) {
JSAutoCompartment ac(cx, global);
if (funobj) {
JS::Rooted<JSObject*> method(cx, JS_CloneFunctionObject(cx, funobj, global));
if (!method) {
return;
}
JS::Rooted<JS::Value> rval(cx);
JS::Rooted<JS::Value> methodVal(cx, JS::ObjectValue(*method));
(void) JS_CallFunctionValue(cx, global, methodVal,
0, nullptr, rval.address());
} else if (script) {
(void) JS_ExecuteScript(cx, global, script, nullptr);
}
}
}
void
nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
CacheFailedBehavior aBehavior)
bool aRunInGlobalScope,
bool aShouldCache,
JS::MutableHandle<JSScript*> aScriptp,
JS::MutableHandle<JSObject*> aFunp)
{
nsCString url = NS_ConvertUTF16toUTF8(aURL);
nsCOMPtr<nsIURI> uri;
@ -1422,32 +1474,65 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
if (global) {
JSAutoCompartment ac(cx, global);
JS::CompileOptions options(cx);
options.setNoScriptRval(true)
.setFileAndLine(url.get(), 1)
options.setFileAndLine(url.get(), 1)
.setPrincipals(nsJSPrincipals::get(mPrincipal));
JS::Rooted<JSScript*> script(cx,
JS::Compile(cx, JS::NullPtr(), options, dataString.get(),
dataString.Length()));
if (script) {
nsAutoCString scheme;
uri->GetScheme(scheme);
// We don't cache data: scripts!
if (!scheme.EqualsLiteral("data")) {
nsFrameJSScriptExecutorHolder* holder =
new nsFrameJSScriptExecutorHolder(script);
// Root the object also for caching.
JS_AddNamedScriptRoot(cx, &(holder->mScript),
"Cached message manager script");
sCachedScripts->Put(aURL, holder);
} else if (aBehavior == EXECUTE_IF_CANT_CACHE) {
(void) JS_ExecuteScript(cx, global, script, nullptr);
JS::Rooted<JSScript*> script(cx);
JS::Rooted<JSObject*> funobj(cx);
if (aRunInGlobalScope) {
options.setNoScriptRval(true);
script = JS::Compile(cx, JS::NullPtr(), options, dataString.get(),
dataString.Length());
} else {
JS::Rooted<JSFunction *> fun(cx);
fun = JS::CompileFunction(cx, JS::NullPtr(), options,
nullptr, 0, nullptr, /* name, nargs, args */
dataString.get(),
dataString.Length());
if (!fun) {
return;
}
funobj = JS_GetFunctionObject(fun);
}
if (!script && !funobj) {
return;
}
aScriptp.set(script);
aFunp.set(funobj);
nsAutoCString scheme;
uri->GetScheme(scheme);
// We don't cache data: scripts!
if (aShouldCache && !scheme.EqualsLiteral("data")) {
nsFrameScriptObjectExecutorHolder* holder;
// Root the object also for caching.
if (script) {
holder = new nsFrameScriptObjectExecutorHolder(script);
JS_AddNamedScriptRoot(cx, &holder->mScript,
"Cached message manager script");
} else {
holder = new nsFrameScriptObjectExecutorHolder(funobj);
JS_AddNamedObjectRoot(cx, &holder->mFunction,
"Cached message manager function");
}
sCachedScripts->Put(aURL, holder);
}
}
}
}
void
nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
bool aRunInGlobalScope)
{
AutoSafeJSContext cx;
JS::Rooted<JSScript*> script(cx);
JS::Rooted<JSObject*> funobj(cx);
TryCacheLoadAndCompileScript(aURL, aRunInGlobalScope, true, &script, &funobj);
}
bool
nsFrameScriptExecutor::InitTabChildGlobalInternal(nsISupports* aScope,
const nsACString& aID)

View File

@ -53,7 +53,7 @@ class MessageManagerCallback
public:
virtual ~MessageManagerCallback() {}
virtual bool DoLoadFrameScript(const nsAString& aURL)
virtual bool DoLoadFrameScript(const nsAString& aURL, bool aRunInGlobalScope)
{
return true;
}
@ -296,6 +296,7 @@ protected:
nsAutoPtr<mozilla::dom::ipc::MessageManagerCallback> mOwnedCallback;
nsFrameMessageManager* mParentManager;
nsTArray<nsString> mPendingScripts;
nsTArray<bool> mPendingScriptsGlobalStates;
public:
static nsFrameMessageManager* sParentProcessManager;
static nsFrameMessageManager* sChildProcessManager;
@ -314,15 +315,25 @@ private:
class nsScriptCacheCleaner;
struct nsFrameJSScriptExecutorHolder
struct nsFrameScriptObjectExecutorHolder
{
nsFrameJSScriptExecutorHolder(JSScript* aScript) : mScript(aScript)
{ MOZ_COUNT_CTOR(nsFrameJSScriptExecutorHolder); }
~nsFrameJSScriptExecutorHolder()
{ MOZ_COUNT_DTOR(nsFrameJSScriptExecutorHolder); }
nsFrameScriptObjectExecutorHolder(JSScript* aScript) : mScript(aScript), mFunction(nullptr)
{ MOZ_COUNT_CTOR(nsFrameScriptObjectExecutorHolder); }
nsFrameScriptObjectExecutorHolder(JSObject* aFunction) : mScript(nullptr), mFunction(aFunction)
{ MOZ_COUNT_CTOR(nsFrameScriptObjectExecutorHolder); }
~nsFrameScriptObjectExecutorHolder()
{ MOZ_COUNT_DTOR(nsFrameScriptObjectExecutorHolder); }
bool WillRunInGlobalScope() { return mScript; }
// We use JS_AddNamed{Script,Object}Root to root these fields explicitly, so
// no need for Heap<T>.
JSScript* mScript;
JSObject* mFunction;
};
class nsFrameScriptObjectExecutorStackHolder;
class nsFrameScriptExecutor
{
public:
@ -339,14 +350,18 @@ protected:
~nsFrameScriptExecutor()
{ MOZ_COUNT_DTOR(nsFrameScriptExecutor); }
void DidCreateGlobal();
void LoadFrameScriptInternal(const nsAString& aURL);
enum CacheFailedBehavior { EXECUTE_IF_CANT_CACHE, DONT_EXECUTE };
void LoadFrameScriptInternal(const nsAString& aURL, bool aRunInGlobalScope);
void TryCacheLoadAndCompileScript(const nsAString& aURL,
CacheFailedBehavior aBehavior = DONT_EXECUTE);
bool aRunInGlobalScope,
bool aShouldCache,
JS::MutableHandle<JSScript*> aScriptp,
JS::MutableHandle<JSObject*> aFunp);
void TryCacheLoadAndCompileScript(const nsAString& aURL,
bool aRunInGlobalScope);
bool InitTabChildGlobalInternal(nsISupports* aScope, const nsACString& aID);
nsCOMPtr<nsIXPConnectJSObjectHolder> mGlobal;
nsCOMPtr<nsIPrincipal> mPrincipal;
static nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>* sCachedScripts;
static nsDataHashtable<nsStringHashKey, nsFrameScriptObjectExecutorHolder*>* sCachedScripts;
static nsScriptCacheCleaner* sScriptCacheCleaner;
};

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8; -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@ -335,23 +335,25 @@ nsInProcessTabChildGlobal::InitTabChildGlobal()
class nsAsyncScriptLoad : public nsRunnable
{
public:
nsAsyncScriptLoad(nsInProcessTabChildGlobal* aTabChild, const nsAString& aURL)
: mTabChild(aTabChild), mURL(aURL) {}
nsAsyncScriptLoad(nsInProcessTabChildGlobal* aTabChild, const nsAString& aURL,
bool aRunInGlobalScope)
: mTabChild(aTabChild), mURL(aURL), mRunInGlobalScope(aRunInGlobalScope) {}
NS_IMETHOD Run()
{
mTabChild->LoadFrameScript(mURL);
mTabChild->LoadFrameScript(mURL, mRunInGlobalScope);
return NS_OK;
}
nsRefPtr<nsInProcessTabChildGlobal> mTabChild;
nsString mURL;
bool mRunInGlobalScope;
};
void
nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL)
nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL, bool aRunInGlobalScope)
{
if (!nsContentUtils::IsSafeToRunScript()) {
nsContentUtils::AddScriptRunner(new nsAsyncScriptLoad(this, aURL));
nsContentUtils::AddScriptRunner(new nsAsyncScriptLoad(this, aURL, aRunInGlobalScope));
return;
}
if (!mInitialized) {
@ -360,7 +362,7 @@ nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL)
}
bool tmp = mLoadingScript;
mLoadingScript = true;
LoadFrameScriptInternal(aURL);
LoadFrameScriptInternal(aURL, aRunInGlobalScope);
mLoadingScript = tmp;
if (!mLoadingScript && mDelayedDisconnect) {
mDelayedDisconnect = false;

View File

@ -119,7 +119,7 @@ public:
virtual JSContext* GetJSContextForEventHandlers() MOZ_OVERRIDE { return nsContentUtils::GetSafeJSContext(); }
virtual nsIPrincipal* GetPrincipal() MOZ_OVERRIDE { return mPrincipal; }
void LoadFrameScript(const nsAString& aURL);
void LoadFrameScript(const nsAString& aURL, bool aRunInGlobalScope);
void Disconnect();
void SendMessageToParent(const nsString& aMessage, bool aSync,
const nsString& aJSON,

View File

@ -400,7 +400,7 @@ child:
*/
ActivateFrameEvent(nsString aType, bool capture);
LoadRemoteScript(nsString aURL);
LoadRemoteScript(nsString aURL, bool aRunInGlobalScope);
/**
* Create a asynchronous request to render whatever document is

View File

@ -222,10 +222,11 @@ TabChild::PreloadSlowThings()
return;
}
// Just load and compile these scripts, but don't run them.
tab->TryCacheLoadAndCompileScript(BROWSER_ELEMENT_CHILD_SCRIPT);
tab->TryCacheLoadAndCompileScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
// Load, compile, and run these scripts.
tab->RecvLoadRemoteScript(
NS_LITERAL_STRING("chrome://global/content/preload.js"));
NS_LITERAL_STRING("chrome://global/content/preload.js"),
true);
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(tab->mWebNav);
if (nsIPresShell* presShell = docShell->GetPresShell()) {
@ -2075,14 +2076,14 @@ TabChild::DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* actor)
}
bool
TabChild::RecvLoadRemoteScript(const nsString& aURL)
TabChild::RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalScope)
{
if (!mGlobal && !InitTabChildGlobal())
// This can happen if we're half-destroyed. It's not a fatal
// error.
return true;
LoadFrameScriptInternal(aURL);
LoadFrameScriptInternal(aURL, aRunInGlobalScope);
return true;
}
@ -2213,7 +2214,7 @@ TabChild::InitTabChildGlobal(FrameScriptLoading aScriptLoading)
// Initialize the child side of the browser element machinery,
// if appropriate.
if (IsBrowserOrApp()) {
RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT);
RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
}
}

View File

@ -242,7 +242,7 @@ public:
virtual bool RecvTextEvent(const mozilla::WidgetTextEvent& event);
virtual bool RecvSelectionEvent(const mozilla::WidgetSelectionEvent& event);
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
virtual bool RecvLoadRemoteScript(const nsString& aURL);
virtual bool RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalScope);
virtual bool RecvAsyncMessage(const nsString& aMessage,
const ClonedMessageData& aData,
const InfallibleTArray<CpowEntry>& aCpows,