| Differences between
and this patch
- a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-false-expected.txt -3 / +3 lines
Lines 1-7 a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-false-expected.txt_sec1
1
1
2
PASS In window.document with click event 
2
PASS In window.document with click event 
3
PASS In window.document with load event 
3
PASS In window.document with load event 
4
FAIL In window.document.cloneNode(true) assert_array_equals: targets lengths differ, expected 8 got 0
4
PASS In window.document.cloneNode(true) 
5
FAIL In new Document() assert_array_equals: targets lengths differ, expected 8 got 0
5
PASS In new Document() 
6
FAIL In DOMImplementation.createHTMLDocument() assert_array_equals: targets lengths differ, expected 8 got 0
6
PASS In DOMImplementation.createHTMLDocument() 
7
7
- a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-true-expected.txt -3 / +3 lines
Lines 1-7 a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubbles-true-expected.txt_sec1
1
1
2
PASS In window.document with click event 
2
PASS In window.document with click event 
3
PASS In window.document with load event 
3
PASS In window.document with load event 
4
FAIL In window.document.cloneNode(true) assert_array_equals: targets lengths differ, expected 14 got 0
4
PASS In window.document.cloneNode(true) 
5
FAIL In new Document() assert_array_equals: targets lengths differ, expected 14 got 0
5
PASS In new Document() 
6
FAIL In DOMImplementation.createHTMLDocument() assert_array_equals: targets lengths differ, expected 14 got 0
6
PASS In DOMImplementation.createHTMLDocument() 
7
7
- a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-other-document-expected.txt +3 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-other-document-expected.txt_sec1
1
2
PASS Custom event on an element in another document 
3
- a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-other-document.html +22 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-other-document.html_sec1
1
<!doctype html>
2
<title>Custom event on an element in another document</title>
3
<script src="/resources/testharness.js"></script>
4
<script src="/resources/testharnessreport.js"></script>
5
<div id=log></div>
6
<script>
7
test(function() {
8
  var doc = document.implementation.createHTMLDocument("Demo");
9
  var element = doc.createElement("div");
10
  var called = false;
11
  element.addEventListener("foo", this.step_func(function(ev) {
12
    assert_false(called);
13
    called = true;
14
    assert_equals(ev.target, element);
15
  }));
16
  doc.body.appendChild(element);
17
18
  var event = new Event("foo");
19
  element.dispatchEvent(event);
20
  assert_true(called);
21
});
22
</script>
- a/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log +1 lines
Lines 29-34 List of files: a/LayoutTests/imported/w3c/web-platform-tests/dom/events/w3c-import.log_sec1
29
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-stopPropagation.html
29
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-stopPropagation.html
30
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-omitted-capture.html
30
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-omitted-capture.html
31
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-order.html
31
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-order.html
32
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-other-document.html
32
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-propagation-stopped.html
33
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-propagation-stopped.html
33
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-redispatch.html
34
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-redispatch.html
34
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-reenter.html
35
/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-reenter.html
- a/Source/WebCore/css/ElementRuleCollector.cpp -1 / +1 lines
Lines 391-397 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, unsigned a/Source/WebCore/css/ElementRuleCollector.cpp_sec1
391
#if ENABLE(CSS_SELECTOR_JIT)
391
#if ENABLE(CSS_SELECTOR_JIT)
392
    void* compiledSelectorChecker = ruleData.compiledSelectorCodeRef().code().executableAddress();
392
    void* compiledSelectorChecker = ruleData.compiledSelectorCodeRef().code().executableAddress();
393
    if (!compiledSelectorChecker && ruleData.compilationStatus() == SelectorCompilationStatus::NotCompiled) {
393
    if (!compiledSelectorChecker && ruleData.compilationStatus() == SelectorCompilationStatus::NotCompiled) {
394
        JSC::VM& vm = m_element.document().scriptExecutionContext()->vm();
394
        JSC::VM& vm = m_element.document().vm();
395
        SelectorCompilationStatus compilationStatus;
395
        SelectorCompilationStatus compilationStatus;
396
        JSC::MacroAssemblerCodeRef compiledSelectorCodeRef;
396
        JSC::MacroAssemblerCodeRef compiledSelectorCodeRef;
397
        compilationStatus = SelectorCompiler::compileSelector(ruleData.selector(), &vm, SelectorCompiler::SelectorContext::RuleCollector, compiledSelectorCodeRef);
397
        compilationStatus = SelectorCompiler::compileSelector(ruleData.selector(), &vm, SelectorCompiler::SelectorContext::RuleCollector, compiledSelectorCodeRef);
- a/Source/WebCore/dom/DOMImplementation.cpp -1 / +2 lines
Lines 114-120 static inline Ref<XMLDocument> createXMLDocument(const String& namespaceURI) a/Source/WebCore/dom/DOMImplementation.cpp_sec1
114
ExceptionOr<Ref<XMLDocument>> DOMImplementation::createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType* documentType)
114
ExceptionOr<Ref<XMLDocument>> DOMImplementation::createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType* documentType)
115
{
115
{
116
    auto document = createXMLDocument(namespaceURI);
116
    auto document = createXMLDocument(namespaceURI);
117
117
    document->setScriptExecutionContext(m_document);
118
    document->setSecurityOriginPolicy(m_document.securityOriginPolicy());
118
    document->setSecurityOriginPolicy(m_document.securityOriginPolicy());
119
119
120
    RefPtr<Element> documentElement;
120
    RefPtr<Element> documentElement;
Lines 153-158 Ref<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title) a/Source/WebCore/dom/DOMImplementation.cpp_sec2
153
        ASSERT(document->head());
153
        ASSERT(document->head());
154
        document->head()->appendChild(titleElement);
154
        document->head()->appendChild(titleElement);
155
    }
155
    }
156
    document->setScriptExecutionContext(m_document);
156
    document->setSecurityOriginPolicy(m_document.securityOriginPolicy());
157
    document->setSecurityOriginPolicy(m_document.securityOriginPolicy());
157
    return document;
158
    return document;
158
}
159
}
- a/Source/WebCore/dom/Document.cpp +9 lines
Lines 579-584 static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, cons a/Source/WebCore/dom/Document.cpp_sec1
579
Ref<Document> Document::create(ScriptExecutionContext& context)
579
Ref<Document> Document::create(ScriptExecutionContext& context)
580
{
580
{
581
    Ref<Document> document = adoptRef(*new Document(nullptr, URL()));
581
    Ref<Document> document = adoptRef(*new Document(nullptr, URL()));
582
    document->setScriptExecutionContext(downcast<Document>(context));
582
    document->setSecurityOriginPolicy(context.securityOriginPolicy());
583
    document->setSecurityOriginPolicy(context.securityOriginPolicy());
583
584
584
    return document;
585
    return document;
Lines 3505-3510 void Document::cloneDataFromDocument(const Document& other) a/Source/WebCore/dom/Document.cpp_sec2
3505
    m_documentURI = other.documentURI();
3506
    m_documentURI = other.documentURI();
3506
3507
3507
    setCompatibilityMode(other.m_compatibilityMode);
3508
    setCompatibilityMode(other.m_compatibilityMode);
3509
    setScriptExecutionContext(*other.scriptExecutionContext());
3508
    setSecurityOriginPolicy(other.securityOriginPolicy());
3510
    setSecurityOriginPolicy(other.securityOriginPolicy());
3509
    overrideMIMEType(other.contentType());
3511
    overrideMIMEType(other.contentType());
3510
    setDecoder(other.decoder());
3512
    setDecoder(other.decoder());
Lines 4113-4118 void Document::takeDOMWindowFrom(Document* document) a/Source/WebCore/dom/Document.cpp_sec3
4113
    ASSERT(m_domWindow->frame() == m_frame);
4115
    ASSERT(m_domWindow->frame() == m_frame);
4114
}
4116
}
4115
4117
4118
Document* Document::scriptExecutionContext() const
4119
{
4120
    if (m_scriptExecutionContext)
4121
        return m_scriptExecutionContext.get();
4122
    return const_cast<Document*>(this);
4123
}
4124
4116
void Document::setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& attributeValue)
4125
void Document::setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& attributeValue)
4117
{
4126
{
4118
    setAttributeEventListener(eventType, JSLazyEventListener::create(*this, attributeName, attributeValue));
4127
    setAttributeEventListener(eventType, JSLazyEventListener::create(*this, attributeName, attributeValue));
- a/Source/WebCore/dom/Document.h -1 / +5 lines
Lines 771-776 public: a/Source/WebCore/dom/Document.h_sec1
771
    // In DOM Level 2, the Document's DOMWindow is called the defaultView.
771
    // In DOM Level 2, the Document's DOMWindow is called the defaultView.
772
    DOMWindow* defaultView() const { return domWindow(); } 
772
    DOMWindow* defaultView() const { return domWindow(); } 
773
773
774
    Document* scriptExecutionContext() const final;
775
    void setScriptExecutionContext(Document& document) { m_scriptExecutionContext = document.createWeakPtr(); }
776
774
    // Helper functions for forwarding DOMWindow event related tasks to the DOMWindow if it exists.
777
    // Helper functions for forwarding DOMWindow event related tasks to the DOMWindow if it exists.
775
    void setWindowAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& value);
778
    void setWindowAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& value);
776
    void setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>);
779
    void setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>);
Lines 1411-1416 private: a/Source/WebCore/dom/Document.h_sec2
1411
1414
1412
    Frame* m_frame;
1415
    Frame* m_frame;
1413
    RefPtr<DOMWindow> m_domWindow;
1416
    RefPtr<DOMWindow> m_domWindow;
1417
    WeakPtr<Document> m_scriptExecutionContext;
1414
1418
1415
    Ref<CachedResourceLoader> m_cachedResourceLoader;
1419
    Ref<CachedResourceLoader> m_cachedResourceLoader;
1416
    RefPtr<DocumentParser> m_parser;
1420
    RefPtr<DocumentParser> m_parser;
Lines 1791-1797 inline bool Node::isDocumentNode() const a/Source/WebCore/dom/Document.h_sec3
1791
1795
1792
inline ScriptExecutionContext* Node::scriptExecutionContext() const
1796
inline ScriptExecutionContext* Node::scriptExecutionContext() const
1793
{
1797
{
1794
    return &document();
1798
    return document().scriptExecutionContext();
1795
}
1799
}
1796
1800
1797
Element* eventTargetElementForDocument(Document*);
1801
Element* eventTargetElementForDocument(Document*);
- a/Source/WebCore/dom/Node.h -1 / +1 lines
Lines 497-503 public: a/Source/WebCore/dom/Node.h_sec1
497
    Node* toNode() override;
497
    Node* toNode() override;
498
498
499
    EventTargetInterface eventTargetInterface() const override;
499
    EventTargetInterface eventTargetInterface() const override;
500
    ScriptExecutionContext* scriptExecutionContext() const final; // Implemented in Document.h
500
    ScriptExecutionContext* scriptExecutionContext() const override; // Implemented in Document.h
501
501
502
    bool addEventListener(const AtomicString& eventType, Ref<EventListener>&&, const AddEventListenerOptions&) override;
502
    bool addEventListener(const AtomicString& eventType, Ref<EventListener>&&, const AddEventListenerOptions&) override;
503
    bool removeEventListener(const AtomicString& eventType, EventListener&, const ListenerOptions&) override;
503
    bool removeEventListener(const AtomicString& eventType, EventListener&, const ListenerOptions&) override;
- a/Source/WebCore/xml/XMLHttpRequest.cpp +1 lines
Lines 199-204 Document* XMLHttpRequest::responseXML(ExceptionCode& ec) a/Source/WebCore/xml/XMLHttpRequest.cpp_sec1
199
                m_responseDocument = XMLDocument::create(0, m_url);
199
                m_responseDocument = XMLDocument::create(0, m_url);
200
            // FIXME: Set Last-Modified.
200
            // FIXME: Set Last-Modified.
201
            m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
201
            m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
202
            m_responseDocument->setScriptExecutionContext(downcast<Document>(*scriptExecutionContext()));
202
            m_responseDocument->setSecurityOriginPolicy(scriptExecutionContext()->securityOriginPolicy());
203
            m_responseDocument->setSecurityOriginPolicy(scriptExecutionContext()->securityOriginPolicy());
203
            m_responseDocument->overrideMIMEType(mimeType);
204
            m_responseDocument->overrideMIMEType(mimeType);
204
205

Return to Bug 162620