зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1031074 - Don't unblock scripts if we never blocked them. r=gabor
This commit is contained in:
Родитель
9a2a8959f1
Коммит
edc87ef0c9
|
@ -24,15 +24,16 @@
|
||||||
|
|
||||||
class AutoError {
|
class AutoError {
|
||||||
public:
|
public:
|
||||||
AutoError(mozilla::dom::ImportLoader* loader)
|
AutoError(mozilla::dom::ImportLoader* loader, bool scriptsBlocked = true)
|
||||||
: mLoader(loader)
|
: mLoader(loader)
|
||||||
, mPassed(false)
|
, mPassed(false)
|
||||||
|
, mScriptsBlocked(scriptsBlocked)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~AutoError()
|
~AutoError()
|
||||||
{
|
{
|
||||||
if (!mPassed) {
|
if (!mPassed) {
|
||||||
mLoader->Error();
|
mLoader->Error(mScriptsBlocked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ public:
|
||||||
private:
|
private:
|
||||||
mozilla::dom::ImportLoader* mLoader;
|
mozilla::dom::ImportLoader* mLoader;
|
||||||
bool mPassed;
|
bool mPassed;
|
||||||
|
bool mScriptsBlocked;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
@ -164,7 +166,7 @@ ImportLoader::Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ImportLoader::Error()
|
ImportLoader::Error(bool aUnblockScripts)
|
||||||
{
|
{
|
||||||
mDocument = nullptr;
|
mDocument = nullptr;
|
||||||
mStopped = true;
|
mStopped = true;
|
||||||
|
@ -172,7 +174,10 @@ ImportLoader::Error()
|
||||||
for (uint32_t i = 0; i < count; i++) {
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
DispatchErrorEvent(mLinks[i]);
|
DispatchErrorEvent(mLinks[i]);
|
||||||
}
|
}
|
||||||
UnblockScripts();
|
if (aUnblockScripts) {
|
||||||
|
UnblockScripts();
|
||||||
|
}
|
||||||
|
|
||||||
ReleaseResources();
|
ReleaseResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +193,7 @@ void ImportLoader::ReleaseResources()
|
||||||
void
|
void
|
||||||
ImportLoader::Open()
|
ImportLoader::Open()
|
||||||
{
|
{
|
||||||
AutoError ae(this);
|
AutoError ae(this, false);
|
||||||
// Imports should obey to the master documents CSP.
|
// Imports should obey to the master documents CSP.
|
||||||
nsCOMPtr<nsIDocument> master = mImportParent->MasterDocument();
|
nsCOMPtr<nsIDocument> master = mImportParent->MasterDocument();
|
||||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(master);
|
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(master);
|
||||||
|
|
|
@ -100,7 +100,7 @@ private:
|
||||||
void DispatchLoadEvent(nsINode* aNode);
|
void DispatchLoadEvent(nsINode* aNode);
|
||||||
|
|
||||||
// Must be called when an error has occured during load.
|
// Must be called when an error has occured during load.
|
||||||
void Error();
|
void Error(bool aUnblockScripts);
|
||||||
|
|
||||||
// Must be called when the import document has been loaded successfully.
|
// Must be called when the import document has been loaded successfully.
|
||||||
void Done();
|
void Done();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче