WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP patch
162620_dispatchEvent_noFrame_wip.patch (text/plain), 8.12 KB, created by
Chris Dumez
on 2016-09-27 09:24:04 PDT
(
hide
)
Description:
WIP patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2016-09-27 09:24:04 PDT
Size:
8.12 KB
patch
obsolete
>diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-false-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-false-expected.txt >index a602e21..f08a8c1 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-false-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-false-expected.txt >@@ -2,6 +2,6 @@ > PASS In window.document with click event > PASS In window.document with load event > FAIL In window.document.cloneNode(true) assert_array_equals: targets lengths differ, expected 8 got 0 >-FAIL In new Document() assert_array_equals: targets lengths differ, expected 8 got 0 >-FAIL In DOMImplementation.createHTMLDocument() assert_array_equals: targets lengths differ, expected 8 got 0 >+PASS In new Document() >+PASS In DOMImplementation.createHTMLDocument() > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-true-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-true-expected.txt >index 04eb8bf..ac6857e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-true-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-true-expected.txt >@@ -2,6 +2,6 @@ > PASS In window.document with click event > PASS In window.document with load event > FAIL In window.document.cloneNode(true) assert_array_equals: targets lengths differ, expected 14 got 0 >-FAIL In new Document() assert_array_equals: targets lengths differ, expected 14 got 0 >-FAIL In DOMImplementation.createHTMLDocument() assert_array_equals: targets lengths differ, expected 14 got 0 >+PASS In new Document() >+PASS In DOMImplementation.createHTMLDocument() > >diff --git a/Source/WebCore/css/ElementRuleCollector.cpp b/Source/WebCore/css/ElementRuleCollector.cpp >index c5dcd9c..bca7bce 100644 >--- a/Source/WebCore/css/ElementRuleCollector.cpp >+++ b/Source/WebCore/css/ElementRuleCollector.cpp >@@ -391,7 +391,7 @@ inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, unsigned > #if ENABLE(CSS_SELECTOR_JIT) > void* compiledSelectorChecker = ruleData.compiledSelectorCodeRef().code().executableAddress(); > if (!compiledSelectorChecker && ruleData.compilationStatus() == SelectorCompilationStatus::NotCompiled) { >- JSC::VM& vm = m_element.document().scriptExecutionContext()->vm(); >+ JSC::VM& vm = m_element.document().vm(); > SelectorCompilationStatus compilationStatus; > JSC::MacroAssemblerCodeRef compiledSelectorCodeRef; > compilationStatus = SelectorCompiler::compileSelector(ruleData.selector(), &vm, SelectorCompiler::SelectorContext::RuleCollector, compiledSelectorCodeRef); >diff --git a/Source/WebCore/dom/DOMImplementation.cpp b/Source/WebCore/dom/DOMImplementation.cpp >index c5a7b94..7861c02 100644 >--- a/Source/WebCore/dom/DOMImplementation.cpp >+++ b/Source/WebCore/dom/DOMImplementation.cpp >@@ -114,7 +114,7 @@ static inline Ref<XMLDocument> createXMLDocument(const String& namespaceURI) > ExceptionOr<Ref<XMLDocument>> DOMImplementation::createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType* documentType) > { > auto document = createXMLDocument(namespaceURI); >- >+ document->setScriptExecutionContext(m_document); > document->setSecurityOriginPolicy(m_document.securityOriginPolicy()); > > RefPtr<Element> documentElement; >@@ -153,6 +153,7 @@ Ref<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title) > ASSERT(document->head()); > document->head()->appendChild(titleElement); > } >+ document->setScriptExecutionContext(m_document); > document->setSecurityOriginPolicy(m_document.securityOriginPolicy()); > return document; > } >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index ec0dc03..f35a38c 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -579,6 +579,7 @@ static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, cons > Ref<Document> Document::create(ScriptExecutionContext& context) > { > Ref<Document> document = adoptRef(*new Document(nullptr, URL())); >+ document->setScriptExecutionContext(downcast<Document>(context)); > document->setSecurityOriginPolicy(context.securityOriginPolicy()); > > return document; >@@ -3503,6 +3504,7 @@ void Document::cloneDataFromDocument(const Document& other) > m_baseURL = other.baseURL(); > m_baseURLOverride = other.baseURLOverride(); > m_documentURI = other.documentURI(); >+ m_scriptExecutionContext = other.m_scriptExecutionContext; > > setCompatibilityMode(other.m_compatibilityMode); > setSecurityOriginPolicy(other.securityOriginPolicy()); >@@ -4113,6 +4115,14 @@ void Document::takeDOMWindowFrom(Document* document) > ASSERT(m_domWindow->frame() == m_frame); > } > >+Document* Document::scriptExecutionContext() const >+{ >+ if (m_scriptExecutionContext) >+ return m_scriptExecutionContext.get(); >+ return const_cast<Document*>(this); >+ //return m_frame ? const_cast<Document*>(this) : nullptr; >+} >+ > void Document::setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& attributeValue) > { > setAttributeEventListener(eventType, JSLazyEventListener::create(*this, attributeName, attributeValue)); >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index ccaa9d2..2d8ae6e 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -771,6 +771,9 @@ public: > // In DOM Level 2, the Document's DOMWindow is called the defaultView. > DOMWindow* defaultView() const { return domWindow(); } > >+ Document* scriptExecutionContext() const final; >+ void setScriptExecutionContext(Document& document) { m_scriptExecutionContext = document.createWeakPtr(); } >+ > // Helper functions for forwarding DOMWindow event related tasks to the DOMWindow if it exists. > void setWindowAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& value); > void setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>); >@@ -1411,6 +1414,7 @@ private: > > Frame* m_frame; > RefPtr<DOMWindow> m_domWindow; >+ WeakPtr<Document> m_scriptExecutionContext; > > Ref<CachedResourceLoader> m_cachedResourceLoader; > RefPtr<DocumentParser> m_parser; >@@ -1791,7 +1795,7 @@ inline bool Node::isDocumentNode() const > > inline ScriptExecutionContext* Node::scriptExecutionContext() const > { >- return &document(); >+ return document().scriptExecutionContext(); > } > > Element* eventTargetElementForDocument(Document*); >diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h >index e26c332..15447c9 100644 >--- a/Source/WebCore/dom/Node.h >+++ b/Source/WebCore/dom/Node.h >@@ -497,7 +497,7 @@ public: > Node* toNode() override; > > EventTargetInterface eventTargetInterface() const override; >- ScriptExecutionContext* scriptExecutionContext() const final; // Implemented in Document.h >+ ScriptExecutionContext* scriptExecutionContext() const override; // Implemented in Document.h > > bool addEventListener(const AtomicString& eventType, Ref<EventListener>&&, const AddEventListenerOptions&) override; > bool removeEventListener(const AtomicString& eventType, EventListener&, const ListenerOptions&) override; >diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp >index 77266a1..2532be4 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.cpp >+++ b/Source/WebCore/xml/XMLHttpRequest.cpp >@@ -199,6 +199,7 @@ Document* XMLHttpRequest::responseXML(ExceptionCode& ec) > m_responseDocument = XMLDocument::create(0, m_url); > // FIXME: Set Last-Modified. > m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity()); >+ m_responseDocument->setScriptExecutionContext(downcast<Document>(*scriptExecutionContext())); > m_responseDocument->setSecurityOriginPolicy(scriptExecutionContext()->securityOriginPolicy()); > m_responseDocument->overrideMIMEType(mimeType); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 162620
:
289953
|
289959
|
289973
|
289978
|
289982
|
289991
|
289995