Index: Source/core/dom/ScriptLoader.cpp |
diff --git a/Source/core/dom/ScriptLoader.cpp b/Source/core/dom/ScriptLoader.cpp |
index 04ef75c5c9e967e21c72208230628164595b3a7b..1fbeec5f7d19ec828b64caac29e8dd73b674d5ad 100644 |
--- a/Source/core/dom/ScriptLoader.cpp |
+++ b/Source/core/dom/ScriptLoader.cpp |
@@ -65,7 +65,6 @@ ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadySt |
, m_willExecuteWhenDocumentFinishedParsing(false) |
, m_forceAsync(!parserInserted) |
, m_willExecuteInOrder(false) |
- , m_isPotentiallyCORSEnabled(false) |
{ |
ASSERT(m_element); |
if (parserInserted && element->document().scriptableDocumentParser() && !element->document().isInDocumentWrite()) |
@@ -241,8 +240,7 @@ bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, Legacy |
// Reset line numbering for nested writes. |
TextPosition position = elementDocument.isInDocumentWrite() ? TextPosition() : scriptStartPosition; |
KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInserted) ? elementDocument.url() : KURL(); |
- if (!executePotentiallyCrossOriginScript(ScriptSourceCode(scriptContent(), scriptURL, position))) |
- return false; |
+ executeScript(ScriptSourceCode(scriptContent(), scriptURL, position)); |
} |
return true; |
@@ -266,7 +264,6 @@ bool ScriptLoader::fetchScript(const String& sourceUrl) |
if (!crossOriginMode.isNull()) { |
StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; |
request.setCrossOriginAccessControl(elementDocument->securityOrigin(), allowCredentials); |
- m_isPotentiallyCORSEnabled = true; |
} |
request.setCharset(scriptCharset()); |
@@ -363,18 +360,6 @@ void ScriptLoader::execute(ScriptResource* resource) |
resource->removeClient(this); |
} |
-bool ScriptLoader::executePotentiallyCrossOriginScript(const ScriptSourceCode& sourceCode) |
-{ |
- if (sourceCode.resource() |
- && isPotentiallyCORSEnabled() |
- && !m_element->document().fetcher()->canAccess(sourceCode.resource(), PotentiallyCORSEnabled)) { |
- dispatchErrorEvent(); |
- return false; |
- } |
- executeScript(sourceCode); |
- return true; |
-} |
- |
void ScriptLoader::notifyFinished(Resource* resource) |
{ |
ASSERT(!m_willBeParserExecuted); |
@@ -391,13 +376,11 @@ void ScriptLoader::notifyFinished(Resource* resource) |
ASSERT_UNUSED(resource, resource == m_resource); |
if (!m_resource) |
return; |
- CORSEnabled corsEnabled = isPotentiallyCORSEnabled() ? PotentiallyCORSEnabled : NotCORSEnabled; |
- if (!elementDocument->fetcher()->canAccess(m_resource.get(), corsEnabled)) { |
+ if (m_resource->errorOccurred()) { |
dispatchErrorEvent(); |
contextDocument->scriptRunner()->notifyScriptLoadError(this, m_willExecuteInOrder ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION); |
return; |
} |
- |
if (m_willExecuteInOrder) |
contextDocument->scriptRunner()->notifyScriptReady(this, ScriptRunner::IN_ORDER_EXECUTION); |
else |