Index: third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp |
diff --git a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp |
index 42646546f853c61723c30e4710dc3622c58bc275..2eeac0b179b93b1b8947c9bdfee2d7ae2370d76d 100644 |
--- a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp |
+++ b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp |
@@ -148,6 +148,9 @@ void ClassicPendingScript::NotifyFinished(Resource* resource) { |
if (GetElement()) { |
integrity_failure_ = !CheckScriptResourceIntegrity(resource, GetElement()); |
} |
+ DCHECK(!resource_data_); |
+ resource_data_ = GetResource()->ResourceData(); |
+ DCHECK(resource_data_); |
// If script streaming is in use, the client will be notified in |
// streamingFinished. |
@@ -164,6 +167,7 @@ void ClassicPendingScript::NotifyAppendData(ScriptResource* resource) { |
DEFINE_TRACE(ClassicPendingScript) { |
visitor->Trace(streamer_); |
+ visitor->Trace(resource_data_); |
ResourceOwner<ScriptResource>::Trace(visitor); |
MemoryCoordinatorClient::Trace(visitor); |
PendingScript::Trace(visitor); |
@@ -175,10 +179,10 @@ ClassicScript* ClassicPendingScript::GetSource(const KURL& document_url, |
error_occurred = this->ErrorOccurred(); |
if (is_external_) { |
- DCHECK(GetResource()->IsLoaded()); |
+ CHECK(ResourceData()); |
if (streamer_ && !streamer_->StreamingSuppressed()) |
- return ClassicScript::Create(ScriptSourceCode(streamer_, GetResource())); |
- return ClassicScript::Create(ScriptSourceCode(GetResource())); |
+ return ClassicScript::Create(ScriptSourceCode(streamer_, ResourceData())); |
+ return ClassicScript::Create(ScriptSourceCode(ResourceData())); |
} |
return ClassicScript::Create(ScriptSourceCode( |
@@ -195,7 +199,7 @@ void ClassicPendingScript::SetStreamer(ScriptStreamer* streamer) { |
bool ClassicPendingScript::IsReady() const { |
CheckState(); |
if (is_external_) { |
- return GetResource()->IsLoaded() && (!streamer_ || streamer_->IsFinished()); |
+ return ResourceData() && (!streamer_ || streamer_->IsFinished()); |
} |
return true; |
@@ -203,8 +207,10 @@ bool ClassicPendingScript::IsReady() const { |
bool ClassicPendingScript::ErrorOccurred() const { |
CheckState(); |
- if (is_external_) |
- return GetResource()->ErrorOccurred() || integrity_failure_; |
+ if (is_external_) { |
+ CHECK(ResourceData()); |
+ return ResourceData()->ErrorOccurred() || integrity_failure_; |
+ } |
return false; |
} |
@@ -237,6 +243,9 @@ bool ClassicPendingScript::WasCanceled() const { |
} |
KURL ClassicPendingScript::UrlForClassicScript() const { |
+ if (ResourceData()) |
+ return ResourceData()->Url(); |
+ CHECK(GetResource()); |
return GetResource()->Url(); |
} |