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

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

Issue 1814853003: Track whether an element was inserted via document.write (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on #384935 Created 4 years, 8 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: third_party/WebKit/Source/core/dom/ScriptLoader.h
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.h b/third_party/WebKit/Source/core/dom/ScriptLoader.h
index 2b79d305860151bcc0f487d735b3e87d1e570357..9cb998498e121affd543a907a70b4a8bd0720dc8 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.h
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.h
@@ -26,6 +26,7 @@
#include "core/fetch/FetchRequest.h"
#include "core/fetch/ResourceClient.h"
#include "core/fetch/ScriptResource.h"
+#include "core/html/parser/HTMLConstructionSite.h"
#include "wtf/text/TextPosition.h"
#include "wtf/text/WTFString.h"
@@ -36,11 +37,18 @@ class ScriptLoaderClient;
class ScriptSourceCode;
class LocalFrame;
+enum ElementConstructionContextFlags {
kouhei (in TOK) 2016/04/05 13:20:45 Thanks for this change! Would you use enum class
+ DefaultContext = 0,
+ ParserInserted = 1 << 0,
+ AlreadyStarted = 1 << 1,
+ CreatedDuringDocumentWrite = 1 << 2,
+};
+
class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>, public ScriptResourceClient {
public:
- static RawPtr<ScriptLoader> create(Element* element, bool createdByParser, bool isEvaluated)
+ static RawPtr<ScriptLoader> create(Element* element, int constructionContextFlags)
{
- return new ScriptLoader(element, createdByParser, isEvaluated);
+ return new ScriptLoader(element, constructionContextFlags);
}
~ScriptLoader() override;
@@ -85,8 +93,10 @@ public:
// Clears the connection to the PendingScript (and Element and Resource).
void detach();
+ bool wasCreatedDuringDocumentWrite() { return m_wasCreatedDuringDocumentWrite; }
+
protected:
- ScriptLoader(Element*, bool createdByParser, bool isEvaluated);
+ ScriptLoader(Element*, int constructionContextFlags);
private:
bool ignoresLoadRequest() const;
@@ -116,6 +126,7 @@ private:
bool m_willExecuteInOrder : 1;
bool m_willExecuteWhenDocumentFinishedParsing : 1;
bool m_forceAsync : 1;
+ const bool m_wasCreatedDuringDocumentWrite : 1;
kouhei (in TOK) 2016/04/05 13:20:45 can we store constructioncontext instead of expand
Member<PendingScript> m_pendingScript;
};

Powered by Google App Engine
This is Rietveld 408576698