Changeset 220342 in webkit
- Timestamp:
- Aug 7, 2017 9:44:12 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r220332 r220342 1 2017-08-07 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r220299. 4 5 This change caused LayoutTest inspector/dom-debugger/dom- 6 breakpoints.html to fail. 7 8 Reverted changeset: 9 10 "Web Inspector: capture async stack trace when workers/main 11 context posts a message" 12 https://bugs.webkit.org/show_bug.cgi?id=167084 13 http://trac.webkit.org/changeset/220299 14 1 15 2017-08-07 Ms2ger <Ms2ger@igalia.com> 2 16 -
trunk/LayoutTests/inspector/debugger/async-stack-trace-expected.txt
r220299 r220342 1 CONSOLE MESSAGE: line 55: Unable to post message to http://example.com. Recipient has origin .2 3 1 Tests for async stack traces. 4 5 2 6 3 … … 80 77 5: [F] testAddEventListener 81 78 6: [P] Global Code 82 83 -- Running test case: CheckAsyncStackTrace.PostMessage84 PAUSE #185 CALL STACK:86 0: [F] pauseThenFinishTest87 1: [F] postMessageFired88 ASYNC CALL STACK:89 2: --- postMessage ---90 3: [F] messageReceived91 4: --- postMessage ---92 5: [F] testPostMessage93 6: [P] Global Code94 95 -- Running test case: ShouldNotPauseForFailedPostMessage96 PASS: Should not pause for failed post message.97 79 -- Running test setup. 98 80 Save DebuggerManager.asyncStackTraceDepth -
trunk/LayoutTests/inspector/debugger/async-stack-trace.html
r220299 r220342 51 51 } 52 52 53 function testPostMessage(targetOrigin = "*") {54 let childFrame = document.getElementById("postMessageTestFrame");55 childFrame.contentWindow.postMessage("<message>", targetOrigin);56 57 window.addEventListener("message", function postMessageFired() {58 window.removeEventListener("message", postMessageFired);59 pauseThenFinishTest();60 });61 }62 63 function testFailPostMessage() {64 testPostMessage("http://example.com");65 setTimeout(() => {66 TestPage.dispatchEventToFrontend("AfterTestFunction");67 }, 0);68 }69 70 53 function recursiveCallThenTest(testFunction, depth) { 71 54 if (depth) { … … 97 80 test(resolve, reject) { 98 81 let pauseCount = 0; 99 function debuggerPaused() {82 function handlePaused() { 100 83 InspectorTest.log(`PAUSE #${++pauseCount}`); 101 84 logActiveStackTrace(); … … 103 86 } 104 87 105 WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, debuggerPaused);88 WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, handlePaused); 106 89 107 InspectorTest.awaitEvent("AfterTestFunction") 108 .then(() => { 109 WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, debuggerPaused); 90 InspectorTest.singleFireEventListener("AfterTestFunction", () => { 91 WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, handlePaused); 110 92 resolve(); 111 93 }); … … 122 104 addSimpleTestCase("ReferenceCounting", "testReferenceCounting()"); 123 105 addSimpleTestCase("AddEventListener", "testAddEventListener()"); 124 addSimpleTestCase("PostMessage", "testPostMessage()");125 126 suite.addTestCase({127 name: "ShouldNotPauseForFailedPostMessage",128 test(resolve, reject) {129 function debuggerPaused() {130 WI.debuggerManager.resume();131 InspectorTest.fail("Should not pause.");132 reject();133 }134 135 WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, debuggerPaused);136 137 InspectorTest.awaitEvent("AfterTestFunction")138 .then(() => {139 WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, debuggerPaused);140 InspectorTest.pass("Should not pause for failed post message.");141 resolve();142 });143 144 InspectorTest.evaluateInPage("testFailPostMessage()");145 }146 });147 106 148 107 function setup(resolve) { … … 232 191 <body onload="runTest()"> 233 192 <p>Tests for async stack traces.</p> 234 <iframe id="postMessageTestFrame" src="resources/postMessage-echo.html"></iframe>235 193 </body> 236 194 </html> -
trunk/LayoutTests/inspector/dom-debugger/dom-breakpoints.html
r220299 r220342 35 35 36 36 resolve(); 37 } 38 39 function awaitEvaluateInPage(expression) { 40 return new Promise((resolve, reject) => { 41 InspectorTest.log("Wait for evaluate in page to return."); 42 InspectorTest.evaluateInPage(expression, (error) => { 43 if (error) 44 reject(error); 45 46 resolve(); 47 }); 48 }); 37 49 } 38 50 -
trunk/Source/JavaScriptCore/ChangeLog
r220336 r220342 1 2017-08-07 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r220299. 4 5 This change caused LayoutTest inspector/dom-debugger/dom- 6 breakpoints.html to fail. 7 8 Reverted changeset: 9 10 "Web Inspector: capture async stack trace when workers/main 11 context posts a message" 12 https://bugs.webkit.org/show_bug.cgi?id=167084 13 http://trac.webkit.org/changeset/220299 14 1 15 2017-08-07 Brian Burg <bburg@apple.com> 2 16 -
trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
r220299 r220342 95 95 DOMTimer, 96 96 EventListener, 97 PostMessage,98 97 RequestAnimationFrame, 99 98 }; -
trunk/Source/WebCore/ChangeLog
r220337 r220342 1 2017-08-07 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r220299. 4 5 This change caused LayoutTest inspector/dom-debugger/dom- 6 breakpoints.html to fail. 7 8 Reverted changeset: 9 10 "Web Inspector: capture async stack trace when workers/main 11 context posts a message" 12 https://bugs.webkit.org/show_bug.cgi?id=167084 13 http://trac.webkit.org/changeset/220299 14 1 15 2017-08-07 Brian Burg <bburg@apple.com> 2 16 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r220299 r220342 364 364 } 365 365 366 void InspectorInstrumentation::didPostMessageImpl(InstrumentingAgents& instrumentingAgents, const TimerBase& timer, JSC::ExecState& state)367 {368 if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())369 pageDebuggerAgent->didPostMessage(timer, state);370 }371 372 void InspectorInstrumentation::didFailPostMessageImpl(InstrumentingAgents& instrumentingAgents, const TimerBase& timer)373 {374 if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())375 pageDebuggerAgent->didFailPostMessage(timer);376 }377 378 void InspectorInstrumentation::willDispatchPostMessageImpl(InstrumentingAgents& instrumentingAgents, const TimerBase& timer)379 {380 if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())381 pageDebuggerAgent->willDispatchPostMessage(timer);382 }383 384 void InspectorInstrumentation::didDispatchPostMessageImpl(InstrumentingAgents& instrumentingAgents, const TimerBase& timer)385 {386 if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())387 pageDebuggerAgent->didDispatchPostMessage(timer);388 }389 390 366 InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents& instrumentingAgents, const String& scriptName, int scriptLine, ScriptExecutionContext* context) 391 367 { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r220299 r220342 86 86 class SecurityOrigin; 87 87 class ShadowRoot; 88 class TimerBase;89 88 class URL; 90 89 #if ENABLE(WEBGL) … … 137 136 static void didInstallTimer(ScriptExecutionContext&, int timerId, Seconds timeout, bool singleShot); 138 137 static void didRemoveTimer(ScriptExecutionContext&, int timerId); 139 140 static void didPostMessage(Frame&, TimerBase&, JSC::ExecState&);141 static void didFailPostMessage(Frame&, TimerBase&);142 static void willDispatchPostMessage(Frame&, TimerBase&);143 static void didDispatchPostMessage(Frame&, TimerBase&);144 138 145 139 static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine); … … 308 302 static void didInstallTimerImpl(InstrumentingAgents&, int timerId, Seconds timeout, bool singleShot, ScriptExecutionContext&); 309 303 static void didRemoveTimerImpl(InstrumentingAgents&, int timerId, ScriptExecutionContext&); 310 311 static void didPostMessageImpl(InstrumentingAgents&, const TimerBase&, JSC::ExecState&);312 static void didFailPostMessageImpl(InstrumentingAgents&, const TimerBase&);313 static void willDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);314 static void didDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);315 304 316 305 static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, ScriptExecutionContext*); … … 681 670 } 682 671 683 inline void InspectorInstrumentation::didPostMessage(Frame& frame, TimerBase& timer, JSC::ExecState& state)684 {685 FAST_RETURN_IF_NO_FRONTENDS(void());686 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))687 didPostMessageImpl(*instrumentingAgents, timer, state);688 }689 690 inline void InspectorInstrumentation::didFailPostMessage(Frame& frame, TimerBase& timer)691 {692 FAST_RETURN_IF_NO_FRONTENDS(void());693 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))694 didFailPostMessageImpl(*instrumentingAgents, timer);695 }696 697 inline void InspectorInstrumentation::willDispatchPostMessage(Frame& frame, TimerBase& timer)698 {699 FAST_RETURN_IF_NO_FRONTENDS(void());700 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))701 willDispatchPostMessageImpl(*instrumentingAgents, timer);702 }703 704 inline void InspectorInstrumentation::didDispatchPostMessage(Frame& frame, TimerBase& timer)705 {706 FAST_RETURN_IF_NO_FRONTENDS(void());707 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))708 didDispatchPostMessageImpl(*instrumentingAgents, timer);709 }710 711 672 inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine) 712 673 { -
trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp
r220299 r220342 46 46 #include "ScriptExecutionContext.h" 47 47 #include "ScriptState.h" 48 #include "Timer.h"49 48 #include <inspector/InjectedScript.h> 50 49 #include <inspector/InjectedScriptManager.h> … … 101 100 { 102 101 m_registeredEventListeners.clear(); 103 m_postMessageTimers.clear();104 102 m_nextEventListenerIdentifier = 1; 105 m_nextPostMessageIdentifier = 1;106 103 } 107 104 … … 231 228 } 232 229 233 void PageDebuggerAgent::didPostMessage(const TimerBase& timer, JSC::ExecState& state)234 {235 if (!breakpointsActive())236 return;237 238 if (m_postMessageTimers.contains(&timer)) {239 ASSERT_NOT_REACHED();240 return;241 }242 243 int postMessageIdentifier = m_nextPostMessageIdentifier++;244 m_postMessageTimers.set(&timer, postMessageIdentifier);245 246 didScheduleAsyncCall(&state, InspectorDebuggerAgent::AsyncCallType::PostMessage, postMessageIdentifier, true);247 }248 249 void PageDebuggerAgent::didFailPostMessage(const TimerBase& timer)250 {251 auto it = m_postMessageTimers.find(&timer);252 if (it == m_postMessageTimers.end())253 return;254 255 didCancelAsyncCall(InspectorDebuggerAgent::AsyncCallType::PostMessage, it->value);256 257 m_postMessageTimers.remove(it);258 }259 260 void PageDebuggerAgent::willDispatchPostMessage(const TimerBase& timer)261 {262 auto it = m_postMessageTimers.find(&timer);263 if (it == m_postMessageTimers.end())264 return;265 266 willDispatchAsyncCall(InspectorDebuggerAgent::AsyncCallType::PostMessage, it->value);267 }268 269 void PageDebuggerAgent::didDispatchPostMessage(const TimerBase& timer)270 {271 auto it = m_postMessageTimers.find(&timer);272 if (it == m_postMessageTimers.end())273 return;274 275 didDispatchAsyncCall();276 277 m_postMessageTimers.remove(it);278 }279 280 230 } // namespace WebCore -
trunk/Source/WebCore/inspector/PageDebuggerAgent.h
r220299 r220342 43 43 class Page; 44 44 class RegisteredEventListener; 45 class TimerBase;46 45 47 46 class PageDebuggerAgent final : public WebDebuggerAgent { … … 65 64 void willRemoveEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); 66 65 void willHandleEvent(const RegisteredEventListener&); 67 68 void didPostMessage(const TimerBase&, JSC::ExecState&);69 void didFailPostMessage(const TimerBase&);70 void willDispatchPostMessage(const TimerBase&);71 void didDispatchPostMessage(const TimerBase&);72 66 73 67 protected: … … 94 88 95 89 HashMap<const RegisteredEventListener*, int> m_registeredEventListeners; 96 HashMap<const TimerBase*, int> m_postMessageTimers;97 90 int m_nextEventListenerIdentifier { 1 }; 98 int m_nextPostMessageIdentifier { 1 };99 91 }; 100 92 -
trunk/Source/WebCore/page/DOMWindow.cpp
r220299 r220342 957 957 timer->startOneShot(0_s); 958 958 959 InspectorInstrumentation::didPostMessage(*m_frame, *timer, state);960 961 959 return { }; 962 960 } … … 977 975 pageConsole->addMessage(MessageSource::Security, MessageLevel::Error, message); 978 976 } 979 980 InspectorInstrumentation::didFailPostMessage(*m_frame, timer);981 977 return; 982 978 } 983 979 } 984 980 985 InspectorInstrumentation::willDispatchPostMessage(*m_frame, timer);986 987 981 dispatchEvent(timer.event(*document())); 988 989 InspectorInstrumentation::didDispatchPostMessage(*m_frame, timer);990 982 } 991 983
Note: See TracChangeset
for help on using the changeset viewer.