Changeset 273794 in webkit
- Timestamp:
- Mar 2, 2021, 7:08:47 PM (6 years ago)
- Location:
- branches/safari-612.1.5-branch
- Files:
-
- 3 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/Window/postMessage-Object-prototype-expected.txt (added)
-
LayoutTests/fast/dom/Window/postMessage-Object-prototype.html (added)
-
LayoutTests/fast/dom/Window/resources/postMessage-Object-prototype-frame.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/ScriptState.cpp (modified) (1 diff)
-
Source/WebCore/bindings/js/ScriptState.h (modified) (2 diffs)
-
Source/WebCore/dom/ScriptExecutionContext.cpp (modified) (1 diff)
-
Source/WebCore/inspector/InspectorFrontendHost.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612.1.5-branch/LayoutTests/ChangeLog
r273792 r273794 1 2021-03-02 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r273438. rdar://problem/74953033 4 5 Regression(r268700) postMessage changes prototype of basic types 6 https://bugs.webkit.org/show_bug.cgi?id=222228 7 <rdar://problem/74612853> 8 9 Reviewed by Geoffrey Garen. 10 11 Source/WebCore: 12 13 r268700 updated ScriptExecutionContext::globalObject() to call: 14 `WebCore::globalObject(mainThreadNormalWorld(), downcast<Document>(*this).page())` 15 instead of 16 `frame ? frame->script().globalObject(mainThreadNormalWorld()) : nullptr` 17 18 This was not right for subframes because globalObject() gets the globalObject from 19 the page's main frame instead of the document's frame. 20 21 This patch gets rid of the error-prone WebCore::globalObject() taking in a Page* 22 and replaces it with one taking in a Frame* to avoid such issues in the future. 23 24 Test: fast/dom/Window/postMessage-Object-prototype.html 25 26 * bindings/js/ScriptState.cpp: 27 (WebCore::globalObject): 28 * bindings/js/ScriptState.h: 29 * dom/ScriptExecutionContext.cpp: 30 (WebCore::ScriptExecutionContext::globalObject): 31 * inspector/InspectorFrontendHost.cpp: 32 (WebCore::InspectorFrontendHost::addSelfToGlobalObjectInWorld): 33 (WebCore::InspectorFrontendHost::showContextMenu): 34 35 LayoutTests: 36 37 Add layout test coverage. 38 39 * fast/dom/Window/postMessage-Object-prototype-expected.txt: Added. 40 * fast/dom/Window/postMessage-Object-prototype.html: Added. 41 * fast/dom/Window/resources/postMessage-Object-prototype-frame.html: Added. 42 43 44 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273438 268f45cc-cd09-0410-ab3c-d52691b4dbfc 45 46 2021-02-24 Chris Dumez <cdumez@apple.com> 47 48 Regression(r268700) postMessage changes prototype of basic types 49 https://bugs.webkit.org/show_bug.cgi?id=222228 50 <rdar://problem/74612853> 51 52 Reviewed by Geoffrey Garen. 53 54 Add layout test coverage. 55 56 * fast/dom/Window/postMessage-Object-prototype-expected.txt: Added. 57 * fast/dom/Window/postMessage-Object-prototype.html: Added. 58 * fast/dom/Window/resources/postMessage-Object-prototype-frame.html: Added. 59 1 60 2021-03-02 Alan Coon <alancoon@apple.com> 2 61 -
branches/safari-612.1.5-branch/Source/WebCore/ChangeLog
r273793 r273794 1 2021-03-02 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r273438. rdar://problem/74953033 4 5 Regression(r268700) postMessage changes prototype of basic types 6 https://bugs.webkit.org/show_bug.cgi?id=222228 7 <rdar://problem/74612853> 8 9 Reviewed by Geoffrey Garen. 10 11 Source/WebCore: 12 13 r268700 updated ScriptExecutionContext::globalObject() to call: 14 `WebCore::globalObject(mainThreadNormalWorld(), downcast<Document>(*this).page())` 15 instead of 16 `frame ? frame->script().globalObject(mainThreadNormalWorld()) : nullptr` 17 18 This was not right for subframes because globalObject() gets the globalObject from 19 the page's main frame instead of the document's frame. 20 21 This patch gets rid of the error-prone WebCore::globalObject() taking in a Page* 22 and replaces it with one taking in a Frame* to avoid such issues in the future. 23 24 Test: fast/dom/Window/postMessage-Object-prototype.html 25 26 * bindings/js/ScriptState.cpp: 27 (WebCore::globalObject): 28 * bindings/js/ScriptState.h: 29 * dom/ScriptExecutionContext.cpp: 30 (WebCore::ScriptExecutionContext::globalObject): 31 * inspector/InspectorFrontendHost.cpp: 32 (WebCore::InspectorFrontendHost::addSelfToGlobalObjectInWorld): 33 (WebCore::InspectorFrontendHost::showContextMenu): 34 35 LayoutTests: 36 37 Add layout test coverage. 38 39 * fast/dom/Window/postMessage-Object-prototype-expected.txt: Added. 40 * fast/dom/Window/postMessage-Object-prototype.html: Added. 41 * fast/dom/Window/resources/postMessage-Object-prototype-frame.html: Added. 42 43 44 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273438 268f45cc-cd09-0410-ab3c-d52691b4dbfc 45 46 2021-02-24 Chris Dumez <cdumez@apple.com> 47 48 Regression(r268700) postMessage changes prototype of basic types 49 https://bugs.webkit.org/show_bug.cgi?id=222228 50 <rdar://problem/74612853> 51 52 Reviewed by Geoffrey Garen. 53 54 r268700 updated ScriptExecutionContext::globalObject() to call: 55 `WebCore::globalObject(mainThreadNormalWorld(), downcast<Document>(*this).page())` 56 instead of 57 `frame ? frame->script().globalObject(mainThreadNormalWorld()) : nullptr` 58 59 This was not right for subframes because globalObject() gets the globalObject from 60 the page's main frame instead of the document's frame. 61 62 This patch gets rid of the error-prone WebCore::globalObject() taking in a Page* 63 and replaces it with one taking in a Frame* to avoid such issues in the future. 64 65 Test: fast/dom/Window/postMessage-Object-prototype.html 66 67 * bindings/js/ScriptState.cpp: 68 (WebCore::globalObject): 69 * bindings/js/ScriptState.h: 70 * dom/ScriptExecutionContext.cpp: 71 (WebCore::ScriptExecutionContext::globalObject): 72 * inspector/InspectorFrontendHost.cpp: 73 (WebCore::InspectorFrontendHost::addSelfToGlobalObjectInWorld): 74 (WebCore::InspectorFrontendHost::showContextMenu): 75 1 76 2021-03-02 Alan Coon <alancoon@apple.com> 2 77 -
branches/safari-612.1.5-branch/Source/WebCore/bindings/js/ScriptState.cpp
r268775 r273794 93 93 } 94 94 95 JSC::JSGlobalObject* globalObject(DOMWrapperWorld& world, Page* page)95 JSC::JSGlobalObject* globalObject(DOMWrapperWorld& world, Frame* frame) 96 96 { 97 return page ? page->mainFrame().script().globalObject(world) : nullptr;97 return frame ? frame->script().globalObject(world) : nullptr; 98 98 } 99 99 -
branches/safari-612.1.5-branch/Source/WebCore/bindings/js/ScriptState.h
r268700 r273794 43 43 class Frame; 44 44 class Node; 45 class Page;46 45 class ScriptExecutionContext; 47 46 class WorkerOrWorkletGlobalScope; … … 54 53 55 54 JSC::JSGlobalObject* globalObject(DOMWrapperWorld&, Node*); 56 WEBCORE_EXPORT JSC::JSGlobalObject* globalObject(DOMWrapperWorld&, Page*);55 WEBCORE_EXPORT JSC::JSGlobalObject* globalObject(DOMWrapperWorld&, Frame*); 57 56 JSC::JSGlobalObject* globalObject(WorkerOrWorkletGlobalScope&); 58 57 -
branches/safari-612.1.5-branch/Source/WebCore/dom/ScriptExecutionContext.cpp
r268868 r273794 513 513 { 514 514 if (is<Document>(*this)) 515 return WebCore::globalObject(mainThreadNormalWorld(), downcast<Document>(*this). page());515 return WebCore::globalObject(mainThreadNormalWorld(), downcast<Document>(*this).frame()); 516 516 517 517 if (is<WorkerOrWorkletGlobalScope>(*this)) -
branches/safari-612.1.5-branch/Source/WebCore/inspector/InspectorFrontendHost.cpp
r273077 r273794 159 159 void InspectorFrontendHost::addSelfToGlobalObjectInWorld(DOMWrapperWorld& world) 160 160 { 161 auto& lexicalGlobalObject = *globalObject(world, m_frontendPage );161 auto& lexicalGlobalObject = *globalObject(world, m_frontendPage ? &m_frontendPage->mainFrame() : nullptr); 162 162 auto& vm = lexicalGlobalObject.vm(); 163 163 JSC::JSLockHolder lock(vm); … … 504 504 ASSERT(m_frontendPage); 505 505 506 auto& lexicalGlobalObject = *globalObject(debuggerWorld(), m_frontendPage);506 auto& lexicalGlobalObject = *globalObject(debuggerWorld(), &m_frontendPage->mainFrame()); 507 507 auto& vm = lexicalGlobalObject.vm(); 508 508 auto value = lexicalGlobalObject.get(&lexicalGlobalObject, JSC::Identifier::fromString(vm, "InspectorFrontendAPI"));
Note:
See TracChangeset
for help on using the changeset viewer.