Changeset 226202 in webkit
- Timestamp:
- Dec 20, 2017 2:47:20 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r226199 r226202 1 2017-12-20 Brady Eidson <beidson@apple.com> 2 3 Assertion failure in MessagePort::contextDestroyed in http/tests/security/MessagePort/event-listener-context.html, usually attributed to later tests. 4 https://bugs.webkit.org/show_bug.cgi?id=94458 5 6 Reviewed by Chris Dumez. 7 8 * fast/events/message-port-constructor-for-deleted-document-expected.txt: 9 * fast/events/message-port-constructor-for-deleted-document.html: 10 * fast/events/resources/copy-of-message-port-context-destroyed.html: Added. 11 * platform/mac/TestExpectations: Reenable the now-reliable and now-passing test. 12 1 13 2017-12-20 Youenn Fablet <youenn@apple.com> 2 14 -
trunk/LayoutTests/fast/events/message-port-constructor-for-deleted-document-expected.txt
r129542 r226202 1 Test that destroying a document doesn't cause a crash when executing MessageChannel constructor saved from its Window object.2 3 1 Didn't crash: SUCCESS 4 -
trunk/LayoutTests/fast/events/message-port-constructor-for-deleted-document.html
r120792 r226202 45 45 } 46 46 47 log("Didn't crash: SUCCESS"); 48 49 if (window.testRunner) 50 testRunner.notifyDone(); 47 location.href='resources/copy-of-message-port-context-destroyed.html'; 51 48 } 52 49 -
trunk/LayoutTests/platform/mac/TestExpectations
r226189 r226202 541 541 webkit.org/b/27684 compositing/text-on-scaled-layer.html [ ImageOnlyFailure ] 542 542 webkit.org/b/27684 compositing/text-on-scaled-surface.html [ ImageOnlyFailure ] 543 544 # Asserts in MessagePort::contextDestroyed, but the assert usually gets attributed to later tests.545 webkit.org/b/94458 fast/events/message-port-constructor-for-deleted-document.html546 543 547 544 webkit.org/b/95501 http/tests/security/inactive-document-with-empty-security-origin.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r226200 r226202 1 2017-12-20 Brady Eidson <beidson@apple.com> 2 3 Assertion failure in MessagePort::contextDestroyed in http/tests/security/MessagePort/event-listener-context.html, usually attributed to later tests. 4 https://bugs.webkit.org/show_bug.cgi?id=94458 5 6 Reviewed by Chris Dumez. 7 8 No new tests (Changed existing test to reliably crash before this change, and work after it) 9 10 There was already a glaring FIXME that said "MessagePorts should be ActiveDOMObjects" 11 12 It was right, and it fixes up this subtle lifetime issue. 13 14 * dom/MessagePort.cpp: 15 (WebCore::MessagePort::MessagePort): 16 (WebCore::MessagePort::hasPendingActivity const): 17 (WebCore::MessagePort::locallyEntangledPort const): 18 (WebCore::MessagePort::activeDOMObjectName const): 19 (WebCore::MessagePort::hasPendingActivity): Deleted. 20 (WebCore::MessagePort::locallyEntangledPort): Deleted. 21 * dom/MessagePort.h: 22 23 * dom/ScriptExecutionContext.cpp: 24 (WebCore::ScriptExecutionContext::~ScriptExecutionContext): 25 (WebCore::ScriptExecutionContext::stopActiveDOMObjects): 26 (WebCore::ScriptExecutionContext::hasPendingActivity const): 27 1 28 2017-12-20 Youenn Fablet <youenn@apple.com> 2 29 -
trunk/Source/WebCore/dom/MessagePort.cpp
r219856 r226202 36 36 37 37 MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext) 38 : m_scriptExecutionContext(&scriptExecutionContext)38 : ActiveDOMObject(&scriptExecutionContext) 39 39 { 40 40 m_scriptExecutionContext->createdMessagePort(*this); 41 suspendIfNeeded(); 41 42 42 43 // Don't need to call processMessagePortMessagesSoon() here, because the port will not be opened until start() is invoked. … … 86 87 ASSERT(m_scriptExecutionContext); 87 88 m_scriptExecutionContext->destroyedMessagePort(*this); 89 m_scriptExecutionContext->willDestroyActiveDOMObject(*this); 90 m_scriptExecutionContext->willDestroyDestructionObserver(*this); 91 88 92 m_scriptExecutionContext = nullptr; 89 93 … … 162 166 } 163 167 164 bool MessagePort::hasPendingActivity() 168 bool MessagePort::hasPendingActivity() const 165 169 { 166 170 // The spec says that entangled message ports should always be treated as if they have a strong reference. … … 173 177 } 174 178 175 MessagePort* MessagePort::locallyEntangledPort() 179 MessagePort* MessagePort::locallyEntangledPort() const 176 180 { 177 181 return m_entangledChannel ? m_entangledChannel->locallyEntangledPort(m_scriptExecutionContext) : nullptr; … … 219 223 } 220 224 225 const char* MessagePort::activeDOMObjectName() const 226 { 227 return "MessagePort"; 228 } 229 230 bool MessagePort::canSuspendForDocumentSuspension() const 231 { 232 return !hasPendingActivity() || (!m_started || m_closed); 233 } 234 221 235 } // namespace WebCore -
trunk/Source/WebCore/dom/MessagePort.h
r224740 r226202 27 27 #pragma once 28 28 29 #include "ActiveDOMObject.h" 29 30 #include "EventTarget.h" 30 31 #include "ExceptionOr.h" … … 41 42 class Frame; 42 43 43 class MessagePort final : public RefCounted<MessagePort>, public EventTargetWithInlineData {44 class MessagePort final : public RefCounted<MessagePort>, public ActiveDOMObject, public EventTargetWithInlineData { 44 45 public: 45 46 static Ref<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(*new MessagePort(scriptExecutionContext)); } … … 61 62 bool started() const { return m_started; } 62 63 63 void contextDestroyed();64 65 ScriptExecutionContext* scriptExecutionContext() const final { return m_scriptExecutionContext; }66 67 64 void dispatchMessages(); 68 69 bool hasPendingActivity();70 65 71 66 // Returns null if there is no entangled port, or if the entangled port is run by a different thread. 72 67 // This is used solely to enable a GC optimization. Some platforms may not be able to determine ownership 73 68 // of the remote port (since it may live cross-process) - those platforms may always return null. 74 MessagePort* locallyEntangledPort() ;69 MessagePort* locallyEntangledPort() const; 75 70 76 71 using RefCounted::ref; 77 72 using RefCounted::deref; 78 73 79 private: 80 explicit MessagePort(ScriptExecutionContext&); 74 // ActiveDOMObject 75 const char* activeDOMObjectName() const final; 76 bool canSuspendForDocumentSuspension() const final; 77 void contextDestroyed() final; 78 void stop() final { close(); } 79 bool hasPendingActivity() const final; 81 80 81 // EventTargetWithInlineData. 82 EventTargetInterface eventTargetInterface() const final { return MessagePortEventTargetInterfaceType; } 83 ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } 82 84 void refEventTarget() final { ref(); } 83 85 void derefEventTarget() final { deref(); } 84 86 85 EventTargetInterface eventTargetInterface() const final { return MessagePortEventTargetInterfaceType; } 87 private: 88 explicit MessagePort(ScriptExecutionContext&); 86 89 87 90 bool addEventListener(const AtomicString& eventType, Ref<EventListener>&&, const AddEventListenerOptions&) final; … … 98 101 bool m_started { false }; 99 102 bool m_closed { false }; 100 ScriptExecutionContext* m_scriptExecutionContext;101 103 }; 102 104 -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r226088 r226202 128 128 destructionObserver->contextDestroyed(); 129 129 130 for (auto* messagePort : m_messagePorts)131 messagePort->contextDestroyed();132 133 130 #if !ASSERT_DISABLED 134 131 m_inScriptExecutionContextDestructor = false; … … 310 307 311 308 m_activeDOMObjectAdditionForbidden = false; 312 313 // FIXME: Make message ports be active DOM objects and let them implement stop instead314 // of having this separate mechanism just for them.315 for (auto* messagePort : m_messagePorts)316 messagePort->close();317 309 } 318 310 … … 516 508 for (auto* activeDOMObject : m_activeDOMObjects) { 517 509 if (activeDOMObject->hasPendingActivity()) 518 return true;519 }520 521 for (auto* messagePort : m_messagePorts) {522 if (messagePort->hasPendingActivity())523 510 return true; 524 511 }
Note: See TracChangeset
for help on using the changeset viewer.