Changeset 205410 in webkit
- Timestamp:
- Sep 3, 2016 4:25:47 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r205409 r205410 1 2016-09-03 Ryosuke Niwa <rniwa@webkit.org> 2 3 Unbreak customElements.whenDefined after r205383 with a crash fix 4 https://bugs.webkit.org/show_bug.cgi?id=161562 5 6 Reviewed by Darin Adler. 7 8 Revert r205383 now that all test cases pass. 9 10 * fast/custom-elements/CustomElementRegistry-expected.txt: 11 1 12 2016-09-03 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/LayoutTests/fast/custom-elements/CustomElementRegistry-expected.txt
r205383 r205410 30 30 PASS customElements.get must return undefined when the registry does not contain an entry with the given name even if the name was not a valid custom element name 31 31 PASS customElements.get return the constructor of the entry with the given name when there is a matching entry. 32 FAIL customElements.whenDefined must return a promise for a valid custom element name assert_true: expected true got false 32 PASS customElements.whenDefined must return a promise for a valid custom element name 33 33 PASS customElements.whenDefined must return the same promise each time invoked for a valid custom element name which has not been defined 34 FAIL customElements.whenDefined must return an unresolved promise when the registry does not contain the entry with the given name undefined is not an object (evaluating 'customElements.whenDefined('a-b').then') 34 PASS customElements.whenDefined must return an unresolved promise when the registry does not contain the entry with the given name 35 35 PASS customElements.whenDefined must return a rejected promise when the given name is not a valid custom element name 36 36 PASS customElements.whenDefined must return a resolved promise when the registry contains the entry with the given name 37 37 PASS customElements.whenDefined must return a new resolved promise each time invoked when the registry contains the entry with the given name 38 FAIL A promise returned by customElements.whenDefined must be resolved by "define" undefined is not an object (evaluating 'promise.then') 38 PASS A promise returned by customElements.whenDefined must be resolved by "define" 39 39 -
trunk/Source/WebCore/ChangeLog
r205409 r205410 1 2016-09-03 Ryosuke Niwa <rniwa@webkit.org> 2 3 Unbreak customElements.whenDefined after r205383 with a crash fix 4 https://bugs.webkit.org/show_bug.cgi?id=161562 5 6 Reviewed by Darin Adler. 7 8 The crash was caused by DeferredWrapper::contextDestroyed not calling ContextDestructionObserver::contextDestroyed. 9 10 This caused m_scriptExecutionContext to not being set to nullptr when the Document was destroyed before DOMWindow 11 during a single GC sweeping, and resulted in a use-after-free in ContextDestructionObserver's destructor. 12 13 Fixed the crash and reverted r205383. 14 15 Tests: fast/custom-elements/CustomElementRegistry.html 16 17 * bindings/js/JSCustomElementRegistryCustom.cpp: 18 (WebCore::whenDefinedPromise): 19 * bindings/js/JSDOMPromise.cpp: 20 (WebCore::DeferredWrapper::contextDestroyed): Fixed the crash. 21 * dom/CustomElementRegistry.cpp: 22 (WebCore::CustomElementRegistry::addElementDefinition): 23 * dom/CustomElementRegistry.h: 24 (WebCore::CustomElementRegistry::promiseMap): 25 1 26 2016-09-03 Chris Dumez <cdumez@apple.com> 2 27 -
trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp
r205383 r205410 183 183 } 184 184 185 return jsUndefined(); 185 auto result = registry.promiseMap().ensure(localName, [&] { 186 return DeferredWrapper::create(&state, &globalObject, JSPromiseDeferred::create(&state, &globalObject)); 187 }); 188 189 return result.iterator->value->promise(); 186 190 } 187 191 -
trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp
r205257 r205410 60 60 void DeferredWrapper::contextDestroyed() 61 61 { 62 ActiveDOMCallback::contextDestroyed(); 62 63 clear(); 63 64 } -
trunk/Source/WebCore/dom/CustomElementRegistry.cpp
r205383 r205410 79 79 if (auto* document = m_window.document()) 80 80 enqueueUpgradeInShadowIncludingTreeOrder(*document, elementInterface.get()); 81 82 if (auto promise = m_promiseMap.take(localName)) 83 promise.value()->resolve(nullptr); 81 84 } 82 85 -
trunk/Source/WebCore/dom/CustomElementRegistry.h
r205383 r205410 67 67 JSC::JSValue get(const AtomicString&); 68 68 69 HashMap<AtomicString, Ref<DeferredWrapper>>& promiseMap() { return m_promiseMap; } 70 69 71 private: 70 72 CustomElementRegistry(DOMWindow&); … … 73 75 HashMap<AtomicString, Ref<JSCustomElementInterface>> m_nameMap; 74 76 HashMap<const JSC::JSObject*, JSCustomElementInterface*> m_constructorMap; 77 HashMap<AtomicString, Ref<DeferredWrapper>> m_promiseMap; 75 78 76 79 bool m_elementDefinitionIsRunning { false };
Note: See TracChangeset
for help on using the changeset viewer.