Bug 1031074 - Don't unblock scripts if we never blocked them. r=gabor

This commit is contained in:
Blake Kaplan 2014-06-30 16:30:13 -07:00
Родитель 9a2a8959f1
Коммит edc87ef0c9
2 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -24,15 +24,16 @@
class AutoError {
public:
AutoError(mozilla::dom::ImportLoader* loader)
AutoError(mozilla::dom::ImportLoader* loader, bool scriptsBlocked = true)
: mLoader(loader)
, mPassed(false)
, mScriptsBlocked(scriptsBlocked)
{}
~AutoError()
{
if (!mPassed) {
mLoader->Error();
mLoader->Error(mScriptsBlocked);
}
}
@ -41,6 +42,7 @@ public:
private:
mozilla::dom::ImportLoader* mLoader;
bool mPassed;
bool mScriptsBlocked;
};
namespace mozilla {
@ -164,7 +166,7 @@ ImportLoader::Done()
}
void
ImportLoader::Error()
ImportLoader::Error(bool aUnblockScripts)
{
mDocument = nullptr;
mStopped = true;
@ -172,7 +174,10 @@ ImportLoader::Error()
for (uint32_t i = 0; i < count; i++) {
DispatchErrorEvent(mLinks[i]);
}
if (aUnblockScripts) {
UnblockScripts();
}
ReleaseResources();
}
@ -188,7 +193,7 @@ void ImportLoader::ReleaseResources()
void
ImportLoader::Open()
{
AutoError ae(this);
AutoError ae(this, false);
// Imports should obey to the master documents CSP.
nsCOMPtr<nsIDocument> master = mImportParent->MasterDocument();
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(master);

Просмотреть файл

@ -100,7 +100,7 @@ private:
void DispatchLoadEvent(nsINode* aNode);
// 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.
void Done();