From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/dom/ScriptableDocumentParser.h | 29 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'Source/WebCore/dom/ScriptableDocumentParser.h') diff --git a/Source/WebCore/dom/ScriptableDocumentParser.h b/Source/WebCore/dom/ScriptableDocumentParser.h index 8f8dc98c8..8fc1c9ca0 100644 --- a/Source/WebCore/dom/ScriptableDocumentParser.h +++ b/Source/WebCore/dom/ScriptableDocumentParser.h @@ -23,11 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScriptableDocumentParser_h -#define ScriptableDocumentParser_h +#pragma once #include "DecodedDataDocumentParser.h" #include "FragmentScriptingPermission.h" +#include "Timer.h" #include namespace WebCore { @@ -38,14 +38,18 @@ public: // JavaScript document.open() call right now, or it should be ignored. virtual bool isExecutingScript() const { return false; } - // FIXME: Only the HTMLDocumentParser ever blocks script execution on - // stylesheet load, which is likely a bug in the XMLDocumentParser. - virtual void executeScriptsWaitingForStylesheets() { } - virtual bool isWaitingForScripts() const = 0; virtual TextPosition textPosition() const = 0; + virtual bool hasScriptsWaitingForStylesheets() const { return false; } + + void executeScriptsWaitingForStylesheetsSoon(); + + // Returns true if the parser didn't yield or pause or synchronously execute a script, + // so calls to PageConsoleClient should be associated with the parser's text position. + virtual bool shouldAssociateConsoleMessagesWithTextPosition() const = 0; + void setWasCreatedByScript(bool wasCreatedByScript) { m_wasCreatedByScript = wasCreatedByScript; } bool wasCreatedByScript() const { return m_wasCreatedByScript; } @@ -54,14 +58,19 @@ public: protected: explicit ScriptableDocumentParser(Document&, ParserContentPolicy = AllowScriptingContent); + virtual void executeScriptsWaitingForStylesheets() { } + + void detach() override; + private: - virtual ScriptableDocumentParser* asScriptableDocumentParser() override { return this; } + ScriptableDocumentParser* asScriptableDocumentParser() final { return this; } + + void scriptsWaitingForStylesheetsExecutionTimerFired(); // http://www.whatwg.org/specs/web-apps/current-work/#script-created-parser bool m_wasCreatedByScript; ParserContentPolicy m_parserContentPolicy; + Timer m_scriptsWaitingForStylesheetsExecutionTimer; }; -} - -#endif // ScriptableDocumentParser_h +} // namespace WebCore -- cgit v1.2.1