Repository navigation
Commit 4418140
committed
Web Inspector: JSContext inspection should report exceptions in the console
https://bugs.webkit.org/show_bug.cgi?id=128776
Source/JavaScriptCore:
Reviewed by Timothy Hatcher.
When JavaScript API functions have an exception, let the inspector
know so it can log the JavaScript and Native backtrace that caused
the exception.
Include some clean up of ConsoleMessage and ScriptCallStack construction.
* API/JSBase.cpp:
(JSEvaluateScript):
(JSCheckScriptSyntax):
* API/JSObjectRef.cpp:
(JSObjectMakeFunction):
(JSObjectMakeArray):
(JSObjectMakeDate):
(JSObjectMakeError):
(JSObjectMakeRegExp):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectGetPropertyAtIndex):
(JSObjectSetPropertyAtIndex):
(JSObjectDeleteProperty):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
* API/JSValue.mm:
(reportExceptionToInspector):
(valueToArray):
(valueToDictionary):
* API/JSValueRef.cpp:
(JSValueIsEqual):
(JSValueIsInstanceOfConstructor):
(JSValueCreateJSONString):
(JSValueToNumber):
(JSValueToStringCopy):
(JSValueToObject):
When seeing an exception, let the inspector know there was an exception.
* inspector/JSGlobalObjectInspectorController.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::appendAPIBacktrace):
(Inspector::JSGlobalObjectInspectorController::reportAPIException):
Log API exceptions by also grabbing the native backtrace.
* inspector/ScriptCallStack.h:
* inspector/ScriptCallStack.cpp:
(Inspector::ScriptCallStack::firstNonNativeCallFrame):
(Inspector::ScriptCallStack::append):
Minor extensions to ScriptCallStack to make it easier to work with.
* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::ConsoleMessage):
(Inspector::ConsoleMessage::autogenerateMetadata):
Provide better default information if the first call frame was native.
* inspector/ScriptCallStackFactory.cpp:
(Inspector::createScriptCallStack):
(Inspector::extractSourceInformationFromException):
(Inspector::createScriptCallStackFromException):
Perform the handling here of inserting a fake call frame for exceptions
if there was no call stack (e.g. a SyntaxError) or if the first call
frame had no information.
* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::ConsoleMessage):
(Inspector::ConsoleMessage::autogenerateMetadata):
* inspector/ConsoleMessage.h:
* inspector/ScriptCallStackFactory.cpp:
(Inspector::createScriptCallStack):
(Inspector::createScriptCallStackForConsole):
* inspector/ScriptCallStackFactory.h:
* inspector/agents/InspectorConsoleAgent.cpp:
(Inspector::InspectorConsoleAgent::enable):
(Inspector::InspectorConsoleAgent::addMessageToConsole):
(Inspector::InspectorConsoleAgent::count):
* inspector/agents/JSGlobalObjectDebuggerAgent.cpp:
(Inspector::JSGlobalObjectDebuggerAgent::breakpointActionLog):
ConsoleMessage cleanup.
Source/WebCore:
Include some clean up of ConsoleMessage and ScriptCallStack construction.
Covered by existing tests.
* bindings/js/JSDOMBinding.cpp:
(WebCore::reportException):
Simplify code now that createStackTraceFromException handles it.
* page/ContentSecurityPolicy.cpp:
(WebCore::gatherSecurityPolicyViolationEventData):
(WebCore::ContentSecurityPolicy::reportViolation):
ScriptCallStack can give us the first non-native callframe.
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::buildInitiatorObject):
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::breakpointActionLog):
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createGenericRecord):
* page/Console.cpp:
(WebCore::internalAddMessage):
(WebCore::Console::profile):
(WebCore::Console::profileEnd):
(WebCore::Console::timeEnd):
* page/ContentSecurityPolicy.cpp:
(WebCore::gatherSecurityPolicyViolationEventData):
(WebCore::ContentSecurityPolicy::reportViolation):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
Source/WebInspectorUI:
Reviewed by Timothy Hatcher.
* UserInterface/ConsoleMessageImpl.js:
(WebInspector.ConsoleMessageImpl.prototype._formatMessage):
(WebInspector.ConsoleMessageImpl.prototype._shouldHideURL):
(WebInspector.ConsoleMessageImpl.prototype._firstNonNativeCallFrame):
(WebInspector.ConsoleMessageImpl.prototype._populateStackTraceTreeElement):
Provide better handling for "[native code]" and legacy "undefined"
call frame URLs. Never linkify these. Also, when showing a link
for an exception, always use the first non-native call frame as
the link location.
Canonical link: https://commits.webkit.org/147194@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164486 268f45cc-cd09-0410-ab3c-d52691b4dbfc1 parent 1d02086 commit 4418140
25 files changed
Lines changed: 489 additions & 160 deletions
File tree
- Source
- JavaScriptCore
- API
- inspector
- agents
- WebCore
- bindings/js
- inspector
- page
- WebInspectorUI
- UserInterface
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
| |||
94 | 106 | | |
95 | 107 | | |
96 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
97 | 112 | | |
98 | 113 | | |
99 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
145 | 149 | | |
146 | 150 | | |
147 | 151 | | |
| 152 | + | |
148 | 153 | | |
149 | | - | |
| 154 | + | |
150 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
151 | 159 | | |
152 | 160 | | |
153 | 161 | | |
| |||
173 | 181 | | |
174 | 182 | | |
175 | 183 | | |
| 184 | + | |
176 | 185 | | |
177 | | - | |
| 186 | + | |
178 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
179 | 191 | | |
180 | 192 | | |
181 | 193 | | |
| |||
197 | 209 | | |
198 | 210 | | |
199 | 211 | | |
| 212 | + | |
200 | 213 | | |
201 | | - | |
| 214 | + | |
202 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
203 | 219 | | |
204 | 220 | | |
205 | 221 | | |
| |||
220 | 236 | | |
221 | 237 | | |
222 | 238 | | |
| 239 | + | |
223 | 240 | | |
224 | | - | |
| 241 | + | |
225 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
226 | 246 | | |
227 | 247 | | |
228 | 248 | | |
| |||
244 | 264 | | |
245 | 265 | | |
246 | 266 | | |
| 267 | + | |
247 | 268 | | |
248 | | - | |
| 269 | + | |
249 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
250 | 274 | | |
251 | 275 | | |
252 | 276 | | |
| |||
308 | 332 | | |
309 | 333 | | |
310 | 334 | | |
| 335 | + | |
311 | 336 | | |
312 | | - | |
| 337 | + | |
313 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
314 | 342 | | |
315 | 343 | | |
316 | 344 | | |
| |||
337 | 365 | | |
338 | 366 | | |
339 | 367 | | |
| 368 | + | |
340 | 369 | | |
341 | | - | |
| 370 | + | |
342 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
343 | 375 | | |
344 | 376 | | |
345 | 377 | | |
| |||
356 | 388 | | |
357 | 389 | | |
358 | 390 | | |
| 391 | + | |
359 | 392 | | |
360 | | - | |
| 393 | + | |
361 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
362 | 398 | | |
363 | 399 | | |
364 | 400 | | |
| |||
378 | 414 | | |
379 | 415 | | |
380 | 416 | | |
| 417 | + | |
381 | 418 | | |
382 | | - | |
| 419 | + | |
383 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
384 | 424 | | |
385 | 425 | | |
386 | 426 | | |
| |||
397 | 437 | | |
398 | 438 | | |
399 | 439 | | |
| 440 | + | |
400 | 441 | | |
401 | | - | |
| 442 | + | |
402 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
403 | 447 | | |
404 | 448 | | |
405 | 449 | | |
| |||
541 | 585 | | |
542 | 586 | | |
543 | 587 | | |
| 588 | + | |
544 | 589 | | |
545 | | - | |
| 590 | + | |
546 | 591 | | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
547 | 595 | | |
548 | 596 | | |
549 | 597 | | |
| |||
578 | 626 | | |
579 | 627 | | |
580 | 628 | | |
| 629 | + | |
581 | 630 | | |
582 | | - | |
| 631 | + | |
583 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
584 | 636 | | |
585 | 637 | | |
586 | 638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
| |||
629 | 635 | | |
630 | 636 | | |
631 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
632 | 646 | | |
633 | 647 | | |
634 | 648 | | |
| |||
781 | 795 | | |
782 | 796 | | |
783 | 797 | | |
784 | | - | |
785 | | - | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
786 | 805 | | |
787 | 806 | | |
788 | 807 | | |
| |||
798 | 817 | | |
799 | 818 | | |
800 | 819 | | |
801 | | - | |
802 | | - | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
803 | 827 | | |
804 | 828 | | |
805 | 829 | | |
| |||
0 commit comments