Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(866)

Unified Diff: Source/core/dom/ScriptLoader.h

Issue 47923008: Block execution of failed 'crossorigin' <script>s. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/ScriptLoader.h
diff --git a/Source/core/dom/ScriptLoader.h b/Source/core/dom/ScriptLoader.h
index e6ba8d3b080a8381caf99d256b575fdc4c62a3a3..012fcd7b290d7fe7273c13c1e2c2627f2af59ed4 100644
--- a/Source/core/dom/ScriptLoader.h
+++ b/Source/core/dom/ScriptLoader.h
@@ -30,6 +30,7 @@ namespace WebCore {
class ScriptResource;
class ContainerNode;
+class Document;
class Element;
class ScriptLoaderClient;
class ScriptSourceCode;
@@ -50,6 +51,12 @@ public:
void executeScript(const ScriptSourceCode&);
void execute(ScriptResource*);
+ // Check if potentially cross-origin enabled script is accessible
+ // prior to execution. Returns 'false' if not accessible, signalling
+ // that callers must not dispatch load events as the cross-origin
+ // fetch failed.
+ bool executePotentiallyCrossOriginScript(const ScriptSourceCode&);
+
// XML parser calls these
void dispatchLoadEvent();
void dispatchErrorEvent();
@@ -72,6 +79,8 @@ public:
void handleSourceAttribute(const String& sourceUrl);
void handleAsyncAttribute();
+ static void reportCrossOriginFailure(Document*, const KURL& originUrl, const String& errorDescription);
+
private:
ScriptLoader(Element*, bool createdByParser, bool isEvaluated);

Powered by Google App Engine
This is Rietveld 408576698