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

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

Issue 2657623005: WIP: Give developers an opt-in mechanism to block some parser-inserted scripts.
Patch Set: Refactor. Created 3 years, 11 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/Document.h
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h
index f4b3d4b85eaa081b97540e286c804ac805782bd5..22e518360217c2221b789bc11374de9a2eaa6b1c 100644
--- a/third_party/WebKit/Source/core/dom/Document.h
+++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -224,6 +224,13 @@ enum CreateElementFlags {
CreatedByFragmentParser = CreatedByParser | AsynchronousCustomElements,
};
+enum SrcdocType {
jochen (gone - plz use gerrit) 2017/01/27 15:14:19 nit. enum class. enum constants should start with
+ NotSrcdoc,
+ Srcdoc,
+ FragmentParserCreatedSrcdoc,
+ DocumentWriteCreatedSrcdoc
+};
+
// Collect data about deferred loading of offscreen cross-origin documents. All
// cross-origin documents log Created. Only those that would load log a reason.
// We can then see the % of cross-origin documents that never have to load.
@@ -434,13 +441,17 @@ class CORE_EXPORT Document : public ContainerNode,
bool isFrameSet() const;
- bool isSrcdocDocument() const { return m_isSrcdocDocument; }
+ bool isSrcdocDocument() const { return m_srcdocType != NotSrcdoc; }
bool isMobileDocument() const { return m_isMobileDocument; }
// True if this document is an IFrame srcdoc document, and the frame in which
- // it lives was created by a fragment parser (e.g. 'innerHTML').
+ // it lives was created by a fragment parser (e.g. 'innerHTML') or
+ // 'document.write', respectively.
bool isFragmentParserCreatedSrcdoc() const {
- return m_isFragmentParserCreatedSrcdoc;
+ return m_srcdocType == FragmentParserCreatedSrcdoc;
+ }
+ bool isDocumentWriteCreatedSrcdoc() const {
+ return m_srcdocType == DocumentWriteCreatedSrcdoc;
}
StyleResolver* styleResolver() const;
@@ -1598,9 +1609,10 @@ class CORE_EXPORT Document : public ContainerNode,
bool m_isViewSource;
bool m_sawElementsInKnownNamespaces;
- bool m_isSrcdocDocument;
+ SrcdocType m_srcdocType;
bool m_isMobileDocument;
bool m_isFragmentParserCreatedSrcdoc;
+ bool m_isDocumentWriteCreatedSrcdoc;
LayoutView* m_layoutView;

Powered by Google App Engine
This is Rietveld 408576698