summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/inspector
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebCore/inspector
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebCore/inspector')
-rw-r--r--Source/WebCore/inspector/CodeGeneratorInspector.pm142
-rw-r--r--Source/WebCore/inspector/ConsoleMessage.cpp12
-rw-r--r--Source/WebCore/inspector/ConsoleMessage.h5
-rw-r--r--Source/WebCore/inspector/DOMNodeHighlighter.cpp292
-rw-r--r--Source/WebCore/inspector/DOMNodeHighlighter.h46
-rw-r--r--Source/WebCore/inspector/InjectedScript.cpp85
-rw-r--r--Source/WebCore/inspector/InjectedScript.h30
-rw-r--r--Source/WebCore/inspector/InjectedScriptHost.cpp128
-rw-r--r--Source/WebCore/inspector/InjectedScriptHost.h85
-rw-r--r--Source/WebCore/inspector/InjectedScriptHost.idl6
-rw-r--r--Source/WebCore/inspector/InjectedScriptManager.cpp117
-rw-r--r--Source/WebCore/inspector/InjectedScriptManager.h80
-rw-r--r--Source/WebCore/inspector/InjectedScriptSource.js64
-rw-r--r--Source/WebCore/inspector/Inspector.idl275
-rw-r--r--Source/WebCore/inspector/Inspector.json1445
-rw-r--r--Source/WebCore/inspector/InspectorAgent.cpp775
-rw-r--r--Source/WebCore/inspector/InspectorAgent.h79
-rw-r--r--Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp2
-rw-r--r--Source/WebCore/inspector/InspectorApplicationCacheAgent.h2
-rw-r--r--Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp142
-rw-r--r--Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h27
-rw-r--r--Source/WebCore/inspector/InspectorCSSAgent.cpp99
-rw-r--r--Source/WebCore/inspector/InspectorCSSAgent.h36
-rw-r--r--Source/WebCore/inspector/InspectorConsoleAgent.cpp50
-rw-r--r--Source/WebCore/inspector/InspectorConsoleAgent.h13
-rw-r--r--Source/WebCore/inspector/InspectorController.cpp75
-rw-r--r--Source/WebCore/inspector/InspectorController.h3
-rw-r--r--Source/WebCore/inspector/InspectorDOMAgent.cpp394
-rw-r--r--Source/WebCore/inspector/InspectorDOMAgent.h104
-rw-r--r--Source/WebCore/inspector/InspectorDOMStorageAgent.cpp10
-rw-r--r--Source/WebCore/inspector/InspectorDOMStorageAgent.h12
-rw-r--r--Source/WebCore/inspector/InspectorDOMStorageResource.cpp2
-rw-r--r--Source/WebCore/inspector/InspectorDOMStorageResource.h6
-rw-r--r--Source/WebCore/inspector/InspectorDatabaseAgent.cpp36
-rw-r--r--Source/WebCore/inspector/InspectorDatabaseAgent.h8
-rw-r--r--Source/WebCore/inspector/InspectorDatabaseResource.cpp2
-rw-r--r--Source/WebCore/inspector/InspectorDatabaseResource.h4
-rw-r--r--Source/WebCore/inspector/InspectorDebuggerAgent.cpp123
-rw-r--r--Source/WebCore/inspector/InspectorDebuggerAgent.h54
-rw-r--r--Source/WebCore/inspector/InspectorFrontendClient.h3
-rw-r--r--Source/WebCore/inspector/InspectorFrontendHost.cpp14
-rw-r--r--Source/WebCore/inspector/InspectorFrontendHost.h3
-rw-r--r--Source/WebCore/inspector/InspectorFrontendHost.idl3
-rw-r--r--Source/WebCore/inspector/InspectorInstrumentation.cpp92
-rw-r--r--Source/WebCore/inspector/InspectorInstrumentation.h37
-rw-r--r--Source/WebCore/inspector/InspectorPageAgent.cpp258
-rw-r--r--Source/WebCore/inspector/InspectorPageAgent.h95
-rw-r--r--Source/WebCore/inspector/InspectorProfilerAgent.cpp90
-rw-r--r--Source/WebCore/inspector/InspectorProfilerAgent.h28
-rw-r--r--Source/WebCore/inspector/InspectorResourceAgent.cpp241
-rw-r--r--Source/WebCore/inspector/InspectorResourceAgent.h16
-rw-r--r--Source/WebCore/inspector/InspectorRuntimeAgent.cpp55
-rw-r--r--Source/WebCore/inspector/InspectorRuntimeAgent.h33
-rw-r--r--Source/WebCore/inspector/InspectorStyleSheet.cpp62
-rw-r--r--Source/WebCore/inspector/InspectorStyleSheet.h1
-rw-r--r--Source/WebCore/inspector/InspectorTimelineAgent.cpp116
-rw-r--r--Source/WebCore/inspector/InspectorTimelineAgent.h35
-rw-r--r--Source/WebCore/inspector/InstrumentingAgents.h14
-rwxr-xr-xSource/WebCore/inspector/PageDebuggerAgent.cpp72
-rwxr-xr-xSource/WebCore/inspector/PageDebuggerAgent.h63
-rw-r--r--Source/WebCore/inspector/ScriptCallStack.cpp2
-rw-r--r--Source/WebCore/inspector/ScriptCallStack.h2
-rw-r--r--Source/WebCore/inspector/TimelineRecordFactory.cpp3
-rwxr-xr-xSource/WebCore/inspector/WorkerDebuggerAgent.cpp70
-rwxr-xr-xSource/WebCore/inspector/WorkerDebuggerAgent.h64
-rw-r--r--Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js30
-rw-r--r--Source/WebCore/inspector/front-end/AuditFormatters.js2
-rw-r--r--Source/WebCore/inspector/front-end/AuditRules.js33
-rw-r--r--Source/WebCore/inspector/front-end/AuditsPanel.js2
-rw-r--r--Source/WebCore/inspector/front-end/BreakpointManager.js211
-rw-r--r--Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js476
-rw-r--r--Source/WebCore/inspector/front-end/CSSStyleModel.js88
-rw-r--r--Source/WebCore/inspector/front-end/CallStackSidebarPane.js70
-rw-r--r--Source/WebCore/inspector/front-end/Color.js4
-rw-r--r--Source/WebCore/inspector/front-end/ConsoleView.js28
-rw-r--r--Source/WebCore/inspector/front-end/CookieItemsView.js56
-rw-r--r--Source/WebCore/inspector/front-end/DOMAgent.js428
-rw-r--r--Source/WebCore/inspector/front-end/DOMStorageItemsView.js8
-rw-r--r--Source/WebCore/inspector/front-end/Database.js11
-rw-r--r--Source/WebCore/inspector/front-end/DebuggerModel.js261
-rw-r--r--Source/WebCore/inspector/front-end/DebuggerPresentationModel.js547
-rw-r--r--Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js68
-rw-r--r--Source/WebCore/inspector/front-end/DetailedHeapshotView.js109
-rw-r--r--Source/WebCore/inspector/front-end/ElementsPanel.js102
-rw-r--r--Source/WebCore/inspector/front-end/ElementsTreeOutline.js172
-rw-r--r--Source/WebCore/inspector/front-end/EventListenersSidebarPane.js14
-rw-r--r--Source/WebCore/inspector/front-end/ExtensionAPI.js2
-rwxr-xr-xSource/WebCore/inspector/front-end/ExtensionAPISchema.json54
-rw-r--r--Source/WebCore/inspector/front-end/ExtensionPanel.js5
-rw-r--r--Source/WebCore/inspector/front-end/ExtensionServer.js16
-rw-r--r--Source/WebCore/inspector/front-end/GoToLineDialog.js4
-rw-r--r--Source/WebCore/inspector/front-end/HeapSnapshot.js363
-rw-r--r--Source/WebCore/inspector/front-end/HelpScreen.js4
-rw-r--r--Source/WebCore/inspector/front-end/Images/applicationCache.pngbin1964 -> 1735 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/auditsIcon.pngbin3997 -> 3778 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/back.pngbin4205 -> 216 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/breakpointBorder.pngbin377 -> 261 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/breakpointConditionalBorder.pngbin379 -> 262 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/breakpointConditionalCounterBorder.pngbin529 -> 422 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/breakpointCounterBorder.pngbin526 -> 414 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/breakpointsActivateButtonGlyph.pngbin250 -> 211 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/breakpointsDeactivateButtonGlyph.pngbin426 -> 386 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/checker.pngbin3471 -> 82 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/clearConsoleButtonGlyph.pngbin396 -> 364 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/closeButtons.pngbin4355 -> 369 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/consoleButtonGlyph.pngbin183 -> 177 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/consoleIcon.pngbin2930 -> 2927 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/cookie.pngbin2246 -> 2189 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/database.pngbin2329 -> 1461 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/databaseTable.pngbin4325 -> 308 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/debuggerContinue.pngbin4190 -> 203 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/debuggerPause.pngbin4081 -> 120 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/debuggerStepInto.pngbin4282 -> 253 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/debuggerStepOut.pngbin4271 -> 246 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/debuggerStepOver.pngbin4366 -> 312 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDown.pngbin3919 -> 235 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownBlack.pngbin3802 -> 138 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownWhite.pngbin3820 -> 145 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRight.pngbin3898 -> 216 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightBlack.pngbin3807 -> 125 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDown.pngbin3953 -> 262 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownBlack.pngbin3816 -> 160 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownWhite.pngbin3838 -> 169 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightWhite.pngbin3818 -> 135 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/dockButtonGlyph.pngbin164 -> 153 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/elementsIcon.pngbin6639 -> 3267 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/enableOutlineButtonGlyph.pngbin363 -> 374 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/enableSolidButtonGlyph.pngbin302 -> 333 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/errorIcon.pngbin4337 -> 375 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/errorMediumIcon.pngbin4059 -> 652 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/errorRedDot.pngbin549 -> 434 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/excludeButtonGlyph.pngbin212 -> 255 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/focusButtonGlyph.pngbin285 -> 312 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/forward.pngbin4202 -> 214 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/frame.pngbin448 -> 482 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/garbageCollectButtonGlyph.pngbin0 -> 399 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/gearButtonGlyph.pngbin323 -> 268 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/glossyHeader.pngbin3720 -> 103 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/glossyHeaderPressed.pngbin3721 -> 103 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/glossyHeaderSelected.pngbin3738 -> 121 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/glossyHeaderSelectedPressed.pngbin3739 -> 121 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/goArrow.pngbin3591 -> 146 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/graphLabelCalloutLeft.pngbin3790 -> 160 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/graphLabelCalloutRight.pngbin3789 -> 161 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/helpButtonGlyph.pngbin271 -> 289 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/largerResourcesButtonGlyph.pngbin192 -> 222 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/localStorage.pngbin1081 -> 1053 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/networkIcon.pngbin4628 -> 4607 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/nodeSearchButtonGlyph.pngbin283 -> 310 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/paneAddButtons.pngbin929 -> 738 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/paneBottomGrow.pngbin3457 -> 85 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/paneBottomGrowActive.pngbin3457 -> 85 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/paneGrowHandleLine.pngbin3443 -> 69 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/paneSettingsButtons.pngbin1422 -> 1122 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/pauseOnExceptionButtonGlyph.pngbin331 -> 345 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/percentButtonGlyph.pngbin357 -> 361 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/popoverArrows.pngbin784 -> 546 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/popoverBackground.pngbin2233 -> 2231 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/profileGroupIcon.pngbin5126 -> 1486 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/profileIcon.pngbin4953 -> 1295 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/profileSmallIcon.pngbin579 -> 568 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/profilesIcon.pngbin4158 -> 3623 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/profilesSilhouette.pngbin48600 -> 42067 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/programCounterBorder.pngbin352 -> 331 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/radioDot.pngbin235 -> 224 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/recordButtonGlyph.pngbin213 -> 241 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/recordToggledButtonGlyph.pngbin510 -> 385 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/reloadButtonGlyph.pngbin267 -> 294 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourceCSSIcon.pngbin1066 -> 1057 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourceDocumentIcon.pngbin4959 -> 979 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourceDocumentIconSmall.pngbin787 -> 158 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourceJSIcon.pngbin879 -> 859 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourcePlainIcon.pngbin4321 -> 378 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourcePlainIconSmall.pngbin731 -> 130 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourcesIcon.pngbin6431 -> 2366 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourcesSizeGraphIcon.pngbin5606 -> 1640 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/resourcesTimeGraphIcon.pngbin5743 -> 1427 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/scriptsIcon.pngbin7428 -> 2863 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/scriptsSilhouette.pngbin49028 -> 43110 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/searchSmallBlue.pngbin3968 -> 311 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/searchSmallBrightBlue.pngbin3966 -> 304 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/searchSmallGray.pngbin3936 -> 264 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/searchSmallWhite.pngbin3844 -> 217 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/segment.pngbin4349 -> 297 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/segmentEnd.pngbin4070 -> 141 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/segmentHover.pngbin4310 -> 320 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/segmentHoverEnd.pngbin4074 -> 145 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/segmentSelected.pngbin4302 -> 309 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/segmentSelectedEnd.pngbin4070 -> 139 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/sessionStorage.pngbin1097 -> 1069 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/splitviewDimple.pngbin216 -> 189 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/splitviewDividerBackground.pngbin149 -> 147 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/statusbarButtons.pngbin4175 -> 216 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/statusbarMenuButton.pngbin4293 -> 328 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.pngbin4291 -> 295 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/statusbarResizerHorizontal.pngbin4026 -> 90 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/statusbarResizerVertical.pngbin4036 -> 92 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/successGreenDot.pngbin585 -> 492 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/thumbActiveHoriz.pngbin647 -> 663 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/thumbActiveVert.pngbin599 -> 567 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/thumbHoriz.pngbin657 -> 665 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/thumbHoverHoriz.pngbin667 -> 667 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/thumbHoverVert.pngbin583 -> 565 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/thumbVert.pngbin568 -> 567 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineBarBlue.pngbin419 -> 403 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineBarGray.pngbin378 -> 366 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineBarGreen.pngbin414 -> 404 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineBarOrange.pngbin394 -> 376 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineBarPurple.pngbin420 -> 403 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineBarRed.pngbin408 -> 401 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineBarYellow.pngbin400 -> 382 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineCheckmarks.pngbin3528 -> 3284 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineDots.pngbin2436 -> 2294 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineHollowPillBlue.pngbin3450 -> 806 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineHollowPillGray.pngbin3392 -> 713 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineHollowPillGreen.pngbin3452 -> 806 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineHollowPillOrange.pngbin3452 -> 807 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineHollowPillPurple.pngbin3453 -> 810 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineHollowPillRed.pngbin3460 -> 810 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineHollowPillYellow.pngbin3444 -> 804 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelineIcon.pngbin4419 -> 4312 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelinePillBlue.pngbin3346 -> 706 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelinePillGray.pngbin3297 -> 636 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelinePillGreen.pngbin3350 -> 712 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelinePillOrange.pngbin3352 -> 712 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelinePillPurple.pngbin3353 -> 716 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelinePillRed.pngbin3343 -> 706 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/timelinePillYellow.pngbin3336 -> 699 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/toolbarItemSelected.pngbin4197 -> 266 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/trackHoriz.pngbin520 -> 530 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/trackVert.pngbin523 -> 565 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/treeDownTriangleBlack.pngbin3570 -> 166 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/treeDownTriangleWhite.pngbin3531 -> 148 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/treeRightTriangleBlack.pngbin3561 -> 155 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/treeRightTriangleWhite.pngbin3535 -> 142 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/treeUpTriangleBlack.pngbin3584 -> 180 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/treeUpTriangleWhite.pngbin3558 -> 162 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/undockButtonGlyph.pngbin179 -> 219 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/userInputIcon.pngbin777 -> 189 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/userInputPreviousIcon.pngbin765 -> 162 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/userInputResultIcon.pngbin259 -> 221 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/warningIcon.pngbin4244 -> 273 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/warningMediumIcon.pngbin3833 -> 592 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/warningOrangeDot.pngbin580 -> 484 bytes
-rw-r--r--Source/WebCore/inspector/front-end/Images/warningsErrors.pngbin5192 -> 1832 bytes
-rw-r--r--Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js4
-rw-r--r--Source/WebCore/inspector/front-end/MetricsSidebarPane.js2
-rw-r--r--Source/WebCore/inspector/front-end/NetworkItemView.js11
-rw-r--r--Source/WebCore/inspector/front-end/NetworkManager.js187
-rw-r--r--Source/WebCore/inspector/front-end/NetworkPanel.js50
-rw-r--r--Source/WebCore/inspector/front-end/ObjectPropertiesSection.js16
-rw-r--r--Source/WebCore/inspector/front-end/ProfileView.js8
-rw-r--r--Source/WebCore/inspector/front-end/ProfilesPanel.js29
-rw-r--r--Source/WebCore/inspector/front-end/PropertiesSidebarPane.js11
-rw-r--r--Source/WebCore/inspector/front-end/RemoteObject.js73
-rw-r--r--Source/WebCore/inspector/front-end/Resource.js16
-rw-r--r--Source/WebCore/inspector/front-end/ResourceJSONView.js75
-rw-r--r--Source/WebCore/inspector/front-end/ResourceTreeModel.js214
-rw-r--r--Source/WebCore/inspector/front-end/ResourceView.js68
-rw-r--r--Source/WebCore/inspector/front-end/ResourcesPanel.js129
-rw-r--r--Source/WebCore/inspector/front-end/Script.js4
-rw-r--r--Source/WebCore/inspector/front-end/ScriptFormatter.js63
-rw-r--r--Source/WebCore/inspector/front-end/ScriptsPanel.js465
-rw-r--r--Source/WebCore/inspector/front-end/Section.js8
-rw-r--r--Source/WebCore/inspector/front-end/Settings.js12
-rw-r--r--Source/WebCore/inspector/front-end/ShortcutsHelp.js4
-rw-r--r--Source/WebCore/inspector/front-end/SourceFile.js311
-rw-r--r--Source/WebCore/inspector/front-end/SourceFrame.js154
-rw-r--r--Source/WebCore/inspector/front-end/SourceFrameContent.js13
-rw-r--r--Source/WebCore/inspector/front-end/StylesSidebarPane.js11
-rw-r--r--Source/WebCore/inspector/front-end/TextEditorHighlighter.js232
-rw-r--r--Source/WebCore/inspector/front-end/TextEditorModel.js5
-rw-r--r--Source/WebCore/inspector/front-end/TextViewer.js283
-rw-r--r--Source/WebCore/inspector/front-end/TimelineAgent.js47
-rw-r--r--Source/WebCore/inspector/front-end/TimelinePanel.js41
-rw-r--r--Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js4
-rw-r--r--Source/WebCore/inspector/front-end/WebKit.qrc4
-rw-r--r--Source/WebCore/inspector/front-end/WorkersSidebarPane.js4
-rw-r--r--Source/WebCore/inspector/front-end/heapProfiler.css19
-rw-r--r--Source/WebCore/inspector/front-end/inspector.css17
-rw-r--r--Source/WebCore/inspector/front-end/inspector.html2
-rw-r--r--Source/WebCore/inspector/front-end/inspector.js92
-rw-r--r--Source/WebCore/inspector/front-end/utilities.js86
-rwxr-xr-xSource/WebCore/inspector/generate-inspector-idl125
-rw-r--r--Source/WebCore/inspector/xxd.pl90
285 files changed, 7900 insertions, 4599 deletions
diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.pm b/Source/WebCore/inspector/CodeGeneratorInspector.pm
index 70eb61d..ea65f2e 100644
--- a/Source/WebCore/inspector/CodeGeneratorInspector.pm
+++ b/Source/WebCore/inspector/CodeGeneratorInspector.pm
@@ -13,71 +13,77 @@ my %typeTransform;
$typeTransform{"ApplicationCache"} = {
"forward" => "InspectorApplicationCacheAgent",
"header" => "InspectorApplicationCacheAgent.h",
- "domainAccessor" => "m_inspectorAgent->applicationCacheAgent()",
+ "domainAccessor" => "m_applicationCacheAgent",
};
$typeTransform{"CSS"} = {
"forward" => "InspectorCSSAgent",
"header" => "InspectorCSSAgent.h",
- "domainAccessor" => "m_inspectorAgent->cssAgent()",
+ "domainAccessor" => "m_cssAgent",
};
$typeTransform{"Console"} = {
"forward" => "InspectorConsoleAgent",
"header" => "InspectorConsoleAgent.h",
- "domainAccessor" => "m_inspectorAgent->consoleAgent()",
+ "domainAccessor" => "m_consoleAgent",
+};
+$typeTransform{"Page"} = {
+ "forward" => "InspectorPageAgent",
+ "header" => "InspectorPageAgent.h",
+ "domainAccessor" => "m_pageAgent",
};
$typeTransform{"Debugger"} = {
"forward" => "InspectorDebuggerAgent",
"header" => "InspectorDebuggerAgent.h",
- "domainAccessor" => "m_inspectorAgent->debuggerAgent()",
+ "domainAccessor" => "m_debuggerAgent",
};
$typeTransform{"BrowserDebugger"} = {
"forward" => "InspectorBrowserDebuggerAgent",
"header" => "InspectorBrowserDebuggerAgent.h",
- "domainAccessor" => "m_inspectorAgent->browserDebuggerAgent()",
+ "domainAccessor" => "m_browserDebuggerAgent",
};
$typeTransform{"Database"} = {
"forward" => "InspectorDatabaseAgent",
"header" => "InspectorDatabaseAgent.h",
- "domainAccessor" => "m_inspectorAgent->databaseAgent()",
+ "domainAccessor" => "m_databaseAgent",
};
$typeTransform{"DOM"} = {
"forward" => "InspectorDOMAgent",
"header" => "InspectorDOMAgent.h",
- "domainAccessor" => "m_inspectorAgent->domAgent()",
+ "domainAccessor" => "m_domAgent",
};
$typeTransform{"DOMStorage"} = {
"forward" => "InspectorDOMStorageAgent",
"header" => "InspectorDOMStorageAgent.h",
- "domainAccessor" => "m_inspectorAgent->domStorageAgent()",
+ "domainAccessor" => "m_domStorageAgent",
};
$typeTransform{"FileSystem"} = {
"forward" => "InspectorFileSystemAgent",
"header" => "InspectorFileSystemAgent.h",
- "domainAccessor" => "m_inspectorAgent->fileSystemAgent()",
+ "domainAccessor" => "m_fileSystemAgent",
};
$typeTransform{"Inspector"} = {
- "forwardHeader" => "InspectorAgent.h",
+ "forward" => "InspectorAgent",
+ "header" => "InspectorAgent.h",
"domainAccessor" => "m_inspectorAgent",
};
$typeTransform{"Network"} = {
"forward" => "InspectorResourceAgent",
"header" => "InspectorResourceAgent.h",
- "domainAccessor" => "m_inspectorAgent->resourceAgent()",
+ "domainAccessor" => "m_resourceAgent",
};
$typeTransform{"Profiler"} = {
"forward" => "InspectorProfilerAgent",
"header" => "InspectorProfilerAgent.h",
- "domainAccessor" => "m_inspectorAgent->profilerAgent()",
+ "domainAccessor" => "m_profilerAgent",
};
$typeTransform{"Runtime"} = {
"forward" => "InspectorRuntimeAgent",
"header" => "InspectorRuntimeAgent.h",
- "domainAccessor" => "m_inspectorAgent->runtimeAgent()",
+ "domainAccessor" => "m_runtimeAgent",
};
$typeTransform{"Timeline"} = {
"forward" => "InspectorTimelineAgent",
"header" => "InspectorTimelineAgent.h",
- "domainAccessor" => "m_inspectorAgent->timelineAgent()",
+ "domainAccessor" => "m_timelineAgent",
};
$typeTransform{"Frontend"} = {
@@ -215,8 +221,9 @@ my %backendMethodSignatures;
my $backendConstructor;
my @backendConstantDeclarations;
my @backendConstantDefinitions;
-my $backendFooter;
+my @backendFooter;
my @backendJSStubs;
+my %backendDomains;
my $frontendClassName;
my %frontendTypes;
@@ -269,13 +276,6 @@ sub GenerateModule
$backendClassName = "InspectorBackendDispatcher";
$backendJSStubName = "InspectorBackendStub";
- my @backendHead;
- push(@backendHead, " ${backendClassName}(InspectorAgent* inspectorAgent) : m_inspectorAgent(inspectorAgent) { }");
- push(@backendHead, " void reportProtocolError(const long callId, const String& errorText) const;");
- push(@backendHead, " void dispatch(const String& message);");
- push(@backendHead, " static bool getCommandName(const String& message, String* result);");
- $backendConstructor = join("\n", @backendHead);
- $backendFooter = " InspectorAgent* m_inspectorAgent;";
$backendTypes{"Inspector"} = 1;
$backendTypes{"InspectorClient"} = 1;
$backendTypes{"PassRefPtr"} = 1;
@@ -418,7 +418,6 @@ sub generateDocumentationEvent
push(@lines, "<pre style='background: lightGrey; padding: 10px'>");
push(@lines, "{");
- push(@lines, " seq: &lt;number&gt;,");
push(@lines, " type: \"event\",");
push(@lines, " domain: \"$domain\",");
if (scalar(@argsFiltered)) {
@@ -476,12 +475,16 @@ sub generateBackendFunction
my $domain = $interface->name;
my $domainAccessor = typeTraits($domain, "domainAccessor");
$backendTypes{$domain} = 1;
+ $backendDomains{$domain} = 1;
push(@function, " if (!$domainAccessor)");
push(@function, " protocolErrors->pushString(\"Protocol Error: $domain handler is not available.\");");
push(@function, "");
# declare local variables for out arguments.
push(@function, map(" " . typeTraits($_->type, "variable") . " " . $_->name . " = " . typeTraits($_->type, "defaultValue") . ";", @outArgs));
+ push(@function, "");
+ push(@function, " ErrorString error;");
+ push(@function, "");
my $indent = "";
if (scalar(@inArgs)) {
@@ -497,12 +500,9 @@ sub generateBackendFunction
$indent = " ";
}
- push(@function, "$indent ErrorString error;");
my $args = join(", ", ("&error", map($_->name, @inArgs), map("&" . $_->name, @outArgs)));
push(@function, "$indent if (!protocolErrors->length())");
push(@function, "$indent $domainAccessor->$functionName($args);");
- push(@function, "$indent if (error.length())");
- push(@function, "$indent protocolErrors->pushString(error);");
if (scalar(@inArgs)) {
push(@function, " } else {");
push(@function, " protocolErrors->pushString(\"Protocol Error: 'arguments' property with type 'object' was not found.\");");
@@ -510,20 +510,22 @@ sub generateBackendFunction
}
push(@function, " // use InspectorFrontend as a marker of WebInspector availability");
- push(@function, " if ((callId || protocolErrors->length()) && m_inspectorAgent->hasFrontend()) {");
+ push(@function, " if (callId || protocolErrors->length()) {");
push(@function, " RefPtr<InspectorObject> responseMessage = InspectorObject::create();");
- push(@function, " responseMessage->setNumber(\"seq\", callId);");
+ push(@function, " responseMessage->setNumber(\"requestId\", callId);");
push(@function, "");
push(@function, " if (protocolErrors->length())");
- push(@function, " responseMessage->setArray(\"errors\", protocolErrors);");
+ push(@function, " responseMessage->setArray(\"protocolErrors\", protocolErrors);");
if (scalar(@outArgs)) {
push(@function, " else {");
+ push(@function, " if (error.length())");
+ push(@function, " responseMessage->setString(\"error\", error);");
push(@function, " RefPtr<InspectorObject> responseBody = InspectorObject::create();");
push(@function, map(" responseBody->set" . typeTraits($_->type, "JSONType") . "(\"" . $_->name . "\", " . $_->name . ");", @outArgs));
push(@function, " responseMessage->setObject(\"body\", responseBody);");
push(@function, " }");
}
- push(@function, " m_inspectorAgent->inspectorClient()->sendMessageToFrontend(responseMessage->toJSONString());");
+ push(@function, " m_inspectorClient->sendMessageToFrontend(responseMessage->toJSONString());");
push(@function, " }");
@@ -551,7 +553,7 @@ sub generateDocumentationCommand
my @inArgs = grep($_->direction eq "in" && !($_->name eq "callId") , @{$function->parameters});
push(@lines, "<pre style='background: lightGrey; padding: 10px'>");
push(@lines, "request: {");
- push(@lines, " seq: &lt;number&gt;,");
+ push(@lines, " id: &lt;number&gt;,");
push(@lines, " type: \"request\",");
push(@lines, " domain: \"" . $interface->name . "\",");
if (scalar(@inArgs)) {
@@ -571,7 +573,7 @@ sub generateDocumentationCommand
my @outArgs = grep($_->direction eq "out", @{$function->parameters});
push(@lines, "");
push(@lines, "response: {");
- push(@lines, " seq: &lt;number&gt;,");
+ push(@lines, " requestId: &lt;number&gt;,");
if (scalar(@outArgs)) {
push(@lines, " type: \"response\",");
push(@lines, " body: {");
@@ -597,11 +599,11 @@ sub generateBackendReportProtocolError
void ${backendClassName}::reportProtocolError(const long callId, const String& errorText) const
{
RefPtr<InspectorObject> message = InspectorObject::create();
- message->setNumber("seq", callId);
+ message->setNumber("requestId", callId);
RefPtr<InspectorArray> errors = InspectorArray::create();
errors->pushString(errorText);
- message->setArray("errors", errors);
- m_inspectorAgent->inspectorClient()->sendMessageToFrontend(message->toJSONString());
+ message->setArray("protocolErrors", errors);
+ m_inspectorClient->sendMessageToFrontend(message->toJSONString());
}
EOF
return split("\n", $reportProtocolError);
@@ -700,14 +702,14 @@ $mapEntries
return;
}
- RefPtr<InspectorValue> callIdValue = messageObject->get("seq");
+ RefPtr<InspectorValue> callIdValue = messageObject->get("id");
if (!callIdValue) {
- reportProtocolError(callId, "Protocol Error: Invalid message format. 'seq' property was not found in the request.");
+ reportProtocolError(callId, "Protocol Error: Invalid message format. 'id' property was not found in the request.");
return;
}
if (!callIdValue->asNumber(&callId)) {
- reportProtocolError(callId, "Protocol Error: Invalid message format. The type of 'seq' property should be number.");
+ reportProtocolError(callId, "Protocol Error: Invalid message format. The type of 'id' property should be number.");
return;
}
@@ -761,7 +763,7 @@ sub collectBackendJSStubFunctions
my $name = $function->signature->name;
my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . typeTraits($_->type, "JSType") . "\"", grep($_->direction eq "in", @{$function->parameters})));
push(@backendJSStubs, " this._registerDelegate('{" .
- "\"seq\": 0, " .
+ "\"id\": 0, " .
"\"domain\": \"$domain\", " .
"\"command\": \"$name\", " .
"\"arguments\": {$argumentNames}" .
@@ -827,7 +829,7 @@ InspectorBackendStub.prototype = {
}
callback = args[0];
}
- request.seq = this._wrap(callback || function() {});
+ request.id = this._wrap(callback || function() {});
if (window.dumpInspectorProtocolMessages)
console.log("frontend: " + JSON.stringify(request));
@@ -855,14 +857,19 @@ InspectorBackendStub.prototype = {
for (var key in messageObject.body)
arguments.push(messageObject.body[key]);
- if ("seq" in messageObject) { // just a response for some request
- if (!messageObject.errors)
- this._callbacks[messageObject.seq].apply(null, arguments);
- else
+ if ("requestId" in messageObject) { // just a response for some request
+ if (messageObject.protocolErrors)
this.reportProtocolError(messageObject);
- --this._pendingResponsesCount;
- delete this._callbacks[messageObject.seq];
+ var callback = this._callbacks[messageObject.requestId];
+ if (callback) {
+ if (!messageObject.protocolErrors) {
+ arguments.unshift(messageObject.error);
+ callback.apply(null, arguments);
+ }
+ --this._pendingResponsesCount;
+ delete this._callbacks[messageObject.requestId];
+ }
if (this._scripts && !this._pendingResponsesCount)
this.runAfterPendingDispatches();
@@ -880,15 +887,16 @@ InspectorBackendStub.prototype = {
console.error("Protocol Error: Attempted to dispatch an unimplemented method '" + messageObject.domain + "." + messageObject.event + "'");
return;
}
+
dispatcher[messageObject.event].apply(dispatcher, arguments);
}
},
reportProtocolError: function(messageObject)
{
- console.error("Protocol Error: InspectorBackend request with seq = " + messageObject.seq + " failed.");
- for (var i = 0; i < messageObject.errors.length; ++i)
- console.error(" " + messageObject.errors[i]);
+ console.error("Protocol Error: InspectorBackend request with id = " + messageObject.requestId + " failed.");
+ for (var i = 0; i < messageObject.protocolErrors.length; ++i)
+ console.error(" " + messageObject.protocolErrors[i]);
},
runAfterPendingDispatches: function(script)
@@ -1032,6 +1040,39 @@ sub parameterDocLine
return $result;
}
+sub generateBackendAgentFieldsAndConstructor
+{
+ my @arguments;
+ my @fieldInitializers;
+
+ push(@arguments, "InspectorClient* inspectorClient");
+ push(@fieldInitializers, " : m_inspectorClient(inspectorClient)");
+ push(@backendFooter, " InspectorClient* m_inspectorClient;");
+
+ foreach my $domain (sort keys %backendDomains) {
+ # Add agent field declaration to the footer.
+ my $agentClassName = typeTraits($domain, "forward");
+ my $field = typeTraits($domain, "domainAccessor");
+ push(@backendFooter, " ${agentClassName}* ${field};");
+
+ # Add agent parameter and initializer.
+ my $arg = substr($field, 2);
+ push(@fieldInitializers, " , ${field}(${arg})");
+ push(@arguments, "${agentClassName}* ${arg}");
+ }
+
+ my $argumentString = join(", ", @arguments);
+
+ my @backendHead;
+ push(@backendHead, " ${backendClassName}(${argumentString})");
+ push(@backendHead, @fieldInitializers);
+ push(@backendHead, " { }");
+ push(@backendHead, " void reportProtocolError(const long callId, const String& errorText) const;");
+ push(@backendHead, " void dispatch(const String& message);");
+ push(@backendHead, " static bool getCommandName(const String& message, String* result);");
+ $backendConstructor = join("\n", @backendHead);
+}
+
sub finish
{
my $object = shift;
@@ -1059,6 +1100,7 @@ sub finish
push(@backendMethodsImpl, generateArgumentGetters($type));
}
}
+ generateBackendAgentFieldsAndConstructor();
push(@backendMethodsImpl, generateBackendMessageParser());
push(@backendMethodsImpl, "");
@@ -1071,7 +1113,7 @@ sub finish
undef($SOURCE);
open($HEADER, ">$outputHeadersDir/$backendClassName.h") || die "Couldn't open file $outputHeadersDir/$backendClassName.h";
- print $HEADER join("\n", generateHeader($backendClassName, \%backendTypes, $backendConstructor, \@backendConstantDeclarations, \@backendMethods, $backendFooter));
+ print $HEADER join("\n", generateHeader($backendClassName, \%backendTypes, $backendConstructor, \@backendConstantDeclarations, \@backendMethods, join("\n", @backendFooter)));
close($HEADER);
undef($HEADER);
diff --git a/Source/WebCore/inspector/ConsoleMessage.cpp b/Source/WebCore/inspector/ConsoleMessage.cpp
index 63fb020..de61ef8 100644
--- a/Source/WebCore/inspector/ConsoleMessage.cpp
+++ b/Source/WebCore/inspector/ConsoleMessage.cpp
@@ -35,7 +35,7 @@
#include "Console.h"
#include "InjectedScript.h"
-#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
#include "InspectorFrontend.h"
#include "InspectorValues.h"
#include "ScriptArguments.h"
@@ -86,7 +86,7 @@ ConsoleMessage::~ConsoleMessage()
{
}
-void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, InjectedScriptHost* injectedScriptHost)
+void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, InjectedScriptManager* injectedScriptManager)
{
RefPtr<InspectorObject> jsonObj = InspectorObject::create();
jsonObj->setNumber("source", static_cast<int>(m_source));
@@ -99,7 +99,7 @@ void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, Injecte
if (m_type == NetworkErrorMessageType)
jsonObj->setNumber("requestId", m_requestId);
if (m_arguments && m_arguments->argumentCount()) {
- InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_arguments->globalState());
+ InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(m_arguments->globalState());
if (!injectedScript.hasNoValue()) {
RefPtr<InspectorArray> jsonArgs = InspectorArray::create();
for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
@@ -114,13 +114,13 @@ void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, Injecte
}
}
if (m_callStack)
- jsonObj->setArray("stackTrace", m_callStack->buildInspectorObject());
- frontend->addConsoleMessage(jsonObj);
+ jsonObj->setArray("stackTrace", m_callStack->buildInspectorArray());
+ frontend->consoleMessage(jsonObj);
}
void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend::Console* frontend)
{
- frontend->updateConsoleMessageRepeatCount(m_repeatCount);
+ frontend->consoleMessageRepeatCountUpdated(m_repeatCount);
}
bool ConsoleMessage::isEqual(ConsoleMessage* msg) const
diff --git a/Source/WebCore/inspector/ConsoleMessage.h b/Source/WebCore/inspector/ConsoleMessage.h
index 26e5675..4e6f115 100644
--- a/Source/WebCore/inspector/ConsoleMessage.h
+++ b/Source/WebCore/inspector/ConsoleMessage.h
@@ -39,7 +39,7 @@
#include <wtf/Vector.h>
namespace WebCore {
-class InjectedScriptHost;
+class InjectedScriptManager;
class InspectorFrontend;
class InspectorObject;
class ScriptArguments;
@@ -55,13 +55,14 @@ public:
ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, const String& responseUrl, unsigned long identifier);
~ConsoleMessage();
- void addToFrontend(InspectorFrontend::Console*, InjectedScriptHost*);
+ void addToFrontend(InspectorFrontend::Console*, InjectedScriptManager*);
void updateRepeatCountInConsole(InspectorFrontend::Console*);
void incrementCount() { ++m_repeatCount; }
bool isEqual(ConsoleMessage* msg) const;
MessageSource source() const { return m_source; }
const String& message() const { return m_message; }
+ MessageType type() const { return m_type; }
private:
MessageSource m_source;
diff --git a/Source/WebCore/inspector/DOMNodeHighlighter.cpp b/Source/WebCore/inspector/DOMNodeHighlighter.cpp
new file mode 100644
index 0000000..c87649b
--- /dev/null
+++ b/Source/WebCore/inspector/DOMNodeHighlighter.cpp
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DOMNodeHighlighter.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "Element.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "Page.h"
+#include "Range.h"
+#include "RenderInline.h"
+#include "Settings.h"
+#include "StyledElement.h"
+#include "TextRun.h"
+
+namespace WebCore {
+
+namespace {
+
+Path quadToPath(const FloatQuad& quad)
+{
+ Path quadPath;
+ quadPath.moveTo(quad.p1());
+ quadPath.addLineTo(quad.p2());
+ quadPath.addLineTo(quad.p3());
+ quadPath.addLineTo(quad.p4());
+ quadPath.closeSubpath();
+ return quadPath;
+}
+
+void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, const Color& fillColor)
+{
+ static const int outlineThickness = 2;
+ static const Color outlineColor(62, 86, 180, 228);
+
+ Path quadPath = quadToPath(quad);
+
+ // Clip out the quad, then draw with a 2px stroke to get a pixel
+ // of outline (because inflating a quad is hard)
+ {
+ context.save();
+ context.clipOut(quadPath);
+
+ context.setStrokeThickness(outlineThickness);
+ context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
+ context.strokePath(quadPath);
+
+ context.restore();
+ }
+
+ // Now do the fill
+ context.setFillColor(fillColor, ColorSpaceDeviceRGB);
+ context.fillPath(quadPath);
+}
+
+void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
+{
+ context.save();
+ Path clipQuadPath = quadToPath(clipQuad);
+ context.clipOut(clipQuadPath);
+ drawOutlinedQuad(context, quad, fillColor);
+ context.restore();
+}
+
+void drawHighlightForBox(GraphicsContext& context, const FloatQuad& contentQuad, const FloatQuad& paddingQuad, const FloatQuad& borderQuad, const FloatQuad& marginQuad)
+{
+ static const Color contentBoxColor(125, 173, 217, 128);
+ static const Color paddingBoxColor(125, 173, 217, 160);
+ static const Color borderBoxColor(125, 173, 217, 192);
+ static const Color marginBoxColor(125, 173, 217, 228);
+
+ if (marginQuad != borderQuad)
+ drawOutlinedQuadWithClip(context, marginQuad, borderQuad, marginBoxColor);
+ if (borderQuad != paddingQuad)
+ drawOutlinedQuadWithClip(context, borderQuad, paddingQuad, borderBoxColor);
+ if (paddingQuad != contentQuad)
+ drawOutlinedQuadWithClip(context, paddingQuad, contentQuad, paddingBoxColor);
+
+ drawOutlinedQuad(context, contentQuad, contentBoxColor);
+}
+
+void drawHighlightForLineBoxesOrSVGRenderer(GraphicsContext& context, const Vector<FloatQuad>& lineBoxQuads)
+{
+ static const Color lineBoxColor(125, 173, 217, 128);
+
+ for (size_t i = 0; i < lineBoxQuads.size(); ++i)
+ drawOutlinedQuad(context, lineBoxQuads[i], lineBoxColor);
+}
+
+inline IntSize frameToMainFrameOffset(Frame* frame)
+{
+ IntPoint mainFramePoint = frame->page()->mainFrame()->view()->windowToContents(frame->view()->contentsToWindow(IntPoint()));
+ return mainFramePoint - IntPoint();
+}
+
+void drawElementTitle(GraphicsContext& context, Node* node, const IntRect& boundingBox, const IntRect& anchorBox, const FloatRect& overlayRect, WebCore::Settings* settings)
+{
+ static const int rectInflatePx = 4;
+ static const int fontHeightPx = 12;
+ static const int borderWidthPx = 1;
+ static const Color tooltipBackgroundColor(255, 255, 194, 255);
+ static const Color tooltipBorderColor(Color::black);
+ static const Color tooltipFontColor(Color::black);
+
+ Element* element = static_cast<Element*>(node);
+ bool isXHTML = element->document()->isXHTMLDocument();
+ String nodeTitle = isXHTML ? element->nodeName() : element->nodeName().lower();
+ const AtomicString& idValue = element->getIdAttribute();
+ if (!idValue.isNull() && !idValue.isEmpty()) {
+ nodeTitle += "#";
+ nodeTitle += idValue;
+ }
+ if (element->hasClass() && element->isStyledElement()) {
+ const SpaceSplitString& classNamesString = static_cast<StyledElement*>(element)->classNames();
+ size_t classNameCount = classNamesString.size();
+ if (classNameCount) {
+ HashSet<AtomicString> usedClassNames;
+ for (size_t i = 0; i < classNameCount; ++i) {
+ const AtomicString& className = classNamesString[i];
+ if (usedClassNames.contains(className))
+ continue;
+ usedClassNames.add(className);
+ nodeTitle += ".";
+ nodeTitle += className;
+ }
+ }
+ }
+
+ nodeTitle += " [";
+ nodeTitle += String::number(boundingBox.width());
+ nodeTitle.append(static_cast<UChar>(0x00D7)); // &times;
+ nodeTitle += String::number(boundingBox.height());
+ nodeTitle += "]";
+
+ FontDescription desc;
+ FontFamily family;
+ family.setFamily(settings->fixedFontFamily());
+ desc.setFamily(family);
+ desc.setComputedSize(fontHeightPx);
+ Font font = Font(desc, 0, 0);
+ font.update(0);
+
+ TextRun nodeTitleRun(nodeTitle);
+ IntPoint titleBasePoint = IntPoint(anchorBox.x(), anchorBox.maxY() - 1);
+ titleBasePoint.move(rectInflatePx, rectInflatePx);
+ IntRect titleRect = enclosingIntRect(font.selectionRectForText(nodeTitleRun, titleBasePoint, fontHeightPx));
+ titleRect.inflate(rectInflatePx);
+
+ // The initial offsets needed to compensate for a 1px-thick border stroke (which is not a part of the rectangle).
+ int dx = -borderWidthPx;
+ int dy = borderWidthPx;
+
+ // If the tip sticks beyond the right of overlayRect, right-align the tip with the said boundary.
+ if (titleRect.maxX() > overlayRect.maxX())
+ dx = overlayRect.maxX() - titleRect.maxX();
+
+ // If the tip sticks beyond the left of overlayRect, left-align the tip with the said boundary.
+ if (titleRect.x() + dx < overlayRect.x())
+ dx = overlayRect.x() - titleRect.x() - borderWidthPx;
+
+ // If the tip sticks beyond the bottom of overlayRect, show the tip at top of bounding box.
+ if (titleRect.maxY() > overlayRect.maxY()) {
+ dy = anchorBox.y() - titleRect.maxY() - borderWidthPx;
+ // If the tip still sticks beyond the bottom of overlayRect, bottom-align the tip with the said boundary.
+ if (titleRect.maxY() + dy > overlayRect.maxY())
+ dy = overlayRect.maxY() - titleRect.maxY();
+ }
+
+ // If the tip sticks beyond the top of overlayRect, show the tip at top of overlayRect.
+ if (titleRect.y() + dy < overlayRect.y())
+ dy = overlayRect.y() - titleRect.y() + borderWidthPx;
+
+ titleRect.move(dx, dy);
+ context.setStrokeColor(tooltipBorderColor, ColorSpaceDeviceRGB);
+ context.setStrokeThickness(borderWidthPx);
+ context.setFillColor(tooltipBackgroundColor, ColorSpaceDeviceRGB);
+ context.drawRect(titleRect);
+ context.setFillColor(tooltipFontColor, ColorSpaceDeviceRGB);
+ context.drawText(font, nodeTitleRun, IntPoint(titleRect.x() + rectInflatePx, titleRect.y() + font.fontMetrics().height()));
+}
+
+} // anonymous namespace
+
+namespace DOMNodeHighlighter {
+
+void DrawNodeHighlight(GraphicsContext& context, Node* node)
+{
+ RenderObject* renderer = node->renderer();
+ Frame* containingFrame = node->document()->frame();
+
+ if (!renderer || !containingFrame)
+ return;
+
+ IntSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
+ IntRect boundingBox = renderer->absoluteBoundingBoxRect(true);
+
+ boundingBox.move(mainFrameOffset);
+
+ IntRect titleAnchorBox = boundingBox;
+
+ FrameView* view = containingFrame->page()->mainFrame()->view();
+ FloatRect overlayRect = view->visibleContentRect();
+ if (!overlayRect.contains(boundingBox) && !boundingBox.contains(enclosingIntRect(overlayRect)))
+ overlayRect = view->visibleContentRect();
+ context.translate(-overlayRect.x(), -overlayRect.y());
+
+ // RenderSVGRoot should be highlighted through the isBox() code path, all other SVG elements should just dump their absoluteQuads().
+#if ENABLE(SVG)
+ bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot();
+#else
+ bool isSVGRenderer = false;
+#endif
+
+ if (renderer->isBox() && !isSVGRenderer) {
+ RenderBox* renderBox = toRenderBox(renderer);
+
+ IntRect contentBox = renderBox->contentBoxRect();
+
+ IntRect paddingBox(contentBox.x() - renderBox->paddingLeft(), contentBox.y() - renderBox->paddingTop(),
+ contentBox.width() + renderBox->paddingLeft() + renderBox->paddingRight(), contentBox.height() + renderBox->paddingTop() + renderBox->paddingBottom());
+ IntRect borderBox(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
+ paddingBox.width() + renderBox->borderLeft() + renderBox->borderRight(), paddingBox.height() + renderBox->borderTop() + renderBox->borderBottom());
+ IntRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
+ borderBox.width() + renderBox->marginLeft() + renderBox->marginRight(), borderBox.height() + renderBox->marginTop() + renderBox->marginBottom());
+
+
+ FloatQuad absContentQuad = renderBox->localToAbsoluteQuad(FloatRect(contentBox));
+ FloatQuad absPaddingQuad = renderBox->localToAbsoluteQuad(FloatRect(paddingBox));
+ FloatQuad absBorderQuad = renderBox->localToAbsoluteQuad(FloatRect(borderBox));
+ FloatQuad absMarginQuad = renderBox->localToAbsoluteQuad(FloatRect(marginBox));
+
+ absContentQuad.move(mainFrameOffset);
+ absPaddingQuad.move(mainFrameOffset);
+ absBorderQuad.move(mainFrameOffset);
+ absMarginQuad.move(mainFrameOffset);
+
+ titleAnchorBox = absMarginQuad.enclosingBoundingBox();
+
+ drawHighlightForBox(context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad);
+ } else if (renderer->isRenderInline() || isSVGRenderer) {
+ // FIXME: We should show margins/padding/border for inlines.
+ Vector<FloatQuad> lineBoxQuads;
+ renderer->absoluteQuads(lineBoxQuads);
+ for (unsigned i = 0; i < lineBoxQuads.size(); ++i)
+ lineBoxQuads[i] += mainFrameOffset;
+
+ drawHighlightForLineBoxesOrSVGRenderer(context, lineBoxQuads);
+ }
+
+ // Draw node title if necessary.
+
+ if (!node->isElementNode())
+ return;
+
+ WebCore::Settings* settings = containingFrame->settings();
+ drawElementTitle(context, node, boundingBox, titleAnchorBox, overlayRect, settings);
+}
+
+} // namespace DOMNodeHighlighter
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/DOMNodeHighlighter.h b/Source/WebCore/inspector/DOMNodeHighlighter.h
new file mode 100644
index 0000000..1de1eec
--- /dev/null
+++ b/Source/WebCore/inspector/DOMNodeHighlighter.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMNodeHighlighter_h
+#define DOMNodeHighlighter_h
+
+namespace WebCore {
+
+class GraphicsContext;
+class Node;
+
+namespace DOMNodeHighlighter {
+
+void DrawNodeHighlight(GraphicsContext&, Node*);
+
+} // namespace DOMNodeHighlighter
+
+} // namespace WebCore
+
+
+#endif // DOMNodeHighlighter_h
diff --git a/Source/WebCore/inspector/InjectedScript.cpp b/Source/WebCore/inspector/InjectedScript.cpp
index 6c115d0..ee2e35a 100644
--- a/Source/WebCore/inspector/InjectedScript.cpp
+++ b/Source/WebCore/inspector/InjectedScript.cpp
@@ -35,6 +35,7 @@
#include "Frame.h"
#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
#include "InspectorValues.h"
#include "Node.h"
#include "PlatformString.h"
@@ -47,50 +48,56 @@ InjectedScript::InjectedScript(ScriptObject injectedScriptObject)
{
}
-void InjectedScript::evaluate(const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
+void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result)
{
ScriptFunctionCall function(m_injectedScriptObject, "evaluate");
function.appendArgument(expression);
function.appendArgument(objectGroup);
function.appendArgument(includeCommandLineAPI);
- makeCall(function, result);
+ makeObjectCall(errorString, function, result);
}
-void InjectedScript::evaluateOn(PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result)
+void InjectedScript::evaluateOn(ErrorString* errorString, const String& objectId, const String& expression, RefPtr<InspectorObject>* result)
{
ScriptFunctionCall function(m_injectedScriptObject, "evaluateOn");
- function.appendArgument(objectId->toJSONString());
+ function.appendArgument(objectId);
function.appendArgument(expression);
- makeCall(function, result);
+ makeObjectCall(errorString, function, result);
}
-void InjectedScript::evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
+void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result)
{
ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame");
- function.appendArgument(callFrameId->toJSONString());
+ function.appendArgument(callFrameId);
function.appendArgument(expression);
function.appendArgument(objectGroup);
function.appendArgument(includeCommandLineAPI);
- makeCall(function, result);
+ makeObjectCall(errorString, function, result);
}
-void InjectedScript::getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result)
+void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorArray>* properties)
{
ScriptFunctionCall function(m_injectedScriptObject, "getProperties");
- String objectIdString = objectId->toJSONString();
- function.appendArgument(objectIdString);
+ function.appendArgument(objectId);
function.appendArgument(ignoreHasOwnProperty);
function.appendArgument(abbreviate);
- makeCall(function, result);
+
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ if (!result || result->type() != InspectorValue::TypeArray) {
+ *errorString = "Internal error.";
+ return;
+ }
+ *properties = result->asArray();
}
-Node* InjectedScript::nodeForObjectId(PassRefPtr<InspectorObject> objectId)
+Node* InjectedScript::nodeForObjectId(const String& objectId)
{
if (hasNoValue() || !canAccessInspectedWindow())
return 0;
ScriptFunctionCall function(m_injectedScriptObject, "nodeForObjectId");
- function.appendArgument(objectId->toJSONString());
+ function.appendArgument(objectId);
bool hadException = false;
ScriptValue resultValue = function.call(hadException);
@@ -99,37 +106,35 @@ Node* InjectedScript::nodeForObjectId(PassRefPtr<InspectorObject> objectId)
return InjectedScriptHost::scriptValueAsNode(resultValue);
}
-void InjectedScript::resolveNode(long nodeId, RefPtr<InspectorValue>* result)
-{
- ScriptFunctionCall function(m_injectedScriptObject, "resolveNode");
- function.appendArgument(nodeId);
- makeCall(function, result);
-}
-
-void InjectedScript::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
+void InjectedScript::setPropertyValue(ErrorString* errorString, const String& objectId, const String& propertyName, const String& expression)
{
ScriptFunctionCall function(m_injectedScriptObject, "setPropertyValue");
- function.appendArgument(objectId->toJSONString());
+ function.appendArgument(objectId);
function.appendArgument(propertyName);
function.appendArgument(expression);
- makeCall(function, result);
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ result->asString(errorString);
}
-void InjectedScript::releaseObject(PassRefPtr<InspectorObject> objectId)
+void InjectedScript::releaseObject(const String& objectId)
{
ScriptFunctionCall function(m_injectedScriptObject, "releaseObject");
- function.appendArgument(objectId->toJSONString());
+ function.appendArgument(objectId);
RefPtr<InspectorValue> result;
makeCall(function, &result);
}
#if ENABLE(JAVASCRIPT_DEBUGGER)
-PassRefPtr<InspectorValue> InjectedScript::callFrames()
+PassRefPtr<InspectorArray> InjectedScript::callFrames()
{
ASSERT(!hasNoValue());
ScriptFunctionCall function(m_injectedScriptObject, "callFrames");
ScriptValue callFramesValue = function.call();
- return callFramesValue.toInspectorValue(m_injectedScriptObject.scriptState());
+ RefPtr<InspectorValue> result = callFramesValue.toInspectorValue(m_injectedScriptObject.scriptState());
+ if (result->type() == InspectorValue::TypeArray)
+ return result->asArray();
+ return InspectorArray::create();
}
#endif
@@ -150,9 +155,9 @@ PassRefPtr<InspectorObject> InjectedScript::wrapObject(ScriptValue value, const
return r.toInspectorValue(m_injectedScriptObject.scriptState())->asObject();
}
-PassRefPtr<InspectorObject> InjectedScript::wrapNode(Node* node, const String& groupName)
+PassRefPtr<InspectorObject> InjectedScript::wrapNode(Node* node)
{
- return wrapObject(nodeAsScriptValue(node), groupName);
+ return wrapObject(nodeAsScriptValue(node), "");
}
void InjectedScript::inspectNode(Node* node)
@@ -174,7 +179,7 @@ void InjectedScript::releaseObjectGroup(const String& objectGroup)
bool InjectedScript::canAccessInspectedWindow()
{
- return InjectedScriptHost::canAccessInspectedWindow(m_injectedScriptObject.scriptState());
+ return InjectedScriptManager::canAccessInspectedWindow(m_injectedScriptObject.scriptState());
}
void InjectedScript::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValue>* result)
@@ -191,7 +196,23 @@ void InjectedScript::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValu
if (!hadException)
*result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
else
- *result = InspectorValue::null();
+ *result = InspectorString::create("Exception while making a call.");
+}
+
+void InjectedScript::makeObjectCall(ErrorString* errorString, ScriptFunctionCall& function, RefPtr<InspectorObject>* objectResult)
+{
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ if (result && result->type() == InspectorValue::TypeString) {
+ result->asString(errorString);
+ return;
+ }
+
+ if (!result || result->type() != InspectorValue::TypeObject) {
+ *errorString = "Internal error.";
+ return;
+ }
+ *objectResult = result->asObject();
}
ScriptValue InjectedScript::nodeAsScriptValue(Node* node)
diff --git a/Source/WebCore/inspector/InjectedScript.h b/Source/WebCore/inspector/InjectedScript.h
index 33d5411..e165e9c 100644
--- a/Source/WebCore/inspector/InjectedScript.h
+++ b/Source/WebCore/inspector/InjectedScript.h
@@ -31,7 +31,7 @@
#ifndef InjectedScript_h
#define InjectedScript_h
-#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
#include "ScriptObject.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
@@ -40,10 +40,14 @@
namespace WebCore {
+class InspectorArray;
+class InspectorObject;
class InspectorValue;
class Node;
class ScriptFunctionCall;
+typedef String ErrorString;
+
class InjectedScript {
public:
InjectedScript() { }
@@ -51,31 +55,31 @@ public:
bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
- void evaluate(const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
- void evaluateOn(PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result);
- void evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
- void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
- Node* nodeForObjectId(PassRefPtr<InspectorObject> objectId);
- void resolveNode(long nodeId, RefPtr<InspectorValue>* result);
- void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
- void releaseObject(PassRefPtr<InspectorObject> objectId);
-
+ void evaluate(ErrorString*, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result);
+ void evaluateOn(ErrorString*, const String& objectId, const String& expression, RefPtr<InspectorObject>* result);
+ void evaluateOnCallFrame(ErrorString*, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result);
+ void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorArray>* result);
+ Node* nodeForObjectId(const String& objectId);
+ void setPropertyValue(ErrorString*, const String& objectId, const String& propertyName, const String& expression);
+ void releaseObject(const String& objectId);
+
#if ENABLE(JAVASCRIPT_DEBUGGER)
- PassRefPtr<InspectorValue> callFrames();
+ PassRefPtr<InspectorArray> callFrames();
#endif
PassRefPtr<InspectorObject> wrapObject(ScriptValue, const String& groupName);
- PassRefPtr<InspectorObject> wrapNode(Node*, const String& groupName);
+ PassRefPtr<InspectorObject> wrapNode(Node*);
void inspectNode(Node*);
void releaseObjectGroup(const String&);
ScriptState* scriptState() const { return m_injectedScriptObject.scriptState(); }
private:
- friend InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState*);
+ friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*);
explicit InjectedScript(ScriptObject);
bool canAccessInspectedWindow();
void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result);
+ void makeObjectCall(ErrorString*, ScriptFunctionCall&, RefPtr<InspectorObject>* result);
ScriptValue nodeAsScriptValue(Node*);
ScriptObject m_injectedScriptObject;
diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp
index ad4df45..a0bafdf 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.cpp
+++ b/Source/WebCore/inspector/InjectedScriptHost.cpp
@@ -38,7 +38,6 @@
#include "FrameLoader.h"
#include "HTMLFrameOwnerElement.h"
#include "InjectedScript.h"
-#include "InjectedScriptSource.h"
#include "InspectorAgent.h"
#include "InspectorClient.h"
#include "InspectorConsoleAgent.h"
@@ -69,29 +68,40 @@ using namespace std;
namespace WebCore {
-InjectedScriptHost::InjectedScriptHost(InspectorAgent* inspectorAgent)
- : m_inspectorAgent(inspectorAgent)
- , m_nextInjectedScriptId(1)
- , m_lastWorkerId(1 << 31) // Distinguish ids of fake workers from real ones, to minimize the chances they overlap.
+PassRefPtr<InjectedScriptHost> InjectedScriptHost::create()
{
+ return adoptRef(new InjectedScriptHost());
}
-InjectedScriptHost::~InjectedScriptHost()
+InjectedScriptHost::InjectedScriptHost()
+ : m_inspectorAgent(0)
+ , m_consoleAgent(0)
+#if ENABLE(DATABASE)
+ , m_databaseAgent(0)
+#endif
+#if ENABLE(DOM_STORAGE)
+ , m_domStorageAgent(0)
+#endif
+ , m_frontend(0)
+ , m_lastWorkerId(1 << 31) // Distinguish ids of fake workers from real ones, to minimize the chances they overlap.
{
}
-void InjectedScriptHost::inspectImpl(PassRefPtr<InspectorValue> objectId, PassRefPtr<InspectorValue> hints)
+InjectedScriptHost::~InjectedScriptHost()
{
- if (InspectorFrontend* fe = frontend())
- fe->inspector()->inspect(objectId->asObject(), hints->asObject());
}
-void InjectedScriptHost::clearConsoleMessages()
+void InjectedScriptHost::disconnect()
{
- if (m_inspectorAgent) {
- ErrorString error;
- m_inspectorAgent->consoleAgent()->clearConsoleMessages(&error);
- }
+ m_inspectorAgent = 0;
+ m_consoleAgent = 0;
+#if ENABLE(DATABASE)
+ m_databaseAgent = 0;
+#endif
+#if ENABLE(DOM_STORAGE)
+ m_domStorageAgent = 0;
+#endif
+ m_frontend = 0;
}
void InjectedScriptHost::addInspectedNode(Node* node)
@@ -106,12 +116,26 @@ void InjectedScriptHost::clearInspectedNodes()
m_inspectedNodes.clear();
}
+void InjectedScriptHost::inspectImpl(PassRefPtr<InspectorValue> object, PassRefPtr<InspectorValue> hints)
+{
+ if (m_frontend)
+ m_frontend->inspector()->inspect(object->asObject(), hints->asObject());
+}
+
+void InjectedScriptHost::clearConsoleMessages()
+{
+ if (m_consoleAgent) {
+ ErrorString error;
+ m_consoleAgent->clearConsoleMessages(&error);
+ }
+}
+
void InjectedScriptHost::copyText(const String& text)
{
Pasteboard::generalPasteboard()->writePlainText(text);
}
-Node* InjectedScriptHost::inspectedNode(unsigned long num)
+Node* InjectedScriptHost::inspectedNode(unsigned int num)
{
if (num < m_inspectedNodes.size())
return m_inspectedNodes[num].get();
@@ -119,81 +143,23 @@ Node* InjectedScriptHost::inspectedNode(unsigned long num)
}
#if ENABLE(DATABASE)
-long InjectedScriptHost::databaseIdImpl(Database* database)
+int InjectedScriptHost::databaseIdImpl(Database* database)
{
- if (m_inspectorAgent && m_inspectorAgent->databaseAgent())
- return m_inspectorAgent->databaseAgent()->databaseId(database);
+ if (m_databaseAgent)
+ return m_databaseAgent->databaseId(database);
return 0;
}
#endif
#if ENABLE(DOM_STORAGE)
-long InjectedScriptHost::storageIdImpl(Storage* storage)
+int InjectedScriptHost::storageIdImpl(Storage* storage)
{
- if (m_inspectorAgent && m_inspectorAgent->domStorageAgent())
- return m_inspectorAgent->domStorageAgent()->storageId(storage);
+ if (m_domStorageAgent)
+ return m_domStorageAgent->storageId(storage);
return 0;
}
#endif
-InjectedScript InjectedScriptHost::injectedScriptForId(long id)
-{
- return m_idToInjectedScript.get(id);
-}
-
-InjectedScript InjectedScriptHost::injectedScriptForObjectId(InspectorObject* objectId)
-{
- long injectedScriptId = 0;
- bool success = objectId->getNumber("injectedScriptId", &injectedScriptId);
- if (success)
- return injectedScriptForId(injectedScriptId);
- return InjectedScript();
-}
-
-InjectedScript InjectedScriptHost::injectedScriptForMainFrame()
-{
- return injectedScriptFor(mainWorldScriptState(m_inspectorAgent->inspectedPage()->mainFrame()));
-}
-
-void InjectedScriptHost::discardInjectedScripts()
-{
- IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end();
- for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != end; ++it)
- discardInjectedScript(it->second.scriptState());
- m_idToInjectedScript.clear();
-}
-
-void InjectedScriptHost::releaseObjectGroup(long injectedScriptId, const String& objectGroup)
-{
- if (injectedScriptId) {
- InjectedScript injectedScript = m_idToInjectedScript.get(injectedScriptId);
- if (!injectedScript.hasNoValue())
- injectedScript.releaseObjectGroup(objectGroup);
- } else {
- // Iterate over all injected scripts if injectedScriptId is not specified.
- for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it)
- it->second.releaseObjectGroup(objectGroup);
- }
-}
-
-InspectorFrontend* InjectedScriptHost::frontend()
-{
- if (!m_inspectorAgent)
- return 0;
- return m_inspectorAgent->frontend();
-}
-
-String InjectedScriptHost::injectedScriptSource()
-{
- return String(reinterpret_cast<char*>(InjectedScriptSource_js), sizeof(InjectedScriptSource_js));
-}
-
-pair<long, ScriptObject> InjectedScriptHost::injectScript(const String& source, ScriptState* scriptState)
-{
- long id = m_nextInjectedScriptId++;
- return std::make_pair(id, createInjectedScript(source, scriptState, id));
-}
-
#if ENABLE(WORKERS)
long InjectedScriptHost::nextWorkerId()
{
@@ -203,13 +169,13 @@ long InjectedScriptHost::nextWorkerId()
void InjectedScriptHost::didCreateWorker(long id, const String& url, bool isSharedWorker)
{
if (m_inspectorAgent)
- m_inspectorAgent->didCreateWorker(id, url, isSharedWorker);
+ m_inspectorAgent->didCreateWorker(static_cast<int>(id), url, isSharedWorker);
}
void InjectedScriptHost::didDestroyWorker(long id)
{
if (m_inspectorAgent)
- m_inspectorAgent->didDestroyWorker(id);
+ m_inspectorAgent->didDestroyWorker(static_cast<int>(id));
}
#endif // ENABLE(WORKERS)
diff --git a/Source/WebCore/inspector/InjectedScriptHost.h b/Source/WebCore/inspector/InjectedScriptHost.h
index cdb1e64..89a5031 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.h
+++ b/Source/WebCore/inspector/InjectedScriptHost.h
@@ -43,6 +43,11 @@ namespace WebCore {
class Database;
class InjectedScript;
+class InspectorAgent;
+class InspectorConsoleAgent;
+class InspectorDOMStorageAgent;
+class InspectorDatabaseAgent;
+class InspectorDebuggerAgent;
class InspectorFrontend;
class InspectorObject;
class Node;
@@ -53,62 +58,80 @@ class Storage;
class InjectedScriptHost : public RefCounted<InjectedScriptHost>
{
public:
- static PassRefPtr<InjectedScriptHost> create(InspectorAgent* inspectorAgent)
+ static PassRefPtr<InjectedScriptHost> create();
+ ~InjectedScriptHost();
+
+ void init(InspectorAgent* inspectorAgent
+ , InspectorConsoleAgent* consoleAgent
+#if ENABLE(DATABASE)
+ , InspectorDatabaseAgent* databaseAgent
+#endif
+#if ENABLE(DOM_STORAGE)
+ , InspectorDOMStorageAgent* domStorageAgent
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ , InspectorDebuggerAgent* debuggerAgent
+#endif
+ )
{
- return adoptRef(new InjectedScriptHost(inspectorAgent));
+ m_inspectorAgent = inspectorAgent;
+ m_consoleAgent = consoleAgent;
+#if ENABLE(DATABASE)
+ m_databaseAgent = databaseAgent;
+#endif
+#if ENABLE(DOM_STORAGE)
+ m_domStorageAgent = domStorageAgent;
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ m_debuggerAgent = debuggerAgent;
+#endif
}
+ void setFrontend(InspectorFrontend* frontend) { m_frontend = frontend; }
+ void clearFrontend() { m_frontend = 0; }
static Node* scriptValueAsNode(ScriptValue);
static ScriptValue nodeAsScriptValue(ScriptState*, Node*);
- ~InjectedScriptHost();
-
- InspectorAgent* inspectorAgent() { return m_inspectorAgent; }
- void disconnectController() { m_inspectorAgent = 0; }
-
- void inspectImpl(PassRefPtr<InspectorValue> objectId, PassRefPtr<InspectorValue> hints);
- void clearConsoleMessages();
+ void disconnect();
void addInspectedNode(Node*);
void clearInspectedNodes();
+ void inspectImpl(PassRefPtr<InspectorValue> objectToInspect, PassRefPtr<InspectorValue> hints);
+ void clearConsoleMessages();
void copyText(const String& text);
- Node* inspectedNode(unsigned long num);
-
+ Node* inspectedNode(unsigned int num);
#if ENABLE(DATABASE)
- long databaseIdImpl(Database*);
+ int databaseIdImpl(Database*);
#endif
#if ENABLE(DOM_STORAGE)
- long storageIdImpl(Storage*);
+ int storageIdImpl(Storage*);
#endif
#if ENABLE(WORKERS)
long nextWorkerId();
void didCreateWorker(long id, const String& url, bool isSharedWorker);
void didDestroyWorker(long id);
#endif
-
- pair<long, ScriptObject> injectScript(const String& source, ScriptState*);
- InjectedScript injectedScriptFor(ScriptState*);
- InjectedScript injectedScriptForId(long);
- InjectedScript injectedScriptForObjectId(InspectorObject* objectId);
- InjectedScript injectedScriptForMainFrame();
- void discardInjectedScripts();
- void releaseObjectGroup(long injectedScriptId, const String& objectGroup);
-
- static bool canAccessInspectedWindow(ScriptState*);
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ InspectorDebuggerAgent* debuggerAgent() { return m_debuggerAgent; }
+#endif
private:
- InjectedScriptHost(InspectorAgent*);
- InspectorFrontend* frontend();
- String injectedScriptSource();
- ScriptObject createInjectedScript(const String& source, ScriptState* scriptState, long id);
- void discardInjectedScript(ScriptState*);
+ InjectedScriptHost();
InspectorAgent* m_inspectorAgent;
- long m_nextInjectedScriptId;
+ InspectorConsoleAgent* m_consoleAgent;
+#if ENABLE(DATABASE)
+ InspectorDatabaseAgent* m_databaseAgent;
+#endif
+#if ENABLE(DOM_STORAGE)
+ InspectorDOMStorageAgent* m_domStorageAgent;
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ InspectorDebuggerAgent* m_debuggerAgent;
+#endif
+ InspectorFrontend* m_frontend;
long m_lastWorkerId;
- typedef HashMap<long, InjectedScript> IdToInjectedScriptMap;
- IdToInjectedScriptMap m_idToInjectedScript;
Vector<RefPtr<Node> > m_inspectedNodes;
};
diff --git a/Source/WebCore/inspector/InjectedScriptHost.idl b/Source/WebCore/inspector/InjectedScriptHost.idl
index 0d5c500..fc60813 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.idl
+++ b/Source/WebCore/inspector/InjectedScriptHost.idl
@@ -36,12 +36,12 @@ module core {
void copyText(in DOMString text);
[Custom] void inspect(in DOMObject objectId, in DOMObject hints);
- [Custom] DOMObject inspectedNode(in unsigned long num);
+ [Custom] DOMObject inspectedNode(in int num);
[Custom] DOMObject internalConstructorName(in DOMObject object);
[Custom] DOMObject currentCallFrame();
- [Custom] long databaseId(in DOMObject database);
- [Custom] long storageId(in DOMObject storage);
+ [Custom] int databaseId(in DOMObject database);
+ [Custom] int storageId(in DOMObject storage);
#if defined(ENABLE_WORKERS) && ENABLE_WORKERS
void didCreateWorker(in long id, in DOMString url, in boolean isFakeWorker);
diff --git a/Source/WebCore/inspector/InjectedScriptManager.cpp b/Source/WebCore/inspector/InjectedScriptManager.cpp
new file mode 100644
index 0000000..5c21802
--- /dev/null
+++ b/Source/WebCore/inspector/InjectedScriptManager.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ * Copyright (C) 2010-2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InjectedScriptManager.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "InjectedScript.h"
+#include "InjectedScriptHost.h"
+#include "InjectedScriptSource.h"
+#include "InspectorValues.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/StdLibExtras.h>
+
+using namespace std;
+
+namespace WebCore {
+
+PassOwnPtr<InjectedScriptManager> InjectedScriptManager::create()
+{
+ return adoptPtr(new InjectedScriptManager());
+}
+
+InjectedScriptManager::InjectedScriptManager()
+ : m_nextInjectedScriptId(1)
+ , m_injectedScriptHost(InjectedScriptHost::create())
+{
+}
+
+InjectedScriptManager::~InjectedScriptManager()
+{
+}
+
+void InjectedScriptManager::disconnect()
+{
+ m_injectedScriptHost->disconnect();
+ m_injectedScriptHost.clear();
+}
+
+InjectedScriptHost* InjectedScriptManager::injectedScriptHost()
+{
+ return m_injectedScriptHost.get();
+}
+
+InjectedScript InjectedScriptManager::injectedScriptForId(long id)
+{
+ return m_idToInjectedScript.get(id);
+}
+
+InjectedScript InjectedScriptManager::injectedScriptForObjectId(const String& objectId)
+{
+ RefPtr<InspectorValue> parsedObjectId = InspectorValue::parseJSON(objectId);
+ if (parsedObjectId && parsedObjectId->type() == InspectorValue::TypeObject) {
+ long injectedScriptId = 0;
+ bool success = parsedObjectId->asObject()->getNumber("injectedScriptId", &injectedScriptId);
+ if (success)
+ return injectedScriptForId(injectedScriptId);
+ }
+ return InjectedScript();
+}
+
+void InjectedScriptManager::discardInjectedScripts()
+{
+ IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end();
+ for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != end; ++it)
+ discardInjectedScript(it->second.scriptState());
+ m_idToInjectedScript.clear();
+}
+
+void InjectedScriptManager::releaseObjectGroup(const String& objectGroup)
+{
+ for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it)
+ it->second.releaseObjectGroup(objectGroup);
+}
+
+String InjectedScriptManager::injectedScriptSource()
+{
+ return String(reinterpret_cast<const char*>(InjectedScriptSource_js), sizeof(InjectedScriptSource_js));
+}
+
+pair<long, ScriptObject> InjectedScriptManager::injectScript(const String& source, ScriptState* scriptState)
+{
+ long id = m_nextInjectedScriptId++;
+ return std::make_pair(id, createInjectedScript(source, scriptState, id));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/InjectedScriptManager.h b/Source/WebCore/inspector/InjectedScriptManager.h
new file mode 100644
index 0000000..2896e8f
--- /dev/null
+++ b/Source/WebCore/inspector/InjectedScriptManager.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InjectedScriptManager_h
+#define InjectedScriptManager_h
+
+#include "PlatformString.h"
+#include "ScriptState.h"
+
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+class InjectedScript;
+class InjectedScriptHost;
+class InspectorObject;
+class ScriptObject;
+
+class InjectedScriptManager {
+ WTF_MAKE_NONCOPYABLE(InjectedScriptManager);
+public:
+ static PassOwnPtr<InjectedScriptManager> create();
+ ~InjectedScriptManager();
+
+ void disconnect();
+
+ InjectedScriptHost* injectedScriptHost();
+
+ pair<long, ScriptObject> injectScript(const String& source, ScriptState*);
+ InjectedScript injectedScriptFor(ScriptState*);
+ InjectedScript injectedScriptForId(long);
+ InjectedScript injectedScriptForObjectId(const String& objectId);
+ void discardInjectedScripts();
+ void releaseObjectGroup(const String& objectGroup);
+
+ static bool canAccessInspectedWindow(ScriptState*);
+
+private:
+ InjectedScriptManager();
+
+ String injectedScriptSource();
+ ScriptObject createInjectedScript(const String& source, ScriptState*, long id);
+ void discardInjectedScript(ScriptState*);
+
+ long m_nextInjectedScriptId;
+ typedef HashMap<long, InjectedScript> IdToInjectedScriptMap;
+ IdToInjectedScriptMap m_idToInjectedScript;
+ RefPtr<InjectedScriptHost> m_injectedScriptHost;
+};
+
+} // namespace WebCore
+
+#endif // !defined(InjectedScriptManager_h)
diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js
index 9c662e8..f499a17 100644
--- a/Source/WebCore/inspector/InjectedScriptSource.js
+++ b/Source/WebCore/inspector/InjectedScriptSource.js
@@ -46,6 +46,7 @@ var InjectedScript = function()
{
this._lastBoundObjectId = 1;
this._idToWrappedObject = {};
+ this._idToObjectGroupName = {};
this._objectGroups = {};
}
@@ -95,8 +96,7 @@ InjectedScript.prototype = {
if (typeof object === "object" || typeof object === "function" || this._isHTMLAllCollection(object)) {
var id = this._lastBoundObjectId++;
this._idToWrappedObject[id] = object;
- var objectId = { injectedScriptId: injectedScriptId, id: id };
-
+ var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + "}";
if (objectGroupName) {
var group = this._objectGroups[objectGroupName];
if (!group) {
@@ -104,7 +104,7 @@ InjectedScript.prototype = {
this._objectGroups[objectGroupName] = group;
}
group.push(id);
- objectId.groupName = objectGroupName;
+ this._idToObjectGroupName[id] = objectGroupName;
}
}
return InjectedScript.RemoteObject.fromObject(object, objectId, abbreviate);
@@ -124,7 +124,7 @@ InjectedScript.prototype = {
if (!group)
return;
for (var i = 0; i < group.length; i++)
- delete this._idToWrappedObject[group[i]];
+ this._releaseObject(group[i]);
delete this._objectGroups[objectGroupName];
},
@@ -143,6 +143,7 @@ InjectedScript.prototype = {
{
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
+ var objectGroupName = this._idToObjectGroupName[parsedObjectId.id];
if (!this._isDefined(object))
return false;
@@ -161,7 +162,7 @@ InjectedScript.prototype = {
var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
if (!isGetter) {
try {
- property.value = this._wrapObject(object[propertyName], parsedObjectId.groupName, abbreviate);
+ property.value = this._wrapObject(object[propertyName], objectGroupName, abbreviate);
} catch(e) {
property.value = new InjectedScript.RemoteObject.fromException(e);
}
@@ -180,12 +181,12 @@ InjectedScript.prototype = {
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
if (!this._isDefined(object))
- return false;
+ return "Object with given id not found";
var expressionLength = expression.length;
if (!expressionLength) {
delete object[propertyName];
- return !(propertyName in object);
+ return propertyName in object ? "Cound not delete property." : undefined;
}
try {
@@ -198,14 +199,12 @@ InjectedScript.prototype = {
var result = inspectedWindow.eval("(" + expression + ")");
// Store the result in the property.
object[propertyName] = result;
- return true;
} catch(e) {
try {
var result = inspectedWindow.eval("\"" + expression.replace(/"/g, "\\\"") + "\"");
object[propertyName] = result;
- return true;
} catch(e) {
- return false;
+ return e.toString();
}
}
},
@@ -213,7 +212,13 @@ InjectedScript.prototype = {
releaseObject: function(objectId)
{
var parsedObjectId = this._parseObjectId(objectId);
- delete this._idToWrappedObject[parsedObjectId.id];
+ this._releaseObject(parsedObjectId.id);
+ },
+
+ _releaseObject: function(id)
+ {
+ delete this._idToWrappedObject[id];
+ delete this._idToObjectGroupName[id];
},
_populatePropertyNames: function(object, resultSet)
@@ -245,7 +250,7 @@ InjectedScript.prototype = {
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
if (!object)
- return false;
+ return "Could not find object with given id";
try {
inspectedWindow.console._objectToEvaluateOn = object;
return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, "(function() {" + expression + "}).call(window.console._objectToEvaluateOn)", parsedObjectId.objectGroup, false, false);
@@ -308,7 +313,7 @@ InjectedScript.prototype = {
{
var callFrame = this._callFrameForId(callFrameId);
if (!callFrame)
- return false;
+ return "Could not find call frame with given id";
return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression, objectGroup, true, injectCommandLineAPI);
},
@@ -336,11 +341,6 @@ InjectedScript.prototype = {
return object;
},
- resolveNode: function(node)
- {
- return this._wrapObject(node);
- },
-
_isDefined: function(object)
{
return object || this._isHTMLAllCollection(object);
@@ -385,10 +385,14 @@ InjectedScript.prototype = {
if (obj instanceof inspectedWindow.RegExp)
return "regexp";
// FireBug's array detection.
- if (isFinite(obj.length) && typeof obj.splice === "function")
- return "array";
- if (isFinite(obj.length) && typeof obj.callee === "function") // arguments.
- return "array";
+ try {
+ if (isFinite(obj.length) && typeof obj.splice === "function")
+ return "array";
+ if (isFinite(obj.length) && typeof obj.callee === "function") // arguments.
+ return "array";
+ } catch (e) {
+ return type;
+ }
if (obj instanceof inspectedWindow.NodeList)
return "array";
if (obj instanceof inspectedWindow.HTMLCollection)
@@ -420,11 +424,9 @@ InjectedScript.prototype = {
className += "[" + obj.length + "]";
return className;
case "string":
- if (!abbreviated)
- return obj;
- if (obj.length > 100)
- return "\"" + obj.substring(0, 100) + "\u2026\"";
- return "\"" + obj + "\"";
+ if (abbreviated && obj.length > 100)
+ return obj.substring(0, 100) + "\u2026";
+ return obj;
case "function":
var objectText = this._toString(obj);
if (abbreviated)
@@ -446,10 +448,12 @@ var injectedScript = new InjectedScript();
InjectedScript.RemoteObject = function(objectId, type, description, hasChildren)
{
- this.objectId = objectId;
+ if (objectId) {
+ this.objectId = objectId;
+ this.hasChildren = hasChildren;
+ }
this.type = type;
this.description = description;
- this.hasChildren = hasChildren;
}
InjectedScript.RemoteObject.fromException = function(e)
@@ -473,7 +477,7 @@ InjectedScript.RemoteObject.fromObject = function(object, objectId, abbreviate)
InjectedScript.CallFrameProxy = function(ordinal, callFrame)
{
- this.id = { ordinal: ordinal, injectedScriptId: injectedScriptId };
+ this.id = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
this.type = callFrame.type;
this.functionName = (this.type === "function" ? callFrame.functionName : "");
this.sourceID = callFrame.sourceID;
diff --git a/Source/WebCore/inspector/Inspector.idl b/Source/WebCore/inspector/Inspector.idl
deleted file mode 100644
index 216d4b1..0000000
--- a/Source/WebCore/inspector/Inspector.idl
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-module core {
- interface [Conditional=INSPECTOR] Inspector {
- void addScriptToEvaluateOnLoad(in String scriptSource);
- void removeAllScriptsToEvaluateOnLoad();
- void reloadPage(in boolean ignoreCache);
- void populateScriptObjects();
-
- void openInInspectedWindow(in String url);
- void setSearchingForNode(in boolean enabled, out boolean newState);
- [event] void frontendReused();
- [event] void bringToFront();
- [event] void disconnectFromBackend();
- [event] void inspectedURLChanged(out String url);
- [event] void domContentEventFired(out double time);
- [event] void loadEventFired(out double time);
- [event] void reset();
- [event] void showPanel(out String panel);
-
- [event] void evaluateForTestInFrontend(out long testCallId, out String script);
- void didEvaluateForTestInFrontend(in long testCallId, in String jsonResult);
-
- void highlightDOMNode(in long nodeId);
- void hideDOMNodeHighlight();
- void highlightFrame(in unsigned long frameId);
- void hideFrameHighlight();
-
- void setUserAgentOverride(in String userAgent);
-
- void getCookies(out Array cookies, out String cookiesString);
- void deleteCookie(in String cookieName, in String domain);
-
- [event] void inspect(out Object objectId, out Object hints);
-
- // FIXME: dispatch on agents.
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
- void enableProfiler();
- void disableProfiler();
- void startProfiling();
- void stopProfiling();
-#endif // ENABLE_JAVASCRIPT_DEBUGGER
- };
-
- interface [Conditional=INSPECTOR] Runtime {
- void evaluate(in String expression, in String objectGroup, in boolean includeCommandLineAPI, out Value result);
- void evaluateOn(in Object objectId, in String expression, out Value result);
- void getProperties(in Object objectId, in boolean ignoreHasOwnProperty, in boolean abbreviate, out Value result);
- void setPropertyValue(in Object objectId, in String propertyName, in String expression, out Value result);
- void releaseObject(in Object objectId);
- void releaseObjectGroup(in long injectedScriptId, in String objectGroup);
- };
-
- interface [Conditional=INSPECTOR] Console {
- void setConsoleMessagesEnabled(in boolean enabled, out boolean newState);
- [event] void addConsoleMessage(out Object messageObj);
- [event] void updateConsoleMessageExpiredCount(out unsigned long count);
- [event] void updateConsoleMessageRepeatCount(out unsigned long count);
- void clearConsoleMessages();
- [event] void consoleMessagesCleared();
- void setMonitoringXHREnabled(in boolean enabled);
- };
-
- interface [Conditional=INSPECTOR] Network {
- void enable(out Object resources);
- void disable();
- void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out boolean success, out String content);
- void setExtraHeaders(in Object headers);
-
- [event] void frameDetachedFromParent(out unsigned long frameId);
- [event] void identifierForInitialRequest(out long identifier, out String url, out Object loader, out Value callStack);
- [event] void willSendRequest(out long identifier, out double time, out Object request, out Object redirectResponse);
- [event] void markResourceAsCached(out long identifier);
- [event] void didReceiveResponse(out long identifier, out double time, out String resourceType, out Object response);
- [event] void didReceiveContentLength(out long identifier, out double time, out long lengthReceived);
- [event] void didFinishLoading(out long identifier, out double finishTime);
- [event] void didFailLoading(out long identifier, out double time, out String localizedDescription);
- [event] void didLoadResourceFromMemoryCache(out double time, out Object resource);
- [event] void setInitialContent(out long identifier, out String sourceString, out String type);
- [event] void didCommitLoadForFrame(out Object frame, out Object loader);
- [event] void didCreateWebSocket(out unsigned long identifier, out String requestURL);
- [event] void willSendWebSocketHandshakeRequest(out unsigned long identifier, out double time, out Object request);
- [event] void didReceiveWebSocketHandshakeResponse(out unsigned long identifier, out double time, out Object response);
- [event] void didCloseWebSocket(out unsigned long identifier, out double time);
- };
-
-#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
- interface [Conditional=INSPECTOR] Database {
- void getDatabaseTableNames(in long databaseId, out Array tableNames);
- void executeSQL(in long databaseId, in String query, out boolean success, out long transactionId);
-
- [event] void addDatabase(out Object database);
- [event] void sqlTransactionSucceeded(out long transactionId, out Value columnNames, out Value values);
- [event] void sqlTransactionFailed(out long transactionId, out Value sqlError);
- };
-#endif
-
-#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE
- interface [Conditional=INSPECTOR] DOMStorage {
- void getDOMStorageEntries(in long storageId, out Array entries);
- void setDOMStorageItem(in long storageId, in String key, in String value, out boolean success);
- void removeDOMStorageItem(in long storageId, in String key, out boolean success);
- [event] void addDOMStorage(out Object storage);
- [event] void updateDOMStorage(out int storageId);
- };
-#endif
-
-#if defined(ENABLE_OFFLINE_WEB_APPLICATIONS) && ENABLE_OFFLINE_WEB_APPLICATIONS
- interface [Conditional=INSPECTOR] ApplicationCache {
- void getApplicationCaches(out Value applicationCaches);
- [event] void updateApplicationCacheStatus(out int status);
- [event] void updateNetworkState(out boolean isNowOnline);
- };
-#endif
-
- interface [Conditional=INSPECTOR] DOM {
- void getDocument(out Object root);
- void getChildNodes(in long nodeId);
- void querySelector(in long nodeId, in String selectors, in boolean documentWide, out long elementId);
- void querySelectorAll(in long nodeId, in String selectors, in boolean documentWide, out Array result);
- void setAttribute(in long elementId, in String name, in String value, out boolean success);
- void removeAttribute(in long elementId, in String name, out boolean success);
- void setTextNodeValue(in long nodeId, in String value, out boolean success);
- void getEventListenersForNode(in long nodeId, out long outNodeId, out Array listenersArray);
- void copyNode(in long nodeId);
- void removeNode(in long nodeId, out long outNodeId);
- void changeTagName(in long nodeId, in String newTagName, out long outNodeId);
- void getOuterHTML(in long nodeId, out String outerHTML);
- void setOuterHTML(in long nodeId, in String outerHTML, out long outNodeId);
- void addInspectedNode(in long nodeId);
- void performSearch(in String query, in boolean runSynchronously);
- void searchCanceled();
- void pushNodeByPathToFrontend(in String path, out long nodeId);
- void resolveNode(in long nodeId, in String objectGroup, out Value result);
- void pushNodeToFrontend(in Object objectId, out long nodeId);
-
- [event] void addNodesToSearchResult(out Array nodeIds);
- [event] void documentUpdated();
- [event] void setChildNodes(out long parentId, out Array nodes);
- [event] void attributesUpdated(out long id, out Array attributes);
- [event] void characterDataModified(out long id, out String newValue);
- [event] void setDetachedRoot(out Object root);
- [event] void childNodeCountUpdated(out long id, out int newValue);
- [event] void childNodeInserted(out long parentId, out long prevId, out Object node);
- [event] void childNodeRemoved(out long parentId, out long id);
- };
-
- interface [Conditional=INSPECTOR] CSS {
- void getStylesForNode(in long nodeId, out Value styles);
- void getComputedStyleForNode(in long nodeId, out Value style);
- void getInlineStyleForNode(in long nodeId, out Value style);
- void getAllStyles(out Array styleSheetIds);
- void getStyleSheet(in String styleSheetId, out Value styleSheet);
- void getStyleSheetText(in String styleSheetId, out String url, out String text);
- void setStyleSheetText(in String styleSheetId, in String text, out boolean success);
- void setPropertyText(in Object styleId, in long propertyIndex, in String text, in boolean overwrite, out Value style);
- void toggleProperty(in Object styleId, in long propertyIndex, in boolean disable, out Value style);
- void setRuleSelector(in Object ruleId, in String selector, out Value rule);
- void addRule(in long contextNodeId, in String selector, out Value rule);
- void getSupportedCSSProperties(out Array cssProperties);
- };
-
- interface [Conditional=INSPECTOR] Timeline {
- void start();
- void stop();
- [event] void timelineProfilerWasStarted();
- [event] void timelineProfilerWasStopped();
- [event] void addRecordToTimeline(out Object record);
- };
-
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
- interface [Conditional=INSPECTOR] Debugger {
- void enable();
- void disable();
- [event] void debuggerWasEnabled();
- [event] void debuggerWasDisabled();
-
- [event] void parsedScriptSource(out String sourceID, out String url, out int lineOffset, out int columnOffset, out int length, out int scriptWorldType);
- [event] void failedToParseScriptSource(out String url, out String data, out int firstLine, out int errorLine, out String errorMessage);
-
- void activateBreakpoints();
- void deactivateBreakpoints();
-
- void setJavaScriptBreakpoint(in String url, in int lineNumber, in int columnNumber, in String condition, in boolean enabled, out String breakpointId, out Array locations);
- void setJavaScriptBreakpointBySourceId(in String sourceId, in int lineNumber, in int columnNumber, in String condition, in boolean enabled, out String breakpointId, out int actualLineNumber, out int actualColumnNumber);
- void removeJavaScriptBreakpoint(in String breakpointId);
- [event] void breakpointResolved(out String breakpointId, out String sourceId, out int lineNumber, out int columnNumber);
- void continueToLocation(in String sourceId, in int lineNumber, in int columnNumber);
-
- void stepOver();
- void stepInto();
- void stepOut();
- void pause();
- [event] void pausedScript(out Object details);
- void resume();
- [event] void resumedScript(); // FIXME: Make this out parameter of resume if possible.
-
- void editScriptSource(in String sourceID, in String newContent, out boolean success, out String result, out Value newCallFrames);
- void getScriptSource(in String sourceID, out String scriptSource);
-
- void setPauseOnExceptionsState(in long pauseOnExceptionsState, out long newState);
-
- void evaluateOnCallFrame(in Object callFrameId, in String expression, in String objectGroup, in boolean includeCommandLineAPI, out Value result);
-
-#if defined(ENABLE_WORKERS) && ENABLE_WORKERS
- [event] void didCreateWorker(out long id, out String url, out boolean isShared);
- [event] void didDestroyWorker(out long id);
-#endif // ENABLE_WORKERS
-
- };
-#endif // ENABLE_JAVASCRIPT_DEBUGGER
-
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
- interface [Conditional=INSPECTOR] BrowserDebugger {
- void setAllBrowserBreakpoints(in Object breakpoints);
- void setDOMBreakpoint(in long nodeId, in long type);
- void removeDOMBreakpoint(in long nodeId, in long type);
- void setEventListenerBreakpoint(in String eventName);
- void removeEventListenerBreakpoint(in String eventName);
- void setXHRBreakpoint(in String url);
- void removeXHRBreakpoint(in String url);
- };
-#endif // ENABLE_JAVASCRIPT_DEBUGGER
-
-#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
- interface [Conditional=INSPECTOR] Profiler {
- [event] void profilerWasEnabled();
- [event] void profilerWasDisabled();
-
- void getProfileHeaders(out Array headers);
- void getProfile(in String type, in unsigned long uid, out Object profile);
- void removeProfile(in String type, in unsigned long uid);
- void clearProfiles();
-
- // FIXME: split into Profiler and HeapProfiler.
- void takeHeapSnapshot(in boolean detailed);
- void getExactHeapSnapshotNodeRetainedSize(in unsigned long uid, in unsigned long nodeId, out long size);
- [event] void addProfileHeader(out Object header);
- [event] void addHeapSnapshotChunk(out unsigned long uid, out String chunk);
- [event] void finishHeapSnapshot(out unsigned long uid);
- [event] void setRecordingProfile(out boolean isProfiling);
- [event] void resetProfiles();
- [event] void reportHeapSnapshotProgress(out int done, out int total);
- };
-#endif // ENABLE_JAVASCRIPT_DEBUGGER
-}
diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json
new file mode 100644
index 0000000..ed5929e
--- /dev/null
+++ b/Source/WebCore/inspector/Inspector.json
@@ -0,0 +1,1445 @@
+[
+ {
+ "domain": "Inspector",
+ "types": [],
+ "commands": [
+ {
+ "name": "didEvaluateForTestInFrontend",
+ "parameters": [
+ { "name": "testCallId", "type": "integer" },
+ { "name": "jsonResult", "type": "string" }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "frontendReused"
+ },
+ {
+ "name": "bringToFront"
+ },
+ {
+ "name": "disconnectFromBackend"
+ },
+ {
+ "name": "reset"
+ },
+ {
+ "name": "showPanel",
+ "parameters": [
+ { "name": "panel", "type": "string" }
+ ]
+ },
+ {
+ "name": "startUserInitiatedDebugging"
+ },
+ {
+ "name": "evaluateForTestInFrontend",
+ "parameters": [
+ { "name": "testCallId", "type": "integer" },
+ { "name": "script", "type": "string" }
+ ]
+ },
+ {
+ "name": "inspect",
+ "parameters": [
+ { "name": "object", "$ref": "RemoteObject" },
+ { "name": "hints", "type": "object" }
+ ]
+ },
+ {
+ "name": "didCreateWorker",
+ "parameters": [
+ { "name": "id", "type": "integer" },
+ { "name": "url", "type": "string" },
+ { "name": "isShared", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "didDestroyWorker",
+ "parameters": [
+ { "name": "id", "type": "integer" }
+ ]
+ }
+ ]
+ },
+ {
+ "domain": "Page",
+ "types": [],
+ "commands": [
+ {
+ "name": "addScriptToEvaluateOnLoad",
+ "parameters": [
+ { "name": "scriptSource", "type": "string" }
+ ]
+ },
+ {
+ "name": "removeAllScriptsToEvaluateOnLoad"
+ },
+ {
+ "name": "reloadPage",
+ "parameters": [
+ { "name": "ignoreCache", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "openInInspectedWindow",
+ "parameters": [
+ { "name": "url", "type": "string" }
+ ]
+ },
+ {
+ "name": "setUserAgentOverride",
+ "parameters": [
+ { "name": "userAgent", "type": "string" }
+ ]
+ },
+ {
+ "name": "getCookies",
+ "returns": [
+ { "name": "cookies", "type": "array", "items": { "$ref" : "Cookie"} },
+ { "name": "cookiesString", "type": "string" }
+ ]
+ },
+ {
+ "name": "deleteCookie",
+ "parameters": [
+ { "name": "cookieName", "type": "string" },
+ { "name": "domain", "type": "string" }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "inspectedURLChanged",
+ "parameters": [
+ { "name": "url", "type": "string" }
+ ]
+ },
+ {
+ "name": "domContentEventFired",
+ "parameters": [
+ { "name": "time", "type": "number" }
+ ]
+ },
+ {
+ "name": "loadEventFired",
+ "parameters": [
+ { "name": "time", "type": "number" }
+ ]
+ }
+ ]
+ },
+ {
+ "domain": "Runtime",
+ "types": [],
+ "commands": [
+ {
+ "name": "evaluate",
+ "parameters": [
+ { "name": "expression", "type": "string" },
+ { "name": "objectGroup", "type": "string" },
+ { "name": "includeCommandLineAPI", "type": "boolean" }
+ ],
+ "returns": [
+ { "name": "result", "$ref": "RuntimeObject" }
+ ]
+ },
+ {
+ "name": "evaluateOn",
+ "parameters": [
+ { "name": "objectId", "type": "string" },
+ { "name": "expression", "type": "string" }
+ ],
+ "returns": [
+ { "name": "result", "$ref": "RuntimeObject" }
+ ]
+ },
+ {
+ "name": "getProperties",
+ "parameters": [
+ { "name": "objectId", "type": "string" },
+ { "name": "ignoreHasOwnProperty", "type": "boolean" },
+ { "name": "abbreviate", "type": "boolean" }
+ ],
+ "returns": [
+ { "name": "result", "type": "array", "items": { "$ref" : "RuntimeProperty"} }
+ ]
+ },
+ {
+ "name": "setPropertyValue",
+ "parameters": [
+ { "name": "objectId", "type": "string" },
+ { "name": "propertyName", "type": "string" },
+ { "name": "expression", "type": "string" }
+ ]
+ },
+ {
+ "name": "releaseObject",
+ "parameters": [
+ { "name": "objectId", "type": "string" }
+ ]
+ },
+ {
+ "name": "releaseObjectGroup",
+ "parameters": [
+ { "name": "objectGroup", "type": "string" }
+ ]
+ }
+ ]
+ },
+ {
+ "domain": "Console",
+ "types": [],
+ "commands": [
+ {
+ "name": "enable",
+ "returns": [
+ { "name": "expiredMessagesCount", "type": "integer" }
+ ]
+ },
+ {
+ "name": "disable"
+ },
+ {
+ "name": "clearConsoleMessages"
+ },
+ {
+ "name": "setMonitoringXHREnabled",
+ "parameters": [
+ { "name": "enabled", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "addInspectedNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer" }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "consoleMessage",
+ "parameters": [
+ { "name": "messageObj", "$ref": "ConsoleMessage" }
+ ]
+ },
+ {
+ "name": "consoleMessageRepeatCountUpdated",
+ "parameters": [
+ { "name": "count", "type": "integer" }
+ ]
+ },
+ {
+ "name": "consoleMessagesCleared"
+ }
+ ]
+ },
+ {
+ "domain": "Network",
+ "description": "Network domain allows tracking network activities of the page. It exposes information about HTTP and WebSocket requests and responses, their headers, bodies, timing, etc. It also allows getting the tree of the Frames on the page along with information about their resources.",
+ "types": [
+ {
+ "id": "ResourceTiming",
+ "type": "object",
+ "description": "Timing information for the request.",
+ "properties": {
+ "requestTime": { "type": "number", "description": "Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime." },
+ "proxyStart": { "type": "number", "description": "Started resolving proxy." },
+ "proxyEnd": { "type": "number", "description": "Finished resolving proxy." },
+ "dnsStart": { "type": "number", "description": "Started DNS address resolve." },
+ "dnsEnd": { "type": "number", "description": "Finished DNS address resolve." },
+ "connectStart": { "type": "number", "description": "Started connecting to the remote host." },
+ "connectEnd": { "type": "number", "description": "Connected to the remote host." },
+ "sslStart": { "type": "number", "description": "Started SSL handshake." },
+ "sslEnd": { "type": "number", "description": "Finished SSL handshake." },
+ "sendStart": { "type": "number", "description": "Started sending request." },
+ "sendEnd": { "type": "number", "description": "Finished sending request." },
+ "receiveHeadersEnd": { "type": "number", "description": "Finished receiving response headers." }
+ }
+ },
+ {
+ "id": "ResourceRequest",
+ "type": "object",
+ "description": "HTTP request data.",
+ "properties": {
+ "url": { "type": "string", "description": "Request URL." },
+ "method": { "type": "string", "description": "HTTP request method." },
+ "headers": { "type": "object", "description": "HTTP request headers." },
+ "postData": { "type": "string", "optional": true, "description": "HTTP POST request data." }
+ }
+ },
+ {
+ "id": "ResourceResponse",
+ "type": "object",
+ "description": "HTTP response data.",
+ "properties": {
+ "status": { "type": "number", "description": "HTTP response status code." },
+ "statusText": { "type": "string", "description": "HTTP response status text." },
+ "headers": { "type": "object", "description": "HTTP response headers." },
+ "mimeType": { "type": "string", "description": "Resource mimeType as determined by the browser." },
+ "requestHeaders": { "type": "object", "optional": true, "description": "Refined HTTP request headers that were actually transmitted over the network." },
+ "connectionReused": { "type": "boolean", "description": "Specifies whether physical connection was actually reused for this request." },
+ "connectionID": { "type": "number", "description": "Physical connection id that was actually used for this request." },
+ "fromDiskCache": { "type": "boolean", "optional": true, "description": "Specifies that the resource was loaded from the disk cache." },
+ "timing": { "$ref": "ResourceTiming", "optional": true, "description": "Timing information for the given request." }
+ }
+ },
+ {
+ "id": "CachedResource",
+ "type": "object",
+ "description": "Information about the cached resource.",
+ "properties": {
+ "url": { "type": "string", "description": "Resource URL." },
+ "type": { "type": "string", "description": "Type of this resource. // FIXME" },
+ "response": { "$ref": "ResourceResponse", "description": "Cached response data." },
+ "bodySize": { "type": "number", "description": "Cached response body size." }
+ }
+ },
+ {
+ "id": "Frame",
+ "type": "object",
+ "description": "Information about the Frame on the page.",
+ "properties": {
+ "id": { "type": "string", "description": "Frame unique identifier." },
+ "parentId": { "type": "string", "description": "Parent frame identifier." },
+ "loaderId": { "type": "string", "description": "Identifier of the loader associated with this frame." },
+ "name": { "type": "string", "optional": true, "description": "Frame's name as specified in the tag." },
+ "url": { "type": "string", "description": "Frame document's URL." }
+ }
+ },
+ {
+ "id": "FrameResourceTree",
+ "type": "object",
+ "description": "Information about the Frame hierarchy along with their cached resources.",
+ "properties": {
+ "frame": { "$ref": "Frame", "description": "Frame information for this tree item." },
+ "childFrames": { "type": "array", "optional": true, "items": { "$ref": "FrameResourceTree" }, "description": "Child frames." },
+ "resources": { "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "url": { "type": "string", "description": "Resource URL." },
+ "type": { "type": "string", "description": "Type of this resource. // FIXME" }
+ }
+ },
+ "description": "Information about frame resources."
+ }
+ }
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables network tracking, network events will now be delivered to the client."
+ },
+ {
+ "name": "disable",
+ "description": "Disables network tracking, prevents network events from being sent to the client."
+ },
+ {
+ "name": "getCachedResources",
+ "description": "Returns present frame / resource tree structure.",
+ "returns": [
+ { "name": "frameTree", "$ref": "FrameResourceTree", "description": "Present frame / resource tree structure." }
+ ]
+ },
+ {
+ "name": "getResourceContent",
+ "description": "Returns content of the given resource.",
+ "parameters": [
+ { "name": "frameId", "type": "string", "description": "Frame id to get resource for." },
+ { "name": "url", "type": "string", "description": "URL of the resource to get content for." },
+ { "name": "base64Encode", "type": "boolean", "optional": true, "description": "Requests that resource content is served as base64." }
+ ],
+ "returns": [
+ { "name": "content", "type": "string", "description": "Resource content." }
+ ]
+ },
+ {
+ "name": "setExtraHeaders",
+ "description": "Allows sending extra HTTP headers with the requests from this page.",
+ "parameters": [
+ { "name": "headers", "type": "object", "description": "Map with extra HTTP headers." }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "frameDetached",
+ "description": "Fired when frame has been detached from its parent.",
+ "parameters": [
+ { "name": "frameId", "type": "string", "description": "If of the frame that has been detached." }
+ ]
+ },
+ {
+ "name": "requestWillBeSent",
+ "description": "Fired when page is about to send HTTP request.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "frameId", "type": "string", "description": "Frame identifier." },
+ { "name": "loaderId", "type": "string", "description": "Loader identifier." },
+ { "name": "documentURL", "type": "string", "description": "URL of the document this resource is loaded for." },
+ { "name": "request", "$ref": "ResourceRequest", "description": "Request data." },
+ { "name": "redirectResponse", "$ref": "ResourceResponse", "description": "Redirect response data." },
+ { "name": "time", "type": "number", "description": "Timestamp." },
+ { "name": "callStack", "type": "array", "items": { "$ref" : "DebuggerStackFrame"}, "description": "JavaScript stack trace upon issuing this request." }
+ ]
+ },
+ {
+ "name": "resourceMarkedAsCached",
+ "description": "Fired when request is known to be served from memory cache.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." }
+ ]
+ },
+ {
+ "name": "responseReceived",
+ "description": "Fired when HTTP response is available.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "time", "type": "number", "description": "Timestamp." },
+ { "name": "resourceType", "type": "string", "description": "Resource type. // FIXME" },
+ { "name": "response", "$ref": "ResourceResponse", "description": "Response data." }
+ ]
+ },
+ {
+ "name": "dataReceived",
+ "description": "Fired when data chunk was received over the network.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "time", "type": "number", "description": "Timestamp." },
+ { "name": "dataLength", "type": "integer", "description": "Data chunk length." },
+ { "name": "lengthReceived", "type": "integer", "description": "Actual bytes received (might be less than dataLength for compressed encodings)." }
+ ]
+ },
+ {
+ "name": "loadingFinished",
+ "description": "Fired when HTTP request has finished loading.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "finishTime", "type": "number", "description": "Timestamp." }
+ ]
+ },
+ {
+ "name": "loadingFailed",
+ "description": "Fired when HTTP request has failed to load.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "time", "type": "number", "description": "Timestamp." },
+ { "name": "errorText", "type": "string", "description": "User friendly error message." }
+ ]
+ },
+ {
+ "name": "resourceLoadedFromMemoryCache",
+ "description": "Fired when HTTP request has been served from memory cache.",
+ "parameters": [
+ { "name": "frameId", "type": "string", "description": "Frame identifier." },
+ { "name": "loaderId", "type": "string", "description": "Loader identifier." },
+ { "name": "documentURL", "type": "string", "description": "URL of the document this resource is loaded for." },
+ { "name": "time", "type": "number", "description": "Timestamp." },
+ { "name": "resource", "$ref": "CachedResource", "description": "Cached resource data." }
+ ]
+ },
+ {
+ "name": "initialContentSet",
+ "description": "Fired for XMLHttpRequests when their content becomes available.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "content", "type": "string", "description": "Resource content." },
+ { "name": "type", "type": "string", "description": "Resource type. // FIXME" }
+ ]
+ },
+ {
+ "name": "frameNavigated",
+ "description": "Fired once navigation of the frame has completed. Frame is now associated with the new loader.",
+ "parameters": [
+ { "name": "frame", "$ref": "Frame", "description": "Frame identifier." },
+ { "name": "loaderId", "type": "string", "description": "Loader identifier." }
+ ]
+ },
+ {
+ "name": "webSocketWillSendHandshakeRequest",
+ "description": "Fired when WebSocket is about to initiate handshake.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "time", "type": "number", "description": "Timestamp." },
+ { "name": "request", "type": "object", "description": "WebSocket request data." }
+ ]
+ },
+ {
+ "name": "webSocketHandshakeResponseReceived",
+ "description": "Fired when WebSocket handshake response becomes available.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "time", "type": "number", "description": "Timestamp." },
+ { "name": "response", "type": "object", "description": "WebSocket response data." }
+ ]
+ },
+ {
+ "name": "webSocketCreated",
+ "description": "Fired upon WebSocket creation.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "url", "type": "string", "description": "WebSocket request URL." }
+ ]
+ },
+ {
+ "name": "webSocketClosed",
+ "description": "Fired when WebSocket is closed.",
+ "parameters": [
+ { "name": "identifier", "type": "integer", "description": "Request identifier." },
+ { "name": "time", "type": "number", "description": "Timestamp." }
+ ]
+ }
+ ]
+ },
+ {
+ "domain": "Database",
+ "types": [],
+ "commands": [
+ {
+ "name": "getDatabaseTableNames",
+ "parameters": [
+ { "name": "databaseId", "type": "integer" }
+ ],
+ "returns": [
+ { "name": "tableNames", "type": "array", "items": { "type": "string" } }
+ ]
+ },
+ {
+ "name": "executeSQL",
+ "parameters": [
+ { "name": "databaseId", "type": "integer" },
+ { "name": "query", "type": "string" }
+ ],
+ "returns": [
+ { "name": "success", "type": "boolean" },
+ { "name": "transactionId", "type": "integer" }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "addDatabase",
+ "parameters": [
+ { "name": "database", "$ref": "DatabaseDatabase" }
+ ]
+ },
+ {
+ "name": "sqlTransactionSucceeded",
+ "parameters": [
+ { "name": "transactionId", "type": "integer" },
+ { "name": "columnNames", "type": "array", "items": { "type": "string" } },
+ { "name": "values", "type": "array", "items": { "type": "string or number" }}
+ ]
+ },
+ {
+ "name": "sqlTransactionFailed",
+ "parameters": [
+ { "name": "transactionId", "type": "integer" },
+ { "name": "sqlError", "$ref": "DatabaseError" }
+ ]
+ }
+ ]
+ },
+ {
+ "domain": "DOMStorage",
+ "types": [],
+ "commands": [
+ {
+ "name": "getDOMStorageEntries",
+ "parameters": [
+ { "name": "storageId", "type": "integer" }
+ ],
+ "returns": [
+ { "name": "entries", "type": "array", "items": { "$ref" : "DOMStorageEntry"} }
+ ]
+ },
+ {
+ "name": "setDOMStorageItem",
+ "parameters": [
+ { "name": "storageId", "type": "integer" },
+ { "name": "key", "type": "string" },
+ { "name": "value", "type": "string" }
+ ],
+ "returns": [
+ { "name": "success", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "removeDOMStorageItem",
+ "parameters": [
+ { "name": "storageId", "type": "integer" },
+ { "name": "key", "type": "string" }
+ ],
+ "returns": [
+ { "name": "success", "type": "boolean" }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "addDOMStorage",
+ "parameters": [
+ { "name": "storage", "$ref": "DOMStorageStorage" }
+ ]
+ },
+ {
+ "name": "updateDOMStorage",
+ "parameters": [
+ { "name": "storageId", "type": "integer" }
+ ]
+ }
+ ]
+ },
+ {
+ "domain": "ApplicationCache",
+ "types": [],
+ "commands": [
+ {
+ "name": "getApplicationCaches",
+ "returns": [
+ { "name": "applicationCaches", "$ref": "AppCache" }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "updateApplicationCacheStatus",
+ "parameters": [
+ { "name": "status", "type": "integer" }
+ ]
+ },
+ {
+ "name": "updateNetworkState",
+ "parameters": [
+ { "name": "isNowOnline", "type": "boolean" }
+ ]
+ }
+ ]
+ },
+ {
+ "domain": "DOM",
+ "description": "This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an <code>id</code>. This <code>id</code> can be used to get additional information on the Node, convert it into the JavaScript object, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client.",
+ "types": [
+ {
+ "id": "DOMNode",
+ "type": "object",
+ "properties": {
+ "id": { "type": "integer", "description": "Node identifier that is passed into the rest of the DOM messages as the <code>nodeId</code>. Backend will only push node with given <code>id</code> once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client." },
+ "nodeType": { "type": "integer", "description": "<code>Node</code>'s nodeType." },
+ "nodeName": { "type": "string", "description": "<code>Node</code>'s nodeName." },
+ "localName": { "type": "string", "description": "<code>Node</code>'s localName." },
+ "nodeValue": { "type": "string", "description": "<code>Node</code>'s nodeValue." },
+ "childNodeCount": { "type": "integer", "optional": true, "description": "Child count for <code>Container</code> nodes." },
+ "children": { "type": "array", "optional": true, "items": { "$ref" : "DOMNode" }, "description": "Child nodes of this node when requested with children." },
+ "attributes": { "type": "array", "optional": true, "items": { "type" : "string" }, "description": "Attributes of the <code>Element</code> node in the form of flat array <code>[name1, value1, name2, value2]</code>." },
+ "documentURL": { "type": "string", "optional": true, "description": "Document URL that <code>Document</code> or <code>FrameOwner</code> node points to." },
+ "publicId": { "type": "string", "optional": true, "description": "<code>DocumentType</code>'s publicId. // FIXME" },
+ "systemId": { "type": "string", "optional": true, "description": "<code>DocumentType</code>'s systemId. // FIXME" },
+ "internalSubset": { "type": "string", "optional": true, "description": "<code>DocumentType</code>'s internalSubset. // FIXME" },
+ "name": { "type": "string", "optional": true, "description": "<code>Attr</code>'s name. // FIXME" },
+ "value": { "type": "string", "optional": true, "description": "<code>Attr</code>'s value. // FIXME" }
+ },
+ "description": "DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type."
+ },
+ {
+ "id": "DOMEventListener",
+ "type": "object",
+ "properties": {
+ "type": { "type": "string", "description": "<code>EventListener</code>'s type." },
+ "useCapture": { "type": "boolean", "description": "<code>EventListener</code>'s useCapture." },
+ "isAttribute": { "type": "boolean", "description": "<code>EventListener</code>'s isAttribute." },
+ "nodeId": { "type": "integer", "description": "Target <code>DOMNode</code> id." },
+ "listenerBody": { "type": "string", "description": "Listener function body." },
+ "sourceName": { "type": "string", "optional" : true, "description": "Handler location source name." },
+ "lineNumber": { "type": "number", "optional" : true, "description": "Handler location line number." }
+ },
+ "description": "DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type."
+ }
+ ],
+ "commands": [
+ {
+ "name": "getDocument",
+ "returns": [
+ { "name": "root", "$ref": "DOMNode", "description": "Resulting node." }
+ ],
+ "description": "Returns the root DOM node to the caller."
+ },
+ {
+ "name": "getChildNodes",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to get children for." }
+ ],
+ "description": "Requests that children of the node with given id are returned to the caller in form of <code>setChildNodes</code> events."
+ },
+ {
+ "name": "querySelector",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to query upon." },
+ { "name": "selectors", "type": "string", "description": "Selector string." },
+ { "name": "documentWide", "type": "boolean", "description": "Set to true to start querying from the node's document." }
+ ],
+ "returns": [
+ { "name": "elementId", "type": "integer", "description": "Query selector result." }
+ ],
+ "description": "Executes <code>querySelector</code> on a given node. Setting <code>documentWide</code> to true starts selecting from the document node."
+ },
+ {
+ "name": "querySelectorAll",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to query upon." },
+ { "name": "selectors", "type": "string", "description": "Selector string." },
+ { "name": "documentWide", "type": "boolean", "description": "Set to true to start querying from the node's document." }
+ ],
+ "returns": [
+ { "name": "nodeIds", "type": "array", "items": { "type": "integer" }, "description": "Query selector result." }
+ ],
+ "description": "Executes <code>querySelectorAll</code> on a given node. Setting <code>documentWide</code> to true starts selecting from the document node."
+ },
+ {
+ "name": "setNodeName",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to set name for." },
+ { "name": "name", "type": "string", "description": "New node's name." }
+ ],
+ "returns": [
+ { "name": "outNodeId", "type": "integer", "description": "New node's id." }
+ ],
+ "description": "Sets node name for a node with given id."
+ },
+ {
+ "name": "setNodeValue",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to set value for." },
+ { "name": "value", "type": "string", "description": "New node's value." }
+ ],
+ "description": "Sets node value for a node with given id."
+ },
+ {
+ "name": "removeNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to remove." }
+ ],
+ "description": "Removes node with given id."
+ },
+ {
+ "name": "setAttribute",
+ "parameters": [
+ { "name": "elementId", "type": "integer", "description": "Id of the element to set attribute for." },
+ { "name": "name", "type": "string", "description": "Attribute name." },
+ { "name": "value", "type": "string", "description": "Attribute value." }
+ ],
+ "description": "Sets attribute for an element with given id."
+ },
+ {
+ "name": "removeAttribute",
+ "parameters": [
+ { "name": "elementId", "type": "integer", "description": "Id of the element to remove attribute from." },
+ { "name": "name", "type": "string", "description": "Name of the attribute to remove." }
+ ],
+ "description": "Removes attribute with given name from an element with given id."
+ },
+ {
+ "name": "getEventListenersForNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to get listeners for." }
+ ],
+ "returns": [
+ { "name": "listenersArray", "type": "array", "items": { "$ref" : "DOMEventListener"}, "description": "Array of relevant listeners." }
+ ],
+ "description": "Returns event listeners relevant to the node."
+ },
+ {
+ "name": "copyNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to copy." }
+ ],
+ "description": "Copies node's HTML markup into the clipboard."
+ },
+ {
+ "name": "getOuterHTML",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to get markup for." }
+ ],
+ "returns": [
+ { "name": "outerHTML", "type": "string", "description": "Outer HTML markup." }
+ ],
+ "description": "Returns node's HTML markup."
+ },
+ {
+ "name": "setOuterHTML",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to set markup for." },
+ { "name": "outerHTML", "type": "string", "description": "Outer HTML markup to set." }
+ ],
+ "returns": [
+ { "name": "outNodeId", "type": "integer", "description": "Setting outer HTML can change node's id." }
+ ],
+ "description": "Sets node HTML markup, returns new node id."
+ },
+ {
+ "name": "performSearch",
+ "parameters": [
+ { "name": "query", "type": "string", "description": "Plain text or query selector or XPath search query." },
+ { "name": "runSynchronously", "type": "boolean", "description": "When set to true, performing search synchronously (can block user interaction)." }
+ ],
+ "description": "Starts asynchronous search for a given string in the DOM tree. Use <code>cancelSearch</code> to stop given asynchronous search task."
+ },
+ {
+ "name": "cancelSearch",
+ "description": "Cancels asynchronous search started with <code>performSearch</code>."
+ },
+ {
+ "name": "pushNodeToFrontend",
+ "parameters": [
+ { "name": "objectId", "type": "string", "description": "JavaScript object id to convert into node." }
+ ],
+ "returns": [
+ { "name": "nodeId", "type": "integer", "description": "Node id for given object." }
+ ],
+ "description": "Requests that the node is sent to the caller given the JavaScript node object reference."
+ },
+ {
+ "name": "setSearchingForNode",
+ "parameters": [
+ { "name": "enabled", "type": "boolean" }
+ ],
+ "returns": [
+ { "name": "newState", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "highlightDOMNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer" }
+ ]
+ },
+ {
+ "name": "hideDOMNodeHighlight"
+ },
+ {
+ "name": "highlightFrame",
+ "parameters": [
+ { "name": "frameId", "type": "string" }
+ ]
+ },
+ {
+ "name": "hideFrameHighlight"
+ },
+
+ {
+ "name": "pushNodeByPathToFrontend",
+ "parameters": [
+ { "name": "path", "type": "string", "description": "Path to node in the proprietary format." }
+ ],
+ "returns": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node for given path." }
+ ],
+ "description": "Requests that the node is sent to the caller given its path. // FIXME, use XPath"
+ },
+ {
+ "name": "resolveNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Id of the node to resolve." }
+ ],
+ "returns": [
+ { "name": "object", "$ref": "Object", "description": "JavaScript object wrapper for given node." }
+ ],
+ "description": "Resolves JavaScript node object for given node id."
+ }
+ ],
+ "events": [
+ {
+ "name": "documentUpdated",
+ "description": "Fired when <code>Document</code> has been totally updated. Node ids are no longer valid."
+ },
+ {
+ "name": "setChildNodes",
+ "parameters": [
+ { "name": "parentId", "type": "integer", "description": "Parent node id to populate with children." },
+ { "name": "nodes", "type": "array", "items": { "$ref" : "DOMNode"}, "description": "Child nodes array." }
+ ],
+ "description": "Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids."
+ },
+ {
+ "name": "attributesUpdated",
+ "parameters": [
+ { "name": "id", "type": "integer", "description": "Id of the node that has changed." },
+ { "name": "attributes", "type": "array", "items": { "$ref" : "DOMAttribute"}, "description": "New attributes value." }
+ ],
+ "description": "Fired when <code>Element</code>'s attributes are updated."
+ },
+ {
+ "name": "characterDataModified",
+ "parameters": [
+ { "name": "id", "type": "integer", "description": "Id of the node that has changed." },
+ { "name": "newValue", "type": "string", "description": "New text value." }
+ ],
+ "description": "Mirrors <code>DOMCharacterDataModified</code> event."
+ },
+ {
+ "name": "childNodeCountUpdated",
+ "parameters": [
+ { "name": "id", "type": "integer", "description": "Id of the node that has changed." },
+ { "name": "newValue", "type": "integer", "description": "New node count." }
+ ],
+ "description": "Fired when <code>Container</code>'s child node count has changed."
+ },
+ {
+ "name": "childNodeInserted",
+ "parameters": [
+ { "name": "parentId", "type": "integer", "description": "Id of the node that has changed." },
+ { "name": "prevId", "type": "integer", "description": "If of the previous siblint." },
+ { "name": "node", "$ref": "DOMNode", "description": "Inserted node data." }
+ ],
+ "description": "Mirrors <code>DOMNodeInserted</code> event."
+ },
+ {
+ "name": "childNodeRemoved",
+ "parameters": [
+ { "name": "parentId", "type": "integer", "description": "Parent id." },
+ { "name": "id", "type": "integer", "description": "Id of the node that has been removed." }
+ ],
+ "description": "Mirrors <code>DOMNodeRemoved</code> event."
+ },
+ {
+ "name": "searchResults",
+ "parameters": [
+ { "name": "nodeIds", "type": "array", "items": { "type": "integer" }, "description": "Ids of the search result nodes." }
+ ],
+ "description": "Pushes search results initiated using <code>performSearch</code> to the client."
+ }
+ ]
+ },
+ {
+ "domain": "CSS",
+ "types": [],
+ "commands": [
+ {
+ "name": "getStylesForNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer" }
+ ],
+ "returns": [
+ { "name": "styles", "$ref": "CSSNodeStyles" }
+ ]
+ },
+ {
+ "name": "getComputedStyleForNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer" }
+ ],
+ "returns": [
+ { "name": "style", "$ref": "CSSComputedStyle" }
+ ]
+ },
+ {
+ "name": "getInlineStyleForNode",
+ "parameters": [
+ { "name": "nodeId", "type": "integer" }
+ ],
+ "returns": [
+ { "name": "style", "$ref": "CSSStyle" }
+ ]
+ },
+ {
+ "name": "getAllStyleSheets",
+ "returns": [
+ { "name": "styleSheetInfos", "type": "array", "items": { "$ref": "CSSStyleSheetInfo" } }
+ ]
+ },
+ {
+ "name": "getStyleSheet",
+ "parameters": [
+ { "name": "styleSheetId", "type": "string" }
+ ],
+ "returns": [
+ { "name": "styleSheet", "$ref": "CSSStyleSheet" }
+ ]
+ },
+ {
+ "name": "getStyleSheetText",
+ "parameters": [
+ { "name": "styleSheetId", "type": "string" }
+ ],
+ "returns": [
+ { "name": "url", "type": "string" },
+ { "name": "text", "type": "string" }
+ ]
+ },
+ {
+ "name": "setStyleSheetText",
+ "parameters": [
+ { "name": "styleSheetId", "type": "string" },
+ { "name": "text", "type": "string" }
+ ],
+ "returns": [
+ { "name": "success", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "setPropertyText",
+ "parameters": [
+ { "name": "styleId", "$ref": "CSSStyleId" },
+ { "name": "propertyIndex", "type": "integer" },
+ { "name": "text", "type": "string" },
+ { "name": "overwrite", "type": "boolean" }
+ ],
+ "returns": [
+ { "name": "style", "$ref": "CSSStyle" }
+ ]
+ },
+ {
+ "name": "toggleProperty",
+ "parameters": [
+ { "name": "styleId", "$ref": "CSSStyleId" },
+ { "name": "propertyIndex", "type": "integer" },
+ { "name": "disable", "type": "boolean" }
+ ],
+ "returns": [
+ { "name": "style", "$ref": "CSSStyle" }
+ ]
+ },
+ {
+ "name": "setRuleSelector",
+ "parameters": [
+ { "name": "ruleId", "$ref": "CSSRuleId" },
+ { "name": "selector", "type": "string" }
+ ],
+ "returns": [
+ { "name": "rule", "$ref": "CSSRule" }
+ ]
+ },
+ {
+ "name": "addRule",
+ "parameters": [
+ { "name": "contextNodeId", "type": "integer" },
+ { "name": "selector", "type": "string" }
+ ],
+ "returns": [
+ { "name": "rule", "$ref": "CSSRule" }
+ ]
+ },
+ {
+ "name": "getSupportedCSSProperties",
+ "returns": [
+ { "name": "cssProperties", "type": "array", "items": { "type": "string" } }
+ ]
+ }
+ ]
+ },
+ {
+ "domain": "Timeline",
+ "description": "Timeline provides its clients with instrumentation records that are generated during the page runtime. Timeline instrumentation can be started and stopped using corresponding commands. While timeline is started, it is generating timeline event records.",
+ "types": [
+ {
+ "id": "TimelineRecord",
+ "type": "object",
+ "properties": {
+ "type": { "type": "string", "description": "Event type." },
+ "data": { "type": "object", "description": "Event data." },
+ "children": { "type": "array", "optional" : true, "items": { "$ref": "TimelineRecord" }, "description": "Nested records." }
+ },
+ "description": "Timeline record contains information about the recorded activity."
+ }
+ ],
+ "commands": [
+ {
+ "name": "start",
+ "description": "Starts capturing instrumentation events."
+ },
+ {
+ "name": "stop",
+ "description": "Stops capturing instrumentation events."
+ }
+ ],
+ "events": [
+ {
+ "name": "started",
+ "description": "Fired when timeline has been started."
+ },
+ {
+ "name": "stopped",
+ "description": "Fired when timeline has been stopped."
+ },
+ {
+ "name": "eventRecorded",
+ "parameters": [
+ { "name": "record", "$ref": "TimelineRecord", "description": "Timeline record data." }
+ ],
+ "description": "Fired for every instrumentation event while timeline is started."
+ }
+ ]
+ },
+ {
+ "domain": "Debugger",
+ "description": "Debugger domain exposes JavaScript debugging functions. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.",
+ "types": [
+ {
+ "id": "Location",
+ "type": "object",
+ "properties": {
+ "sourceID": { "type": "string", "description": "Script identifier as reported by the <code>scriptParsed</code>" },
+ "lineNumber": { "type": "integer", "description": "Line number in the script." },
+ "columnNumber": { "type": "integer", "description": "Column number in the script." }
+ },
+ "description": "Location in the source code."
+ },
+ {
+ "id": "CallFrame",
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "description": "Call frame identifier" },
+ "type": { "type": "string", "description": "Call frame type. // FIXME" },
+ "functionName": { "type": "string", "description": "Name of the function called on this frame." },
+ "sourceID": { "type": "string", "description": "Script identifier." },
+ "line": { "type": "integer", "description": "Line number in the script." },
+ "column": { "type": "integer", "description": "Column number in the script." },
+ "scopeChain": { "type": "array", "items": { "type": "object" }, "description": "Scope chain for given call frame. // FIXME" }
+ },
+ "description": "Debugger call frame. Array of call frames form call stack."
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables debugger for given page."
+ },
+ {
+ "name": "disable",
+ "description": "Disables debugger for given page."
+ },
+ {
+ "name": "setBreakpointsActive",
+ "parameters": [
+ { "name": "active", "type": "boolean", "description": "New value for breakpoints active state." }
+ ],
+ "description": "Activates / deactivates all breakpoints on the page."
+ },
+ {
+ "name": "setBreakpointByUrl",
+ "parameters": [
+ { "name": "url", "type": "string", "description": "URL of the resource to set breakpoint on." },
+ { "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." },
+ { "name": "columnNumber", "type": "integer", "optional": true, "description": "Offset in the line to set breakpoint at." },
+ { "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." },
+ { "name": "enabled", "type": "boolean", "optional": true, "description": "Determines initial state for the breakpoint." }
+ ],
+ "returns": [
+ { "name": "breakpointId", "type": "string", "description": "Id of the created breakpoint for further manipulations." },
+ { "name": "locations", "type": "array", "items": { "$ref" : "Location"}, "description": "List of the locations this breakpoint resolved into." }
+ ],
+ "description": "Sets JavaScript breakpoint at a given location specified by URL. This breakpoint will survive page reload."
+ },
+ {
+ "name": "setBreakpoint",
+ "parameters": [
+ { "name": "sourceId", "type": "string", "description": "Source ID of the resource to set breakpoint on (as reported by <code>scriptParsed</code>)." },
+ { "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." },
+ { "name": "columnNumber", "type": "integer", "optional": true, "description": "Offset in the line to set breakpoint at." },
+ { "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." },
+ { "name": "enabled", "type": "boolean", "optional": true, "description": "Determines initial state for the breakpoint." }
+ ],
+ "returns": [
+ { "name": "breakpointId", "type": "string", "description": "Id of the created breakpoint for further manipulations." },
+ { "name": "actualLineNumber", "type": "integer", "description": "Line number in the script." },
+ { "name": "actualColumnNumber", "type": "integer", "description": "Column number in the script." }
+ ],
+ "description": "Sets JavaScript breakpoint at a given location."
+ },
+ {
+ "name": "removeBreakpoint",
+ "parameters": [
+ { "name": "breakpointId", "type": "string" }
+ ],
+ "description": "Removes JavaScript breakpoint."
+ },
+ {
+ "name": "continueToLocation",
+ "parameters": [
+ { "name": "sourceId", "type": "string", "description": "Source ID of the resource to continue to (as reported by <code>scriptParsed</code>)." },
+ { "name": "lineNumber", "type": "integer", "description": "Line number to stop at." },
+ { "name": "columnNumber", "type": "integer", "description": "Column number to stop at." }
+ ],
+ "description": "Continues execution until specific location is reached."
+ },
+ {
+ "name": "stepOver",
+ "description": "Steps over the statement."
+ },
+ {
+ "name": "stepInto",
+ "description": "Steps into the statement."
+ },
+ {
+ "name": "stepOut",
+ "description": "Steps out of the function."
+ },
+ {
+ "name": "pause",
+ "description": "Stops on the next JavaScript statement."
+ },
+ {
+ "name": "resume",
+ "description": "Resumes JavaScript execution."
+ },
+ {
+ "name": "editScriptSource",
+ "parameters": [
+ { "name": "sourceID", "type": "string", "description": "Id of the script to edit." },
+ { "name": "newContent", "type": "string", "description": "New content of the script." }
+ ],
+ "returns": [
+ { "name": "result", "type": "string", "description": "New content of the script." },
+ { "name": "stackFrames", "type": "array", "items": { "$ref" : "CallFrame"}, "description": "New stack trace in case editing has happened while VM was stopped." }
+ ],
+ "description": "Edits JavaScript script live."
+ },
+ {
+ "name": "getScriptSource",
+ "parameters": [
+ { "name": "sourceID", "type": "string", "description": "Id of the script to get source for." }
+ ],
+ "returns": [
+ { "name": "scriptSource", "type": "string", "description": "Script source." }
+ ],
+ "description": "Returns source for the script with given ID."
+ },
+ {
+ "name": "setPauseOnExceptionsState",
+ "parameters": [
+ { "name": "pauseOnExceptionsState", "type": "integer", "description": "Pause on exceptions mode. // FIXME, make enumerable." }
+ ],
+ "description": "Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions."
+ },
+ {
+ "name": "evaluateOnCallFrame",
+ "parameters": [
+ { "name": "callFrameId", "type": "string", "description": "Call frame identifier to evaluate on. This identifier is a part of backtrace reported by the <code>pausedScript</code>." },
+ { "name": "expression", "type": "string", "description": "Expression to evaluate." },
+ { "name": "objectGroup", "type": "string", "description": "String object group name to put result into (allows rapid releasing resulting object handles using <code>releaseObjectGroup</code>)." },
+ { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated expression, defaults to false." }
+ ],
+ "returns": [
+ { "name": "result", "$ref": "Object", "description": "Object wrapper for the evaluation result." }
+ ],
+ "description": "Evaluates expression on a given call frame."
+ }
+ ],
+ "events": [
+ {
+ "name": "debuggerWasEnabled",
+ "description": "Fired when debugger gets enabled."
+ },
+ {
+ "name": "debuggerWasDisabled",
+ "description": "Fired when debugger gets disabled."
+ },
+ {
+ "name": "scriptParsed",
+ "parameters": [
+ { "name": "sourceID", "type": "string", "description": "Identifier of the script parsed." },
+ { "name": "url", "type": "string", "description": "URL of the script parsed (if any)." },
+ { "name": "lineOffset", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." },
+ { "name": "columnOffset", "type": "integer", "description": "Column offset of the script within the resource with given URL." },
+ { "name": "length", "type": "integer", "description": "Length of the script" },
+ { "name": "scriptWorldType", "type": "integer", "description": "Script type. // FIXME." }
+ ],
+ "description": "Fired when virtual machine parses script. This even is also fired for all known scripts upon enabling debugger."
+ },
+ {
+ "name": "scriptFailedToParse",
+ "parameters": [
+ { "name": "url", "type": "string", "description": "URL of the script that failed to parse." },
+ { "name": "data", "type": "string", "description": "Source text of the script that failed to parse." },
+ { "name": "firstLine", "type": "integer", "description": "Line offset of the script within the resource." },
+ { "name": "errorLine", "type": "integer", "description": "Line with error." },
+ { "name": "errorMessage", "type": "string", "description": "Parse error message." }
+ ],
+ "description": "Fired when virtual machine fails to parse the script."
+ },
+ {
+ "name": "breakpointResolved",
+ "parameters": [
+ { "name": "breakpointId", "type": "string", "description": "Breakpoint unique identifier." },
+ { "name": "sourceId", "type": "string", "description": "Identifier of the script breakpoint is set in." },
+ { "name": "lineNumber", "type": "integer", "description": "Line number of the statement breakpoint is set on." },
+ { "name": "columnNumber", "type": "integer", "description": "Column offset of the statement breakpoint is set on." }
+ ],
+ "description": "Fired when breakpoint is resolved to an actual script and location."
+ },
+ {
+ "name": "paused",
+ "parameters": [
+ {
+ "name": "details",
+ "type": "object",
+ "properties": {
+ "callFrames": { "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }
+ },
+ "description": "Call stack information."
+ }
+ ],
+ "description": "Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria."
+ },
+ {
+ "name": "resumed",
+ "description": "Fired when the virtual machine resumed execution."
+ }
+ ]
+ },
+ {
+ "domain": "BrowserDebugger",
+ "description": "Browser debugging allows setting breakpoints on particular DOM operations and events. JavaScript execution will stop on these operations as if there was a regular breakpoint set.",
+ "commands": [
+ {
+ "name": "setDOMBreakpoint",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Identifier of the node to set breakpoint on." },
+ { "name": "type", "type": "integer", "description": "Type of the operation to stop upon." }
+ ],
+ "description": "Sets breakpoint on particular operation with DOM. "
+ },
+ {
+ "name": "removeDOMBreakpoint",
+ "parameters": [
+ { "name": "nodeId", "type": "integer", "description": "Identifier of the node to remove breakpoint from." },
+ { "name": "type", "type": "integer", "description": "Type of the breakpoint to remove." }
+ ],
+ "description": "Removes DOM breakpoint that was set using <code>setDOMBreakpoint</code>."
+ },
+ {
+ "name": "setEventListenerBreakpoint",
+ "parameters": [
+ { "name": "eventName", "type": "string", "description": "Event name to stop on (any DOM event will do)." }
+ ],
+ "description": "Sets breakpoint on particular DOM event."
+ },
+ {
+ "name": "removeEventListenerBreakpoint",
+ "parameters": [
+ { "name": "eventName", "type": "string", "description": "Event name." }
+ ],
+ "description": "Removes breakpoint on particular DOM event."
+ },
+ {
+ "name": "setXHRBreakpoint",
+ "parameters": [
+ { "name": "url", "type": "string", "description": "Resource URL substring. All XHRs having this substring in the URL will get stopped upon." }
+ ],
+ "description": "Sets breakpoint on XMLHttpRequest."
+ },
+ {
+ "name": "removeXHRBreakpoint",
+ "parameters": [
+ { "name": "url", "type": "string", "description": "Resource URL substring." }
+ ],
+ "description": "Removes breakpoint from XMLHttpRequest."
+ }
+ ]
+ },
+ {
+ "domain": "Profiler",
+ "types": [],
+ "commands": [
+ {
+ "name": "enable"
+ },
+ {
+ "name": "disable"
+ },
+ {
+ "name": "isEnabled",
+ "returns": [
+ { "name": "state", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "start"
+ },
+ {
+ "name": "stop"
+ },
+ {
+ "name": "getProfileHeaders",
+ "returns": [
+ { "name": "headers", "type": "array", "items": { "$ref" : "ProfileHeader"} }
+ ]
+ },
+ {
+ "name": "getProfile",
+ "parameters": [
+ { "name": "type", "type": "string" },
+ { "name": "uid", "type": "integer" }
+ ],
+ "returns": [
+ { "name": "profile", "$ref": "Profile" }
+ ]
+ },
+ {
+ "name": "removeProfile",
+ "parameters": [
+ { "name": "type", "type": "string" },
+ { "name": "uid", "type": "integer" }
+ ]
+ },
+ {
+ "name": "clearProfiles"
+ },
+ {
+ "name": "takeHeapSnapshot",
+ "parameters": [
+ { "name": "detailed", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "collectGarbage"
+ }
+ ],
+ "events": [
+ {
+ "name": "profilerWasEnabled"
+ },
+ {
+ "name": "profilerWasDisabled"
+ },
+ {
+ "name": "addProfileHeader",
+ "parameters": [
+ { "name": "header", "$ref": "ProfileHeader" }
+ ]
+ },
+ {
+ "name": "addHeapSnapshotChunk",
+ "parameters": [
+ { "name": "uid", "type": "integer" },
+ { "name": "chunk", "type": "string" }
+ ]
+ },
+ {
+ "name": "finishHeapSnapshot",
+ "parameters": [
+ { "name": "uid", "type": "integer" }
+ ]
+ },
+ {
+ "name": "setRecordingProfile",
+ "parameters": [
+ { "name": "isProfiling", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "resetProfiles"
+ },
+ {
+ "name": "reportHeapSnapshotProgress",
+ "parameters": [
+ { "name": "done", "type": "integer" },
+ { "name": "total", "type": "integer" }
+ ]
+ }
+ ]
+ }
+]
diff --git a/Source/WebCore/inspector/InspectorAgent.cpp b/Source/WebCore/inspector/InspectorAgent.cpp
index 15ceba0..beac507 100644
--- a/Source/WebCore/inspector/InspectorAgent.cpp
+++ b/Source/WebCore/inspector/InspectorAgent.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,40 +33,21 @@
#if ENABLE(INSPECTOR)
-#include "CachedResource.h"
-#include "CachedResourceLoader.h"
-#include "Chrome.h"
-#include "Cookie.h"
-#include "CookieJar.h"
-#include "DOMWindow.h"
-#include "DOMWrapperWorld.h"
#include "Document.h"
#include "DocumentLoader.h"
-#include "Element.h"
-#include "FloatConversion.h"
-#include "FloatQuad.h"
-#include "FloatRect.h"
#include "Frame.h"
-#include "FrameLoadRequest.h"
-#include "FrameLoader.h"
-#include "FrameTree.h"
-#include "FrameView.h"
#include "GraphicsContext.h"
-#include "HTMLFrameOwnerElement.h"
-#include "HTTPHeaderMap.h"
-#include "HitTestResult.h"
-#include "InjectedScript.h"
#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
#include "InspectorBrowserDebuggerAgent.h"
#include "InspectorCSSAgent.h"
#include "InspectorClient.h"
#include "InspectorConsoleAgent.h"
#include "InspectorController.h"
#include "InspectorDOMAgent.h"
-#include "InspectorDebuggerAgent.h"
#include "InspectorFrontend.h"
-#include "InspectorFrontendClient.h"
#include "InspectorInstrumentation.h"
+#include "InspectorPageAgent.h"
#include "InspectorProfilerAgent.h"
#include "InspectorResourceAgent.h"
#include "InspectorRuntimeAgent.h"
@@ -74,35 +56,13 @@
#include "InspectorValues.h"
#include "InspectorWorkerResource.h"
#include "InstrumentingAgents.h"
-#include "IntRect.h"
#include "Page.h"
-#include "ProgressTracker.h"
-#include "Range.h"
-#include "RenderInline.h"
+#include "PageDebuggerAgent.h"
#include "ResourceRequest.h"
-#include "ResourceResponse.h"
-#include "ScriptArguments.h"
-#include "ScriptCallStack.h"
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
-#include "ScriptProfile.h"
-#include "ScriptProfiler.h"
-#include "ScriptSourceCode.h"
#include "ScriptState.h"
-#include "SecurityOrigin.h"
#include "Settings.h"
-#include "SharedBuffer.h"
-#include "TextEncoding.h"
-#include "TextIterator.h"
-#include "TextRun.h"
-#include "UserGestureIndicator.h"
-#include "WindowFeatures.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/ListHashSet.h>
-#include <wtf/RefCounted.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/UnusedParam.h>
-#include <wtf/text/StringConcatenate.h>
#if ENABLE(DATABASE)
#include "InspectorDatabaseAgent.h"
@@ -121,25 +81,23 @@ using namespace std;
namespace WebCore {
namespace InspectorAgentState {
-static const char searchingForNode[] = "searchingForNode";
static const char timelineProfilerEnabled[] = "timelineProfilerEnabled";
-static const char userInitiatedProfiling[] = "userInitiatedProfiling";
static const char debuggerEnabled[] = "debuggerEnabled";
-static const char profilerEnabled[] = "profilerEnabled";
}
static const char scriptsPanelName[] = "scripts";
static const char consolePanelName[] = "console";
static const char profilesPanelName[] = "profiles";
-InspectorAgent::InspectorAgent(Page* page, InspectorClient* client)
+InspectorAgent::InspectorAgent(Page* page, InspectorClient* client, InjectedScriptManager* injectedScriptManager)
: m_inspectedPage(page)
, m_client(client)
, m_frontend(0)
, m_instrumentingAgents(new InstrumentingAgents())
- , m_injectedScriptHost(InjectedScriptHost::create(this))
+ , m_injectedScriptManager(injectedScriptManager)
, m_state(new InspectorState(client))
- , m_domAgent(InspectorDOMAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptHost.get()))
+ , m_pageAgent(InspectorPageAgent::create(m_instrumentingAgents.get(), page, injectedScriptManager))
+ , m_domAgent(InspectorDOMAgent::create(m_instrumentingAgents.get(), page, m_client, m_state.get(), injectedScriptManager))
, m_cssAgent(new InspectorCSSAgent(m_instrumentingAgents.get(), m_domAgent.get()))
#if ENABLE(DATABASE)
, m_databaseAgent(InspectorDatabaseAgent::create(m_instrumentingAgents.get()))
@@ -152,25 +110,40 @@ InspectorAgent::InspectorAgent(Page* page, InspectorClient* client)
, m_applicationCacheAgent(new InspectorApplicationCacheAgent(m_instrumentingAgents.get(), page))
#endif
, m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), page, m_state.get()))
- , m_consoleAgent(new InspectorConsoleAgent(m_instrumentingAgents.get(), this, m_state.get(), m_injectedScriptHost.get(), m_domAgent.get()))
+ , m_consoleAgent(new InspectorConsoleAgent(m_instrumentingAgents.get(), this, m_state.get(), injectedScriptManager, m_domAgent.get()))
#if ENABLE(JAVASCRIPT_DEBUGGER)
- , m_debuggerAgent(InspectorDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptHost.get()))
+ , m_debuggerAgent(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, injectedScriptManager))
, m_browserDebuggerAgent(InspectorBrowserDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_domAgent.get(), m_debuggerAgent.get(), this))
- , m_profilerAgent(InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), page))
+ , m_profilerAgent(InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), page, m_state.get()))
#endif
, m_canIssueEvaluateForTestInFrontend(false)
{
ASSERT_ARG(page, page);
ASSERT_ARG(client, client);
InspectorInstrumentation::bindInspectorAgent(m_inspectedPage, this);
+ m_instrumentingAgents->setInspectorAgent(this);
+
+ m_injectedScriptManager->injectedScriptHost()->init(this
+ , m_consoleAgent.get()
+#if ENABLE(DATABASE)
+ , m_databaseAgent.get()
+#endif
+#if ENABLE(DOM_STORAGE)
+ , m_domStorageAgent.get()
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ , m_debuggerAgent.get()
+#endif
+ );
}
InspectorAgent::~InspectorAgent()
{
+ m_instrumentingAgents->setInspectorAgent(0);
+
// These should have been cleared in inspectedPageDestroyed().
ASSERT(!m_client);
ASSERT(!m_inspectedPage);
- ASSERT(!m_highlightedNode);
}
void InspectorAgent::inspectedPageDestroyed()
@@ -180,9 +153,6 @@ void InspectorAgent::inspectedPageDestroyed()
disconnectFrontend();
}
- ErrorString error;
- hideHighlight(&error);
-
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_browserDebuggerAgent.clear();
m_debuggerAgent.clear();
@@ -193,172 +163,36 @@ void InspectorAgent::inspectedPageDestroyed()
m_inspectedPage = 0;
releaseFrontendLifetimeAgents();
- m_injectedScriptHost->disconnectController();
+ m_injectedScriptManager->disconnect();
m_client->inspectorDestroyed();
m_client = 0;
}
-bool InspectorAgent::searchingForNodeInPage() const
-{
- return m_state->getBoolean(InspectorAgentState::searchingForNode);
-}
-
void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStateCookie)
{
m_state->loadFromCookie(inspectorStateCookie);
m_frontend->inspector()->frontendReused();
- m_frontend->inspector()->inspectedURLChanged(inspectedURL().string());
- pushDataCollectedOffline();
+ m_pageAgent->restore();
+ m_domAgent->restore();
m_resourceAgent->restore();
m_timelineAgent->restore();
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->restore();
- restoreProfiler(ProfilerRestoreResetAgent);
- if (m_state->getBoolean(InspectorAgentState::userInitiatedProfiling))
- startUserInitiatedProfiling();
+ m_profilerAgent->restore();
#endif
}
-void InspectorAgent::inspect(Node* node)
-{
- if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)
- node = node->parentNode();
- m_nodeToFocus = node;
-
- if (!m_frontend)
- return;
-
- focusNode();
-}
-
-void InspectorAgent::focusNode()
-{
- if (!enabled())
- return;
-
- ASSERT(m_frontend);
- ASSERT(m_nodeToFocus);
-
- RefPtr<Node> node = m_nodeToFocus.get();
- m_nodeToFocus = 0;
-
- Document* document = node->ownerDocument();
- if (!document)
- return;
- Frame* frame = document->frame();
- if (!frame)
- return;
-
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame));
- if (injectedScript.hasNoValue())
- return;
-
- injectedScript.inspectNode(node.get());
-}
-
-void InspectorAgent::highlight(ErrorString*, Node* node)
-{
- if (!enabled())
- return;
- ASSERT_ARG(node, node);
- m_highlightedNode = node;
- m_client->highlight(node);
-}
-
-void InspectorAgent::highlightDOMNode(ErrorString* error, long nodeId)
-{
- Node* node = 0;
- if (m_domAgent && (node = m_domAgent->nodeForId(nodeId)))
- highlight(error, node);
-}
-
-void InspectorAgent::highlightFrame(ErrorString* error, unsigned long frameId)
-{
- Frame* mainFrame = m_inspectedPage->mainFrame();
- for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext(mainFrame)) {
- if (reinterpret_cast<uintptr_t>(frame) == frameId && frame->ownerElement()) {
- highlight(error, frame->ownerElement());
- return;
- }
- }
-}
-
-void InspectorAgent::hideHighlight(ErrorString*)
-{
- if (!enabled())
- return;
- m_highlightedNode = 0;
- m_client->hideHighlight();
-}
-
-void InspectorAgent::mouseDidMoveOverElement(const HitTestResult& result, unsigned)
-{
- if (!enabled() || !searchingForNodeInPage())
- return;
-
- Node* node = result.innerNode();
- while (node && node->nodeType() == Node::TEXT_NODE)
- node = node->parentNode();
- if (node) {
- ErrorString error;
- highlight(&error, node);
- }
-}
-
-bool InspectorAgent::handleMousePress()
-{
- if (!enabled() || !searchingForNodeInPage())
- return false;
-
- if (m_highlightedNode) {
- RefPtr<Node> node = m_highlightedNode;
- setSearchingForNode(false);
- inspect(node.get());
- }
- return true;
-}
-
void InspectorAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
{
if (world != mainThreadNormalWorld())
return;
- if (enabled()) {
- if (m_frontend && frame == m_inspectedPage->mainFrame())
- m_injectedScriptHost->discardInjectedScripts();
-
- if (m_scriptsToEvaluateOnLoad.size()) {
- ScriptState* scriptState = mainWorldScriptState(frame);
- for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin();
- it != m_scriptsToEvaluateOnLoad.end(); ++it) {
- m_injectedScriptHost->injectScript(*it, scriptState);
- }
- }
- }
-
if (!m_inspectorExtensionAPI.isEmpty())
- m_injectedScriptHost->injectScript(m_inspectorExtensionAPI, mainWorldScriptState(frame));
-}
-
-void InspectorAgent::setSearchingForNode(bool enabled)
-{
- if (searchingForNodeInPage() == enabled)
- return;
- m_state->setBoolean(InspectorAgentState::searchingForNode, enabled);
- if (!enabled) {
- ErrorString error;
- hideHighlight(&error);
- }
-}
-
-void InspectorAgent::setSearchingForNode(ErrorString*, bool enabled, bool* newState)
-{
- *newState = enabled;
- setSearchingForNode(enabled);
+ m_injectedScriptManager->injectScript(m_inspectorExtensionAPI, mainWorldScriptState(frame));
}
void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
@@ -372,13 +206,14 @@ void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
m_applicationCacheAgent->setFrontend(m_frontend);
#endif
+ m_pageAgent->setFrontend(m_frontend);
m_domAgent->setFrontend(m_frontend);
m_consoleAgent->setFrontend(m_frontend);
m_timelineAgent->setFrontend(m_frontend);
m_resourceAgent->setFrontend(m_frontend);
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->setFrontend(m_frontend);
- m_browserDebuggerAgent->setFrontend(m_frontend);
+ m_profilerAgent->setFrontend(m_frontend);
#endif
#if ENABLE(DATABASE)
m_databaseAgent->setFrontend(m_frontend);
@@ -386,8 +221,20 @@ void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
#if ENABLE(DOM_STORAGE)
m_domStorageAgent->setFrontend(m_frontend);
#endif
- // Initialize Web Inspector title.
- m_frontend->inspector()->inspectedURLChanged(inspectedURL().string());
+
+ if (!m_showPanelAfterVisible.isEmpty()) {
+ m_frontend->inspector()->showPanel(m_showPanelAfterVisible);
+ m_showPanelAfterVisible = String();
+ }
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
+ WorkersMap::iterator workersEnd = m_workers.end();
+ for (WorkersMap::iterator it = m_workers.begin(); it != workersEnd; ++it) {
+ InspectorWorkerResource* worker = it->second.get();
+ m_frontend->inspector()->didCreateWorker(worker->id(), worker->url(), worker->isSharedWorker());
+ }
+#endif
+ // Dispatch pending frontend commands
+ issueEvaluateForTestCommands();
}
void InspectorAgent::disconnectFrontend()
@@ -404,19 +251,12 @@ void InspectorAgent::disconnectFrontend()
m_frontend = 0;
- ErrorString error;
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->clearFrontend();
m_browserDebuggerAgent->clearFrontend();
-#endif
- setSearchingForNode(false);
-
- hideHighlight(&error);
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
m_profilerAgent->clearFrontend();
- m_profilerAgent->stopUserInitiatedProfiling(true);
#endif
+
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
m_applicationCacheAgent->clearFrontend();
#endif
@@ -431,14 +271,14 @@ void InspectorAgent::disconnectFrontend()
#if ENABLE(DOM_STORAGE)
m_domStorageAgent->clearFrontend();
#endif
+ m_pageAgent->clearFrontend();
releaseFrontendLifetimeAgents();
- m_userAgentOverride = "";
}
void InspectorAgent::createFrontendLifetimeAgents()
{
- m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptHost.get());
+ m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptManager, m_inspectedPage);
}
void InspectorAgent::releaseFrontendLifetimeAgents()
@@ -446,103 +286,20 @@ void InspectorAgent::releaseFrontendLifetimeAgents()
m_runtimeAgent.clear();
}
-void InspectorAgent::populateScriptObjects(ErrorString*)
-{
- ASSERT(m_frontend);
- if (!m_frontend)
- return;
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (m_profilerAgent->enabled())
- m_frontend->profiler()->profilerWasEnabled();
-#endif
-
- pushDataCollectedOffline();
-
- if (m_nodeToFocus)
- focusNode();
-
- if (!m_showPanelAfterVisible.isEmpty()) {
- m_frontend->inspector()->showPanel(m_showPanelAfterVisible);
- m_showPanelAfterVisible = "";
- }
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- m_debuggerAgent->enableDebuggerAfterShown();
-#endif
- restoreProfiler(ProfilerRestoreNoAction);
-
- // Dispatch pending frontend commands
- issueEvaluateForTestCommands();
-}
-
-void InspectorAgent::pushDataCollectedOffline()
-{
- m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
-
-#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
- WorkersMap::iterator workersEnd = m_workers.end();
- for (WorkersMap::iterator it = m_workers.begin(); it != workersEnd; ++it) {
- InspectorWorkerResource* worker = it->second.get();
- m_frontend->debugger()->didCreateWorker(worker->id(), worker->url(), worker->isSharedWorker());
- }
-#endif
-}
-
-void InspectorAgent::restoreProfiler(ProfilerRestoreAction action)
-{
- ASSERT(m_frontend);
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- m_profilerAgent->setFrontend(m_frontend);
- if (m_state->getBoolean(InspectorAgentState::profilerEnabled)) {
- ErrorString error;
- enableProfiler(&error);
- }
- if (action == ProfilerRestoreResetAgent)
- m_profilerAgent->resetFrontendProfiles();
-#endif
-}
-
-void InspectorAgent::didCommitLoad(DocumentLoader* loader)
+void InspectorAgent::didCommitLoad()
{
- if (m_frontend) {
- m_frontend->inspector()->inspectedURLChanged(loader->url().string());
+ if (m_frontend)
m_frontend->inspector()->reset();
- }
- m_injectedScriptHost->discardInjectedScripts();
+
+ m_injectedScriptManager->discardInjectedScripts();
#if ENABLE(WORKERS)
m_workers.clear();
#endif
}
-void InspectorAgent::domContentLoadedEventFired(DocumentLoader* loader, const KURL& url)
+void InspectorAgent::domContentLoadedEventFired()
{
- if (!enabled() || !isMainResourceLoader(loader, url))
- return;
-
- if (InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent())
- domAgent->mainFrameDOMContentLoaded();
- if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent())
- timelineAgent->didMarkDOMContentEvent();
- if (m_frontend)
- m_frontend->inspector()->domContentEventFired(currentTime());
-}
-
-void InspectorAgent::loadEventFired(DocumentLoader* loader, const KURL& url)
-{
- if (!enabled())
- return;
-
- if (InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent())
- domAgent->loadEventFired(loader->frame()->document());
-
- if (!isMainResourceLoader(loader, url))
- return;
-
- if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent())
- timelineAgent->didMarkLoadEvent();
- if (m_frontend)
- m_frontend->inspector()->loadEventFired(currentTime());
+ m_injectedScriptManager->injectedScriptHost()->clearInspectedNodes();
}
bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl)
@@ -550,17 +307,6 @@ bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& re
return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
}
-void InspectorAgent::setUserAgentOverride(ErrorString*, const String& userAgent)
-{
- m_userAgentOverride = userAgent;
-}
-
-void InspectorAgent::applyUserAgentOverride(String* userAgent) const
-{
- if (!m_userAgentOverride.isEmpty())
- *userAgent = m_userAgentOverride;
-}
-
#if ENABLE(WORKERS)
class PostWorkerNotificationToFrontendTask : public ScriptExecutionContext::Task {
public:
@@ -596,10 +342,10 @@ void InspectorAgent::postWorkerNotificationToFrontend(const InspectorWorkerResou
#if ENABLE(JAVASCRIPT_DEBUGGER)
switch (action) {
case InspectorAgent::WorkerCreated:
- m_frontend->debugger()->didCreateWorker(worker.id(), worker.url(), worker.isSharedWorker());
+ m_frontend->inspector()->didCreateWorker(worker.id(), worker.url(), worker.isSharedWorker());
break;
case InspectorAgent::WorkerDestroyed:
- m_frontend->debugger()->didDestroyWorker(worker.id());
+ m_frontend->inspector()->didDestroyWorker(worker.id());
break;
}
#endif
@@ -630,136 +376,11 @@ void InspectorAgent::didDestroyWorker(intptr_t id)
}
#endif // ENABLE(WORKERS)
-void InspectorAgent::getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
-{
- // If we can get raw cookies.
- ListHashSet<Cookie> rawCookiesList;
-
- // If we can't get raw cookies - fall back to String representation
- String stringCookiesList;
-
- // Return value to getRawCookies should be the same for every call because
- // the return value is platform/network backend specific, and the call will
- // always return the same true/false value.
- bool rawCookiesImplemented = false;
-
- for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
- Document* document = frame->document();
- const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
- CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
- for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
- Vector<Cookie> docCookiesList;
- rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, it->second->url()), docCookiesList);
-
- if (!rawCookiesImplemented) {
- // FIXME: We need duplication checking for the String representation of cookies.
- ExceptionCode ec = 0;
- stringCookiesList += document->cookie(ec);
- // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here
- // because "document" is the document of the main frame of the page.
- ASSERT(!ec);
- } else {
- int cookiesSize = docCookiesList.size();
- for (int i = 0; i < cookiesSize; i++) {
- if (!rawCookiesList.contains(docCookiesList[i]))
- rawCookiesList.add(docCookiesList[i]);
- }
- }
- }
- }
-
- if (rawCookiesImplemented)
- *cookies = buildArrayForCookies(rawCookiesList);
- else
- *cookiesString = stringCookiesList;
-}
-
-PassRefPtr<InspectorArray> InspectorAgent::buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
-{
- RefPtr<InspectorArray> cookies = InspectorArray::create();
-
- ListHashSet<Cookie>::iterator end = cookiesList.end();
- ListHashSet<Cookie>::iterator it = cookiesList.begin();
- for (int i = 0; it != end; ++it, i++)
- cookies->pushObject(buildObjectForCookie(*it));
-
- return cookies;
-}
-
-PassRefPtr<InspectorObject> InspectorAgent::buildObjectForCookie(const Cookie& cookie)
-{
- RefPtr<InspectorObject> value = InspectorObject::create();
- value->setString("name", cookie.name);
- value->setString("value", cookie.value);
- value->setString("domain", cookie.domain);
- value->setString("path", cookie.path);
- value->setNumber("expires", cookie.expires);
- value->setNumber("size", (cookie.name.length() + cookie.value.length()));
- value->setBoolean("httpOnly", cookie.httpOnly);
- value->setBoolean("secure", cookie.secure);
- value->setBoolean("session", cookie.session);
- return value;
-}
-
-void InspectorAgent::deleteCookie(ErrorString*, const String& cookieName, const String& domain)
-{
- for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
- Document* document = frame->document();
- if (document->url().host() != domain)
- continue;
- const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
- CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
- for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it)
- WebCore::deleteCookie(document, KURL(ParsedURLString, it->second->url()), cookieName);
- }
-}
-
#if ENABLE(JAVASCRIPT_DEBUGGER)
-bool InspectorAgent::isRecordingUserInitiatedProfile() const
-{
- return m_profilerAgent->isRecordingUserInitiatedProfile();
-}
-
-void InspectorAgent::startUserInitiatedProfiling()
+void InspectorAgent::showProfilesPanel()
{
- if (!enabled())
- return;
- m_profilerAgent->startUserInitiatedProfiling();
- m_state->setBoolean(InspectorAgentState::userInitiatedProfiling, true);
-}
-
-void InspectorAgent::stopUserInitiatedProfiling()
-{
- m_profilerAgent->stopUserInitiatedProfiling();
- m_state->setBoolean(InspectorAgentState::userInitiatedProfiling, false);
showPanel(profilesPanelName);
}
-
-bool InspectorAgent::profilerEnabled() const
-{
- return enabled() && m_profilerAgent->enabled();
-}
-
-void InspectorAgent::enableProfiler(ErrorString*)
-{
- if (profilerEnabled())
- return;
- m_state->setBoolean(InspectorAgentState::profilerEnabled, true);
- m_profilerAgent->enable(false);
-}
-
-void InspectorAgent::disableProfiler(ErrorString*)
-{
- m_state->setBoolean(InspectorAgentState::profilerEnabled, false);
- m_profilerAgent->disable();
-}
-#endif
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-void InspectorAgent::showScriptsPanel()
-{
- showPanel(scriptsPanelName);
-}
#endif
void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
@@ -780,277 +401,6 @@ void InspectorAgent::didEvaluateForTestInFrontend(ErrorString*, long callId, con
function.call();
}
-static Path quadToPath(const FloatQuad& quad)
-{
- Path quadPath;
- quadPath.moveTo(quad.p1());
- quadPath.addLineTo(quad.p2());
- quadPath.addLineTo(quad.p3());
- quadPath.addLineTo(quad.p4());
- quadPath.closeSubpath();
- return quadPath;
-}
-
-static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, const Color& fillColor)
-{
- static const int outlineThickness = 2;
- static const Color outlineColor(62, 86, 180, 228);
-
- Path quadPath = quadToPath(quad);
-
- // Clip out the quad, then draw with a 2px stroke to get a pixel
- // of outline (because inflating a quad is hard)
- {
- context.save();
- context.clipOut(quadPath);
-
- context.setStrokeThickness(outlineThickness);
- context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
- context.strokePath(quadPath);
-
- context.restore();
- }
-
- // Now do the fill
- context.setFillColor(fillColor, ColorSpaceDeviceRGB);
- context.fillPath(quadPath);
-}
-
-static void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
-{
- context.save();
- Path clipQuadPath = quadToPath(clipQuad);
- context.clipOut(clipQuadPath);
- drawOutlinedQuad(context, quad, fillColor);
- context.restore();
-}
-
-static void drawHighlightForBox(GraphicsContext& context, const FloatQuad& contentQuad, const FloatQuad& paddingQuad, const FloatQuad& borderQuad, const FloatQuad& marginQuad)
-{
- static const Color contentBoxColor(125, 173, 217, 128);
- static const Color paddingBoxColor(125, 173, 217, 160);
- static const Color borderBoxColor(125, 173, 217, 192);
- static const Color marginBoxColor(125, 173, 217, 228);
-
- if (marginQuad != borderQuad)
- drawOutlinedQuadWithClip(context, marginQuad, borderQuad, marginBoxColor);
- if (borderQuad != paddingQuad)
- drawOutlinedQuadWithClip(context, borderQuad, paddingQuad, borderBoxColor);
- if (paddingQuad != contentQuad)
- drawOutlinedQuadWithClip(context, paddingQuad, contentQuad, paddingBoxColor);
-
- drawOutlinedQuad(context, contentQuad, contentBoxColor);
-}
-
-static void drawHighlightForLineBoxesOrSVGRenderer(GraphicsContext& context, const Vector<FloatQuad>& lineBoxQuads)
-{
- static const Color lineBoxColor(125, 173, 217, 128);
-
- for (size_t i = 0; i < lineBoxQuads.size(); ++i)
- drawOutlinedQuad(context, lineBoxQuads[i], lineBoxColor);
-}
-
-static inline void convertFromFrameToMainFrame(Frame* frame, IntRect& rect)
-{
- rect = frame->page()->mainFrame()->view()->windowToContents(frame->view()->contentsToWindow(rect));
-}
-
-static inline IntSize frameToMainFrameOffset(Frame* frame)
-{
- IntPoint mainFramePoint = frame->page()->mainFrame()->view()->windowToContents(frame->view()->contentsToWindow(IntPoint()));
- return mainFramePoint - IntPoint();
-}
-
-void InspectorAgent::drawNodeHighlight(GraphicsContext& context) const
-{
- if (!m_highlightedNode)
- return;
-
- RenderObject* renderer = m_highlightedNode->renderer();
- Frame* containingFrame = m_highlightedNode->document()->frame();
- if (!renderer || !containingFrame)
- return;
-
- IntSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
- IntRect boundingBox = renderer->absoluteBoundingBoxRect(true);
- boundingBox.move(mainFrameOffset);
-
- IntRect titleAnchorBox = boundingBox;
-
- ASSERT(m_inspectedPage);
-
- FrameView* view = m_inspectedPage->mainFrame()->view();
- FloatRect overlayRect = view->visibleContentRect();
- if (!overlayRect.contains(boundingBox) && !boundingBox.contains(enclosingIntRect(overlayRect)))
- overlayRect = view->visibleContentRect();
- context.translate(-overlayRect.x(), -overlayRect.y());
-
- // RenderSVGRoot should be highlighted through the isBox() code path, all other SVG elements should just dump their absoluteQuads().
-#if ENABLE(SVG)
- bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot();
-#else
- bool isSVGRenderer = false;
-#endif
-
- if (renderer->isBox() && !isSVGRenderer) {
- RenderBox* renderBox = toRenderBox(renderer);
-
- IntRect contentBox = renderBox->contentBoxRect();
-
- IntRect paddingBox(contentBox.x() - renderBox->paddingLeft(), contentBox.y() - renderBox->paddingTop(),
- contentBox.width() + renderBox->paddingLeft() + renderBox->paddingRight(), contentBox.height() + renderBox->paddingTop() + renderBox->paddingBottom());
- IntRect borderBox(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
- paddingBox.width() + renderBox->borderLeft() + renderBox->borderRight(), paddingBox.height() + renderBox->borderTop() + renderBox->borderBottom());
- IntRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
- borderBox.width() + renderBox->marginLeft() + renderBox->marginRight(), borderBox.height() + renderBox->marginTop() + renderBox->marginBottom());
-
-
- FloatQuad absContentQuad = renderBox->localToAbsoluteQuad(FloatRect(contentBox));
- FloatQuad absPaddingQuad = renderBox->localToAbsoluteQuad(FloatRect(paddingBox));
- FloatQuad absBorderQuad = renderBox->localToAbsoluteQuad(FloatRect(borderBox));
- FloatQuad absMarginQuad = renderBox->localToAbsoluteQuad(FloatRect(marginBox));
-
- absContentQuad.move(mainFrameOffset);
- absPaddingQuad.move(mainFrameOffset);
- absBorderQuad.move(mainFrameOffset);
- absMarginQuad.move(mainFrameOffset);
-
- titleAnchorBox = absMarginQuad.enclosingBoundingBox();
-
- drawHighlightForBox(context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad);
- } else if (renderer->isRenderInline() || isSVGRenderer) {
- // FIXME: We should show margins/padding/border for inlines.
- Vector<FloatQuad> lineBoxQuads;
- renderer->absoluteQuads(lineBoxQuads);
- for (unsigned i = 0; i < lineBoxQuads.size(); ++i)
- lineBoxQuads[i] += mainFrameOffset;
-
- drawHighlightForLineBoxesOrSVGRenderer(context, lineBoxQuads);
- }
-
- // Draw node title if necessary.
-
- if (!m_highlightedNode->isElementNode())
- return;
-
- WebCore::Settings* settings = containingFrame->settings();
- drawElementTitle(context, boundingBox, titleAnchorBox, overlayRect, settings);
-}
-
-void InspectorAgent::drawElementTitle(GraphicsContext& context, const IntRect& boundingBox, const IntRect& anchorBox, const FloatRect& overlayRect, WebCore::Settings* settings) const
-{
- static const int rectInflatePx = 4;
- static const int fontHeightPx = 12;
- static const int borderWidthPx = 1;
- static const Color tooltipBackgroundColor(255, 255, 194, 255);
- static const Color tooltipBorderColor(Color::black);
- static const Color tooltipFontColor(Color::black);
-
- Element* element = static_cast<Element*>(m_highlightedNode.get());
- bool isXHTML = element->document()->isXHTMLDocument();
- String nodeTitle = isXHTML ? element->nodeName() : element->nodeName().lower();
- const AtomicString& idValue = element->getIdAttribute();
- if (!idValue.isNull() && !idValue.isEmpty()) {
- nodeTitle += "#";
- nodeTitle += idValue;
- }
- if (element->hasClass() && element->isStyledElement()) {
- const SpaceSplitString& classNamesString = static_cast<StyledElement*>(element)->classNames();
- size_t classNameCount = classNamesString.size();
- if (classNameCount) {
- HashSet<AtomicString> usedClassNames;
- for (size_t i = 0; i < classNameCount; ++i) {
- const AtomicString& className = classNamesString[i];
- if (usedClassNames.contains(className))
- continue;
- usedClassNames.add(className);
- nodeTitle += ".";
- nodeTitle += className;
- }
- }
- }
-
- nodeTitle += " [";
- nodeTitle += String::number(boundingBox.width());
- nodeTitle.append(static_cast<UChar>(0x00D7)); // &times;
- nodeTitle += String::number(boundingBox.height());
- nodeTitle += "]";
-
- FontDescription desc;
- FontFamily family;
- family.setFamily(settings->fixedFontFamily());
- desc.setFamily(family);
- desc.setComputedSize(fontHeightPx);
- Font font = Font(desc, 0, 0);
- font.update(0);
-
- TextRun nodeTitleRun(nodeTitle);
- IntPoint titleBasePoint = IntPoint(anchorBox.x(), anchorBox.maxY() - 1);
- titleBasePoint.move(rectInflatePx, rectInflatePx);
- IntRect titleRect = enclosingIntRect(font.selectionRectForText(nodeTitleRun, titleBasePoint, fontHeightPx));
- titleRect.inflate(rectInflatePx);
-
- // The initial offsets needed to compensate for a 1px-thick border stroke (which is not a part of the rectangle).
- int dx = -borderWidthPx;
- int dy = borderWidthPx;
-
- // If the tip sticks beyond the right of overlayRect, right-align the tip with the said boundary.
- if (titleRect.maxX() > overlayRect.maxX())
- dx = overlayRect.maxX() - titleRect.maxX();
-
- // If the tip sticks beyond the left of overlayRect, left-align the tip with the said boundary.
- if (titleRect.x() + dx < overlayRect.x())
- dx = overlayRect.x() - titleRect.x() - borderWidthPx;
-
- // If the tip sticks beyond the bottom of overlayRect, show the tip at top of bounding box.
- if (titleRect.maxY() > overlayRect.maxY()) {
- dy = anchorBox.y() - titleRect.maxY() - borderWidthPx;
- // If the tip still sticks beyond the bottom of overlayRect, bottom-align the tip with the said boundary.
- if (titleRect.maxY() + dy > overlayRect.maxY())
- dy = overlayRect.maxY() - titleRect.maxY();
- }
-
- // If the tip sticks beyond the top of overlayRect, show the tip at top of overlayRect.
- if (titleRect.y() + dy < overlayRect.y())
- dy = overlayRect.y() - titleRect.y() + borderWidthPx;
-
- titleRect.move(dx, dy);
- context.setStrokeColor(tooltipBorderColor, ColorSpaceDeviceRGB);
- context.setStrokeThickness(borderWidthPx);
- context.setFillColor(tooltipBackgroundColor, ColorSpaceDeviceRGB);
- context.drawRect(titleRect);
- context.setFillColor(tooltipFontColor, ColorSpaceDeviceRGB);
- context.drawText(font, nodeTitleRun, IntPoint(titleRect.x() + rectInflatePx, titleRect.y() + font.fontMetrics().height()));
-}
-
-void InspectorAgent::openInInspectedWindow(ErrorString*, const String& url)
-{
- Frame* mainFrame = m_inspectedPage->mainFrame();
-
- FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
-
- bool created;
- WindowFeatures windowFeatures;
- Frame* newFrame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
- if (!newFrame)
- return;
-
- UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
- newFrame->loader()->setOpener(mainFrame);
- newFrame->page()->setOpenedByDOM();
- newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
-}
-
-void InspectorAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& source)
-{
- m_scriptsToEvaluateOnLoad.append(source);
-}
-
-void InspectorAgent::removeAllScriptsToEvaluateOnLoad(ErrorString*)
-{
- m_scriptsToEvaluateOnLoad.clear();
-}
-
void InspectorAgent::setInspectorExtensionAPI(const String& source)
{
m_inspectorExtensionAPI = source;
@@ -1068,11 +418,6 @@ KURL InspectorAgent::inspectedURLWithoutFragment() const
return url;
}
-void InspectorAgent::reloadPage(ErrorString*, bool ignoreCache)
-{
- m_inspectedPage->mainFrame()->loader()->reload(ignoreCache);
-}
-
bool InspectorAgent::enabled() const
{
if (!m_inspectedPage)
diff --git a/Source/WebCore/inspector/InspectorAgent.h b/Source/WebCore/inspector/InspectorAgent.h
index 151dba5..cda9137 100644
--- a/Source/WebCore/inspector/InspectorAgent.h
+++ b/Source/WebCore/inspector/InspectorAgent.h
@@ -31,30 +31,24 @@
#include "CharacterData.h"
#include "Console.h"
-#include "Cookie.h"
#include "Page.h"
#include "PlatformString.h"
#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/ListHashSet.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
namespace WebCore {
-class CachedResource;
class CharacterData;
class Database;
class DOMWrapperWorld;
class Document;
class DocumentLoader;
class FloatRect;
-class GraphicsContext;
class HTTPHeaderMap;
-class HitTestResult;
class InjectedScript;
-class InjectedScriptHost;
+class InjectedScriptManager;
class InspectorArray;
class InspectorBrowserDebuggerAgent;
class InspectorClient;
@@ -68,6 +62,7 @@ class InspectorDebuggerAgent;
class InspectorFrontend;
class InspectorFrontendClient;
class InspectorObject;
+class InspectorPageAgent;
class InspectorProfilerAgent;
class InspectorResourceAgent;
class InspectorRuntimeAgent;
@@ -100,11 +95,10 @@ class InspectorAgent {
WTF_MAKE_NONCOPYABLE(InspectorAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
- InspectorAgent(Page*, InspectorClient*);
+ InspectorAgent(Page*, InspectorClient*, InjectedScriptManager*);
virtual ~InspectorAgent();
InspectorClient* inspectorClient() { return m_client; }
- InjectedScriptHost* injectedScriptHost() { return m_injectedScriptHost.get(); }
void inspectedPageDestroyed();
@@ -113,27 +107,18 @@ public:
Page* inspectedPage() const { return m_inspectedPage; }
KURL inspectedURL() const;
KURL inspectedURLWithoutFragment() const;
- void reloadPage(ErrorString* error, bool ignoreCache);
+ void reloadPage(ErrorString*, bool ignoreCache);
void showConsole();
void restoreInspectorStateFromCookie(const String& inspectorCookie);
- void highlight(ErrorString* error, Node*);
- void hideHighlight(ErrorString* error);
- void inspect(Node*);
- void highlightDOMNode(ErrorString* error, long nodeId);
- void hideDOMNodeHighlight(ErrorString* error) { hideHighlight(error); }
-
- void highlightFrame(ErrorString* error, unsigned long frameId);
- void hideFrameHighlight(ErrorString* error) { hideHighlight(error); }
-
void setFrontend(InspectorFrontend*);
InspectorFrontend* frontend() const { return m_frontend; }
void disconnectFrontend();
InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents.get(); }
- InspectorAgent* inspectorAgent() { return this; }
+ InspectorPageAgent* pageAgent() { return m_pageAgent.get(); }
InspectorConsoleAgent* consoleAgent() { return m_consoleAgent.get(); }
InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); }
InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
@@ -155,19 +140,10 @@ public:
InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
#endif
- bool handleMousePress();
- bool searchingForNodeInPage() const;
- void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
-
void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
- void didCommitLoad(DocumentLoader*);
-
- void getCookies(ErrorString* error, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString);
- void deleteCookie(ErrorString* error, const String& cookieName, const String& domain);
-
- void domContentLoadedEventFired(DocumentLoader*, const KURL&);
- void loadEventFired(DocumentLoader*, const KURL&);
+ void didCommitLoad();
+ void domContentLoadedEventFired();
#if ENABLE(WORKERS)
enum WorkerAction { WorkerCreated, WorkerDestroyed };
@@ -179,28 +155,14 @@ public:
bool hasFrontend() const { return m_frontend; }
- void drawNodeHighlight(GraphicsContext&) const;
- void openInInspectedWindow(ErrorString* error, const String& url);
- void drawElementTitle(GraphicsContext&, const IntRect& boundingBox, const IntRect& anchorBox, const FloatRect& overlayRect, WebCore::Settings*) const;
#if ENABLE(JAVASCRIPT_DEBUGGER)
- bool isRecordingUserInitiatedProfile() const;
- void startProfiling(ErrorString*) { startUserInitiatedProfiling(); }
- void startUserInitiatedProfiling();
- void stopProfiling(ErrorString*) { stopUserInitiatedProfiling(); }
- void stopUserInitiatedProfiling();
- void enableProfiler(ErrorString* error);
- void disableProfiler(ErrorString* error);
- bool profilerEnabled() const;
-
- void showScriptsPanel();
+ void showProfilesPanel();
#endif
// Generic code called from custom implementations.
void evaluateForTestInFrontend(long testCallId, const String& script);
- void addScriptToEvaluateOnLoad(ErrorString* error, const String& source);
- void removeAllScriptsToEvaluateOnLoad(ErrorString* error);
void setInspectorExtensionAPI(const String& source);
InspectorState* state() { return m_state.get(); }
@@ -208,24 +170,12 @@ public:
// InspectorAgent API
void getInspectorState(RefPtr<InspectorObject>* state);
void setMonitoringXHREnabled(bool enabled, bool* newState);
- void populateScriptObjects(ErrorString* error);
// Following are used from InspectorBackend and internally.
- void setSearchingForNode(ErrorString* error, bool enabled, bool* newState);
- void didEvaluateForTestInFrontend(ErrorString* error, long callId, const String& jsonResult);
-
- void setUserAgentOverride(ErrorString* error, const String& userAgent);
- void applyUserAgentOverride(String* userAgent) const;
+ void didEvaluateForTestInFrontend(ErrorString*, long callId, const String& jsonResult);
private:
void showPanel(const String& panel);
- void pushDataCollectedOffline();
- enum ProfilerRestoreAction {
- ProfilerRestoreNoAction = 0,
- ProfilerRestoreResetAgent = 1
- };
- void restoreProfiler(ProfilerRestoreAction);
void unbindAllResources();
- void setSearchingForNode(bool enabled);
void releaseFrontendLifetimeAgents();
void createFrontendLifetimeAgents();
@@ -234,10 +184,6 @@ private:
void toggleRecordButton(bool);
#endif
- PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie&);
- PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>&);
-
- void focusNode();
bool isMainResourceLoader(DocumentLoader*, const KURL& requestUrl);
void issueEvaluateForTestCommands();
@@ -245,8 +191,9 @@ private:
InspectorClient* m_client;
InspectorFrontend* m_frontend;
OwnPtr<InstrumentingAgents> m_instrumentingAgents;
- RefPtr<InjectedScriptHost> m_injectedScriptHost;
+ InjectedScriptManager* m_injectedScriptManager;
OwnPtr<InspectorState> m_state;
+ OwnPtr<InspectorPageAgent> m_pageAgent;
OwnPtr<InspectorDOMAgent> m_domAgent;
OwnPtr<InspectorCSSAgent> m_cssAgent;
@@ -264,8 +211,6 @@ private:
OwnPtr<InspectorApplicationCacheAgent> m_applicationCacheAgent;
#endif
- RefPtr<Node> m_highlightedNode;
- RefPtr<Node> m_nodeToFocus;
RefPtr<InspectorResourceAgent> m_resourceAgent;
OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
@@ -273,14 +218,12 @@ private:
Vector<pair<long, String> > m_pendingEvaluateTestCommands;
String m_showPanelAfterVisible;
- Vector<String> m_scriptsToEvaluateOnLoad;
String m_inspectorExtensionAPI;
#if ENABLE(JAVASCRIPT_DEBUGGER)
OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
OwnPtr<InspectorBrowserDebuggerAgent> m_browserDebuggerAgent;
OwnPtr<InspectorProfilerAgent> m_profilerAgent;
#endif
- String m_userAgentOverride;
#if ENABLE(WORKERS)
typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
WorkersMap m_workers;
diff --git a/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp b/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
index 625f53d..705a640 100644
--- a/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
+++ b/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
@@ -73,7 +73,7 @@ void InspectorApplicationCacheAgent::networkStateChanged()
m_frontend->updateNetworkState(isNowOnline);
}
-void InspectorApplicationCacheAgent::getApplicationCaches(ErrorString*, RefPtr<InspectorValue>* applicationCaches)
+void InspectorApplicationCacheAgent::getApplicationCaches(ErrorString*, RefPtr<InspectorObject>* applicationCaches)
{
DocumentLoader* documentLoader = m_inspectedPage->mainFrame()->loader()->documentLoader();
if (!documentLoader)
diff --git a/Source/WebCore/inspector/InspectorApplicationCacheAgent.h b/Source/WebCore/inspector/InspectorApplicationCacheAgent.h
index 34abf81..04b9533 100644
--- a/Source/WebCore/inspector/InspectorApplicationCacheAgent.h
+++ b/Source/WebCore/inspector/InspectorApplicationCacheAgent.h
@@ -60,7 +60,7 @@ public:
void networkStateChanged();
// From Frontend
- void getApplicationCaches(ErrorString* error, RefPtr<InspectorValue>* applicationCaches);
+ void getApplicationCaches(ErrorString*, RefPtr<InspectorObject>* applicationCaches);
private:
PassRefPtr<InspectorObject> buildObjectForApplicationCache(const ApplicationCacheHost::ResourceInfoList&, const ApplicationCacheHost::CacheInfo&);
diff --git a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp
index 0cba775..1cf2a25 100644
--- a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp
@@ -35,12 +35,13 @@
#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
#include "HTMLElement.h"
+#include "InspectorAgent.h"
#include "InspectorDOMAgent.h"
#include "InspectorDebuggerAgent.h"
#include "InspectorState.h"
#include "InspectorValues.h"
#include "InstrumentingAgents.h"
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
namespace {
@@ -63,7 +64,9 @@ const int domBreakpointDerivedTypeShift = 16;
namespace WebCore {
namespace BrowserDebuggerAgentState {
-static const char browserBreakpoints[] = "browserBreakpoints";
+static const char eventListenerBreakpoints[] = "eventListenerBreakpoints";
+static const char pauseOnAllXHRs[] = "pauseOnAllXHRs";
+static const char xhrBreakpoints[] = "xhrBreakpoints";
}
PassOwnPtr<InspectorBrowserDebuggerAgent> InspectorBrowserDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, InspectorDOMAgent* domAgent, InspectorDebuggerAgent* debuggerAgent, InspectorAgent* inspectorAgent)
@@ -77,7 +80,6 @@ InspectorBrowserDebuggerAgent::InspectorBrowserDebuggerAgent(InstrumentingAgents
, m_domAgent(domAgent)
, m_debuggerAgent(debuggerAgent)
, m_inspectorAgent(inspectorAgent)
- , m_hasXHRBreakpointWithEmptyURL(false)
{
m_debuggerAgent->setListener(this);
}
@@ -105,84 +107,38 @@ void InspectorBrowserDebuggerAgent::disable()
clear();
}
-void InspectorBrowserDebuggerAgent::setFrontend(InspectorFrontend*)
-{
- // Erase sticky breakpoints. If we are restoring from a cookie setFrontend msut be called
- // before the state is loaded from the cookie.
- m_inspectorState->setObject(BrowserDebuggerAgentState::browserBreakpoints, InspectorObject::create());
-}
-
void InspectorBrowserDebuggerAgent::clearFrontend()
{
disable();
}
-void InspectorBrowserDebuggerAgent::setAllBrowserBreakpoints(ErrorString*, PassRefPtr<InspectorObject> breakpoints)
-{
- m_inspectorState->setObject(BrowserDebuggerAgentState::browserBreakpoints, breakpoints);
- // FIXME: remove this call to inspector agent and dependency on the inspector agent.
- inspectedURLChanged(m_inspectorAgent->inspectedURLWithoutFragment());
-}
-
-void InspectorBrowserDebuggerAgent::inspectedURLChanged(const String& url)
+void InspectorBrowserDebuggerAgent::discardBindings()
{
- m_eventListenerBreakpoints.clear();
- m_XHRBreakpoints.clear();
- m_hasXHRBreakpointWithEmptyURL = false;
-
- RefPtr<InspectorObject> allBreakpoints = m_inspectorState->getObject(BrowserDebuggerAgentState::browserBreakpoints);
- RefPtr<InspectorArray> breakpoints = allBreakpoints->getArray(url);
- if (!breakpoints)
- return;
- for (unsigned i = 0; i < breakpoints->length(); ++i)
- restoreStickyBreakpoint(breakpoints->get(i)->asObject());
+ m_domBreakpoints.clear();
}
-void InspectorBrowserDebuggerAgent::restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint)
+void InspectorBrowserDebuggerAgent::setEventListenerBreakpoint(ErrorString* error, const String& eventName)
{
- if (!breakpoint)
- return;
- String type;
- if (!breakpoint->getString("type", &type))
- return;
- bool enabled;
- if (!breakpoint->getBoolean("enabled", &enabled))
+ if (eventName.isEmpty()) {
+ *error = "Event name is empty";
return;
- RefPtr<InspectorObject> condition = breakpoint->getObject("condition");
- if (!condition)
- return;
-
- ErrorString error;
- if (type == eventListenerNativeBreakpointType) {
- if (!enabled)
- return;
- String eventName;
- if (!condition->getString("eventName", &eventName))
- return;
- setEventListenerBreakpoint(&error, eventName);
- } else if (type == xhrNativeBreakpointType) {
- if (!enabled)
- return;
- String url;
- if (!condition->getString("url", &url))
- return;
- setXHRBreakpoint(&error, url);
}
-}
-void InspectorBrowserDebuggerAgent::discardBindings()
-{
- m_domBreakpoints.clear();
+ RefPtr<InspectorObject> eventListenerBreakpoints = m_inspectorState->getObject(BrowserDebuggerAgentState::eventListenerBreakpoints);
+ eventListenerBreakpoints->setBoolean(eventName, true);
+ m_inspectorState->setObject(BrowserDebuggerAgentState::eventListenerBreakpoints, eventListenerBreakpoints);
}
-void InspectorBrowserDebuggerAgent::setEventListenerBreakpoint(ErrorString*, const String& eventName)
+void InspectorBrowserDebuggerAgent::removeEventListenerBreakpoint(ErrorString* error, const String& eventName)
{
- m_eventListenerBreakpoints.add(eventName);
-}
+ if (eventName.isEmpty()) {
+ *error = "Event name is empty";
+ return;
+ }
-void InspectorBrowserDebuggerAgent::removeEventListenerBreakpoint(ErrorString*, const String& eventName)
-{
- m_eventListenerBreakpoints.remove(eventName);
+ RefPtr<InspectorObject> eventListenerBreakpoints = m_inspectorState->getObject(BrowserDebuggerAgentState::eventListenerBreakpoints);
+ eventListenerBreakpoints->remove(eventName);
+ m_inspectorState->setObject(BrowserDebuggerAgentState::eventListenerBreakpoints, eventListenerBreakpoints);
}
void InspectorBrowserDebuggerAgent::didInsertDOMNode(Node* node)
@@ -213,7 +169,7 @@ void InspectorBrowserDebuggerAgent::didRemoveDOMNode(Node* node)
}
}
-void InspectorBrowserDebuggerAgent::setDOMBreakpoint(ErrorString*, long nodeId, long type)
+void InspectorBrowserDebuggerAgent::setDOMBreakpoint(ErrorString*, int nodeId, int type)
{
Node* node = m_domAgent->nodeForId(nodeId);
if (!node)
@@ -227,7 +183,7 @@ void InspectorBrowserDebuggerAgent::setDOMBreakpoint(ErrorString*, long nodeId,
}
}
-void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(ErrorString*, long nodeId, long type)
+void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(ErrorString*, int nodeId, int type)
{
Node* node = m_domAgent->nodeForId(nodeId);
if (!node)
@@ -266,12 +222,13 @@ void InspectorBrowserDebuggerAgent::willRemoveDOMNode(Node* node)
if (!debuggerAgent)
return;
+ Node* parentNode = InspectorDOMAgent::innerParentNode(node);
if (hasBreakpoint(node, NodeRemoved)) {
RefPtr<InspectorObject> eventData = InspectorObject::create();
descriptionForDOMEvent(node, NodeRemoved, false, eventData.get());
eventData->setString("breakpointType", domNativeBreakpointType);
debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release());
- } else if (hasBreakpoint(InspectorDOMAgent::innerParentNode(node), SubtreeModified)) {
+ } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) {
RefPtr<InspectorObject> eventData = InspectorObject::create();
descriptionForDOMEvent(node, SubtreeModified, false, eventData.get());
eventData->setString("breakpointType", domNativeBreakpointType);
@@ -293,7 +250,7 @@ void InspectorBrowserDebuggerAgent::willModifyDOMAttr(Element* element)
}
}
-void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long breakpointType, bool insertion, InspectorObject* description)
+void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, int breakpointType, bool insertion, InspectorObject* description)
{
ASSERT(hasBreakpoint(target, breakpointType));
@@ -301,7 +258,7 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br
if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) {
// For inheritable breakpoint types, target node isn't always the same as the node that owns a breakpoint.
// Target node may be unknown to frontend, so we need to push it first.
- RefPtr<InspectorObject> targetNodeObject = m_domAgent->resolveNode(target, "");
+ RefPtr<InspectorObject> targetNodeObject = m_domAgent->resolveNode(target);
description->setObject("targetNode", targetNodeObject);
// Find breakpoint owner node.
@@ -317,13 +274,13 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br
description->setBoolean("insertion", insertion);
}
- long breakpointOwnerNodeId = m_domAgent->boundNodeId(breakpointOwner);
+ int breakpointOwnerNodeId = m_domAgent->boundNodeId(breakpointOwner);
ASSERT(breakpointOwnerNodeId);
description->setNumber("nodeId", breakpointOwnerNodeId);
description->setNumber("type", breakpointType);
}
-bool InspectorBrowserDebuggerAgent::hasBreakpoint(Node* node, long type)
+bool InspectorBrowserDebuggerAgent::hasBreakpoint(Node* node, int type)
{
uint32_t rootBit = 1 << type;
uint32_t derivedBit = rootBit << domBreakpointDerivedTypeShift;
@@ -354,8 +311,9 @@ void InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded(const String& cat
if (!debuggerAgent)
return;
- String fullEventName = String::format("%s:%s", categoryType.utf8().data(), eventName.utf8().data());
- if (!m_eventListenerBreakpoints.contains(fullEventName))
+ String fullEventName = makeString(categoryType, ":", eventName);
+ RefPtr<InspectorObject> eventListenerBreakpoints = m_inspectorState->getObject(BrowserDebuggerAgentState::eventListenerBreakpoints);
+ if (eventListenerBreakpoints->find(fullEventName) == eventListenerBreakpoints->end())
return;
RefPtr<InspectorObject> eventData = InspectorObject::create();
@@ -369,18 +327,26 @@ void InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded(const String& cat
void InspectorBrowserDebuggerAgent::setXHRBreakpoint(ErrorString*, const String& url)
{
- if (url.isEmpty())
- m_hasXHRBreakpointWithEmptyURL = true;
- else
- m_XHRBreakpoints.add(url);
+ if (url.isEmpty()) {
+ m_inspectorState->setBoolean(BrowserDebuggerAgentState::pauseOnAllXHRs, true);
+ return;
+ }
+
+ RefPtr<InspectorObject> xhrBreakpoints = m_inspectorState->getObject(BrowserDebuggerAgentState::xhrBreakpoints);
+ xhrBreakpoints->setBoolean(url, true);
+ m_inspectorState->setObject(BrowserDebuggerAgentState::xhrBreakpoints, xhrBreakpoints);
}
void InspectorBrowserDebuggerAgent::removeXHRBreakpoint(ErrorString*, const String& url)
{
- if (url.isEmpty())
- m_hasXHRBreakpointWithEmptyURL = false;
- else
- m_XHRBreakpoints.remove(url);
+ if (url.isEmpty()) {
+ m_inspectorState->setBoolean(BrowserDebuggerAgentState::pauseOnAllXHRs, false);
+ return;
+ }
+
+ RefPtr<InspectorObject> xhrBreakpoints = m_inspectorState->getObject(BrowserDebuggerAgentState::xhrBreakpoints);
+ xhrBreakpoints->remove(url);
+ m_inspectorState->setObject(BrowserDebuggerAgentState::xhrBreakpoints, xhrBreakpoints);
}
void InspectorBrowserDebuggerAgent::willSendXMLHttpRequest(const String& url)
@@ -390,12 +356,13 @@ void InspectorBrowserDebuggerAgent::willSendXMLHttpRequest(const String& url)
return;
String breakpointURL;
- if (m_hasXHRBreakpointWithEmptyURL)
+ if (m_inspectorState->getBoolean(BrowserDebuggerAgentState::pauseOnAllXHRs))
breakpointURL = "";
else {
- for (HashSet<String>::iterator it = m_XHRBreakpoints.begin(); it != m_XHRBreakpoints.end(); ++it) {
- if (url.contains(*it)) {
- breakpointURL = *it;
+ RefPtr<InspectorObject> xhrBreakpoints = m_inspectorState->getObject(BrowserDebuggerAgentState::xhrBreakpoints);
+ for (InspectorObject::iterator it = xhrBreakpoints->begin(); it != xhrBreakpoints->end(); ++it) {
+ if (url.contains(it->first)) {
+ breakpointURL = it->first;
break;
}
}
@@ -414,9 +381,6 @@ void InspectorBrowserDebuggerAgent::willSendXMLHttpRequest(const String& url)
void InspectorBrowserDebuggerAgent::clear()
{
m_domBreakpoints.clear();
- m_eventListenerBreakpoints.clear();
- m_XHRBreakpoints.clear();
- m_hasXHRBreakpointWithEmptyURL = false;
}
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h
index 7c0bc8d..add0c05 100644
--- a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h
+++ b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h
@@ -36,10 +36,8 @@
#include "InspectorDebuggerAgent.h"
#include "PlatformString.h"
#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/RefCounted.h>
-#include <wtf/text/StringHash.h>
namespace WebCore {
@@ -62,19 +60,15 @@ public:
virtual ~InspectorBrowserDebuggerAgent();
- void setFrontend(InspectorFrontend*);
void clearFrontend();
- void setAllBrowserBreakpoints(ErrorString* error, PassRefPtr<InspectorObject>);
- void inspectedURLChanged(const String& url);
-
// BrowserDebugger API for InspectorFrontend
- void setXHRBreakpoint(ErrorString* error, const String& url);
- void removeXHRBreakpoint(ErrorString* error, const String& url);
- void setEventListenerBreakpoint(ErrorString* error, const String& eventName);
- void removeEventListenerBreakpoint(ErrorString* error, const String& eventName);
- void setDOMBreakpoint(ErrorString* error, long nodeId, long type);
- void removeDOMBreakpoint(ErrorString* error, long nodeId, long type);
+ void setXHRBreakpoint(ErrorString*, const String& url);
+ void removeXHRBreakpoint(ErrorString*, const String& url);
+ void setEventListenerBreakpoint(ErrorString*, const String& eventName);
+ void removeEventListenerBreakpoint(ErrorString*, const String& eventName);
+ void setDOMBreakpoint(ErrorString*, int nodeId, int type);
+ void removeDOMBreakpoint(ErrorString*, int nodeId, int type);
// InspectorInstrumentation API
void willInsertDOMNode(Node*, Node* parent);
@@ -93,11 +87,9 @@ private:
virtual void debuggerWasDisabled();
void disable();
- void restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint);
-
- void descriptionForDOMEvent(Node* target, long breakpointType, bool insertion, InspectorObject* description);
+ void descriptionForDOMEvent(Node* target, int breakpointType, bool insertion, InspectorObject* description);
void updateSubtreeBreakpoints(Node*, uint32_t rootMask, bool set);
- bool hasBreakpoint(Node*, long type);
+ bool hasBreakpoint(Node*, int type);
void discardBindings();
void clear();
@@ -108,9 +100,6 @@ private:
InspectorDebuggerAgent* m_debuggerAgent;
InspectorAgent* m_inspectorAgent;
HashMap<Node*, uint32_t> m_domBreakpoints;
- HashSet<String> m_eventListenerBreakpoints;
- HashSet<String> m_XHRBreakpoints;
- bool m_hasXHRBreakpointWithEmptyURL;
};
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp
index b96071d..980fcf2 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp
+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp
@@ -104,17 +104,21 @@
// selectorRange: { start: <number>, end: <number> } // Optional - for source-based rules only
// }
//
+// cssStyleSheetInfo = {
+// styleSheetId : <number>
+// sourceURL : <string>
+// title : <string>
+// disabled : <boolean>
+// }
+//
// cssStyleSheet = {
-// styleSheetId : <number>
-// sourceURL : <string>
-// title : <string>
-// disabled : <boolean>
-// rules : [
-// #cssRule,
-// ...
-// #cssRule
-// ]
-// text : <string> // Optional - whenever the text is available for a text-based stylesheet
+// styleSheetId : <number>
+// rules : [
+// #cssRule,
+// ...
+// #cssRule
+// ]
+// text : <string> // Optional - whenever the text is available for a text-based stylesheet
// }
namespace WebCore {
@@ -171,9 +175,9 @@ void InspectorCSSAgent::reset()
m_documentToInspectorStyleSheet.clear();
}
-void InspectorCSSAgent::getStylesForNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::getStylesForNode(ErrorString* errorString, int nodeId, RefPtr<InspectorObject>* result)
{
- Element* element = elementForId(nodeId);
+ Element* element = elementForId(errorString, nodeId);
if (!element)
return;
@@ -191,7 +195,7 @@ void InspectorCSSAgent::getStylesForNode(ErrorString*, long nodeId, RefPtr<Inspe
RefPtr<CSSRuleList> matchedRules = selector->styleRulesForElement(element, false, true);
resultObject->setArray("matchedCSSRules", buildArrayForRuleList(matchedRules.get()));
- resultObject->setObject("styleAttributes", buildObjectForAttributeStyles(element));
+ resultObject->setArray("styleAttributes", buildArrayForAttributeStyles(element));
RefPtr<InspectorArray> pseudoElements = InspectorArray::create();
for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_INTERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) {
@@ -226,9 +230,9 @@ void InspectorCSSAgent::getStylesForNode(ErrorString*, long nodeId, RefPtr<Inspe
*result = resultObject.release();
}
-void InspectorCSSAgent::getInlineStyleForNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* style)
+void InspectorCSSAgent::getInlineStyleForNode(ErrorString* errorString, int nodeId, RefPtr<InspectorObject>* style)
{
- Element* element = elementForId(nodeId);
+ Element* element = elementForId(errorString, nodeId);
if (!element)
return;
@@ -239,9 +243,9 @@ void InspectorCSSAgent::getInlineStyleForNode(ErrorString*, long nodeId, RefPtr<
*style = styleSheet->buildObjectForStyle(element->style());
}
-void InspectorCSSAgent::getComputedStyleForNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* style)
+void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int nodeId, RefPtr<InspectorObject>* style)
{
- Element* element = elementForId(nodeId);
+ Element* element = elementForId(errorString, nodeId);
if (!element)
return;
@@ -250,7 +254,7 @@ void InspectorCSSAgent::getComputedStyleForNode(ErrorString*, long nodeId, RefPt
*style = inspectorStyle->buildObjectForStyle();
}
-void InspectorCSSAgent::getAllStyles(ErrorString*, RefPtr<InspectorArray>* styles)
+void InspectorCSSAgent::getAllStyleSheets(ErrorString*, RefPtr<InspectorArray>* styleInfos)
{
Vector<Document*> documents = m_domAgent->documents();
for (Vector<Document*>::iterator it = documents.begin(); it != documents.end(); ++it) {
@@ -259,33 +263,33 @@ void InspectorCSSAgent::getAllStyles(ErrorString*, RefPtr<InspectorArray>* style
StyleSheet* styleSheet = list->item(i);
if (styleSheet->isCSSStyleSheet()) {
InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(static_cast<CSSStyleSheet*>(styleSheet));
- (*styles)->pushString(inspectorStyleSheet->id());
+ (*styleInfos)->pushObject(inspectorStyleSheet->buildObjectForStyleSheetInfo());
}
}
}
}
-void InspectorCSSAgent::getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<InspectorValue>* styleSheetObject)
+void InspectorCSSAgent::getStyleSheet(ErrorString* errorString, const String& styleSheetId, RefPtr<InspectorObject>* styleSheetObject)
{
- InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(styleSheetId);
+ InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(errorString, styleSheetId);
if (!inspectorStyleSheet)
return;
*styleSheetObject = inspectorStyleSheet->buildObjectForStyleSheet();
}
-void InspectorCSSAgent::getStyleSheetText(ErrorString*, const String& styleSheetId, String* url, String* result)
+void InspectorCSSAgent::getStyleSheetText(ErrorString* errorString, const String& styleSheetId, String* url, String* result)
{
- InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(styleSheetId);
+ InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(errorString, styleSheetId);
if (!inspectorStyleSheet)
return;
*url = inspectorStyleSheet->finalURL();
inspectorStyleSheet->text(result);
}
-void InspectorCSSAgent::setStyleSheetText(ErrorString*, const String& styleSheetId, const String& text, bool* success)
+void InspectorCSSAgent::setStyleSheetText(ErrorString* errorString, const String& styleSheetId, const String& text, bool* success)
{
- InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(styleSheetId);
+ InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(errorString, styleSheetId);
if (!inspectorStyleSheet) {
*success = false;
return;
@@ -296,12 +300,12 @@ void InspectorCSSAgent::setStyleSheetText(ErrorString*, const String& styleSheet
inspectorStyleSheet->reparseStyleSheet(text);
}
-void InspectorCSSAgent::setPropertyText(ErrorString*, const RefPtr<InspectorObject>& fullStyleId, long propertyIndex, const String& text, bool overwrite, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::setPropertyText(ErrorString* errorString, const RefPtr<InspectorObject>& fullStyleId, int propertyIndex, const String& text, bool overwrite, RefPtr<InspectorObject>* result)
{
InspectorCSSId compoundId(fullStyleId);
ASSERT(!compoundId.isEmpty());
- InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(compoundId.styleSheetId());
+ InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(errorString, compoundId.styleSheetId());
if (!inspectorStyleSheet)
return;
@@ -310,12 +314,12 @@ void InspectorCSSAgent::setPropertyText(ErrorString*, const RefPtr<InspectorObje
*result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId));
}
-void InspectorCSSAgent::toggleProperty(ErrorString*, const RefPtr<InspectorObject>& fullStyleId, long propertyIndex, bool disable, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::toggleProperty(ErrorString* errorString, const RefPtr<InspectorObject>& fullStyleId, int propertyIndex, bool disable, RefPtr<InspectorObject>* result)
{
InspectorCSSId compoundId(fullStyleId);
ASSERT(!compoundId.isEmpty());
- InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(compoundId.styleSheetId());
+ InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(errorString, compoundId.styleSheetId());
if (!inspectorStyleSheet)
return;
@@ -324,12 +328,12 @@ void InspectorCSSAgent::toggleProperty(ErrorString*, const RefPtr<InspectorObjec
*result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId));
}
-void InspectorCSSAgent::setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& fullRuleId, const String& selector, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::setRuleSelector(ErrorString* errorString, const RefPtr<InspectorObject>& fullRuleId, const String& selector, RefPtr<InspectorObject>* result)
{
InspectorCSSId compoundId(fullRuleId);
ASSERT(!compoundId.isEmpty());
- InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(compoundId.styleSheetId());
+ InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(errorString, compoundId.styleSheetId());
if (!inspectorStyleSheet)
return;
@@ -340,7 +344,7 @@ void InspectorCSSAgent::setRuleSelector(ErrorString*, const RefPtr<InspectorObje
*result = inspectorStyleSheet->buildObjectForRule(inspectorStyleSheet->ruleForId(compoundId));
}
-void InspectorCSSAgent::addRule(ErrorString*, const long contextNodeId, const String& selector, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::addRule(ErrorString*, const int contextNodeId, const String& selector, RefPtr<InspectorObject>* result)
{
Node* node = m_domAgent->nodeForId(contextNodeId);
if (!node)
@@ -394,10 +398,18 @@ InspectorStyleSheetForInlineStyle* InspectorCSSAgent::asInspectorStyleSheet(Elem
return it->second.get();
}
-Element* InspectorCSSAgent::elementForId(long nodeId)
+Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId)
{
Node* node = m_domAgent->nodeForId(nodeId);
- return (!node || node->nodeType() != Node::ELEMENT_NODE) ? 0 : static_cast<Element*>(node);
+ if (!node) {
+ *errorString = "No node with given id found.";
+ return 0;
+ }
+ if (node->nodeType() != Node::ELEMENT_NODE) {
+ *errorString = "Not an element node.";
+ return 0;
+ }
+ return static_cast<Element*>(node);
}
InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet)
@@ -453,10 +465,14 @@ InspectorStyleSheet* InspectorCSSAgent::viaInspectorStyleSheet(Document* documen
return inspectorStyleSheet.get();
}
-InspectorStyleSheet* InspectorCSSAgent::styleSheetForId(const String& styleSheetId)
+InspectorStyleSheet* InspectorCSSAgent::styleSheetForId(ErrorString* errorString, const String& styleSheetId)
{
IdToInspectorStyleSheet::iterator it = m_idToInspectorStyleSheet.find(styleSheetId);
- return it == m_idToInspectorStyleSheet.end() ? 0 : it->second.get();
+ if (it == m_idToInspectorStyleSheet.end()) {
+ *errorString = "No style sheet with given id found.";
+ return 0;
+ }
+ return it->second.get();
}
String InspectorCSSAgent::detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument)
@@ -496,20 +512,23 @@ PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForRuleList(CSSRuleList*
return result.release();
}
-PassRefPtr<InspectorObject> InspectorCSSAgent::buildObjectForAttributeStyles(Element* element)
+PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForAttributeStyles(Element* element)
{
- RefPtr<InspectorObject> styleAttributes = InspectorObject::create();
+ RefPtr<InspectorArray> attrStyles = InspectorArray::create();
NamedNodeMap* attributes = element->attributes();
for (unsigned i = 0; attributes && i < attributes->length(); ++i) {
Attribute* attribute = attributes->attributeItem(i);
if (attribute->style()) {
+ RefPtr<InspectorObject> attrStyleObject = InspectorObject::create();
String attributeName = attribute->localName();
RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attribute->style(), 0);
- styleAttributes->setObject(attributeName.utf8().data(), inspectorStyle->buildObjectForStyle());
+ attrStyleObject->setString("name", attributeName.utf8().data());
+ attrStyleObject->setObject("style", inspectorStyle->buildObjectForStyle());
+ attrStyles->pushObject(attrStyleObject.release());
}
}
- return styleAttributes;
+ return attrStyles.release();
}
void InspectorCSSAgent::didRemoveDocument(Document* document)
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.h b/Source/WebCore/inspector/InspectorCSSAgent.h
index 4e3f57a..40bc2ab 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.h
+++ b/Source/WebCore/inspector/InspectorCSSAgent.h
@@ -61,18 +61,18 @@ public:
~InspectorCSSAgent();
void reset();
- void getStylesForNode(ErrorString* error, long nodeId, RefPtr<InspectorValue>* result);
- void getInlineStyleForNode(ErrorString* error, long nodeId, RefPtr<InspectorValue>* style);
- void getComputedStyleForNode(ErrorString* error, long nodeId, RefPtr<InspectorValue>* style);
- void getAllStyles(ErrorString* error, RefPtr<InspectorArray>* styles);
- void getStyleSheet(ErrorString* error, const String& styleSheetId, RefPtr<InspectorValue>* result);
- void getStyleSheetText(ErrorString* error, const String& styleSheetId, String* url, String* result);
- void setStyleSheetText(ErrorString* error, const String& styleSheetId, const String& text, bool* success);
- void setPropertyText(ErrorString* error, const RefPtr<InspectorObject>& styleId, long propertyIndex, const String& text, bool overwrite, RefPtr<InspectorValue>* result);
- void toggleProperty(ErrorString* error, const RefPtr<InspectorObject>& styleId, long propertyIndex, bool disable, RefPtr<InspectorValue>* result);
- void setRuleSelector(ErrorString* error, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<InspectorValue>* result);
- void addRule(ErrorString* error, const long contextNodeId, const String& selector, RefPtr<InspectorValue>* result);
- void getSupportedCSSProperties(ErrorString* error, RefPtr<InspectorArray>* result);
+ void getStylesForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>* result);
+ void getInlineStyleForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>* style);
+ void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>* style);
+ void getAllStyleSheets(ErrorString*, RefPtr<InspectorArray>* styleSheetInfos);
+ void getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<InspectorObject>* result);
+ void getStyleSheetText(ErrorString*, const String& styleSheetId, String* url, String* result);
+ void setStyleSheetText(ErrorString*, const String& styleSheetId, const String& text, bool* success);
+ void setPropertyText(ErrorString*, const RefPtr<InspectorObject>& styleId, int propertyIndex, const String& text, bool overwrite, RefPtr<InspectorObject>* result);
+ void toggleProperty(ErrorString*, const RefPtr<InspectorObject>& styleId, int propertyIndex, bool disable, RefPtr<InspectorObject>* result);
+ void setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<InspectorObject>* result);
+ void addRule(ErrorString*, const int contextNodeId, const String& selector, RefPtr<InspectorObject>* result);
+ void getSupportedCSSProperties(ErrorString*, RefPtr<InspectorArray>* result);
private:
typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleSheet;
@@ -83,15 +83,15 @@ private:
static Element* inlineStyleElement(CSSStyleDeclaration*);
InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element);
- Element* elementForId(long nodeId);
+ Element* elementForId(ErrorString*, int nodeId);
InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*);
InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent);
- InspectorStyleSheet* styleSheetForId(const String&);
+ InspectorStyleSheet* styleSheetForId(ErrorString*, const String&);
String detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument);
PassRefPtr<InspectorArray> buildArrayForRuleList(CSSRuleList* ruleList);
- PassRefPtr<InspectorObject> buildObjectForAttributeStyles(Element* element);
+ PassRefPtr<InspectorArray> buildArrayForAttributeStyles(Element*);
// InspectorDOMAgent::DOMListener interface
virtual void didRemoveDocument(Document*);
@@ -106,9 +106,9 @@ private:
NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet;
DocumentToViaInspectorStyleSheet m_documentToInspectorStyleSheet;
- long m_lastStyleSheetId;
- long m_lastRuleId;
- long m_lastStyleId;
+ int m_lastStyleSheetId;
+ int m_lastRuleId;
+ int m_lastStyleId;
};
#endif
diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.cpp b/Source/WebCore/inspector/InspectorConsoleAgent.cpp
index 0379590..47cd2d5 100644
--- a/Source/WebCore/inspector/InspectorConsoleAgent.cpp
+++ b/Source/WebCore/inspector/InspectorConsoleAgent.cpp
@@ -31,6 +31,7 @@
#include "Console.h"
#include "ConsoleMessage.h"
#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
#include "InspectorAgent.h"
#include "InspectorDOMAgent.h"
#include "InspectorFrontend.h"
@@ -48,18 +49,18 @@
namespace WebCore {
static const unsigned maximumConsoleMessages = 1000;
-static const unsigned expireConsoleMessagesStep = 100;
+static const int expireConsoleMessagesStep = 100;
namespace ConsoleAgentState {
static const char monitoringXHR[] = "monitoringXHR";
static const char consoleMessagesEnabled[] = "consoleMessagesEnabled";
}
-InspectorConsoleAgent::InspectorConsoleAgent(InstrumentingAgents* instrumentingAgents, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptHost* injectedScriptHost, InspectorDOMAgent* domAgent)
+InspectorConsoleAgent::InspectorConsoleAgent(InstrumentingAgents* instrumentingAgents, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptManager* injectedScriptManager, InspectorDOMAgent* domAgent)
: m_instrumentingAgents(instrumentingAgents)
, m_inspectorAgent(inspectorAgent)
, m_inspectorState(state)
- , m_injectedScriptHost(injectedScriptHost)
+ , m_injectedScriptManager(injectedScriptManager)
, m_inspectorDOMAgent(domAgent)
, m_frontend(0)
, m_previousMessage(0)
@@ -74,14 +75,24 @@ InspectorConsoleAgent::~InspectorConsoleAgent()
m_instrumentingAgents = 0;
m_inspectorAgent = 0;
m_inspectorState = 0;
- m_injectedScriptHost = 0;
+ m_injectedScriptManager = 0;
m_inspectorDOMAgent = 0;
}
-void InspectorConsoleAgent::setConsoleMessagesEnabled(ErrorString*, bool enabled, bool* newState)
+void InspectorConsoleAgent::enable(ErrorString*, int* consoleMessageExpireCount)
{
- *newState = enabled;
- setConsoleMessagesEnabled(enabled);
+ *consoleMessageExpireCount = m_expiredConsoleMessageCount;
+
+ m_inspectorState->setBoolean(ConsoleAgentState::consoleMessagesEnabled, true);
+
+ size_t messageCount = m_consoleMessages.size();
+ for (size_t i = 0; i < messageCount; ++i)
+ m_consoleMessages[i]->addToFrontend(m_frontend, m_injectedScriptManager);
+}
+
+void InspectorConsoleAgent::disable(ErrorString*)
+{
+ m_inspectorState->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false);
}
void InspectorConsoleAgent::clearConsoleMessages(ErrorString*)
@@ -89,9 +100,8 @@ void InspectorConsoleAgent::clearConsoleMessages(ErrorString*)
m_consoleMessages.clear();
m_expiredConsoleMessageCount = 0;
m_previousMessage = 0;
- m_injectedScriptHost->releaseObjectGroup(0 /* release the group in all scripts */, "console");
- if (InspectorDOMAgent* domAgent = m_inspectorAgent->domAgent())
- domAgent->releaseDanglingNodes();
+ m_injectedScriptManager->releaseObjectGroup("console");
+ m_inspectorDOMAgent->releaseDanglingNodes();
if (m_frontend)
m_frontend->consoleMessagesCleared();
}
@@ -205,7 +215,8 @@ void InspectorConsoleAgent::didFailLoading(unsigned long identifier, const Resou
{
if (!m_inspectorAgent->enabled())
return;
-
+ if (error.isCancellation()) // Report failures only.
+ return;
String message = "Failed to load resource";
if (!error.localizedDescription().isEmpty())
message += ": " + error.localizedDescription();
@@ -217,17 +228,12 @@ void InspectorConsoleAgent::setMonitoringXHREnabled(ErrorString*, bool enabled)
m_inspectorState->setBoolean(ConsoleAgentState::monitoringXHR, enabled);
}
-void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled)
+void InspectorConsoleAgent::addInspectedNode(ErrorString*, int nodeId)
{
- m_inspectorState->setBoolean(ConsoleAgentState::consoleMessagesEnabled, enabled);
- if (!enabled || !m_frontend)
+ Node* node = m_inspectorDOMAgent->nodeForId(nodeId);
+ if (!node)
return;
-
- if (m_expiredConsoleMessageCount)
- m_frontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount);
- unsigned messageCount = m_consoleMessages.size();
- for (unsigned i = 0; i < messageCount; ++i)
- m_consoleMessages[i]->addToFrontend(m_frontend, m_injectedScriptHost);
+ m_injectedScriptManager->injectedScriptHost()->addInspectedNode(node);
}
void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> consoleMessage)
@@ -235,7 +241,7 @@ void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> console
ASSERT(m_inspectorAgent->enabled());
ASSERT_ARG(consoleMessage, consoleMessage);
- if (m_previousMessage && m_previousMessage->isEqual(consoleMessage.get())) {
+ if (m_previousMessage && m_previousMessage->type() != EndGroupMessageType && m_previousMessage->isEqual(consoleMessage.get())) {
m_previousMessage->incrementCount();
if (m_inspectorState->getBoolean(ConsoleAgentState::consoleMessagesEnabled) && m_frontend)
m_previousMessage->updateRepeatCountInConsole(m_frontend);
@@ -243,7 +249,7 @@ void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> console
m_previousMessage = consoleMessage.get();
m_consoleMessages.append(consoleMessage);
if (m_inspectorState->getBoolean(ConsoleAgentState::consoleMessagesEnabled) && m_frontend)
- m_previousMessage->addToFrontend(m_frontend, m_injectedScriptHost);
+ m_previousMessage->addToFrontend(m_frontend, m_injectedScriptManager);
}
if (!m_frontend && m_consoleMessages.size() >= maximumConsoleMessages) {
diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.h b/Source/WebCore/inspector/InspectorConsoleAgent.h
index 8d3a570..2b753b5 100644
--- a/Source/WebCore/inspector/InspectorConsoleAgent.h
+++ b/Source/WebCore/inspector/InspectorConsoleAgent.h
@@ -42,7 +42,7 @@ class InspectorAgent;
class InspectorDOMAgent;
class InspectorFrontend;
class InspectorState;
-class InjectedScriptHost;
+class InjectedScriptManager;
class InstrumentingAgents;
class ResourceError;
class ResourceResponse;
@@ -55,10 +55,11 @@ typedef String ErrorString;
class InspectorConsoleAgent {
WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
public:
- InspectorConsoleAgent(InstrumentingAgents*, InspectorAgent*, InspectorState*, InjectedScriptHost*, InspectorDOMAgent*);
+ InspectorConsoleAgent(InstrumentingAgents*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorDOMAgent*);
~InspectorConsoleAgent();
- void setConsoleMessagesEnabled(ErrorString* error, bool enabled, bool* newState);
+ void enable(ErrorString*, int* consoleMessageExpireCount);
+ void disable(ErrorString*);
void clearConsoleMessages(ErrorString* error);
void reset();
void setFrontend(InspectorFrontend*);
@@ -79,20 +80,20 @@ public:
void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
#endif
void setMonitoringXHREnabled(ErrorString* error, bool enabled);
+ void addInspectedNode(ErrorString*, int nodeId);
private:
- void setConsoleMessagesEnabled(bool);
void addConsoleMessage(PassOwnPtr<ConsoleMessage>);
InstrumentingAgents* m_instrumentingAgents;
InspectorAgent* m_inspectorAgent;
InspectorState* m_inspectorState;
- InjectedScriptHost* m_injectedScriptHost;
+ InjectedScriptManager* m_injectedScriptManager;
InspectorDOMAgent* m_inspectorDOMAgent;
InspectorFrontend::Console* m_frontend;
ConsoleMessage* m_previousMessage;
Vector<OwnPtr<ConsoleMessage> > m_consoleMessages;
- unsigned m_expiredConsoleMessageCount;
+ int m_expiredConsoleMessageCount;
HashMap<String, unsigned> m_counts;
HashMap<String, double> m_times;
};
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp
index 2f1bea2..62b22ee 100644
--- a/Source/WebCore/inspector/InspectorController.cpp
+++ b/Source/WebCore/inspector/InspectorController.cpp
@@ -36,14 +36,17 @@
#include "Frame.h"
#include "GraphicsContext.h"
#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
#include "InspectorAgent.h"
#include "InspectorBackendDispatcher.h"
#include "InspectorBrowserDebuggerAgent.h"
#include "InspectorDebuggerAgent.h"
#include "InspectorClient.h"
+#include "InspectorDOMAgent.h"
#include "InspectorFrontend.h"
#include "InspectorFrontendClient.h"
#include "InspectorInstrumentation.h"
+#include "InspectorProfilerAgent.h"
#include "InspectorTimelineAgent.h"
#include "Page.h"
#include "ScriptObject.h"
@@ -52,10 +55,11 @@
namespace WebCore {
InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)
- : m_inspectorAgent(new InspectorAgent(page, inspectorClient))
- , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(m_inspectorAgent.get()))
+ : m_injectedScriptManager(InjectedScriptManager::create())
+ , m_inspectorAgent(new InspectorAgent(page, inspectorClient, m_injectedScriptManager.get()))
, m_inspectorClient(inspectorClient)
, m_openingFrontend(false)
+ , m_startUserInitiatedDebuggingWhenFrontedIsConnected(false)
{
}
@@ -100,19 +104,57 @@ void InspectorController::connectFrontend()
{
m_openingFrontend = false;
m_inspectorFrontend = new InspectorFrontend(m_inspectorClient);
+ m_injectedScriptManager->injectedScriptHost()->setFrontend(m_inspectorFrontend.get());
m_inspectorAgent->setFrontend(m_inspectorFrontend.get());
if (!InspectorInstrumentation::hasFrontends())
ScriptController::setCaptureCallStackForUncaughtExceptions(true);
InspectorInstrumentation::frontendCreated();
+
+ ASSERT(m_inspectorClient);
+ m_inspectorBackendDispatcher = new InspectorBackendDispatcher(
+ m_inspectorClient,
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ m_inspectorAgent->applicationCacheAgent(),
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ m_inspectorAgent->browserDebuggerAgent(),
+#endif
+ m_inspectorAgent->cssAgent(),
+ m_inspectorAgent->consoleAgent(),
+ m_inspectorAgent->domAgent(),
+#if ENABLE(DOM_STORAGE)
+ m_inspectorAgent->domStorageAgent(),
+#endif
+#if ENABLE(DATABASE)
+ m_inspectorAgent->databaseAgent(),
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ m_inspectorAgent->debuggerAgent(),
+#endif
+ m_inspectorAgent.get(),
+ m_inspectorAgent->resourceAgent(),
+ m_inspectorAgent->pageAgent(),
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ m_inspectorAgent->profilerAgent(),
+#endif
+ m_inspectorAgent->runtimeAgent(),
+ m_inspectorAgent->timelineAgent());
+
+ if (m_startUserInitiatedDebuggingWhenFrontedIsConnected) {
+ m_inspectorFrontend->inspector()->startUserInitiatedDebugging();
+ m_startUserInitiatedDebuggingWhenFrontedIsConnected = false;
+ }
}
void InspectorController::disconnectFrontend()
{
if (!m_inspectorFrontend)
return;
+ m_inspectorBackendDispatcher.clear();
m_inspectorAgent->disconnectFrontend();
+ m_injectedScriptManager->injectedScriptHost()->clearFrontend();
m_inspectorFrontend.clear();
@@ -160,7 +202,7 @@ void InspectorController::evaluateForTestInFrontend(long callId, const String& s
void InspectorController::drawNodeHighlight(GraphicsContext& context) const
{
- m_inspectorAgent->drawNodeHighlight(context);
+ m_inspectorAgent->domAgent()->drawNodeHighlight(context);
}
void InspectorController::showConsole()
@@ -178,7 +220,7 @@ void InspectorController::inspect(Node* node)
show();
- m_inspectorAgent->inspect(node);
+ m_inspectorAgent->domAgent()->inspect(node);
}
bool InspectorController::enabled() const
@@ -203,31 +245,32 @@ void InspectorController::setInspectorExtensionAPI(const String& source)
void InspectorController::dispatchMessageFromFrontend(const String& message)
{
- m_inspectorBackendDispatcher->dispatch(message);
+ if (m_inspectorBackendDispatcher)
+ m_inspectorBackendDispatcher->dispatch(message);
}
void InspectorController::hideHighlight()
{
ErrorString error;
- m_inspectorAgent->hideHighlight(&error);
+ m_inspectorAgent->domAgent()->hideHighlight(&error);
}
#if ENABLE(JAVASCRIPT_DEBUGGER)
void InspectorController::enableProfiler()
{
ErrorString error;
- m_inspectorAgent->enableProfiler(&error);
+ m_inspectorAgent->profilerAgent()->enable(&error);
}
void InspectorController::disableProfiler()
{
ErrorString error;
- m_inspectorAgent->disableProfiler(&error);
+ m_inspectorAgent->profilerAgent()->disable(&error);
}
bool InspectorController::profilerEnabled()
{
- return m_inspectorAgent->profilerEnabled();
+ return m_inspectorAgent->profilerAgent()->enabled();
}
bool InspectorController::debuggerEnabled()
@@ -240,8 +283,11 @@ void InspectorController::showAndEnableDebugger()
if (!enabled())
return;
show();
- m_inspectorAgent->showScriptsPanel();
- m_inspectorAgent->debuggerAgent()->startUserInitiatedDebugging();
+
+ if (m_inspectorFrontend)
+ m_inspectorFrontend->inspector()->startUserInitiatedDebugging();
+ else
+ m_startUserInitiatedDebuggingWhenFrontedIsConnected = true;
}
void InspectorController::disableDebugger()
@@ -251,7 +297,7 @@ void InspectorController::disableDebugger()
void InspectorController::startUserInitiatedProfiling()
{
- m_inspectorAgent->startUserInitiatedProfiling();
+ m_inspectorAgent->profilerAgent()->startUserInitiatedProfiling();
}
void InspectorController::stopUserInitiatedProfiling()
@@ -259,12 +305,13 @@ void InspectorController::stopUserInitiatedProfiling()
if (!enabled())
return;
show();
- m_inspectorAgent->stopUserInitiatedProfiling();
+ m_inspectorAgent->profilerAgent()->stopUserInitiatedProfiling();
+ m_inspectorAgent->showProfilesPanel();
}
bool InspectorController::isRecordingUserInitiatedProfile() const
{
- return m_inspectorAgent->isRecordingUserInitiatedProfile();
+ return m_inspectorAgent->profilerAgent()->isRecordingUserInitiatedProfile();
}
void InspectorController::resume()
diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h
index 7db024c..f38eb3d 100644
--- a/Source/WebCore/inspector/InspectorController.h
+++ b/Source/WebCore/inspector/InspectorController.h
@@ -41,6 +41,7 @@ namespace WebCore {
class DOMWrapperWorld;
class Frame;
class GraphicsContext;
+class InjectedScriptManager;
class InspectorAgent;
class InspectorBackendDispatcher;
class InspectorClient;
@@ -102,12 +103,14 @@ public:
private:
friend class PostWorkerNotificationToFrontendTask;
+ OwnPtr<InjectedScriptManager> m_injectedScriptManager;
OwnPtr<InspectorAgent> m_inspectorAgent;
OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
OwnPtr<InspectorFrontend> m_inspectorFrontend;
InspectorClient* m_inspectorClient;
bool m_openingFrontend;
+ bool m_startUserInitiatedDebuggingWhenFrontedIsConnected;
};
}
diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp
index 3edd72c..06c5977 100644
--- a/Source/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009-2011 Google Inc. All rights reserved.
* Copyright (C) 2009 Joseph Pecoraro
*
* Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@
#include "ContainerNode.h"
#include "Cookie.h"
#include "CookieJar.h"
+#include "DOMNodeHighlighter.h"
#include "DOMWindow.h"
#include "Document.h"
#include "DocumentType.h"
@@ -57,15 +58,19 @@
#include "EventTarget.h"
#include "Frame.h"
#include "FrameTree.h"
+#include "HitTestResult.h"
#include "HTMLElement.h"
#include "HTMLFrameOwnerElement.h"
-#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
+#include "InspectorClient.h"
#include "InspectorFrontend.h"
+#include "InspectorResourceAgent.h"
#include "InspectorState.h"
#include "InstrumentingAgents.h"
#include "MutationEvent.h"
#include "Node.h"
#include "NodeList.h"
+#include "Page.h"
#include "Pasteboard.h"
#include "PlatformString.h"
#include "RenderStyle.h"
@@ -206,8 +211,12 @@ public:
unsigned long size = result->snapshotLength(ec);
for (unsigned long i = 0; !ec && i < size; ++i) {
Node* node = result->snapshotItem(i, ec);
- if (!ec)
- resultCollector.add(node);
+ if (ec)
+ break;
+
+ if (node->nodeType() == Node::ATTRIBUTE_NODE)
+ node = static_cast<Attr*>(node)->ownerElement();
+ resultCollector.add(node);
}
#else
UNUSED_PARAM(resultCollector);
@@ -248,20 +257,25 @@ void RevalidateStyleAttributeTask::onTimer(Timer<RevalidateStyleAttributeTask>*)
m_elements.clear();
}
-InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, InjectedScriptHost* injectedScriptHost)
+InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, Page* inspectedPage, InspectorClient* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
: m_instrumentingAgents(instrumentingAgents)
+ , m_inspectedPage(inspectedPage)
+ , m_client(client)
, m_inspectorState(inspectorState)
- , m_injectedScriptHost(injectedScriptHost)
+ , m_injectedScriptManager(injectedScriptManager)
, m_frontend(0)
, m_domListener(0)
, m_lastNodeId(1)
, m_matchJobsTimer(this, &InspectorDOMAgent::onMatchJobsTimer)
+ , m_searchingForNode(false)
{
}
InspectorDOMAgent::~InspectorDOMAgent()
{
reset();
+ ASSERT(!m_highlightedNode);
+ ASSERT(!m_searchingForNode);
}
void InspectorDOMAgent::setFrontend(InspectorFrontend* frontend)
@@ -269,17 +283,33 @@ void InspectorDOMAgent::setFrontend(InspectorFrontend* frontend)
ASSERT(!m_frontend);
m_frontend = frontend->dom();
m_instrumentingAgents->setInspectorDOMAgent(this);
+ m_document = m_inspectedPage->mainFrame()->document();
+
+ if (m_nodeToFocus)
+ focusNode();
}
void InspectorDOMAgent::clearFrontend()
{
ASSERT(m_frontend);
+ setSearchingForNode(false);
+
+ ErrorString error;
+ hideHighlight(&error);
+
m_frontend = 0;
m_instrumentingAgents->setInspectorDOMAgent(0);
m_inspectorState->setBoolean(DOMAgentState::documentRequested, false);
reset();
}
+void InspectorDOMAgent::restore()
+{
+ // Reset document to avoid early return from setDocument.
+ m_document = 0;
+ setDocument(m_inspectedPage->mainFrame()->document());
+}
+
Vector<Document*> InspectorDOMAgent::documents()
{
Vector<Document*> result;
@@ -295,7 +325,7 @@ Vector<Document*> InspectorDOMAgent::documents()
void InspectorDOMAgent::reset()
{
ErrorString error;
- searchCanceled(&error);
+ cancelSearch(&error);
discardBindings();
if (m_revalidateStyleAttrTask)
m_revalidateStyleAttrTask->reset();
@@ -326,9 +356,9 @@ void InspectorDOMAgent::releaseDanglingNodes()
m_danglingNodeToIdMaps.clear();
}
-long InspectorDOMAgent::bind(Node* node, NodeToIdMap* nodesMap)
+int InspectorDOMAgent::bind(Node* node, NodeToIdMap* nodesMap)
{
- long id = nodesMap->get(node);
+ int id = nodesMap->get(node);
if (id)
return id;
id = m_lastNodeId++;
@@ -346,7 +376,7 @@ void InspectorDOMAgent::unbind(Node* node, NodeToIdMap* nodesMap)
m_domListener->didRemoveDocument(frameOwner->contentDocument());
}
- long id = nodesMap->get(node);
+ int id = nodesMap->get(node);
if (!id)
return;
m_idToNode.remove(id);
@@ -363,13 +393,53 @@ void InspectorDOMAgent::unbind(Node* node, NodeToIdMap* nodesMap)
}
}
-Node* InspectorDOMAgent::nodeToSelectOn(long nodeId, bool documentWide)
+Node* InspectorDOMAgent::assertNode(ErrorString* errorString, int nodeId)
+{
+ Node* node = nodeForId(nodeId);
+ if (!node) {
+ *errorString = "Could not find node with given id.";
+ return 0;
+ }
+ return node;
+}
+
+Element* InspectorDOMAgent::assertElement(ErrorString* errorString, int nodeId)
+{
+ Node* node = assertNode(errorString, nodeId);
+ if (!node)
+ return 0;
+
+ if (node->nodeType() != Node::ELEMENT_NODE) {
+ *errorString = "Node is not an Element.";
+ return 0;
+ }
+ return toElement(node);
+}
+
+
+HTMLElement* InspectorDOMAgent::assertHTMLElement(ErrorString* errorString, int nodeId)
+{
+ Element* element = assertElement(errorString, nodeId);
+ if (!element)
+ return 0;
+
+ if (!element->isHTMLElement()) {
+ *errorString = "Node is not an HTML Element.";
+ return 0;
+ }
+ return toHTMLElement(element);
+}
+
+Node* InspectorDOMAgent::nodeToSelectOn(ErrorString* errorString, int nodeId, bool documentWide)
{
Node* node;
- if (!nodeId)
+ if (!nodeId) {
node = m_document.get();
- else
- node = nodeForId(nodeId);
+ if (!node)
+ *errorString = "No document to query on.";
+ } else
+ node = assertNode(errorString, nodeId);
+
if (!node)
return 0;
@@ -394,7 +464,7 @@ void InspectorDOMAgent::getDocument(ErrorString*, RefPtr<InspectorObject>* root)
*root = buildObjectForNode(m_document.get(), 2, &m_documentNodeToIdMap);
}
-void InspectorDOMAgent::pushChildNodesToFrontend(long nodeId)
+void InspectorDOMAgent::pushChildNodesToFrontend(int nodeId)
{
Node* node = nodeForId(nodeId);
if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE && node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE))
@@ -414,57 +484,60 @@ void InspectorDOMAgent::discardBindings()
m_idToNode.clear();
releaseDanglingNodes();
m_childrenRequested.clear();
- m_injectedScriptHost->clearInspectedNodes();
}
-Node* InspectorDOMAgent::nodeForId(long id)
+Node* InspectorDOMAgent::nodeForId(int id)
{
if (!id)
return 0;
- HashMap<long, Node*>::iterator it = m_idToNode.find(id);
+ HashMap<int, Node*>::iterator it = m_idToNode.find(id);
if (it != m_idToNode.end())
return it->second;
return 0;
}
-void InspectorDOMAgent::getChildNodes(ErrorString*, long nodeId)
+void InspectorDOMAgent::getChildNodes(ErrorString*, int nodeId)
{
pushChildNodesToFrontend(nodeId);
}
-void InspectorDOMAgent::querySelector(ErrorString*, long nodeId, const String& selectors, bool documentWide, long* elementId)
+void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, const String& selectors, bool documentWide, int* elementId)
{
*elementId = 0;
- Node* node = nodeToSelectOn(nodeId, documentWide);
+ Node* node = nodeToSelectOn(errorString, nodeId, documentWide);
if (!node)
return;
ExceptionCode ec = 0;
RefPtr<Element> element = node->querySelector(selectors, ec);
- if (ec)
+ if (ec) {
+ *errorString = "DOM Error while querying.";
return;
+ }
if (element)
*elementId = pushNodePathToFrontend(element.get());
}
-void InspectorDOMAgent::querySelectorAll(ErrorString*, long nodeId, const String& selectors, bool documentWide, RefPtr<InspectorArray>* result)
+void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, const String& selectors, bool documentWide, RefPtr<InspectorArray>* result)
{
- Node* node = nodeToSelectOn(nodeId, documentWide);
+ Node* node = nodeToSelectOn(errorString, nodeId, documentWide);
if (!node)
return;
ExceptionCode ec = 0;
RefPtr<NodeList> nodes = node->querySelectorAll(selectors, ec);
- if (ec)
+ if (ec) {
+ *errorString = "DOM Error while querying.";
return;
+ }
for (unsigned i = 0; i < nodes->length(); ++i)
(*result)->pushNumber(pushNodePathToFrontend(nodes->item(i)));
}
-long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush)
+int InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush)
{
ASSERT(nodeToPush); // Invalid input
@@ -474,7 +547,7 @@ long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush)
return 0;
// Return id in case the node is known.
- long result = m_documentNodeToIdMap.get(nodeToPush);
+ int result = m_documentNodeToIdMap.get(nodeToPush);
if (result)
return result;
@@ -503,60 +576,62 @@ long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush)
NodeToIdMap* map = danglingMap ? danglingMap : &m_documentNodeToIdMap;
for (int i = path.size() - 1; i >= 0; --i) {
- long nodeId = map->get(path.at(i));
+ int nodeId = map->get(path.at(i));
ASSERT(nodeId);
pushChildNodesToFrontend(nodeId);
}
return map->get(nodeToPush);
}
-long InspectorDOMAgent::boundNodeId(Node* node)
+int InspectorDOMAgent::boundNodeId(Node* node)
{
return m_documentNodeToIdMap.get(node);
}
-void InspectorDOMAgent::setAttribute(ErrorString*, long elementId, const String& name, const String& value, bool* success)
+void InspectorDOMAgent::setAttribute(ErrorString* errorString, int elementId, const String& name, const String& value)
{
- Node* node = nodeForId(elementId);
- if (node && (node->nodeType() == Node::ELEMENT_NODE)) {
- Element* element = static_cast<Element*>(node);
+ Element* element = assertElement(errorString, elementId);
+ if (element) {
ExceptionCode ec = 0;
element->setAttribute(name, value, ec);
- *success = !ec;
+ if (ec)
+ *errorString = "Exception while setting attribute value.";
}
}
-void InspectorDOMAgent::removeAttribute(ErrorString*, long elementId, const String& name, bool* success)
+void InspectorDOMAgent::removeAttribute(ErrorString* errorString, int elementId, const String& name)
{
- Node* node = nodeForId(elementId);
- if (node && (node->nodeType() == Node::ELEMENT_NODE)) {
- Element* element = static_cast<Element*>(node);
+ Element* element = assertElement(errorString, elementId);
+ if (element) {
ExceptionCode ec = 0;
element->removeAttribute(name, ec);
- *success = !ec;
+ if (ec)
+ *errorString = "Exception while removing attribute.";
}
}
-void InspectorDOMAgent::removeNode(ErrorString*, long nodeId, long* outNodeId)
+void InspectorDOMAgent::removeNode(ErrorString* errorString, int nodeId)
{
- Node* node = nodeForId(nodeId);
+ Node* node = assertNode(errorString, nodeId);
if (!node)
return;
ContainerNode* parentNode = node->parentNode();
- if (!parentNode)
+ if (!parentNode) {
+ *errorString = "Can not remove detached node.";
return;
+ }
ExceptionCode ec = 0;
parentNode->removeChild(node, ec);
if (ec)
- return;
-
- *outNodeId = nodeId;
+ *errorString = "Could not remove node due to DOM exception.";
}
-void InspectorDOMAgent::changeTagName(ErrorString*, long nodeId, const String& tagName, long* newId)
+void InspectorDOMAgent::setNodeName(ErrorString*, int nodeId, const String& tagName, int* newId)
{
+ *newId = 0;
+
Node* oldNode = nodeForId(nodeId);
if (!oldNode || !oldNode->isElementNode())
return;
@@ -590,28 +665,25 @@ void InspectorDOMAgent::changeTagName(ErrorString*, long nodeId, const String& t
pushChildNodesToFrontend(*newId);
}
-void InspectorDOMAgent::getOuterHTML(ErrorString*, long nodeId, WTF::String* outerHTML)
+void InspectorDOMAgent::getOuterHTML(ErrorString* errorString, int nodeId, WTF::String* outerHTML)
{
- Node* node = nodeForId(nodeId);
- if (!node || !node->isHTMLElement())
- return;
-
- *outerHTML = toHTMLElement(node)->outerHTML();
+ HTMLElement* element = assertHTMLElement(errorString, nodeId);
+ if (element)
+ *outerHTML = element->outerHTML();
}
-void InspectorDOMAgent::setOuterHTML(ErrorString*, long nodeId, const String& outerHTML, long* newId)
+void InspectorDOMAgent::setOuterHTML(ErrorString* errorString, int nodeId, const String& outerHTML, int* newId)
{
- Node* node = nodeForId(nodeId);
- if (!node || !node->isHTMLElement())
+ HTMLElement* htmlElement = assertHTMLElement(errorString, nodeId);
+ if (!htmlElement)
return;
- bool requiresTotalUpdate = node->nodeName() == "HTML" || node->nodeName() == "BODY" || node->nodeName() == "HEAD";
+ bool requiresTotalUpdate = htmlElement->tagName() == "HTML" || htmlElement->tagName() == "BODY" || htmlElement->tagName() == "HEAD";
bool childrenRequested = m_childrenRequested.contains(nodeId);
- Node* previousSibling = node->previousSibling();
- ContainerNode* parentNode = node->parentNode();
+ Node* previousSibling = htmlElement->previousSibling();
+ ContainerNode* parentNode = htmlElement->parentNode();
- HTMLElement* htmlElement = toHTMLElement(node);
ExceptionCode ec = 0;
htmlElement->setOuterHTML(outerHTML, ec);
if (ec)
@@ -637,21 +709,27 @@ void InspectorDOMAgent::setOuterHTML(ErrorString*, long nodeId, const String& ou
pushChildNodesToFrontend(*newId);
}
-void InspectorDOMAgent::setTextNodeValue(ErrorString*, long nodeId, const String& value, bool* success)
+void InspectorDOMAgent::setNodeValue(ErrorString* errorString, int nodeId, const String& value)
{
- Node* node = nodeForId(nodeId);
- if (node && (node->nodeType() == Node::TEXT_NODE)) {
- Text* text_node = static_cast<Text*>(node);
- ExceptionCode ec = 0;
- text_node->replaceWholeText(value, ec);
- *success = !ec;
+ Node* node = assertNode(errorString, nodeId);
+ if (!node)
+ return;
+
+ if (node->nodeType() != Node::TEXT_NODE) {
+ *errorString = "Can only set value of text nodes.";
+ return;
}
+
+ Text* textNode = static_cast<Text*>(node);
+ ExceptionCode ec = 0;
+ textNode->replaceWholeText(value, ec);
+ if (ec)
+ *errorString = "DOM Error while setting the node value.";
}
-void InspectorDOMAgent::getEventListenersForNode(ErrorString*, long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray)
+void InspectorDOMAgent::getEventListenersForNode(ErrorString*, int nodeId, RefPtr<InspectorArray>* listenersArray)
{
Node* node = nodeForId(nodeId);
- *outNodeId = nodeId;
EventTargetData* d;
// Quick break if a null node or no listeners at all
@@ -670,18 +748,19 @@ void InspectorDOMAgent::getEventListenersForNode(ErrorString*, long nodeId, long
if (!eventTypesLength)
return;
- // The Node's Event Ancestors (not including self)
- Vector<EventContext> ancestors;
- node->getEventAncestors(ancestors, node);
+ // The Node's Ancestors (not including self)
+ Vector<ContainerNode*> ancestors;
+ for (ContainerNode* ancestor = node->parentOrHostNode(); ancestor; ancestor = ancestor->parentOrHostNode())
+ ancestors.append(ancestor);
// Nodes and their Listeners for the concerned event types (order is top to bottom)
Vector<EventListenerInfo> eventInformation;
for (size_t i = ancestors.size(); i; --i) {
- Node* ancestor = ancestors[i - 1].node();
+ ContainerNode* ancestor = ancestors[i - 1];
for (size_t j = 0; j < eventTypesLength; ++j) {
AtomicString& type = eventTypes[j];
if (ancestor->hasEventListeners(type))
- eventInformation.append(EventListenerInfo(static_cast<Node*>(ancestor), type, ancestor->getEventListeners(type)));
+ eventInformation.append(EventListenerInfo(ancestor, type, ancestor->getEventListeners(type)));
}
}
@@ -715,14 +794,6 @@ void InspectorDOMAgent::getEventListenersForNode(ErrorString*, long nodeId, long
}
}
-void InspectorDOMAgent::addInspectedNode(ErrorString*, long nodeId)
-{
- Node* node = nodeForId(nodeId);
- if (!node)
- return;
- m_injectedScriptHost->addInspectedNode(node);
-}
-
void InspectorDOMAgent::performSearch(ErrorString* error, const String& whitespaceTrimmedQuery, bool runSynchronously)
{
// FIXME: Few things are missing here:
@@ -750,7 +821,7 @@ void InspectorDOMAgent::performSearch(ErrorString* error, const String& whitespa
escapedTagNameQuery.replace("'", "\\'");
// Clear pending jobs.
- searchCanceled(error);
+ cancelSearch(error);
// Find all frames, iframes and object elements to search their documents.
Vector<Document*> docs = documents();
@@ -804,13 +875,13 @@ void InspectorDOMAgent::performSearch(ErrorString* error, const String& whitespa
for (Deque<MatchJob*>::iterator it = m_pendingMatchJobs.begin(); it != m_pendingMatchJobs.end(); ++it)
(*it)->match(resultCollector);
reportNodesAsSearchResults(resultCollector);
- searchCanceled(error);
+ cancelSearch(error);
return;
}
m_matchJobsTimer.startOneShot(0);
}
-void InspectorDOMAgent::searchCanceled(ErrorString*)
+void InspectorDOMAgent::cancelSearch(ErrorString*)
{
if (m_matchJobsTimer.isActive())
m_matchJobsTimer.stop();
@@ -819,19 +890,122 @@ void InspectorDOMAgent::searchCanceled(ErrorString*)
m_searchResults.clear();
}
-void InspectorDOMAgent::resolveNode(ErrorString* error, long nodeId, const String& objectGroup, RefPtr<InspectorValue>* result)
+bool InspectorDOMAgent::handleMousePress()
+{
+ if (!m_searchingForNode)
+ return false;
+
+ if (m_highlightedNode) {
+ RefPtr<Node> node = m_highlightedNode;
+ setSearchingForNode(false);
+ inspect(node.get());
+ }
+ return true;
+}
+
+void InspectorDOMAgent::inspect(Node* node)
+{
+ if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)
+ node = node->parentNode();
+ m_nodeToFocus = node;
+
+ focusNode();
+}
+
+void InspectorDOMAgent::focusNode()
+{
+ if (!m_frontend)
+ return;
+
+ ASSERT(m_nodeToFocus);
+
+ RefPtr<Node> node = m_nodeToFocus.get();
+ m_nodeToFocus = 0;
+
+ Document* document = node->ownerDocument();
+ if (!document)
+ return;
+ Frame* frame = document->frame();
+ if (!frame)
+ return;
+
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(mainWorldScriptState(frame));
+ if (injectedScript.hasNoValue())
+ return;
+
+ injectedScript.inspectNode(node.get());
+}
+
+void InspectorDOMAgent::mouseDidMoveOverElement(const HitTestResult& result, unsigned)
+{
+ if (!m_searchingForNode)
+ return;
+
+ Node* node = result.innerNode();
+ while (node && node->nodeType() == Node::TEXT_NODE)
+ node = node->parentNode();
+ if (node) {
+ ErrorString error;
+ highlight(&error, node);
+ }
+}
+
+void InspectorDOMAgent::setSearchingForNode(bool enabled)
+{
+ if (m_searchingForNode == enabled)
+ return;
+ m_searchingForNode = enabled;
+ if (!enabled) {
+ ErrorString error;
+ hideHighlight(&error);
+ }
+}
+
+void InspectorDOMAgent::setSearchingForNode(ErrorString*, bool enabled, bool* newState)
+{
+ *newState = enabled;
+ setSearchingForNode(enabled);
+}
+
+void InspectorDOMAgent::highlight(ErrorString*, Node* node)
+{
+ ASSERT_ARG(node, node);
+ m_highlightedNode = node;
+ m_client->highlight(node);
+}
+
+void InspectorDOMAgent::highlightDOMNode(ErrorString* error, int nodeId)
+{
+ if (Node* node = nodeForId(nodeId))
+ highlight(error, node);
+}
+
+void InspectorDOMAgent::highlightFrame(ErrorString* error, const String& frameId)
+{
+ Frame* frame = m_instrumentingAgents->inspectorResourceAgent()->frameForId(frameId);
+ if (frame && frame->ownerElement())
+ highlight(error, frame->ownerElement());
+}
+
+void InspectorDOMAgent::hideHighlight(ErrorString*)
+{
+ m_highlightedNode = 0;
+ m_client->hideHighlight();
+}
+
+void InspectorDOMAgent::resolveNode(ErrorString* error, int nodeId, RefPtr<InspectorObject>* result)
{
Node* node = nodeForId(nodeId);
if (!node) {
*error = "No node with given id found.";
return;
}
- *result = resolveNode(node, objectGroup);
+ *result = resolveNode(node);
}
-void InspectorDOMAgent::pushNodeToFrontend(ErrorString*, PassRefPtr<InspectorObject> objectId, long* nodeId)
+void InspectorDOMAgent::pushNodeToFrontend(ErrorString*, const String& objectId, int* nodeId)
{
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
Node* node = injectedScript.nodeForObjectId(objectId);
if (node)
*nodeId = pushNodePathToFrontend(node);
@@ -850,7 +1024,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForNode(Node* node, in
{
RefPtr<InspectorObject> value = InspectorObject::create();
- long id = bind(node, nodesMap);
+ int id = bind(node, nodesMap);
String nodeName;
String localName;
String nodeValue;
@@ -1036,7 +1210,7 @@ void InspectorDOMAgent::loadEventFired(Document* document)
if (!frameOwner)
return;
- long frameOwnerId = m_documentNodeToIdMap.get(frameOwner);
+ int frameOwnerId = m_documentNodeToIdMap.get(frameOwner);
if (!frameOwnerId)
return;
@@ -1045,11 +1219,11 @@ void InspectorDOMAgent::loadEventFired(Document* document)
m_frontend->childNodeCountUpdated(frameOwnerId, innerChildNodeCount(frameOwner));
} else {
// Re-add frame owner element together with its new children.
- long parentId = m_documentNodeToIdMap.get(innerParentNode(frameOwner));
+ int parentId = m_documentNodeToIdMap.get(innerParentNode(frameOwner));
m_frontend->childNodeRemoved(parentId, frameOwnerId);
RefPtr<InspectorObject> value = buildObjectForNode(frameOwner, 0, &m_documentNodeToIdMap);
Node* previousSibling = innerPreviousSibling(frameOwner);
- long prevId = previousSibling ? m_documentNodeToIdMap.get(previousSibling) : 0;
+ int prevId = previousSibling ? m_documentNodeToIdMap.get(previousSibling) : 0;
m_frontend->childNodeInserted(parentId, prevId, value.release());
// Invalidate children requested flag for the element.
m_childrenRequested.remove(m_childrenRequested.find(frameOwnerId));
@@ -1065,7 +1239,7 @@ void InspectorDOMAgent::didInsertDOMNode(Node* node)
unbind(node, &m_documentNodeToIdMap);
ContainerNode* parent = node->parentNode();
- long parentId = m_documentNodeToIdMap.get(parent);
+ int parentId = m_documentNodeToIdMap.get(parent);
// Return if parent is not mapped yet.
if (!parentId)
return;
@@ -1076,7 +1250,7 @@ void InspectorDOMAgent::didInsertDOMNode(Node* node)
} else {
// Children have been requested -> return value of a new child.
Node* prevSibling = innerPreviousSibling(node);
- long prevId = prevSibling ? m_documentNodeToIdMap.get(prevSibling) : 0;
+ int prevId = prevSibling ? m_documentNodeToIdMap.get(prevSibling) : 0;
RefPtr<InspectorObject> value = buildObjectForNode(node, 0, &m_documentNodeToIdMap);
m_frontend->childNodeInserted(parentId, prevId, value.release());
}
@@ -1088,7 +1262,7 @@ void InspectorDOMAgent::didRemoveDOMNode(Node* node)
return;
ContainerNode* parent = node->parentNode();
- long parentId = m_documentNodeToIdMap.get(parent);
+ int parentId = m_documentNodeToIdMap.get(parent);
// If parent is not mapped yet -> ignore the event.
if (!parentId)
return;
@@ -1107,7 +1281,7 @@ void InspectorDOMAgent::didRemoveDOMNode(Node* node)
void InspectorDOMAgent::didModifyDOMAttr(Element* element)
{
- long id = m_documentNodeToIdMap.get(element);
+ int id = m_documentNodeToIdMap.get(element);
// If node is not mapped yet -> ignore the event.
if (!id)
return;
@@ -1120,7 +1294,7 @@ void InspectorDOMAgent::didModifyDOMAttr(Element* element)
void InspectorDOMAgent::characterDataModified(CharacterData* characterData)
{
- long id = m_documentNodeToIdMap.get(characterData);
+ int id = m_documentNodeToIdMap.get(characterData);
if (!id)
return;
m_frontend->characterDataModified(id, characterData->data());
@@ -1128,7 +1302,7 @@ void InspectorDOMAgent::characterDataModified(CharacterData* characterData)
void InspectorDOMAgent::didInvalidateStyleAttr(Node* node)
{
- long id = m_documentNodeToIdMap.get(node);
+ int id = m_documentNodeToIdMap.get(node);
// If node is not mapped yet -> ignore the event.
if (!id)
return;
@@ -1181,7 +1355,7 @@ void InspectorDOMAgent::onMatchJobsTimer(Timer<InspectorDOMAgent>*)
{
if (!m_pendingMatchJobs.size()) {
ErrorString error;
- searchCanceled(&error);
+ cancelSearch(&error);
return;
}
@@ -1202,12 +1376,12 @@ void InspectorDOMAgent::reportNodesAsSearchResults(ListHashSet<Node*>& resultCol
if (m_searchResults.contains(*it))
continue;
m_searchResults.add(*it);
- nodeIds->pushNumber(static_cast<long long>(pushNodePathToFrontend(*it)));
+ nodeIds->pushNumber(pushNodePathToFrontend(*it));
}
- m_frontend->addNodesToSearchResult(nodeIds.release());
+ m_frontend->searchResults(nodeIds.release());
}
-void InspectorDOMAgent::copyNode(ErrorString*, long nodeId)
+void InspectorDOMAgent::copyNode(ErrorString*, int nodeId)
{
Node* node = nodeForId(nodeId);
if (!node)
@@ -1216,24 +1390,32 @@ void InspectorDOMAgent::copyNode(ErrorString*, long nodeId)
Pasteboard::generalPasteboard()->writePlainText(markup);
}
-void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString*, const String& path, long* nodeId)
+void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId)
{
if (Node* node = nodeForPath(path))
*nodeId = pushNodePathToFrontend(node);
}
-PassRefPtr<InspectorObject> InspectorDOMAgent::resolveNode(Node* node, const String& objectGroup)
+PassRefPtr<InspectorObject> InspectorDOMAgent::resolveNode(Node* node)
{
Document* document = node->ownerDocument();
Frame* frame = document ? document->frame() : 0;
if (!frame)
return 0;
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame));
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(mainWorldScriptState(frame));
if (injectedScript.hasNoValue())
return 0;
- return injectedScript.wrapNode(node, objectGroup);
+ return injectedScript.wrapNode(node);
+}
+
+void InspectorDOMAgent::drawNodeHighlight(GraphicsContext& context) const
+{
+ if (!m_highlightedNode)
+ return;
+
+ DOMNodeHighlighter::DrawNodeHighlight(context, m_highlightedNode.get());
}
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h
index 0368880..8aeb66b 100644
--- a/Source/WebCore/inspector/InspectorDOMAgent.h
+++ b/Source/WebCore/inspector/InspectorDOMAgent.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009-2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +30,9 @@
#ifndef InspectorDOMAgent_h
#define InspectorDOMAgent_h
+#include "EventTarget.h"
#include "InjectedScript.h"
-#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
#include "InspectorFrontend.h"
#include "InspectorValues.h"
#include "Timer.h"
@@ -52,9 +53,13 @@ class CharacterData;
class Document;
class Element;
class Event;
+class GraphicsContext;
+class InspectorClient;
class InspectorDOMAgent;
class InspectorFrontend;
+class HitTestResult;
class MatchJob;
+class HTMLElement;
class InspectorState;
class InstrumentingAgents;
class NameNodeMap;
@@ -91,38 +96,44 @@ public:
virtual void didModifyDOMAttr(Element*) = 0;
};
- static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, InjectedScriptHost* injectedScriptHost)
+ static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, Page* page, InspectorClient* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
{
- return adoptPtr(new InspectorDOMAgent(instrumentingAgents, inspectorState, injectedScriptHost));
+ return adoptPtr(new InspectorDOMAgent(instrumentingAgents, page, client, inspectorState, injectedScriptManager));
}
~InspectorDOMAgent();
void setFrontend(InspectorFrontend*);
void clearFrontend();
+ void restore();
Vector<Document*> documents();
void reset();
// Methods called from the frontend for DOM nodes inspection.
- void querySelector(ErrorString*, long nodeId, const String& selectors, bool documentWide, long* elementId);
- void querySelectorAll(ErrorString*, long nodeId, const String& selectors, bool documentWide, RefPtr<InspectorArray>* result);
+ void querySelector(ErrorString*, int nodeId, const String& selectors, bool documentWide, int* elementId);
+ void querySelectorAll(ErrorString*, int nodeId, const String& selectors, bool documentWide, RefPtr<InspectorArray>* result);
void getDocument(ErrorString*, RefPtr<InspectorObject>* root);
- void getChildNodes(ErrorString*, long nodeId);
- void setAttribute(ErrorString*, long elementId, const String& name, const String& value, bool* success);
- void removeAttribute(ErrorString*, long elementId, const String& name, bool* success);
- void removeNode(ErrorString*, long nodeId, long* outNodeId);
- void changeTagName(ErrorString*, long nodeId, const String& tagName, long* newId);
- void getOuterHTML(ErrorString*, long nodeId, WTF::String* outerHTML);
- void setOuterHTML(ErrorString*, long nodeId, const String& outerHTML, long* newId);
- void setTextNodeValue(ErrorString*, long nodeId, const String& value, bool* success);
- void getEventListenersForNode(ErrorString*, long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray);
- void addInspectedNode(ErrorString*, long nodeId);
+ void getChildNodes(ErrorString*, int nodeId);
+ void setAttribute(ErrorString*, int elementId, const String& name, const String& value);
+ void removeAttribute(ErrorString*, int elementId, const String& name);
+ void removeNode(ErrorString*, int nodeId);
+ void setNodeName(ErrorString*, int nodeId, const String& name, int* newId);
+ void getOuterHTML(ErrorString*, int nodeId, WTF::String* outerHTML);
+ void setOuterHTML(ErrorString*, int nodeId, const String& outerHTML, int* newId);
+ void setNodeValue(ErrorString*, int nodeId, const String& value);
+ void getEventListenersForNode(ErrorString*, int nodeId, RefPtr<InspectorArray>* listenersArray);
void performSearch(ErrorString*, const String& whitespaceTrimmedQuery, bool runSynchronously);
- void searchCanceled(ErrorString*);
- void resolveNode(ErrorString*, long nodeId, const String& objectGroup, RefPtr<InspectorValue>* result);
- void pushNodeToFrontend(ErrorString*, PassRefPtr<InspectorObject> objectId, long* nodeId);
- void pushNodeByPathToFrontend(ErrorString*, const String& path, long* nodeId);
+ void cancelSearch(ErrorString*);
+ void resolveNode(ErrorString*, int nodeId, RefPtr<InspectorObject>* result);
+ void setSearchingForNode(ErrorString*, bool enabled, bool* newState);
+ void pushNodeToFrontend(ErrorString*, const String& objectId, int* nodeId);
+ void pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId);
+ void hideHighlight(ErrorString*);
+ void highlightDOMNode(ErrorString*, int nodeId);
+ void hideDOMNodeHighlight(ErrorString* error) { hideHighlight(error); }
+ void highlightFrame(ErrorString*, const String& frameId);
+ void hideFrameHighlight(ErrorString* error) { hideHighlight(error); }
// Methods called from the InspectorInstrumentation.
void setDocument(Document*);
@@ -137,14 +148,21 @@ public:
void characterDataModified(CharacterData*);
void didInvalidateStyleAttr(Node*);
- Node* nodeForId(long nodeId);
- long boundNodeId(Node*);
- void copyNode(ErrorString*, long nodeId);
+ Node* nodeForId(int nodeId);
+ int boundNodeId(Node*);
+ void copyNode(ErrorString*, int nodeId);
void setDOMListener(DOMListener*);
String documentURLString(Document*) const;
- PassRefPtr<InspectorObject> resolveNode(Node*, const String& objectGroup);
+ PassRefPtr<InspectorObject> resolveNode(Node*);
+ bool handleMousePress();
+ bool searchingForNodeInPage() const;
+ void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
+ void inspect(Node*);
+ void focusNode();
+
+ void drawNodeHighlight(GraphicsContext&) const;
// We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently.
// We also skip whitespace text nodes conditionally. Following methods encapsulate these specifics.
@@ -156,21 +174,26 @@ public:
static bool isWhitespace(Node*);
private:
- InspectorDOMAgent(InstrumentingAgents*, InspectorState*, InjectedScriptHost*);
+ InspectorDOMAgent(InstrumentingAgents*, Page*, InspectorClient*, InspectorState*, InjectedScriptManager*);
+
+ void setSearchingForNode(bool enabled);
+ void highlight(ErrorString*, Node*);
// Node-related methods.
- typedef HashMap<RefPtr<Node>, long> NodeToIdMap;
- long bind(Node*, NodeToIdMap*);
+ typedef HashMap<RefPtr<Node>, int> NodeToIdMap;
+ int bind(Node*, NodeToIdMap*);
void unbind(Node*, NodeToIdMap*);
+ Node* assertNode(ErrorString*, int nodeId);
+ Element* assertElement(ErrorString*, int nodeId);
+ HTMLElement* assertHTMLElement(ErrorString*, int nodeId);
+ Node* nodeToSelectOn(ErrorString*, int nodeId, bool documentWide);
- Node* nodeToSelectOn(long nodeId, bool documentWide);
-
- long pushNodePathToFrontend(Node*);
- void pushChildNodesToFrontend(long nodeId);
+ int pushNodePathToFrontend(Node*);
+ void pushChildNodesToFrontend(int nodeId);
- bool hasBreakpoint(Node*, long type);
+ bool hasBreakpoint(Node*, int type);
void updateSubtreeBreakpoints(Node* root, uint32_t rootMask, bool value);
- void descriptionForDOMEvent(Node* target, long breakpointType, bool insertion, PassRefPtr<InspectorObject> description);
+ void descriptionForDOMEvent(Node* target, int breakpointType, bool insertion, PassRefPtr<InspectorObject> description);
PassRefPtr<InspectorObject> buildObjectForNode(Node*, int depth, NodeToIdMap*);
PassRefPtr<InspectorArray> buildArrayForElementAttributes(Element*);
@@ -186,22 +209,27 @@ private:
void discardBindings();
InstrumentingAgents* m_instrumentingAgents;
+ Page* m_inspectedPage;
+ InspectorClient* m_client;
InspectorState* m_inspectorState;
- InjectedScriptHost* m_injectedScriptHost;
+ InjectedScriptManager* m_injectedScriptManager;
InspectorFrontend::DOM* m_frontend;
DOMListener* m_domListener;
NodeToIdMap m_documentNodeToIdMap;
// Owns node mappings for dangling nodes.
Vector<NodeToIdMap*> m_danglingNodeToIdMaps;
- HashMap<long, Node*> m_idToNode;
- HashMap<long, NodeToIdMap*> m_idToNodesMap;
- HashSet<long> m_childrenRequested;
- long m_lastNodeId;
+ HashMap<int, Node*> m_idToNode;
+ HashMap<int, NodeToIdMap*> m_idToNodesMap;
+ HashSet<int> m_childrenRequested;
+ int m_lastNodeId;
RefPtr<Document> m_document;
Deque<MatchJob*> m_pendingMatchJobs;
Timer<InspectorDOMAgent> m_matchJobsTimer;
HashSet<RefPtr<Node> > m_searchResults;
OwnPtr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask;
+ RefPtr<Node> m_highlightedNode;
+ RefPtr<Node> m_nodeToFocus;
+ bool m_searchingForNode;
};
#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp b/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
index 6ea72f6..c44bbd8 100644
--- a/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
@@ -79,7 +79,7 @@ void InspectorDOMStorageAgent::clearFrontend()
m_frontend = 0;
}
-void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, long storageId, RefPtr<InspectorArray>* entries)
+void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, int storageId, RefPtr<InspectorArray>* entries)
{
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (storageResource) {
@@ -96,7 +96,7 @@ void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, long storageId
}
}
-void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString*, long storageId, const String& key, const String& value, bool* success)
+void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString*, int storageId, const String& key, const String& value, bool* success)
{
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (storageResource) {
@@ -106,7 +106,7 @@ void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString*, long storageId, c
}
}
-void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, long storageId, const String& key, bool* success)
+void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, int storageId, const String& key, bool* success)
{
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (storageResource) {
@@ -115,7 +115,7 @@ void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, long storageId
}
}
-long InspectorDOMStorageAgent::storageId(Storage* storage)
+int InspectorDOMStorageAgent::storageId(Storage* storage)
{
ASSERT(storage);
Frame* frame = storage->frame();
@@ -129,7 +129,7 @@ long InspectorDOMStorageAgent::storageId(Storage* storage)
return 0;
}
-InspectorDOMStorageResource* InspectorDOMStorageAgent::getDOMStorageResourceForId(long storageId)
+InspectorDOMStorageResource* InspectorDOMStorageAgent::getDOMStorageResourceForId(int storageId)
{
DOMStorageResourcesMap::iterator it = m_resources.find(storageId);
if (it == m_resources.end())
diff --git a/Source/WebCore/inspector/InspectorDOMStorageAgent.h b/Source/WebCore/inspector/InspectorDOMStorageAgent.h
index adae9b2..567a713 100644
--- a/Source/WebCore/inspector/InspectorDOMStorageAgent.h
+++ b/Source/WebCore/inspector/InspectorDOMStorageAgent.h
@@ -59,12 +59,12 @@ public:
void clearResources();
// Called from the front-end.
- void getDOMStorageEntries(ErrorString*, long storageId, RefPtr<InspectorArray>* entries);
- void setDOMStorageItem(ErrorString*, long storageId, const String& key, const String& value, bool* success);
- void removeDOMStorageItem(ErrorString*, long storageId, const String& key, bool* success);
+ void getDOMStorageEntries(ErrorString*, int storageId, RefPtr<InspectorArray>* entries);
+ void setDOMStorageItem(ErrorString*, int storageId, const String& key, const String& value, bool* success);
+ void removeDOMStorageItem(ErrorString*, int storageId, const String& key, bool* success);
// Called from the injected script.
- long storageId(Storage*);
+ int storageId(Storage*);
// Called from InspectorInstrumentation
void didUseDOMStorage(StorageArea*, bool isLocalStorage, Frame*);
@@ -72,10 +72,10 @@ public:
private:
explicit InspectorDOMStorageAgent(InstrumentingAgents*);
- InspectorDOMStorageResource* getDOMStorageResourceForId(long storageId);
+ InspectorDOMStorageResource* getDOMStorageResourceForId(int storageId);
InstrumentingAgents* m_instrumentingAgents;
- typedef HashMap<long, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
+ typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
DOMStorageResourcesMap m_resources;
InspectorFrontend* m_frontend;
};
diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp
index 6ff6418..d618eb5 100644
--- a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp
+++ b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp
@@ -46,7 +46,7 @@ using namespace JSC;
namespace WebCore {
-long InspectorDOMStorageResource::s_nextUnusedId = 1;
+int InspectorDOMStorageResource::s_nextUnusedId = 1;
InspectorDOMStorageResource::InspectorDOMStorageResource(Storage* domStorage, bool isLocalStorage, Frame* frame)
: EventListener(InspectorDOMStorageResourceType)
diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.h b/Source/WebCore/inspector/InspectorDOMStorageResource.h
index 9ad5b91..eb75113 100644
--- a/Source/WebCore/inspector/InspectorDOMStorageResource.h
+++ b/Source/WebCore/inspector/InspectorDOMStorageResource.h
@@ -66,7 +66,7 @@ namespace WebCore {
virtual bool operator==(const EventListener& listener);
bool isSameHostAndType(Frame*, bool isLocalStorage) const;
- long id() const { return m_id; }
+ int id() const { return m_id; }
Storage* domStorage() const { return m_domStorage.get(); }
private:
@@ -77,10 +77,10 @@ namespace WebCore {
bool m_isLocalStorage;
RefPtr<Frame> m_frame;
InspectorFrontend::DOMStorage* m_frontend;
- long m_id;
+ int m_id;
bool m_reportingChangesToFrontend;
- static long s_nextUnusedId;
+ static int s_nextUnusedId;
};
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorDatabaseAgent.cpp b/Source/WebCore/inspector/InspectorDatabaseAgent.cpp
index 45ec42a..7f6e379 100644
--- a/Source/WebCore/inspector/InspectorDatabaseAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDatabaseAgent.cpp
@@ -70,9 +70,9 @@ private:
namespace {
-long lastTransactionId = 0;
+int lastTransactionId = 0;
-void reportTransactionFailed(InspectorFrontend::Database* frontend, long transactionId, SQLError* error)
+void reportTransactionFailed(InspectorFrontend::Database* frontend, int transactionId, SQLError* error)
{
if (!frontend)
return;
@@ -84,7 +84,7 @@ void reportTransactionFailed(InspectorFrontend::Database* frontend, long transac
class StatementCallback : public SQLStatementCallback {
public:
- static PassRefPtr<StatementCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
+ static PassRefPtr<StatementCallback> create(int transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
{
return adoptRef(new StatementCallback(transactionId, frontendProvider));
}
@@ -118,16 +118,16 @@ public:
}
private:
- StatementCallback(long transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
+ StatementCallback(int transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
: m_transactionId(transactionId)
, m_frontendProvider(frontendProvider) { }
- long m_transactionId;
+ int m_transactionId;
RefPtr<InspectorDatabaseAgent::FrontendProvider> m_frontendProvider;
};
class StatementErrorCallback : public SQLStatementErrorCallback {
public:
- static PassRefPtr<StatementErrorCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
+ static PassRefPtr<StatementErrorCallback> create(int transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
{
return adoptRef(new StatementErrorCallback(transactionId, frontendProvider));
}
@@ -141,16 +141,16 @@ public:
}
private:
- StatementErrorCallback(long transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
+ StatementErrorCallback(int transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
: m_transactionId(transactionId)
, m_frontendProvider(frontendProvider) { }
- long m_transactionId;
+ int m_transactionId;
RefPtr<InspectorDatabaseAgent::FrontendProvider> m_frontendProvider;
};
class TransactionCallback : public SQLTransactionCallback {
public:
- static PassRefPtr<TransactionCallback> create(const String& sqlStatement, long transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
+ static PassRefPtr<TransactionCallback> create(const String& sqlStatement, int transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
{
return adoptRef(new TransactionCallback(sqlStatement, transactionId, frontendProvider));
}
@@ -170,18 +170,18 @@ public:
return true;
}
private:
- TransactionCallback(const String& sqlStatement, long transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
+ TransactionCallback(const String& sqlStatement, int transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
: m_sqlStatement(sqlStatement)
, m_transactionId(transactionId)
, m_frontendProvider(frontendProvider) { }
String m_sqlStatement;
- long m_transactionId;
+ int m_transactionId;
RefPtr<InspectorDatabaseAgent::FrontendProvider> m_frontendProvider;
};
class TransactionErrorCallback : public SQLTransactionErrorCallback {
public:
- static PassRefPtr<TransactionErrorCallback> create(long transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
+ static PassRefPtr<TransactionErrorCallback> create(int transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
{
return adoptRef(new TransactionErrorCallback(transactionId, frontendProvider));
}
@@ -194,10 +194,10 @@ public:
return true;
}
private:
- TransactionErrorCallback(long transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
+ TransactionErrorCallback(int transactionId, PassRefPtr<InspectorDatabaseAgent::FrontendProvider> frontendProvider)
: m_transactionId(transactionId)
, m_frontendProvider(frontendProvider) { }
- long m_transactionId;
+ int m_transactionId;
RefPtr<InspectorDatabaseAgent::FrontendProvider> m_frontendProvider;
};
@@ -257,7 +257,7 @@ void InspectorDatabaseAgent::clearFrontend()
m_frontendProvider.clear();
}
-void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString*, long databaseId, RefPtr<InspectorArray>* names)
+void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString*, int databaseId, RefPtr<InspectorArray>* names)
{
Database* database = databaseForId(databaseId);
if (database) {
@@ -268,7 +268,7 @@ void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString*, long databaseId
}
}
-void InspectorDatabaseAgent::executeSQL(ErrorString*, long databaseId, const String& query, bool* success, long* transactionId)
+void InspectorDatabaseAgent::executeSQL(ErrorString*, int databaseId, const String& query, bool* success, int* transactionId)
{
Database* database = databaseForId(databaseId);
if (!database) {
@@ -284,7 +284,7 @@ void InspectorDatabaseAgent::executeSQL(ErrorString*, long databaseId, const Str
*success = true;
}
-long InspectorDatabaseAgent::databaseId(Database* database)
+int InspectorDatabaseAgent::databaseId(Database* database)
{
for (DatabaseResourcesMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) {
if (it->second->database() == database)
@@ -293,7 +293,7 @@ long InspectorDatabaseAgent::databaseId(Database* database)
return 0;
}
-Database* InspectorDatabaseAgent::databaseForId(long databaseId)
+Database* InspectorDatabaseAgent::databaseForId(int databaseId)
{
DatabaseResourcesMap::iterator it = m_resources.find(databaseId);
if (it == m_resources.end())
diff --git a/Source/WebCore/inspector/InspectorDatabaseAgent.h b/Source/WebCore/inspector/InspectorDatabaseAgent.h
index 7e42211..45fbfa4 100644
--- a/Source/WebCore/inspector/InspectorDatabaseAgent.h
+++ b/Source/WebCore/inspector/InspectorDatabaseAgent.h
@@ -59,17 +59,17 @@ public:
void clearResources();
// Called from the front-end.
- void getDatabaseTableNames(ErrorString* error, long databaseId, RefPtr<InspectorArray>* names);
- void executeSQL(ErrorString* error, long databaseId, const String& query, bool* success, long* transactionId);
+ void getDatabaseTableNames(ErrorString*, int databaseId, RefPtr<InspectorArray>* names);
+ void executeSQL(ErrorString*, int databaseId, const String& query, bool* success, int* transactionId);
// Called from the injected script.
- long databaseId(Database*);
+ int databaseId(Database*);
void didOpenDatabase(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
private:
explicit InspectorDatabaseAgent(InstrumentingAgents*);
- Database* databaseForId(long databaseId);
+ Database* databaseForId(int databaseId);
InstrumentingAgents* m_instrumentingAgents;
typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
diff --git a/Source/WebCore/inspector/InspectorDatabaseResource.cpp b/Source/WebCore/inspector/InspectorDatabaseResource.cpp
index 41342a4..852370e 100644
--- a/Source/WebCore/inspector/InspectorDatabaseResource.cpp
+++ b/Source/WebCore/inspector/InspectorDatabaseResource.cpp
@@ -38,7 +38,7 @@
namespace WebCore {
-static long nextUnusedId = 1;
+static int nextUnusedId = 1;
PassRefPtr<InspectorDatabaseResource> InspectorDatabaseResource::create(PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
{
diff --git a/Source/WebCore/inspector/InspectorDatabaseResource.h b/Source/WebCore/inspector/InspectorDatabaseResource.h
index 550fcd8..9fa7ebd 100644
--- a/Source/WebCore/inspector/InspectorDatabaseResource.h
+++ b/Source/WebCore/inspector/InspectorDatabaseResource.h
@@ -48,13 +48,13 @@ public:
void bind(InspectorFrontend::Database*);
Database* database() { return m_database.get(); }
- long id() const { return m_id; }
+ int id() const { return m_id; }
private:
InspectorDatabaseResource(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
RefPtr<Database> m_database;
- long m_id;
+ int m_id;
String m_domain;
String m_name;
String m_version;
diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
index 0cdc2b0..56bc7b7 100644
--- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010-2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
#include "InjectedScript.h"
-#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
#include "InspectorFrontend.h"
#include "InspectorState.h"
#include "InspectorValues.h"
@@ -45,20 +45,13 @@ namespace WebCore {
namespace DebuggerAgentState {
static const char debuggerEnabled[] = "debuggerEnabled";
-static const char enableWhenShown[] = "debuggerEnableWhenShown";
static const char javaScriptBreakpoints[] = "javaScriptBreakopints";
};
-PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptHost* injectedScriptHost)
-{
- return adoptPtr(new InspectorDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptHost));
-}
-
-InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptHost* injectedScriptHost)
+InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
: m_instrumentingAgents(instrumentingAgents)
, m_inspectorState(inspectorState)
- , m_inspectedPage(inspectedPage)
- , m_injectedScriptHost(injectedScriptHost)
+ , m_injectedScriptManager(injectedScriptManager)
, m_frontend(0)
, m_pausedScriptState(0)
, m_javaScriptPauseScheduled(false)
@@ -71,14 +64,6 @@ InspectorDebuggerAgent::~InspectorDebuggerAgent()
ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent());
}
-void InspectorDebuggerAgent::startUserInitiatedDebugging()
-{
- if (m_frontend)
- enable(false);
- else
- m_inspectorState->setBoolean(DebuggerAgentState::enableWhenShown, true);
-}
-
void InspectorDebuggerAgent::enable(bool restoringFromState)
{
ASSERT(m_frontend);
@@ -87,10 +72,10 @@ void InspectorDebuggerAgent::enable(bool restoringFromState)
m_inspectorState->setBoolean(DebuggerAgentState::debuggerEnabled, true);
m_instrumentingAgents->setInspectorDebuggerAgent(this);
- ScriptDebugServer::shared().clearBreakpoints();
+ scriptDebugServer().clearBreakpoints();
// FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends
- ScriptDebugServer::shared().setBreakpointsActivated(true);
- ScriptDebugServer::shared().addListener(this, m_inspectedPage);
+ scriptDebugServer().setBreakpointsActivated(true);
+ startListeningScriptDebugServer();
m_frontend->debuggerWasEnabled();
if (m_listener)
@@ -102,9 +87,10 @@ void InspectorDebuggerAgent::disable()
if (!enabled())
return;
m_inspectorState->setBoolean(DebuggerAgentState::debuggerEnabled, false);
+ m_inspectorState->setObject(DebuggerAgentState::javaScriptBreakpoints, InspectorObject::create());
m_instrumentingAgents->setInspectorDebuggerAgent(0);
- ScriptDebugServer::shared().removeListener(this, m_inspectedPage);
+ stopListeningScriptDebugServer();
clear();
if (m_frontend)
@@ -129,17 +115,6 @@ void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend)
m_frontend = frontend->debugger();
}
-void InspectorDebuggerAgent::enableDebuggerAfterShown()
-{
- // Erase sticky breakpoints. If we are restoring from a cookie setFrontend msut be called
- // before the state is loaded from the cookie.
- m_inspectorState->setObject(DebuggerAgentState::javaScriptBreakpoints, InspectorObject::create());
- if (m_inspectorState->getBoolean(DebuggerAgentState::enableWhenShown)) {
- m_inspectorState->setBoolean(DebuggerAgentState::enableWhenShown, false);
- enable(false);
- }
-}
-
void InspectorDebuggerAgent::clearFrontend()
{
m_frontend = 0;
@@ -150,17 +125,14 @@ void InspectorDebuggerAgent::clearFrontend()
// remember this state to re-enable debugger on the next window
// opening.
disable();
- m_inspectorState->setBoolean(DebuggerAgentState::enableWhenShown, true);
}
-void InspectorDebuggerAgent::activateBreakpoints(ErrorString*)
+void InspectorDebuggerAgent::setBreakpointsActive(ErrorString*, bool active)
{
- ScriptDebugServer::shared().activateBreakpoints();
-}
-
-void InspectorDebuggerAgent::deactivateBreakpoints(ErrorString*)
-{
- ScriptDebugServer::shared().deactivateBreakpoints();
+ if (active)
+ scriptDebugServer().activateBreakpoints();
+ else
+ scriptDebugServer().deactivateBreakpoints();
}
void InspectorDebuggerAgent::inspectedURLChanged(const String&)
@@ -169,7 +141,7 @@ void InspectorDebuggerAgent::inspectedURLChanged(const String&)
m_breakpointIdToDebugServerBreakpointIds.clear();
}
-void InspectorDebuggerAgent::setJavaScriptBreakpoint(ErrorString*, const String& url, int lineNumber, int columnNumber, const String& condition, bool enabled, String* outBreakpointId, RefPtr<InspectorArray>* locations)
+void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString*, const String& url, int lineNumber, int columnNumber, const String& condition, bool enabled, String* outBreakpointId, RefPtr<InspectorArray>* locations)
{
String breakpointId = makeString(url, ":", String::number(lineNumber), ":", String::number(columnNumber));
RefPtr<InspectorObject> breakpointsCookie = m_inspectorState->getObject(DebuggerAgentState::javaScriptBreakpoints);
@@ -200,7 +172,7 @@ void InspectorDebuggerAgent::setJavaScriptBreakpoint(ErrorString*, const String&
*outBreakpointId = breakpointId;
}
-void InspectorDebuggerAgent::setJavaScriptBreakpointBySourceId(ErrorString*, const String& sourceId, int lineNumber, int columnNumber, const String& condition, bool enabled, String* outBreakpointId, int* actualLineNumber, int* actualColumnNumber)
+void InspectorDebuggerAgent::setBreakpoint(ErrorString*, const String& sourceId, int lineNumber, int columnNumber, const String& condition, bool enabled, String* outBreakpointId, int* actualLineNumber, int* actualColumnNumber)
{
String breakpointId = makeString(sourceId, ":", String::number(lineNumber), ":", String::number(columnNumber));
if (m_breakpointIdToDebugServerBreakpointIds.find(breakpointId) != m_breakpointIdToDebugServerBreakpointIds.end())
@@ -211,7 +183,7 @@ void InspectorDebuggerAgent::setJavaScriptBreakpointBySourceId(ErrorString*, con
*outBreakpointId = breakpointId;
}
-void InspectorDebuggerAgent::removeJavaScriptBreakpoint(ErrorString*, const String& breakpointId)
+void InspectorDebuggerAgent::removeBreakpoint(ErrorString*, const String& breakpointId)
{
RefPtr<InspectorObject> breakpointsCookie = m_inspectorState->getObject(DebuggerAgentState::javaScriptBreakpoints);
breakpointsCookie->remove(breakpointId);
@@ -221,18 +193,18 @@ void InspectorDebuggerAgent::removeJavaScriptBreakpoint(ErrorString*, const Stri
if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpointIds.end())
return;
for (size_t i = 0; i < debugServerBreakpointIdsIterator->second.size(); ++i)
- ScriptDebugServer::shared().removeBreakpoint(debugServerBreakpointIdsIterator->second[i]);
+ scriptDebugServer().removeBreakpoint(debugServerBreakpointIdsIterator->second[i]);
m_breakpointIdToDebugServerBreakpointIds.remove(debugServerBreakpointIdsIterator);
}
void InspectorDebuggerAgent::continueToLocation(ErrorString* error, const String& sourceId, int lineNumber, int columnNumber)
{
if (!m_continueToLocationBreakpointId.isEmpty()) {
- ScriptDebugServer::shared().removeBreakpoint(m_continueToLocationBreakpointId);
+ scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId);
m_continueToLocationBreakpointId = "";
}
ScriptBreakpoint breakpoint(lineNumber, columnNumber, "", true);
- m_continueToLocationBreakpointId = ScriptDebugServer::shared().setBreakpoint(sourceId, breakpoint, &lineNumber, &columnNumber);
+ m_continueToLocationBreakpointId = scriptDebugServer().setBreakpoint(sourceId, breakpoint, &lineNumber, &columnNumber);
resume(error);
}
@@ -254,7 +226,7 @@ bool InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointId, const
if (breakpoint.lineNumber >= script.lineOffset + script.linesCount)
return false;
- String debugServerBreakpointId = ScriptDebugServer::shared().setBreakpoint(sourceId, breakpoint, actualLineNumber, actualColumnNumber);
+ String debugServerBreakpointId = scriptDebugServer().setBreakpoint(sourceId, breakpoint, actualLineNumber, actualColumnNumber);
if (debugServerBreakpointId.isEmpty())
return false;
@@ -266,10 +238,14 @@ bool InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointId, const
return true;
}
-void InspectorDebuggerAgent::editScriptSource(ErrorString*, const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames)
+void InspectorDebuggerAgent::editScriptSource(ErrorString* errorString, const String& sourceID, const String& newContent, String* result, RefPtr<InspectorArray>* newCallFrames)
{
- if ((*success = ScriptDebugServer::shared().editScriptSource(sourceID, newContent, *result)))
+ String editResult;
+ if (scriptDebugServer().editScriptSource(sourceID, newContent, editResult)) {
*newCallFrames = currentCallFrames();
+ *result = editResult;
+ } else
+ *errorString = editResult;
}
void InspectorDebuggerAgent::getScriptSource(ErrorString*, const String& sourceID, String* scriptSource)
@@ -284,7 +260,7 @@ void InspectorDebuggerAgent::schedulePauseOnNextStatement(DebuggerEventType type
m_breakProgramDetails = InspectorObject::create();
m_breakProgramDetails->setNumber("eventType", type);
m_breakProgramDetails->setValue("eventData", data);
- ScriptDebugServer::shared().setPauseOnNextStatement(true);
+ scriptDebugServer().setPauseOnNextStatement(true);
}
void InspectorDebuggerAgent::cancelPauseOnNextStatement()
@@ -292,7 +268,7 @@ void InspectorDebuggerAgent::cancelPauseOnNextStatement()
if (m_javaScriptPauseScheduled)
return;
m_breakProgramDetails = 0;
- ScriptDebugServer::shared().setPauseOnNextStatement(false);
+ scriptDebugServer().setPauseOnNextStatement(false);
}
void InspectorDebuggerAgent::pause(ErrorString*)
@@ -303,45 +279,46 @@ void InspectorDebuggerAgent::pause(ErrorString*)
void InspectorDebuggerAgent::resume(ErrorString*)
{
- ScriptDebugServer::shared().continueProgram();
+ scriptDebugServer().continueProgram();
}
void InspectorDebuggerAgent::stepOver(ErrorString*)
{
- ScriptDebugServer::shared().stepOverStatement();
+ scriptDebugServer().stepOverStatement();
}
void InspectorDebuggerAgent::stepInto(ErrorString*)
{
- ScriptDebugServer::shared().stepIntoStatement();
+ scriptDebugServer().stepIntoStatement();
}
void InspectorDebuggerAgent::stepOut(ErrorString*)
{
- ScriptDebugServer::shared().stepOutOfFunction();
+ scriptDebugServer().stepOutOfFunction();
}
-void InspectorDebuggerAgent::setPauseOnExceptionsState(ErrorString*, long pauseState, long* newState)
+void InspectorDebuggerAgent::setPauseOnExceptionsState(ErrorString* errorString, int pauseState)
{
- ScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState));
- *newState = ScriptDebugServer::shared().pauseOnExceptionsState();
+ scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState));
+ if (scriptDebugServer().pauseOnExceptionsState() != pauseState)
+ *errorString = "Internal error. Could not change pause on exceptions state.";
}
-void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString*, PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
+void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result)
{
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(callFrameId.get());
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId);
if (!injectedScript.hasNoValue())
- injectedScript.evaluateOnCallFrame(callFrameId, expression, objectGroup, includeCommandLineAPI, result);
+ injectedScript.evaluateOnCallFrame(errorString, callFrameId, expression, objectGroup, includeCommandLineAPI, result);
}
-PassRefPtr<InspectorValue> InspectorDebuggerAgent::currentCallFrames()
+PassRefPtr<InspectorArray> InspectorDebuggerAgent::currentCallFrames()
{
if (!m_pausedScriptState)
- return InspectorValue::null();
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(m_pausedScriptState);
+ return InspectorArray::create();
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m_pausedScriptState);
if (injectedScript.hasNoValue()) {
ASSERT_NOT_REACHED();
- return InspectorValue::null();
+ return InspectorArray::create();
}
return injectedScript.callFrames();
}
@@ -351,7 +328,7 @@ PassRefPtr<InspectorValue> InspectorDebuggerAgent::currentCallFrames()
void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, ScriptWorldType worldType)
{
// Don't send script content to the front end until it's really needed.
- m_frontend->parsedScriptSource(sourceID, url, lineOffset, columnOffset, data.length(), worldType);
+ m_frontend->scriptParsed(sourceID, url, lineOffset, columnOffset, data.length(), worldType);
m_scripts.set(sourceID, Script(url, data, lineOffset, columnOffset));
@@ -378,7 +355,7 @@ void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String
void InspectorDebuggerAgent::failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage)
{
- m_frontend->failedToParseScriptSource(url, data, firstLine, errorLine, errorMessage);
+ m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessage);
}
void InspectorDebuggerAgent::didPause(ScriptState* scriptState)
@@ -390,11 +367,11 @@ void InspectorDebuggerAgent::didPause(ScriptState* scriptState)
m_breakProgramDetails = InspectorObject::create();
m_breakProgramDetails->setValue("callFrames", currentCallFrames());
- m_frontend->pausedScript(m_breakProgramDetails);
+ m_frontend->paused(m_breakProgramDetails);
m_javaScriptPauseScheduled = false;
if (!m_continueToLocationBreakpointId.isEmpty()) {
- ScriptDebugServer::shared().removeBreakpoint(m_continueToLocationBreakpointId);
+ scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId);
m_continueToLocationBreakpointId = "";
}
}
@@ -403,7 +380,7 @@ void InspectorDebuggerAgent::didContinue()
{
m_pausedScriptState = 0;
m_breakProgramDetails = 0;
- m_frontend->resumedScript();
+ m_frontend->resumed();
}
void InspectorDebuggerAgent::breakProgram(DebuggerEventType type, PassRefPtr<InspectorValue> data)
@@ -411,7 +388,7 @@ void InspectorDebuggerAgent::breakProgram(DebuggerEventType type, PassRefPtr<Ins
m_breakProgramDetails = InspectorObject::create();
m_breakProgramDetails->setNumber("eventType", type);
m_breakProgramDetails->setValue("eventData", data);
- ScriptDebugServer::shared().breakProgram();
+ scriptDebugServer().breakProgram();
}
void InspectorDebuggerAgent::clear()
diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.h b/Source/WebCore/inspector/InspectorDebuggerAgent.h
index 394034a..d5726e7 100644
--- a/Source/WebCore/inspector/InspectorDebuggerAgent.h
+++ b/Source/WebCore/inspector/InspectorDebuggerAgent.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010-2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,13 +44,14 @@
namespace WebCore {
-class InjectedScriptHost;
+class InjectedScriptManager;
class InspectorFrontend;
+class InspectorArray;
class InspectorObject;
class InspectorState;
class InspectorValue;
class InstrumentingAgents;
-class Page;
+class ScriptDebugServer;
typedef String ErrorString;
@@ -63,42 +64,38 @@ enum DebuggerEventType {
class InspectorDebuggerAgent : public ScriptDebugListener {
WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED;
public:
- static PassOwnPtr<InspectorDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptHost*);
virtual ~InspectorDebuggerAgent();
- void startUserInitiatedDebugging();
void enable(ErrorString*) { enable(false); }
void disable(ErrorString*) { disable(); }
void disable();
bool enabled();
void restore();
void setFrontend(InspectorFrontend*);
- void enableDebuggerAfterShown();
void clearFrontend();
void inspectedURLChanged(const String& url);
// Part of the protocol.
- void activateBreakpoints(ErrorString* error);
- void deactivateBreakpoints(ErrorString* error);
+ void setBreakpointsActive(ErrorString*, bool active);
- void setJavaScriptBreakpoint(ErrorString* error, const String& url, int lineNumber, int columnNumber, const String& condition, bool enabled, String* breakpointId, RefPtr<InspectorArray>* locations);
- void setJavaScriptBreakpointBySourceId(ErrorString* error, const String& sourceId, int lineNumber, int columnNumber, const String& condition, bool enabled, String* breakpointId, int* actualLineNumber, int* actualColumnNumber);
- void removeJavaScriptBreakpoint(ErrorString* error, const String& breakpointId);
- void continueToLocation(ErrorString* error, const String& sourceId, int lineNumber, int columnNumber);
+ void setBreakpointByUrl(ErrorString*, const String& url, int lineNumber, int columnNumber, const String& condition, bool enabled, String* breakpointId, RefPtr<InspectorArray>* locations);
+ void setBreakpoint(ErrorString*, const String& sourceId, int lineNumber, int columnNumber, const String& condition, bool enabled, String* breakpointId, int* actualLineNumber, int* actualColumnNumber);
+ void removeBreakpoint(ErrorString*, const String& breakpointId);
+ void continueToLocation(ErrorString*, const String& sourceId, int lineNumber, int columnNumber);
- void editScriptSource(ErrorString* error, const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames);
- void getScriptSource(ErrorString* error, const String& sourceID, String* scriptSource);
+ void editScriptSource(ErrorString*, const String& sourceID, const String& newContent, String* result, RefPtr<InspectorArray>* newCallFrames);
+ void getScriptSource(ErrorString*, const String& sourceID, String* scriptSource);
void schedulePauseOnNextStatement(DebuggerEventType type, PassRefPtr<InspectorValue> data);
void cancelPauseOnNextStatement();
void breakProgram(DebuggerEventType type, PassRefPtr<InspectorValue> data);
- void pause(ErrorString* error);
- void resume(ErrorString* error);
- void stepOver(ErrorString* error);
- void stepInto(ErrorString* error);
- void stepOut(ErrorString* error);
- void setPauseOnExceptionsState(ErrorString* error, long pauseState, long* newState);
- void evaluateOnCallFrame(ErrorString* error, PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
+ void pause(ErrorString*);
+ void resume(ErrorString*);
+ void stepOver(ErrorString*);
+ void stepInto(ErrorString*);
+ void stepOut(ErrorString*);
+ void setPauseOnExceptionsState(ErrorString*, int pauseState);
+ void evaluateOnCallFrame(ErrorString*, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result);
class Listener {
public:
@@ -108,12 +105,18 @@ public:
};
void setListener(Listener* listener) { m_listener = listener; }
-private:
- InspectorDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptHost*);
+ virtual ScriptDebugServer& scriptDebugServer() = 0;
+
+protected:
+ InspectorDebuggerAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*);
+ virtual void startListeningScriptDebugServer() = 0;
+ virtual void stopListeningScriptDebugServer() = 0;
+
+private:
void enable(bool restoringFromState);
- PassRefPtr<InspectorValue> currentCallFrames();
+ PassRefPtr<InspectorArray> currentCallFrames();
virtual void didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, ScriptWorldType);
virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage);
@@ -153,8 +156,7 @@ private:
InstrumentingAgents* m_instrumentingAgents;
InspectorState* m_inspectorState;
- Page* m_inspectedPage;
- InjectedScriptHost* m_injectedScriptHost;
+ InjectedScriptManager* m_injectedScriptManager;
InspectorFrontend::Debugger* m_frontend;
ScriptState* m_pausedScriptState;
ScriptsMap m_scripts;
diff --git a/Source/WebCore/inspector/InspectorFrontendClient.h b/Source/WebCore/inspector/InspectorFrontendClient.h
index 31f52b7..d5eeafb 100644
--- a/Source/WebCore/inspector/InspectorFrontendClient.h
+++ b/Source/WebCore/inspector/InspectorFrontendClient.h
@@ -62,6 +62,9 @@ public:
virtual void inspectedURLChanged(const String&) = 0;
virtual void sendMessageToBackend(const String&) = 0;
+
+ virtual void saveSessionSetting(const String&, const String&) {}
+ virtual void loadSessionSetting(const String&, String*) {}
};
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorFrontendHost.cpp b/Source/WebCore/inspector/InspectorFrontendHost.cpp
index f2e66bc..7450d35 100644
--- a/Source/WebCore/inspector/InspectorFrontendHost.cpp
+++ b/Source/WebCore/inspector/InspectorFrontendHost.cpp
@@ -220,6 +220,20 @@ void InspectorFrontendHost::copyText(const String& text)
Pasteboard::generalPasteboard()->writePlainText(text);
}
+void InspectorFrontendHost::saveSessionSetting(const String& key, const String& value)
+{
+ if (m_client)
+ m_client->saveSessionSetting(key, value);
+}
+
+String InspectorFrontendHost::loadSessionSetting(const String& key)
+{
+ String value;
+ if (m_client)
+ m_client->loadSessionSetting(key, &value);
+ return value;
+}
+
void InspectorFrontendHost::sendMessageToBackend(const String& message)
{
m_client->sendMessageToBackend(message);
diff --git a/Source/WebCore/inspector/InspectorFrontendHost.h b/Source/WebCore/inspector/InspectorFrontendHost.h
index 03c55a9..05d555a 100644
--- a/Source/WebCore/inspector/InspectorFrontendHost.h
+++ b/Source/WebCore/inspector/InspectorFrontendHost.h
@@ -75,6 +75,9 @@ public:
void copyText(const String& text);
+ void saveSessionSetting(const String& key, const String& value);
+ String loadSessionSetting(const String& key);
+
// Called from [Custom] implementations.
void showContextMenu(Event*, const Vector<ContextMenuItem*>& items);
void sendMessageToBackend(const String& message);
diff --git a/Source/WebCore/inspector/InspectorFrontendHost.idl b/Source/WebCore/inspector/InspectorFrontendHost.idl
index 6853c7d..0703a8e 100644
--- a/Source/WebCore/inspector/InspectorFrontendHost.idl
+++ b/Source/WebCore/inspector/InspectorFrontendHost.idl
@@ -47,6 +47,9 @@ module core {
DOMString localizedStringsURL();
DOMString hiddenPanels();
+ void saveSessionSetting(in DOMString key, in DOMString value);
+ DOMString loadSessionSetting(in DOMString key);
+
void copyText(in DOMString text);
[Custom] DOMString platform();
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp
index dfe1c28..6d3b4ad 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp
+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp
@@ -47,6 +47,7 @@
#include "InspectorDOMAgent.h"
#include "InspectorDOMStorageAgent.h"
#include "InspectorDebuggerAgent.h"
+#include "InspectorPageAgent.h"
#include "InspectorProfilerAgent.h"
#include "InspectorResourceAgent.h"
#include "InspectorTimelineAgent.h"
@@ -92,6 +93,8 @@ static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window,
void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InspectorAgent* inspectorAgent, Frame* frame, DOMWrapperWorld* world)
{
+ if (InspectorPageAgent* pageAgent = inspectorAgent->instrumentingAgents()->inspectorPageAgent())
+ pageAgent->didClearWindowObjectInWorld(frame, world);
inspectorAgent->didClearWindowObjectInWorld(frame, world);
}
@@ -158,12 +161,15 @@ void InspectorInstrumentation::didInvalidateStyleAttrImpl(InspectorAgent* inspec
void InspectorInstrumentation::mouseDidMoveOverElementImpl(InspectorAgent* inspectorAgent, const HitTestResult& result, unsigned modifierFlags)
{
- inspectorAgent->mouseDidMoveOverElement(result, modifierFlags);
+ if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
+ domAgent->mouseDidMoveOverElement(result, modifierFlags);
}
bool InspectorInstrumentation::handleMousePressImpl(InspectorAgent* inspectorAgent)
{
- return inspectorAgent->handleMousePress();
+ if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
+ return domAgent->handleMousePress();
+ return false;
}
void InspectorInstrumentation::characterDataModifiedImpl(InspectorAgent* inspectorAgent, CharacterData* characterData)
@@ -382,26 +388,18 @@ void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrument
timelineAgent->didRecalculateStyle();
}
-void InspectorInstrumentation::identifierForInitialRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
-{
- if (!inspectorAgent->enabled())
- return;
-
- if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
- resourceAgent->identifierForInitialRequest(identifier, request.url(), loader);
-}
-
void InspectorInstrumentation::applyUserAgentOverrideImpl(InspectorAgent* inspectorAgent, String* userAgent)
{
- inspectorAgent->applyUserAgentOverride(userAgent);
+ if (InspectorPageAgent* pageAgent = retrievePageAgent(inspectorAgent))
+ pageAgent->applyUserAgentOverride(userAgent);
}
-void InspectorInstrumentation::willSendRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void InspectorInstrumentation::willSendRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent))
timelineAgent->willSendResourceRequest(identifier, request);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
- resourceAgent->willSendRequest(identifier, request, redirectResponse);
+ resourceAgent->willSendRequest(identifier, loader, request, redirectResponse);
}
void InspectorInstrumentation::markResourceAsCachedImpl(InspectorAgent* inspectorAgent, unsigned long identifier)
@@ -448,18 +446,21 @@ InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResp
void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
{
- InspectorAgent* inspectorAgent = cookie.first;
- if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
- resourceAgent->didReceiveResponse(identifier, loader, response);
- inspectorAgent->consoleAgent()->didReceiveResponse(identifier, response);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didReceiveResourceResponse();
+ if (!loader)
+ return;
+ if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(loader->frame())) {
+ if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
+ resourceAgent->didReceiveResponse(identifier, loader, response);
+ inspectorAgent->consoleAgent()->didReceiveResponse(identifier, response); // This should come AFTER resource notification, front-end relies on this.
+ }
}
-void InspectorInstrumentation::didReceiveContentLengthImpl(InspectorAgent* inspectorAgent, unsigned long identifier, int lengthReceived)
+void InspectorInstrumentation::didReceiveContentLengthImpl(InspectorAgent* inspectorAgent, unsigned long identifier, int dataLength, int lengthReceived)
{
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
- resourceAgent->didReceiveContentLength(identifier, lengthReceived);
+ resourceAgent->didReceiveContentLength(identifier, dataLength, lengthReceived);
}
void InspectorInstrumentation::didFinishLoadingImpl(InspectorAgent* inspectorAgent, unsigned long identifier, double finishTime)
@@ -472,11 +473,11 @@ void InspectorInstrumentation::didFinishLoadingImpl(InspectorAgent* inspectorAge
void InspectorInstrumentation::didFailLoadingImpl(InspectorAgent* inspectorAgent, unsigned long identifier, const ResourceError& error)
{
- inspectorAgent->consoleAgent()->didFailLoading(identifier, error);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent))
timelineAgent->didFinishLoadingResource(identifier, true, 0);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
resourceAgent->didFailLoading(identifier, error);
+ inspectorAgent->consoleAgent()->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
}
void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
@@ -494,12 +495,40 @@ void InspectorInstrumentation::scriptImportedImpl(InspectorAgent* inspectorAgent
void InspectorInstrumentation::domContentLoadedEventFiredImpl(InspectorAgent* inspectorAgent, Frame* frame, const KURL& url)
{
- inspectorAgent->domContentLoadedEventFired(frame->loader()->documentLoader(), url);
+ DocumentLoader* documentLoader = frame->loader()->documentLoader();
+ ASSERT(documentLoader);
+
+ if (frame->page()->mainFrame() != frame || url != documentLoader->requestURL())
+ return;
+
+ inspectorAgent->domContentLoadedEventFired();
+
+ if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
+ domAgent->mainFrameDOMContentLoaded();
+
+ if (InspectorTimelineAgent* timelineAgent = inspectorAgent->instrumentingAgents()->inspectorTimelineAgent())
+ timelineAgent->didMarkDOMContentEvent();
+
+ if (InspectorPageAgent* pageAgent = inspectorAgent->instrumentingAgents()->inspectorPageAgent())
+ pageAgent->domContentEventFired();
}
void InspectorInstrumentation::loadEventFiredImpl(InspectorAgent* inspectorAgent, Frame* frame, const KURL& url)
{
- inspectorAgent->loadEventFired(frame->loader()->documentLoader(), url);
+ DocumentLoader* documentLoader = frame->loader()->documentLoader();
+ ASSERT(documentLoader);
+
+ if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
+ domAgent->loadEventFired(documentLoader->frame()->document());
+
+ if (frame->page()->mainFrame() != frame || url != documentLoader->requestURL())
+ return;
+
+ if (InspectorTimelineAgent* timelineAgent = inspectorAgent->instrumentingAgents()->inspectorTimelineAgent())
+ timelineAgent->didMarkLoadEvent();
+
+ if (InspectorPageAgent* pageAgent = inspectorAgent->instrumentingAgents()->inspectorPageAgent())
+ pageAgent->loadEventFired();
}
void InspectorInstrumentation::frameDetachedFromParentImpl(InspectorAgent* inspectorAgent, Frame* frame)
@@ -527,8 +556,6 @@ void InspectorInstrumentation::didCommitLoadImpl(Page* page, InspectorAgent* ins
if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
KURL url = inspectorAgent->inspectedURLWithoutFragment();
debuggerAgent->inspectedURLChanged(url);
- if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = instrumentingAgents->inspectorBrowserDebuggerAgent())
- browserDebuggerAgent->inspectedURLChanged(url);
}
#endif
#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
@@ -549,7 +576,11 @@ void InspectorInstrumentation::didCommitLoadImpl(Page* page, InspectorAgent* ins
#endif
if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
domAgent->setDocument(mainFrame->document());
- inspectorAgent->didCommitLoad(loader);
+
+ if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+ pageAgent->inspectedURLChanged(loader->url().string());
+
+ inspectorAgent->didCommitLoad();
}
InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InspectorAgent* inspectorAgent, unsigned int length, unsigned int startLine)
@@ -627,7 +658,7 @@ String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(Inspecto
bool InspectorInstrumentation::profilerEnabledImpl(InspectorAgent* inspectorAgent)
{
- return inspectorAgent->profilerEnabled();
+ return inspectorAgent->instrumentingAgents()->inspectorProfilerAgent()->enabled();
}
#endif
@@ -733,6 +764,8 @@ InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(Inspecto
InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
{
+ if (!cookie.first)
+ return 0;
InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie.first);
if (timelineAgent && timelineAgent->id() == cookie.second)
return timelineAgent;
@@ -744,6 +777,11 @@ InspectorResourceAgent* InspectorInstrumentation::retrieveResourceAgent(Inspecto
return inspectorAgent->instrumentingAgents()->inspectorResourceAgent();
}
+InspectorPageAgent* InspectorInstrumentation::retrievePageAgent(InspectorAgent* inspectorAgent)
+{
+ return inspectorAgent->instrumentingAgents()->inspectorPageAgent();
+}
+
} // namespace WebCore
#endif // !ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
index 2ea4e4f..77c464e 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
@@ -48,6 +48,7 @@ class EventContext;
class DocumentLoader;
class HitTestResult;
class InspectorAgent;
+class InspectorPageAgent;
class InspectorResourceAgent;
class InspectorTimelineAgent;
class KURL;
@@ -110,15 +111,14 @@ public:
static void didRecalculateStyle(const InspectorInstrumentationCookie&);
static void applyUserAgentOverride(Frame*, String*);
- static void identifierForInitialRequest(Frame*, unsigned long identifier, DocumentLoader*, const ResourceRequest&);
- static void willSendRequest(Frame*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
+ static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
static void markResourceAsCached(Page*, unsigned long identifier);
static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, const CachedResource*);
static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier);
static void didReceiveResourceData(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
- static void didReceiveContentLength(Frame*, unsigned long identifier, int lengthReceived);
+ static void didReceiveContentLength(Frame*, unsigned long identifier, int dataLength, int lengthReceived);
static void didFinishLoading(Frame*, unsigned long identifier, double finishTime);
static void didFailLoading(Frame*, unsigned long identifier, const ResourceError&);
static void resourceRetrievedByXMLHttpRequest(ScriptExecutionContext*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
@@ -227,15 +227,14 @@ private:
static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
static void applyUserAgentOverrideImpl(InspectorAgent*, String*);
- static void identifierForInitialRequestImpl(InspectorAgent*, unsigned long identifier, DocumentLoader*, const ResourceRequest&);
- static void willSendRequestImpl(InspectorAgent*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
+ static void willSendRequestImpl(InspectorAgent*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
static void markResourceAsCachedImpl(InspectorAgent*, unsigned long identifier);
static void didLoadResourceFromMemoryCacheImpl(InspectorAgent*, DocumentLoader*, const CachedResource*);
static InspectorInstrumentationCookie willReceiveResourceDataImpl(InspectorAgent*, unsigned long identifier);
static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InspectorAgent*, unsigned long identifier, const ResourceResponse&);
static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
- static void didReceiveContentLengthImpl(InspectorAgent*, unsigned long identifier, int lengthReceived);
+ static void didReceiveContentLengthImpl(InspectorAgent*, unsigned long identifier, int dataLength, int lengthReceived);
static void didFinishLoadingImpl(InspectorAgent*, unsigned long identifier, double finishTime);
static void didFailLoadingImpl(InspectorAgent*, unsigned long identifier, const ResourceError&);
static void resourceRetrievedByXMLHttpRequestImpl(InspectorAgent*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
@@ -301,6 +300,7 @@ private:
static InspectorTimelineAgent* retrieveTimelineAgent(InspectorAgent*);
static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
static InspectorResourceAgent* retrieveResourceAgent(InspectorAgent*);
+ static InspectorPageAgent* retrievePageAgent(InspectorAgent*);
static HashMap<Page*, InspectorAgent*>& inspectorAgents();
static int s_frontendCounter;
@@ -601,17 +601,6 @@ inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrum
#endif
}
-inline void InspectorInstrumentation::identifierForInitialRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
-{
-#if ENABLE(INSPECTOR)
- // This notification should be procecessed even in cases there is no frontend.
- if (!frame)
- return;
- if (InspectorAgent* ic = inspectorAgentForPage(frame->page()))
- identifierForInitialRequestImpl(ic, identifier, loader, request);
-#endif
-}
-
inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, String* userAgent)
{
#if ENABLE(INSPECTOR)
@@ -620,11 +609,11 @@ inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, Strin
#endif
}
-inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
#if ENABLE(INSPECTOR)
if (InspectorAgent* ic = inspectorAgentWithFrontendForFrame(frame))
- willSendRequestImpl(ic, identifier, request, redirectResponse);
+ willSendRequestImpl(ic, identifier, loader, request, redirectResponse);
#endif
}
@@ -671,16 +660,16 @@ inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResou
inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
{
#if ENABLE(INSPECTOR)
- if (hasFrontends() && cookie.first)
- didReceiveResourceResponseImpl(cookie, identifier, loader, response);
+ // Call this unconditionally so that we're able to log to console with no front-end attached.
+ didReceiveResourceResponseImpl(cookie, identifier, loader, response);
#endif
}
-inline void InspectorInstrumentation::didReceiveContentLength(Frame* frame, unsigned long identifier, int lengthReceived)
+inline void InspectorInstrumentation::didReceiveContentLength(Frame* frame, unsigned long identifier, int dataLength, int lengthReceived)
{
#if ENABLE(INSPECTOR)
if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
- didReceiveContentLengthImpl(inspectorAgent, identifier, lengthReceived);
+ didReceiveContentLengthImpl(inspectorAgent, identifier, dataLength, lengthReceived);
#endif
}
@@ -695,7 +684,7 @@ inline void InspectorInstrumentation::didFinishLoading(Frame* frame, unsigned lo
inline void InspectorInstrumentation::didFailLoading(Frame* frame, unsigned long identifier, const ResourceError& error)
{
#if ENABLE(INSPECTOR)
- if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
didFailLoadingImpl(inspectorAgent, identifier, error);
#endif
}
diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp
new file mode 100644
index 0000000..af053c9
--- /dev/null
+++ b/Source/WebCore/inspector/InspectorPageAgent.cpp
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "InspectorPageAgent.h"
+
+#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "CachedResourceLoader.h"
+#include "Cookie.h"
+#include "CookieJar.h"
+#include "DocumentLoader.h"
+#include "Frame.h"
+#include "FrameLoadRequest.h"
+#include "InjectedScriptManager.h"
+#include "InspectorFrontend.h"
+#include "InspectorValues.h"
+#include "InstrumentingAgents.h"
+#include "Page.h"
+#include "ScriptObject.h"
+#include "UserGestureIndicator.h"
+#include "WindowFeatures.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/ListHashSet.h>
+
+namespace WebCore {
+
+PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* inspectedPage, InjectedScriptManager* injectedScriptManager)
+{
+ return adoptPtr(new InspectorPageAgent(instrumentingAgents, inspectedPage, injectedScriptManager));
+}
+
+InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* inspectedPage, InjectedScriptManager* injectedScriptManager)
+ : m_instrumentingAgents(instrumentingAgents)
+ , m_inspectedPage(inspectedPage)
+ , m_injectedScriptManager(injectedScriptManager)
+ , m_frontend(0)
+{
+}
+
+void InspectorPageAgent::setFrontend(InspectorFrontend* frontend)
+{
+ m_frontend = frontend;
+ m_instrumentingAgents->setInspectorPageAgent(this);
+
+ // Initialize Web Inspector title.
+ m_frontend->page()->inspectedURLChanged(m_inspectedPage->mainFrame()->document()->url().string());
+
+}
+
+void InspectorPageAgent::clearFrontend()
+{
+ m_instrumentingAgents->setInspectorPageAgent(0);
+ m_userAgentOverride = "";
+ m_frontend = 0;
+}
+
+void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& source)
+{
+ m_scriptsToEvaluateOnLoad.append(source);
+}
+
+void InspectorPageAgent::removeAllScriptsToEvaluateOnLoad(ErrorString*)
+{
+ m_scriptsToEvaluateOnLoad.clear();
+}
+
+void InspectorPageAgent::reloadPage(ErrorString*, bool ignoreCache)
+{
+ m_inspectedPage->mainFrame()->loader()->reload(ignoreCache);
+}
+
+void InspectorPageAgent::openInInspectedWindow(ErrorString*, const String& url)
+{
+ Frame* mainFrame = m_inspectedPage->mainFrame();
+
+ FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
+
+ bool created;
+ WindowFeatures windowFeatures;
+ Frame* newFrame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
+ if (!newFrame)
+ return;
+
+ UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
+ newFrame->loader()->setOpener(mainFrame);
+ newFrame->page()->setOpenedByDOM();
+ newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
+}
+
+void InspectorPageAgent::setUserAgentOverride(ErrorString*, const String& userAgent)
+{
+ m_userAgentOverride = userAgent;
+}
+
+void InspectorPageAgent::applyUserAgentOverride(String* userAgent) const
+{
+ if (!m_userAgentOverride.isEmpty())
+ *userAgent = m_userAgentOverride;
+}
+
+static PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie& cookie)
+{
+ RefPtr<InspectorObject> value = InspectorObject::create();
+ value->setString("name", cookie.name);
+ value->setString("value", cookie.value);
+ value->setString("domain", cookie.domain);
+ value->setString("path", cookie.path);
+ value->setNumber("expires", cookie.expires);
+ value->setNumber("size", (cookie.name.length() + cookie.value.length()));
+ value->setBoolean("httpOnly", cookie.httpOnly);
+ value->setBoolean("secure", cookie.secure);
+ value->setBoolean("session", cookie.session);
+ return value;
+}
+
+static PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
+{
+ RefPtr<InspectorArray> cookies = InspectorArray::create();
+
+ ListHashSet<Cookie>::iterator end = cookiesList.end();
+ ListHashSet<Cookie>::iterator it = cookiesList.begin();
+ for (int i = 0; it != end; ++it, i++)
+ cookies->pushObject(buildObjectForCookie(*it));
+
+ return cookies;
+}
+
+void InspectorPageAgent::getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
+{
+ // If we can get raw cookies.
+ ListHashSet<Cookie> rawCookiesList;
+
+ // If we can't get raw cookies - fall back to String representation
+ String stringCookiesList;
+
+ // Return value to getRawCookies should be the same for every call because
+ // the return value is platform/network backend specific, and the call will
+ // always return the same true/false value.
+ bool rawCookiesImplemented = false;
+
+ for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
+ Document* document = frame->document();
+ const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
+ CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
+ for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
+ Vector<Cookie> docCookiesList;
+ rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, it->second->url()), docCookiesList);
+
+ if (!rawCookiesImplemented) {
+ // FIXME: We need duplication checking for the String representation of cookies.
+ ExceptionCode ec = 0;
+ stringCookiesList += document->cookie(ec);
+ // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here
+ // because "document" is the document of the main frame of the page.
+ ASSERT(!ec);
+ } else {
+ int cookiesSize = docCookiesList.size();
+ for (int i = 0; i < cookiesSize; i++) {
+ if (!rawCookiesList.contains(docCookiesList[i]))
+ rawCookiesList.add(docCookiesList[i]);
+ }
+ }
+ }
+ }
+
+ if (rawCookiesImplemented)
+ *cookies = buildArrayForCookies(rawCookiesList);
+ else
+ *cookiesString = stringCookiesList;
+}
+
+void InspectorPageAgent::deleteCookie(ErrorString*, const String& cookieName, const String& domain)
+{
+ for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
+ Document* document = frame->document();
+ if (document->url().host() != domain)
+ continue;
+ const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
+ CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
+ for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it)
+ WebCore::deleteCookie(document, KURL(ParsedURLString, it->second->url()), cookieName);
+ }
+}
+
+void InspectorPageAgent::inspectedURLChanged(const String& url)
+{
+ m_frontend->page()->inspectedURLChanged(url);
+}
+
+void InspectorPageAgent::restore()
+{
+ inspectedURLChanged(m_inspectedPage->mainFrame()->document()->url().string());
+}
+
+void InspectorPageAgent::didCommitLoad(const String& url)
+{
+ inspectedURLChanged(url);
+}
+
+void InspectorPageAgent::domContentEventFired()
+{
+ m_frontend->page()->domContentEventFired(currentTime());
+}
+
+void InspectorPageAgent::loadEventFired()
+{
+ m_frontend->page()->loadEventFired(currentTime());
+}
+
+void InspectorPageAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
+{
+ if (world != mainThreadNormalWorld())
+ return;
+
+ if (frame == m_inspectedPage->mainFrame())
+ m_injectedScriptManager->discardInjectedScripts();
+
+ if (m_scriptsToEvaluateOnLoad.size()) {
+ ScriptState* scriptState = mainWorldScriptState(frame);
+ for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin();
+ it != m_scriptsToEvaluateOnLoad.end(); ++it) {
+ m_injectedScriptManager->injectScript(*it, scriptState);
+ }
+ }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h
new file mode 100644
index 0000000..bb6b96f
--- /dev/null
+++ b/Source/WebCore/inspector/InspectorPageAgent.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorPageAgent_h
+#define InspectorPageAgent_h
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class DOMWrapperWorld;
+class Frame;
+class Frontend;
+class InjectedScriptManager;
+class InspectorArray;
+class InspectorFrontend;
+class InstrumentingAgents;
+class Page;
+
+typedef String ErrorString;
+
+class InspectorPageAgent {
+ WTF_MAKE_NONCOPYABLE(InspectorPageAgent);
+public:
+ static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InjectedScriptManager*);
+
+ // Page API for InspectorFrontend
+ void addScriptToEvaluateOnLoad(ErrorString*, const String& source);
+ void removeAllScriptsToEvaluateOnLoad(ErrorString*);
+ void reloadPage(ErrorString*, bool ignoreCache);
+ void openInInspectedWindow(ErrorString*, const String& url);
+ void setUserAgentOverride(ErrorString*, const String& userAgent);
+ void getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString);
+ void deleteCookie(ErrorString*, const String& cookieName, const String& domain);
+
+ // InspectorInstrumentation API
+ void inspectedURLChanged(const String& url);
+ void didCommitLoad(const String& url);
+ void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
+ void domContentEventFired();
+ void loadEventFired();
+
+ void setFrontend(InspectorFrontend*);
+ void clearFrontend();
+ void restore();
+ void applyUserAgentOverride(String* userAgent) const;
+
+private:
+ InspectorPageAgent(InstrumentingAgents*, Page*, InjectedScriptManager*);
+
+ InstrumentingAgents* m_instrumentingAgents;
+ Page* m_inspectedPage;
+ InjectedScriptManager* m_injectedScriptManager;
+ InspectorFrontend* m_frontend;
+ Vector<String> m_scriptsToEvaluateOnLoad;
+ String m_userAgentOverride;
+};
+
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+
+#endif // !defined(InspectorPageAgent_h)
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
index 8867023..870a120 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -33,14 +33,15 @@
#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
#include "Console.h"
-#include "InspectorAgent.h"
#include "InspectorConsoleAgent.h"
#include "InspectorFrontend.h"
+#include "InspectorState.h"
#include "InspectorValues.h"
#include "InstrumentingAgents.h"
#include "KURL.h"
#include "Page.h"
-#include "ScriptDebugServer.h"
+#include "PageScriptDebugServer.h"
+#include "ScriptController.h"
#include "ScriptHeapSnapshot.h"
#include "ScriptProfile.h"
#include "ScriptProfiler.h"
@@ -53,19 +54,25 @@
namespace WebCore {
+namespace ProfilerAgentState {
+static const char userInitiatedProfiling[] = "userInitiatedProfiling";
+static const char profilerEnabled[] = "profilerEnabled";
+}
+
static const char* const UserInitiatedProfileName = "org.webkit.profiles.user-initiated";
static const char* const CPUProfileType = "CPU";
static const char* const HeapProfileType = "HEAP";
-PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage)
+PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState)
{
- return adoptPtr(new InspectorProfilerAgent(instrumentingAgents, consoleAgent, inspectedPage));
+ return adoptPtr(new InspectorProfilerAgent(instrumentingAgents, consoleAgent, inspectedPage, inspectorState));
}
-InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage)
+InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState)
: m_instrumentingAgents(instrumentingAgents)
, m_consoleAgent(consoleAgent)
, m_inspectedPage(inspectedPage)
+ , m_inspectorState(inspectorState)
, m_frontend(0)
, m_enabled(false)
, m_recordingUserInitiatedProfile(false)
@@ -108,6 +115,11 @@ void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& tit
m_consoleAgent->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
}
+void InspectorProfilerAgent::collectGarbage(WebCore::ErrorString*)
+{
+ ScriptProfiler::collectGarbage();
+}
+
PassRefPtr<InspectorObject> InspectorProfilerAgent::createProfileHeader(const ScriptProfile& profile)
{
RefPtr<InspectorObject> header = InspectorObject::create();
@@ -126,12 +138,26 @@ PassRefPtr<InspectorObject> InspectorProfilerAgent::createSnapshotHeader(const S
return header;
}
+void InspectorProfilerAgent::enable(ErrorString*)
+{
+ if (enabled())
+ return;
+ m_inspectorState->setBoolean(ProfilerAgentState::profilerEnabled, true);
+ enable(false);
+}
+
+void InspectorProfilerAgent::disable(ErrorString*)
+{
+ m_inspectorState->setBoolean(ProfilerAgentState::profilerEnabled, false);
+ disable();
+}
+
void InspectorProfilerAgent::disable()
{
if (!m_enabled)
return;
m_enabled = false;
- ScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
if (m_frontend)
m_frontend->profilerWasDisabled();
}
@@ -142,7 +168,7 @@ void InspectorProfilerAgent::enable(bool skipRecompile)
return;
m_enabled = true;
if (!skipRecompile)
- ScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
if (m_frontend)
m_frontend->profilerWasEnabled();
}
@@ -155,16 +181,6 @@ String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool increment
return makeString(UserInitiatedProfileName, '.', String::number(m_currentUserInitiatedProfileNumber));
}
-void InspectorProfilerAgent::getExactHeapSnapshotNodeRetainedSize(ErrorString*, unsigned long uid, unsigned long nodeId, long* size)
-{
- HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
- if (it != m_snapshots.end()) {
- RefPtr<ScriptHeapSnapshot> snapshot = it->second;
- *size = snapshot->exactRetainedSize(nodeId);
- } else
- *size = -1;
-}
-
void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<InspectorArray>* headers)
{
ProfilesMap::iterator profilesEnd = m_profiles.end();
@@ -179,13 +195,13 @@ namespace {
class OutputStream : public ScriptHeapSnapshot::OutputStream {
public:
- OutputStream(InspectorFrontend::Profiler* frontend, unsigned long uid)
+ OutputStream(InspectorFrontend::Profiler* frontend, unsigned uid)
: m_frontend(frontend), m_uid(uid) { }
void Write(const String& chunk) { m_frontend->addHeapSnapshotChunk(m_uid, chunk); }
void Close() { m_frontend->finishHeapSnapshot(m_uid); }
private:
InspectorFrontend::Profiler* m_frontend;
- unsigned long m_uid;
+ int m_uid;
};
} // namespace
@@ -224,6 +240,7 @@ void InspectorProfilerAgent::removeProfile(ErrorString*, const String& type, uns
void InspectorProfilerAgent::resetState()
{
+ stopUserInitiatedProfiling();
m_profiles.clear();
m_snapshots.clear();
m_currentUserInitiatedProfileNumber = 1;
@@ -240,13 +257,44 @@ void InspectorProfilerAgent::resetFrontendProfiles()
m_frontend->resetProfiles();
}
+void InspectorProfilerAgent::setFrontend(InspectorFrontend* frontend)
+{
+ m_frontend = frontend->profiler();
+ restoreEnablement();
+}
+
+void InspectorProfilerAgent::clearFrontend()
+{
+ m_frontend = 0;
+ stopUserInitiatedProfiling();
+}
+
+void InspectorProfilerAgent::restore()
+{
+ // Need to restore enablement state here as in setFrontend m_inspectorState wasn't loaded yet.
+ restoreEnablement();
+
+ // Revisit this.
+ resetFrontendProfiles();
+ if (m_inspectorState->getBoolean(ProfilerAgentState::userInitiatedProfiling))
+ startUserInitiatedProfiling();
+}
+
+void InspectorProfilerAgent::restoreEnablement()
+{
+ if (m_inspectorState->getBoolean(ProfilerAgentState::profilerEnabled)) {
+ ErrorString error;
+ enable(&error);
+ }
+}
+
void InspectorProfilerAgent::startUserInitiatedProfiling()
{
if (m_recordingUserInitiatedProfile)
return;
if (!enabled()) {
enable(true);
- ScriptDebugServer::shared().recompileAllJSFunctions();
+ PageScriptDebugServer::shared().recompileAllJSFunctions(0);
}
m_recordingUserInitiatedProfile = true;
String title = getCurrentUserInitiatedProfileName(true);
@@ -258,6 +306,7 @@ void InspectorProfilerAgent::startUserInitiatedProfiling()
ScriptProfiler::start(scriptState, title);
addStartProfilingMessageToConsole(title, 0, String());
toggleRecordButton(true);
+ m_inspectorState->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
}
void InspectorProfilerAgent::stopUserInitiatedProfiling(bool ignoreProfile)
@@ -281,6 +330,7 @@ void InspectorProfilerAgent::stopUserInitiatedProfiling(bool ignoreProfile)
addProfileFinishedMessageToConsole(profile, 0, String());
}
toggleRecordButton(false);
+ m_inspectorState->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
}
namespace {
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.h b/Source/WebCore/inspector/InspectorProfilerAgent.h
index 839d801..6c5cf4c 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.h
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.h
@@ -45,6 +45,7 @@ class InspectorArray;
class InspectorConsoleAgent;
class InspectorFrontend;
class InspectorObject;
+class InspectorState;
class InstrumentingAgents;
class Page;
class ScriptHeapSnapshot;
@@ -55,26 +56,35 @@ typedef String ErrorString;
class InspectorProfilerAgent {
WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
public:
- static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, InspectorConsoleAgent*, Page*);
+ static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*);
virtual ~InspectorProfilerAgent();
void addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL);
void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
+ void collectGarbage(ErrorString*);
void clearProfiles(ErrorString*) { resetState(); }
+ void resetState();
+
+ void enable(ErrorString*);
+ void disable(ErrorString*);
+ void isEnabled(ErrorString*, bool* result) { *result = enabled(); }
+ void start(ErrorString*) { startUserInitiatedProfiling(); }
+ void stop(ErrorString*) { stopUserInitiatedProfiling(); }
+
void disable();
void enable(bool skipRecompile);
bool enabled() { return m_enabled; }
String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
- void getExactHeapSnapshotNodeRetainedSize(ErrorString*, unsigned long uid, unsigned long nodeId, long* size);
void getProfileHeaders(ErrorString* error, RefPtr<InspectorArray>* headers);
void getProfile(ErrorString* error, const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject);
bool isRecordingUserInitiatedProfile() { return m_recordingUserInitiatedProfile; }
void removeProfile(ErrorString* error, const String& type, unsigned uid);
- void resetState();
- void resetFrontendProfiles();
- void setFrontend(InspectorFrontend* frontend) { m_frontend = frontend->profiler(); }
- void clearFrontend() { m_frontend = 0; }
+
+ void setFrontend(InspectorFrontend*);
+ void clearFrontend();
+ void restore();
+
void startUserInitiatedProfiling();
void stopUserInitiatedProfiling(bool ignoreProfile = false);
void takeHeapSnapshot(ErrorString* error, bool detailed);
@@ -84,13 +94,17 @@ private:
typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
typedef HashMap<unsigned int, RefPtr<ScriptHeapSnapshot> > HeapSnapshotsMap;
- InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, Page*);
+ void resetFrontendProfiles();
+ void restoreEnablement();
+
+ InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*);
PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile);
PassRefPtr<InspectorObject> createSnapshotHeader(const ScriptHeapSnapshot& snapshot);
InstrumentingAgents* m_instrumentingAgents;
InspectorConsoleAgent* m_consoleAgent;
Page* m_inspectedPage;
+ InspectorState* m_inspectorState;
InspectorFrontend::Profiler* m_frontend;
bool m_enabled;
bool m_recordingUserInitiatedProfile;
diff --git a/Source/WebCore/inspector/InspectorResourceAgent.cpp b/Source/WebCore/inspector/InspectorResourceAgent.cpp
index db41640..1e2c16d 100644
--- a/Source/WebCore/inspector/InspectorResourceAgent.cpp
+++ b/Source/WebCore/inspector/InspectorResourceAgent.cpp
@@ -62,9 +62,10 @@
#include "WebSocketHandshakeResponse.h"
#include <wtf/CurrentTime.h>
+#include <wtf/HexNumber.h>
#include <wtf/ListHashSet.h>
#include <wtf/RefPtr.h>
-#include <wtf/text/StringBuffer.h>
+#include <wtf/text/StringBuilder.h>
namespace WebCore {
@@ -90,10 +91,12 @@ void InspectorResourceAgent::restore()
enable();
}
-bool InspectorResourceAgent::resourceContent(Frame* frame, const KURL& url, String* result)
+void InspectorResourceAgent::resourceContent(ErrorString* errorString, Frame* frame, const KURL& url, String* result)
{
- if (!frame)
- return false;
+ if (!frame) {
+ *errorString = "No frame to get resource content for.";
+ return;
+ }
String textEncodingName;
RefPtr<SharedBuffer> buffer = InspectorResourceAgent::resourceData(frame, url, &textEncodingName);
@@ -103,23 +106,22 @@ bool InspectorResourceAgent::resourceContent(Frame* frame, const KURL& url, Stri
if (!encoding.isValid())
encoding = WindowsLatin1Encoding();
*result = encoding.decode(buffer->data(), buffer->size());
- return true;
+ return;
}
-
- return false;
+ *errorString = "No resource with given URL found.";
}
-bool InspectorResourceAgent::resourceContentBase64(Frame* frame, const KURL& url, String* result)
+void InspectorResourceAgent::resourceContentBase64(ErrorString* errorString, Frame* frame, const KURL& url, String* result)
{
String textEncodingName;
RefPtr<SharedBuffer> data = InspectorResourceAgent::resourceData(frame, url, &textEncodingName);
if (!data) {
*result = String();
- return false;
+ *errorString = "No resource with given URL found.";
+ return;
}
*result = base64Encode(data->data(), data->size());
- return true;
}
PassRefPtr<SharedBuffer> InspectorResourceAgent::resourceData(Frame* frame, const KURL& url, String* textEncodingName)
@@ -193,69 +195,41 @@ static PassRefPtr<InspectorObject> buildObjectForResourceRequest(const ResourceR
{
RefPtr<InspectorObject> requestObject = InspectorObject::create();
requestObject->setString("url", request.url().string());
- requestObject->setString("httpMethod", request.httpMethod());
- requestObject->setObject("httpHeaderFields", buildObjectForHeaders(request.httpHeaderFields()));
+ requestObject->setString("method", request.httpMethod());
+ requestObject->setObject("headers", buildObjectForHeaders(request.httpHeaderFields()));
if (request.httpBody() && !request.httpBody()->isEmpty())
- requestObject->setString("requestFormData", request.httpBody()->flattenToString());
+ requestObject->setString("postData", request.httpBody()->flattenToString());
return requestObject;
}
static PassRefPtr<InspectorObject> buildObjectForResourceResponse(const ResourceResponse& response)
{
RefPtr<InspectorObject> responseObject = InspectorObject::create();
- if (response.isNull()) {
- responseObject->setBoolean("isNull", true);
+ if (response.isNull())
return responseObject;
- }
- responseObject->setString("url", response.url().string());
+
+ responseObject->setNumber("status", response.resourceLoadInfo() ? response.resourceLoadInfo()->httpStatusCode : response.httpStatusCode());
+ responseObject->setString("statusText", response.resourceLoadInfo() ? response.resourceLoadInfo()->httpStatusText : response.httpStatusText());
+ responseObject->setObject("headers", buildObjectForHeaders(response.resourceLoadInfo() ? response.resourceLoadInfo()->responseHeaders : response.httpHeaderFields()));
+
responseObject->setString("mimeType", response.mimeType());
- responseObject->setNumber("expectedContentLength", response.expectedContentLength());
- responseObject->setString("textEncodingName", response.textEncodingName());
- responseObject->setString("suggestedFilename", response.suggestedFilename());
- responseObject->setNumber("httpStatusCode", response.httpStatusCode());
- responseObject->setString("httpStatusText", response.httpStatusText());
- responseObject->setObject("httpHeaderFields", buildObjectForHeaders(response.httpHeaderFields()));
responseObject->setBoolean("connectionReused", response.connectionReused());
responseObject->setNumber("connectionID", response.connectionID());
- responseObject->setBoolean("wasCached", response.wasCached());
+ responseObject->setBoolean("fromDiskCache", response.wasCached());
if (response.resourceLoadTiming())
responseObject->setObject("timing", buildObjectForTiming(*response.resourceLoadTiming()));
- if (response.resourceLoadInfo()) {
- RefPtr<InspectorObject> loadInfoObject = InspectorObject::create();
- loadInfoObject->setNumber("httpStatusCode", response.resourceLoadInfo()->httpStatusCode);
- loadInfoObject->setString("httpStatusText", response.resourceLoadInfo()->httpStatusText);
- loadInfoObject->setObject("requestHeaders", buildObjectForHeaders(response.resourceLoadInfo()->requestHeaders));
- loadInfoObject->setObject("responseHeaders", buildObjectForHeaders(response.resourceLoadInfo()->responseHeaders));
- responseObject->setObject("loadInfo", loadInfoObject);
- }
- return responseObject;
-}
-static unsigned long frameId(Frame* frame)
-{
- return reinterpret_cast<uintptr_t>(frame);
-}
+ if (response.resourceLoadInfo())
+ responseObject->setObject("requestHeaders", buildObjectForHeaders(response.resourceLoadInfo()->requestHeaders));
-static PassRefPtr<InspectorObject> buildObjectForDocumentLoader(DocumentLoader* loader)
-{
- RefPtr<InspectorObject> documentLoaderObject = InspectorObject::create();
- documentLoaderObject->setNumber("frameId", frameId(loader->frame()));
- documentLoaderObject->setNumber("loaderId", reinterpret_cast<uintptr_t>(loader));
- documentLoaderObject->setString("url", loader->requestURL().string());
- return documentLoaderObject;
+ return responseObject;
}
-static PassRefPtr<InspectorObject> buildObjectForFrameResource(Frame* frame)
+static String pointerAsId(void* pointer)
{
- FrameLoader* frameLoader = frame->loader();
- DocumentLoader* loader = frameLoader->documentLoader();
-
- RefPtr<InspectorObject> resourceObject = InspectorObject::create();
- resourceObject->setString("url", loader->url().string());
- resourceObject->setObject("loader", buildObjectForDocumentLoader(loader));
- resourceObject->setObject("request", buildObjectForResourceRequest(loader->request()));
- resourceObject->setObject("response", buildObjectForResourceResponse(loader->response()));
- return resourceObject;
+ unsigned long long address = reinterpret_cast<uintptr_t>(pointer);
+ // We want 0 to be "", so that JavaScript checks for if (frameId) worked.
+ return String::format("%.0llX", address);
}
static String cachedResourceTypeString(const CachedResource& cachedResource)
@@ -279,56 +253,22 @@ static String cachedResourceTypeString(const CachedResource& cachedResource)
return "Other";
}
-static PassRefPtr<InspectorObject> buildObjectForCachedResource(DocumentLoader* loader, const CachedResource& cachedResource)
+static PassRefPtr<InspectorObject> buildObjectForCachedResource(const CachedResource& cachedResource)
{
RefPtr<InspectorObject> resourceObject = InspectorObject::create();
resourceObject->setString("url", cachedResource.url());
resourceObject->setString("type", cachedResourceTypeString(cachedResource));
- resourceObject->setNumber("encodedSize", cachedResource.encodedSize());
+ resourceObject->setNumber("bodySize", cachedResource.encodedSize());
resourceObject->setObject("response", buildObjectForResourceResponse(cachedResource.response()));
- resourceObject->setObject("loader", buildObjectForDocumentLoader(loader));
return resourceObject;
}
-static void populateObjectWithFrameResources(Frame* frame, PassRefPtr<InspectorObject> frameResources)
-{
- frameResources->setObject("resource", buildObjectForFrameResource(frame));
- RefPtr<InspectorArray> subresources = InspectorArray::create();
- frameResources->setArray("subresources", subresources);
-
- const CachedResourceLoader::DocumentResourceMap& allResources = frame->document()->cachedResourceLoader()->allCachedResources();
- CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
- for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
- CachedResource* cachedResource = it->second.get();
- RefPtr<InspectorObject> cachedResourceObject = buildObjectForCachedResource(frame->loader()->documentLoader(), *cachedResource);
- subresources->pushValue(cachedResourceObject);
- }
-}
-
InspectorResourceAgent::~InspectorResourceAgent()
{
ASSERT(!m_instrumentingAgents->inspectorResourceAgent());
}
-void InspectorResourceAgent::identifierForInitialRequest(unsigned long identifier, const KURL& url, DocumentLoader* loader)
-{
- RefPtr<InspectorObject> loaderObject = buildObjectForDocumentLoader(loader);
- RefPtr<ScriptCallStack> callStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
- RefPtr<InspectorValue> callStackValue;
- if (callStack)
- callStackValue = callStack->buildInspectorObject();
- else
- callStackValue = InspectorValue::null();
- m_frontend->identifierForInitialRequest(identifier, url.string(), loaderObject, callStackValue);
-}
-
-void InspectorResourceAgent::setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject> headers)
-{
- m_state->setObject(ResourceAgentState::extraRequestHeaders, headers);
-}
-
-
-void InspectorResourceAgent::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
RefPtr<InspectorObject> headers = m_state->getObject(ResourceAgentState::extraRequestHeaders);
@@ -344,12 +284,18 @@ void InspectorResourceAgent::willSendRequest(unsigned long identifier, ResourceR
request.setReportLoadTiming(true);
request.setReportRawHeaders(true);
- m_frontend->willSendRequest(identifier, currentTime(), buildObjectForResourceRequest(request), buildObjectForResourceResponse(redirectResponse));
+ RefPtr<ScriptCallStack> callStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
+ RefPtr<InspectorArray> callStackValue;
+ if (callStack)
+ callStackValue = callStack->buildInspectorArray();
+ else
+ callStackValue = InspectorArray::create();
+ m_frontend->requestWillBeSent(static_cast<int>(identifier), pointerAsId(loader->frame()), pointerAsId(loader), loader->url().string(), buildObjectForResourceRequest(request), buildObjectForResourceResponse(redirectResponse), currentTime(), callStackValue);
}
void InspectorResourceAgent::markResourceAsCached(unsigned long identifier)
{
- m_frontend->markResourceAsCached(identifier);
+ m_frontend->resourceMarkedAsCached(static_cast<int>(identifier));
}
void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
@@ -372,16 +318,16 @@ void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, Docume
else if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == "Other")
type = "Document";
}
- m_frontend->didReceiveResponse(identifier, currentTime(), type, resourceResponse);
+ m_frontend->responseReceived(static_cast<int>(identifier), currentTime(), type, resourceResponse);
// If we revalidated the resource and got Not modified, send content length following didReceiveResponse
// as there will be no calls to didReceiveContentLength from the network stack.
if (cachedResourceSize && response.httpStatusCode() == 304)
- didReceiveContentLength(identifier, cachedResourceSize);
+ didReceiveContentLength(identifier, cachedResourceSize, 0);
}
-void InspectorResourceAgent::didReceiveContentLength(unsigned long identifier, int lengthReceived)
+void InspectorResourceAgent::didReceiveContentLength(unsigned long identifier, int dataLength, int lengthReceived)
{
- m_frontend->didReceiveContentLength(identifier, currentTime(), lengthReceived);
+ m_frontend->dataReceived(static_cast<int>(identifier), currentTime(), dataLength, lengthReceived);
}
void InspectorResourceAgent::didFinishLoading(unsigned long identifier, double finishTime)
@@ -389,29 +335,29 @@ void InspectorResourceAgent::didFinishLoading(unsigned long identifier, double f
if (!finishTime)
finishTime = currentTime();
- m_frontend->didFinishLoading(identifier, finishTime);
+ m_frontend->loadingFinished(static_cast<int>(identifier), finishTime);
}
void InspectorResourceAgent::didFailLoading(unsigned long identifier, const ResourceError& error)
{
- m_frontend->didFailLoading(identifier, currentTime(), error.localizedDescription());
+ m_frontend->loadingFailed(static_cast<int>(identifier), currentTime(), error.localizedDescription());
}
void InspectorResourceAgent::didLoadResourceFromMemoryCache(DocumentLoader* loader, const CachedResource* resource)
{
- m_frontend->didLoadResourceFromMemoryCache(currentTime(), buildObjectForCachedResource(loader, *resource));
+ m_frontend->resourceLoadedFromMemoryCache(pointerAsId(loader->frame()), pointerAsId(loader), loader->url().string(), currentTime(), buildObjectForCachedResource(*resource));
}
void InspectorResourceAgent::setInitialContent(unsigned long identifier, const String& sourceString, const String& type)
{
- m_frontend->setInitialContent(identifier, sourceString, type);
+ m_frontend->initialContentSet(static_cast<int>(identifier), sourceString, type);
}
static PassRefPtr<InspectorObject> buildObjectForFrame(Frame* frame)
{
RefPtr<InspectorObject> frameObject = InspectorObject::create();
- frameObject->setNumber("id", frameId(frame));
- frameObject->setNumber("parentId", frameId(frame->tree()->parent()));
+ frameObject->setString("id", pointerAsId(frame));
+ frameObject->setString("parentId", pointerAsId(frame->tree()->parent()));
if (frame->ownerElement()) {
String name = frame->ownerElement()->getAttribute(HTMLNames::nameAttr);
if (name.isEmpty())
@@ -419,34 +365,48 @@ static PassRefPtr<InspectorObject> buildObjectForFrame(Frame* frame)
frameObject->setString("name", name);
}
frameObject->setString("url", frame->document()->url().string());
+ frameObject->setString("loaderId", pointerAsId(frame->loader()->documentLoader()));
+
return frameObject;
}
-static PassRefPtr<InspectorObject> buildObjectForFrameTree(Frame* frame, bool dumpResources)
+static PassRefPtr<InspectorObject> buildObjectForFrameTree(Frame* frame)
{
+ RefPtr<InspectorObject> result = InspectorObject::create();
RefPtr<InspectorObject> frameObject = buildObjectForFrame(frame);
+ result->setObject("frame", frameObject);
+
+ RefPtr<InspectorArray> subresources = InspectorArray::create();
+ result->setArray("resources", subresources);
+ const CachedResourceLoader::DocumentResourceMap& allResources = frame->document()->cachedResourceLoader()->allCachedResources();
+ CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
+ for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
+ CachedResource* cachedResource = it->second.get();
+ RefPtr<InspectorObject> resourceObject = InspectorObject::create();
+ resourceObject->setString("url", cachedResource->url());
+ resourceObject->setString("type", cachedResourceTypeString(*cachedResource));
+ subresources->pushValue(resourceObject);
+ }
- if (dumpResources)
- populateObjectWithFrameResources(frame, frameObject);
RefPtr<InspectorArray> childrenArray;
for (Frame* child = frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
if (!childrenArray) {
childrenArray = InspectorArray::create();
- frameObject->setArray("children", childrenArray);
+ result->setArray("childFrames", childrenArray);
}
- childrenArray->pushObject(buildObjectForFrameTree(child, dumpResources));
+ childrenArray->pushObject(buildObjectForFrameTree(child));
}
- return frameObject;
+ return result;
}
void InspectorResourceAgent::didCommitLoad(DocumentLoader* loader)
{
- m_frontend->didCommitLoadForFrame(buildObjectForFrame(loader->frame()), buildObjectForDocumentLoader(loader));
+ m_frontend->frameNavigated(buildObjectForFrame(loader->frame()), pointerAsId(loader));
}
void InspectorResourceAgent::frameDetachedFromParent(Frame* frame)
{
- m_frontend->frameDetachedFromParent(frameId(frame));
+ m_frontend->frameDetached(pointerAsId(frame));
}
#if ENABLE(WEB_SOCKETS)
@@ -456,63 +416,58 @@ void InspectorResourceAgent::frameDetachedFromParent(Frame* frame)
static String createReadableStringFromBinary(const unsigned char* value, size_t length)
{
ASSERT(length > 0);
- static const char hexDigits[17] = "0123456789ABCDEF";
- size_t bufferSize = length * 3 - 1;
- StringBuffer buffer(bufferSize);
- size_t index = 0;
+ StringBuilder builder;
+ builder.reserveCapacity(length * 3 - 1);
for (size_t i = 0; i < length; ++i) {
if (i > 0)
- buffer[index++] = ':';
- buffer[index++] = hexDigits[value[i] >> 4];
- buffer[index++] = hexDigits[value[i] & 0xF];
+ builder.append(':');
+ appendByteAsHex(value[i], builder);
}
- ASSERT(index == bufferSize);
- return String::adopt(buffer);
+ return builder.toString();
}
void InspectorResourceAgent::didCreateWebSocket(unsigned long identifier, const KURL& requestURL)
{
- m_frontend->didCreateWebSocket(identifier, requestURL.string());
+ m_frontend->webSocketCreated(static_cast<int>(identifier), requestURL.string());
}
void InspectorResourceAgent::willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest& request)
{
RefPtr<InspectorObject> requestObject = InspectorObject::create();
- requestObject->setObject("webSocketHeaderFields", buildObjectForHeaders(request.headerFields()));
- requestObject->setString("webSocketRequestKey3", createReadableStringFromBinary(request.key3().value, sizeof(request.key3().value)));
- m_frontend->willSendWebSocketHandshakeRequest(identifier, currentTime(), requestObject);
+ requestObject->setObject("headers", buildObjectForHeaders(request.headerFields()));
+ requestObject->setString("requestKey3", createReadableStringFromBinary(request.key3().value, sizeof(request.key3().value)));
+ m_frontend->webSocketWillSendHandshakeRequest(static_cast<int>(identifier), currentTime(), requestObject);
}
void InspectorResourceAgent::didReceiveWebSocketHandshakeResponse(unsigned long identifier, const WebSocketHandshakeResponse& response)
{
RefPtr<InspectorObject> responseObject = InspectorObject::create();
- responseObject->setNumber("statusCode", response.statusCode());
+ responseObject->setNumber("status", response.statusCode());
responseObject->setString("statusText", response.statusText());
- responseObject->setObject("webSocketHeaderFields", buildObjectForHeaders(response.headerFields()));
- responseObject->setString("webSocketChallengeResponse", createReadableStringFromBinary(response.challengeResponse().value, sizeof(response.challengeResponse().value)));
- m_frontend->didReceiveWebSocketHandshakeResponse(identifier, currentTime(), responseObject);
+ responseObject->setObject("headers", buildObjectForHeaders(response.headerFields()));
+ responseObject->setString("challengeResponse", createReadableStringFromBinary(response.challengeResponse().value, sizeof(response.challengeResponse().value)));
+ m_frontend->webSocketHandshakeResponseReceived(static_cast<int>(identifier), currentTime(), responseObject);
}
void InspectorResourceAgent::didCloseWebSocket(unsigned long identifier)
{
- m_frontend->didCloseWebSocket(identifier, currentTime());
+ m_frontend->webSocketClosed(static_cast<int>(identifier), currentTime());
}
#endif // ENABLE(WEB_SOCKETS)
-Frame* InspectorResourceAgent::frameForId(unsigned long frameId)
+Frame* InspectorResourceAgent::frameForId(const String& frameId)
{
Frame* mainFrame = m_page->mainFrame();
for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext(mainFrame)) {
- if (reinterpret_cast<uintptr_t>(frame) == frameId)
+ if (pointerAsId(frame) == frameId)
return frame;
}
return 0;
}
-void InspectorResourceAgent::enable(ErrorString*, RefPtr<InspectorObject>* object)
+void InspectorResourceAgent::enable(ErrorString*)
{
enable();
- *object = buildObjectForFrameTree(m_page->mainFrame(), true);
}
void InspectorResourceAgent::enable()
@@ -529,17 +484,27 @@ void InspectorResourceAgent::disable(ErrorString*)
m_instrumentingAgents->setInspectorResourceAgent(0);
}
-void InspectorResourceAgent::resourceContent(ErrorString*, unsigned long frameId, const String& url, bool base64Encode, bool* success, String* content)
+void InspectorResourceAgent::getCachedResources(ErrorString*, RefPtr<InspectorObject>* object)
+{
+ *object = buildObjectForFrameTree(m_page->mainFrame());
+}
+
+void InspectorResourceAgent::getResourceContent(ErrorString* errorString, const String& frameId, const String& url, bool base64Encode, String* content)
{
Frame* frame = frameForId(frameId);
if (!frame) {
- *success = false;
+ *errorString = "No frame for given id found.";
return;
}
if (base64Encode)
- *success = InspectorResourceAgent::resourceContentBase64(frame, KURL(ParsedURLString, url), content);
+ InspectorResourceAgent::resourceContentBase64(errorString, frame, KURL(ParsedURLString, url), content);
else
- *success = InspectorResourceAgent::resourceContent(frame, KURL(ParsedURLString, url), content);
+ InspectorResourceAgent::resourceContent(errorString, frame, KURL(ParsedURLString, url), content);
+}
+
+void InspectorResourceAgent::setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject> headers)
+{
+ m_state->setObject(ResourceAgentState::extraRequestHeaders, headers);
}
InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorState* state)
diff --git a/Source/WebCore/inspector/InspectorResourceAgent.h b/Source/WebCore/inspector/InspectorResourceAgent.h
index f1b3d46..c919469 100644
--- a/Source/WebCore/inspector/InspectorResourceAgent.h
+++ b/Source/WebCore/inspector/InspectorResourceAgent.h
@@ -81,18 +81,17 @@ public:
static PassRefPtr<InspectorResourceAgent> restore(Page*, InspectorState*, InspectorFrontend*);
- static bool resourceContent(Frame*, const KURL&, String* result);
- static bool resourceContentBase64(Frame*, const KURL&, String* result);
+ static void resourceContent(ErrorString*, Frame*, const KURL&, String* result);
+ static void resourceContentBase64(ErrorString*, Frame*, const KURL&, String* result);
static PassRefPtr<SharedBuffer> resourceData(Frame*, const KURL&, String* textEncodingName);
static CachedResource* cachedResource(Frame*, const KURL&);
~InspectorResourceAgent();
- void identifierForInitialRequest(unsigned long identifier, const KURL&, DocumentLoader*);
- void willSendRequest(unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
+ void willSendRequest(unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
void markResourceAsCached(unsigned long identifier);
void didReceiveResponse(unsigned long identifier, DocumentLoader* laoder, const ResourceResponse&);
- void didReceiveContentLength(unsigned long identifier, int lengthReceived);
+ void didReceiveContentLength(unsigned long identifier, int dataLength, int lengthReceived);
void didFinishLoading(unsigned long identifier, double finishTime);
void didFailLoading(unsigned long identifier, const ResourceError&);
void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
@@ -107,12 +106,13 @@ public:
void didCloseWebSocket(unsigned long identifier);
#endif
- Frame* frameForId(unsigned long);
+ Frame* frameForId(const String& frameId);
// Called from frontend
- void enable(ErrorString*, RefPtr<InspectorObject>*);
+ void enable(ErrorString*);
void disable(ErrorString*);
- void resourceContent(ErrorString*, unsigned long frameId, const String& url, bool base64Encode, bool* resourceFound, String* content);
+ void getCachedResources(ErrorString*, RefPtr<InspectorObject>*);
+ void getResourceContent(ErrorString*, const String& frameId, const String& url, bool base64Encode, String* content);
void setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject>);
private:
diff --git a/Source/WebCore/inspector/InspectorRuntimeAgent.cpp b/Source/WebCore/inspector/InspectorRuntimeAgent.cpp
index badd8e1..04fed9d 100644
--- a/Source/WebCore/inspector/InspectorRuntimeAgent.cpp
+++ b/Source/WebCore/inspector/InspectorRuntimeAgent.cpp
@@ -33,56 +33,71 @@
#if ENABLE(INSPECTOR)
-#include "InjectedScriptHost.h"
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
#include "InspectorValues.h"
+#include "Page.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
namespace WebCore {
-InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptHost* injectedScriptHost)
- : m_injectedScriptHost(injectedScriptHost)
+PassOwnPtr<InspectorRuntimeAgent> InspectorRuntimeAgent::create(InjectedScriptManager* injectedScriptManager, Page* inspectedPage)
{
+ return adoptPtr(new InspectorRuntimeAgent(injectedScriptManager, inspectedPage));
}
-InspectorRuntimeAgent::~InspectorRuntimeAgent() { }
+InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* inspectedPage)
+ : m_injectedScriptManager(injectedScriptManager)
+ , m_inspectedPage(inspectedPage)
+{
+}
+
+InspectorRuntimeAgent::~InspectorRuntimeAgent()
+{
+}
-void InspectorRuntimeAgent::evaluate(ErrorString*, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result)
{
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForMainFrame();
+ ScriptState* scriptState = mainWorldScriptState(m_inspectedPage->mainFrame());
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState);
if (!injectedScript.hasNoValue())
- injectedScript.evaluate(expression, objectGroup, includeCommandLineAPI, result);
+ injectedScript.evaluate(errorString, expression, objectGroup, includeCommandLineAPI, result);
}
-void InspectorRuntimeAgent::evaluateOn(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::evaluateOn(ErrorString* errorString, const String& objectId, const String& expression, RefPtr<InspectorObject>* result)
{
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
if (!injectedScript.hasNoValue())
- injectedScript.evaluateOn(objectId, expression, result);
+ injectedScript.evaluateOn(errorString, objectId, expression, result);
}
-void InspectorRuntimeAgent::getProperties(ErrorString*, PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorArray>* result)
{
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
if (!injectedScript.hasNoValue())
- injectedScript.getProperties(objectId, ignoreHasOwnProperty, abbreviate, result);
+ injectedScript.getProperties(errorString, objectId, ignoreHasOwnProperty, abbreviate, result);
}
-void InspectorRuntimeAgent::setPropertyValue(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::setPropertyValue(ErrorString* errorString, const String& objectId, const String& propertyName, const String& expression)
{
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
if (!injectedScript.hasNoValue())
- injectedScript.setPropertyValue(objectId, propertyName, expression, result);
+ injectedScript.setPropertyValue(errorString, objectId, propertyName, expression);
+ else
+ *errorString = "No injected script found.";
}
-void InspectorRuntimeAgent::releaseObject(ErrorString*, PassRefPtr<InspectorObject> objectId)
+void InspectorRuntimeAgent::releaseObject(ErrorString*, const String& objectId)
{
- InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
if (!injectedScript.hasNoValue())
injectedScript.releaseObject(objectId);
}
-void InspectorRuntimeAgent::releaseObjectGroup(ErrorString*, long injectedScriptId, const String& objectGroup)
+void InspectorRuntimeAgent::releaseObjectGroup(ErrorString*, const String& objectGroup)
{
- m_injectedScriptHost->releaseObjectGroup(injectedScriptId, objectGroup);
+ m_injectedScriptManager->releaseObjectGroup(objectGroup);
}
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorRuntimeAgent.h b/Source/WebCore/inspector/InspectorRuntimeAgent.h
index 4274eea..48f3670 100644
--- a/Source/WebCore/inspector/InspectorRuntimeAgent.h
+++ b/Source/WebCore/inspector/InspectorRuntimeAgent.h
@@ -33,43 +33,38 @@
#if ENABLE(INSPECTOR)
-#include "InjectedScript.h"
-#include "PlatformString.h"
-
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
namespace WebCore {
-class InjectedScriptHost;
+class InjectedScriptManager;
+class InspectorArray;
class InspectorObject;
class InspectorValue;
+class Page;
typedef String ErrorString;
class InspectorRuntimeAgent {
WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent);
public:
- static PassOwnPtr<InspectorRuntimeAgent> create(InjectedScriptHost* injectedScriptHost)
- {
- return adoptPtr(new InspectorRuntimeAgent(injectedScriptHost));
- }
-
+ static PassOwnPtr<InspectorRuntimeAgent> create(InjectedScriptManager*, Page*);
~InspectorRuntimeAgent();
// Part of the protocol.
- void evaluate(ErrorString*, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
- void evaluateOn(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result);
- void releaseObject(ErrorString*, PassRefPtr<InspectorObject> objectId);
- void getProperties(ErrorString*, PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
- void setPropertyValue(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
- void releaseObjectGroup(ErrorString*, long injectedScriptId, const String& objectGroup);
+ void evaluate(ErrorString*, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result);
+ void evaluateOn(ErrorString*, const String& objectId, const String& expression, RefPtr<InspectorObject>* result);
+ void releaseObject(ErrorString*, const String& objectId);
+ void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorArray>* result);
+ void setPropertyValue(ErrorString*, const String& objectId, const String& propertyName, const String& expression);
+ void releaseObjectGroup(ErrorString*, const String& objectGroup);
private:
- InspectorRuntimeAgent(InjectedScriptHost*);
+ InspectorRuntimeAgent(InjectedScriptManager*, Page*);
- InjectedScriptHost* m_injectedScriptHost;
+ InjectedScriptManager* m_injectedScriptManager;
+ Page* m_inspectedPage;
};
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp
index 45e6e43..342cf54 100644
--- a/Source/WebCore/inspector/InspectorStyleSheet.cpp
+++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp
@@ -450,13 +450,19 @@ void InspectorStyle::populateObjectWithStyleProperties(InspectorObject* result)
RefPtr<InspectorObject> property = InspectorObject::create();
propertiesObject->pushObject(property);
- property->setString("status", it->disabled ? "disabled" : "active");
- property->setBoolean("parsedOk", propertyEntry.parsedOk);
+ String status = it->disabled ? "disabled" : "active";
+
+ // Default "parsedOk" == true.
+ if (!propertyEntry.parsedOk)
+ property->setBoolean("parsedOk", false);
if (it->hasRawText())
property->setString("text", it->rawText);
property->setString("name", name);
property->setString("value", propertyEntry.value);
- property->setString("priority", propertyEntry.important ? "important" : "");
+
+ // Default "priority" == "".
+ if (propertyEntry.important)
+ property->setString("priority", "important");
if (!it->disabled) {
if (it->hasSource) {
property->setBoolean("implicit", false);
@@ -481,25 +487,35 @@ void InspectorStyle::populateObjectWithStyleProperties(InspectorObject* result)
if (shouldInactivate) {
activeIt->second->setString("status", "inactive");
- activeIt->second->setString("shorthandName", "");
+ activeIt->second->remove("shorthandName");
propertyNameToPreviousActiveProperty.set(name, property);
}
} else {
- property->setBoolean("implicit", m_style->isPropertyImplicit(name));
- property->setString("status", "style");
+ bool implicit = m_style->isPropertyImplicit(name);
+ // Default "implicit" == false.
+ if (implicit)
+ property->setBoolean("implicit", true);
+ status = "";
}
}
+ // Default "status" == "style".
+ if (!status.isEmpty())
+ property->setString("status", status);
+
if (propertyEntry.parsedOk) {
// Both for style-originated and parsed source properties.
String shorthand = m_style->getPropertyShorthand(name);
- property->setString("shorthandName", shorthand);
- if (!shorthand.isEmpty() && !foundShorthands.contains(shorthand)) {
- foundShorthands.add(shorthand);
- shorthandValues->setString(shorthand, shorthandValue(shorthand));
+ if (!shorthand.isEmpty()) {
+ // Default "shorthandName" == "".
+ property->setString("shorthandName", shorthand);
+ if (!foundShorthands.contains(shorthand)) {
+ foundShorthands.add(shorthand);
+ shorthandValues->setString(shorthand, shorthandValue(shorthand));
+ }
}
- } else
- property->setString("shorthandName", "");
+ }
+ // else shorthandName is not set
}
result->setArray("cssProperties", propertiesObject);
@@ -692,9 +708,7 @@ PassRefPtr<InspectorObject> InspectorStyleSheet::buildObjectForStyleSheet()
return 0;
RefPtr<InspectorObject> result = InspectorObject::create();
- result->setBoolean("disabled", styleSheet->disabled());
- result->setString("sourceURL", finalURL());
- result->setString("title", styleSheet->title());
+ result->setString("styleSheetId", id());
RefPtr<CSSRuleList> cssRuleList = CSSRuleList::create(styleSheet, true);
RefPtr<InspectorArray> cssRules = buildArrayForRuleList(cssRuleList.get());
result->setArray("rules", cssRules.release());
@@ -704,8 +718,20 @@ PassRefPtr<InspectorObject> InspectorStyleSheet::buildObjectForStyleSheet()
if (success)
result->setString("text", styleSheetText);
- result->setString("styleSheetId", id());
+ return result.release();
+}
+
+PassRefPtr<InspectorObject> InspectorStyleSheet::buildObjectForStyleSheetInfo()
+{
+ CSSStyleSheet* styleSheet = pageStyleSheet();
+ if (!styleSheet)
+ return 0;
+ RefPtr<InspectorObject> result = InspectorObject::create();
+ result->setString("styleSheetId", id());
+ result->setBoolean("disabled", styleSheet->disabled());
+ result->setString("sourceURL", finalURL());
+ result->setString("title", styleSheet->title());
return result.release();
}
@@ -1017,7 +1043,9 @@ bool InspectorStyleSheet::resourceStyleSheetText(String* result) const
if (!m_pageStyleSheet || !ownerDocument())
return false;
- return InspectorResourceAgent::resourceContent(ownerDocument()->frame(), m_pageStyleSheet->finalURL(), result);
+ String error;
+ InspectorResourceAgent::resourceContent(&error, ownerDocument()->frame(), m_pageStyleSheet->finalURL(), result);
+ return error.isEmpty();
}
bool InspectorStyleSheet::inlineStyleSheetText(String* result) const
diff --git a/Source/WebCore/inspector/InspectorStyleSheet.h b/Source/WebCore/inspector/InspectorStyleSheet.h
index 92318cb..3048b1b 100644
--- a/Source/WebCore/inspector/InspectorStyleSheet.h
+++ b/Source/WebCore/inspector/InspectorStyleSheet.h
@@ -168,6 +168,7 @@ public:
CSSStyleRule* addRule(const String& selector);
CSSStyleRule* ruleForId(const InspectorCSSId&) const;
PassRefPtr<InspectorObject> buildObjectForStyleSheet();
+ PassRefPtr<InspectorObject> buildObjectForStyleSheetInfo();
PassRefPtr<InspectorObject> buildObjectForRule(CSSStyleRule*);
PassRefPtr<InspectorObject> buildObjectForStyle(CSSStyleDeclaration*);
bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const String& text, bool overwrite);
diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/InspectorTimelineAgent.cpp
index d45a507..2faad67 100644
--- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp
+++ b/Source/WebCore/inspector/InspectorTimelineAgent.cpp
@@ -50,6 +50,36 @@ namespace TimelineAgentState {
static const char timelineAgentEnabled[] = "timelineAgentEnabled";
}
+namespace TimelineRecordType {
+static const char EventDispatch[] = "EventDispatch";
+static const char Layout[] = "Layout";
+static const char RecalculateStyles[] = "RecalculateStyles";
+static const char Paint[] = "Paint";
+static const char ParseHTML[] = "ParseHTML";
+
+static const char TimerInstall[] = "TimerInstall";
+static const char TimerRemove[] = "TimerRemove";
+static const char TimerFire[] = "TimerFire";
+
+static const char EvaluateScript[] = "EvaluateScript";
+
+static const char MarkLoad[] = "MarkLoad";
+static const char MarkDOMContent[] = "MarkDOMContent";
+static const char MarkTimeline[] = "MarkTimeline";
+
+static const char ScheduleResourceRequest[] = "ScheduleResourceRequest";
+static const char ResourceSendRequest[] = "ResourceSendRequest";
+static const char ResourceReceiveResponse[] = "ResourceReceiveResponse";
+static const char ResourceReceivedData[] = "ResourceReceivedData";
+static const char ResourceFinish[] = "ResourceFinish";
+
+static const char XHRReadyStateChange[] = "XHRReadyStateChange";
+static const char XHRLoad[] = "XHRLoad";
+
+static const char FunctionCall[] = "FunctionCall";
+static const char GCEvent[] = "GCEvent";
+}
+
void InspectorTimelineAgent::pushGCEventRecords()
{
if (!m_gcEvents.size())
@@ -61,7 +91,7 @@ void InspectorTimelineAgent::pushGCEventRecords()
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(i->startTime);
record->setObject("data", TimelineRecordFactory::createGCEventData(i->collectedBytes));
record->setNumber("endTime", i->endTime);
- addRecordToTimeline(record.release(), GCEventTimelineRecordType);
+ addRecordToTimeline(record.release(), TimelineRecordType::GCEvent);
}
}
@@ -101,7 +131,7 @@ void InspectorTimelineAgent::start(ErrorString*)
return;
m_instrumentingAgents->setInspectorTimelineAgent(this);
ScriptGCEvent::addEventListener(this);
- m_frontend->timelineProfilerWasStarted();
+ m_frontend->started();
m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true);
}
@@ -111,7 +141,7 @@ void InspectorTimelineAgent::stop(ErrorString*)
return;
m_instrumentingAgents->setInspectorTimelineAgent(0);
if (m_frontend)
- m_frontend->timelineProfilerWasStopped();
+ m_frontend->stopped();
ScriptGCEvent::removeEventListener(this);
clearRecordStack();
@@ -127,58 +157,58 @@ bool InspectorTimelineAgent::started() const
void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scriptLine)
{
- pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), FunctionCallTimelineRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall);
}
void InspectorTimelineAgent::didCallFunction()
{
- didCompleteCurrentRecord(FunctionCallTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::FunctionCall);
}
void InspectorTimelineAgent::willDispatchEvent(const Event& event)
{
pushCurrentRecord(TimelineRecordFactory::createEventDispatchData(event),
- EventDispatchTimelineRecordType);
+ TimelineRecordType::EventDispatch);
}
void InspectorTimelineAgent::didDispatchEvent()
{
- didCompleteCurrentRecord(EventDispatchTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::EventDispatch);
}
void InspectorTimelineAgent::willLayout()
{
- pushCurrentRecord(InspectorObject::create(), LayoutTimelineRecordType);
+ pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Layout);
}
void InspectorTimelineAgent::didLayout()
{
- didCompleteCurrentRecord(LayoutTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::Layout);
}
void InspectorTimelineAgent::willRecalculateStyle()
{
- pushCurrentRecord(InspectorObject::create(), RecalculateStylesTimelineRecordType);
+ pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RecalculateStyles);
}
void InspectorTimelineAgent::didRecalculateStyle()
{
- didCompleteCurrentRecord(RecalculateStylesTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::RecalculateStyles);
}
void InspectorTimelineAgent::willPaint(const IntRect& rect)
{
- pushCurrentRecord(TimelineRecordFactory::createPaintData(rect), PaintTimelineRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createPaintData(rect), TimelineRecordType::Paint);
}
void InspectorTimelineAgent::didPaint()
{
- didCompleteCurrentRecord(PaintTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::Paint);
}
void InspectorTimelineAgent::willWriteHTML(unsigned int length, unsigned int startLine)
{
- pushCurrentRecord(TimelineRecordFactory::createParseHTMLData(length, startLine), ParseHTMLTimelineRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createParseHTMLData(length, startLine), TimelineRecordType::ParseHTML);
}
void InspectorTimelineAgent::didWriteHTML(unsigned int endLine)
@@ -186,7 +216,7 @@ void InspectorTimelineAgent::didWriteHTML(unsigned int endLine)
if (!m_recordStack.isEmpty()) {
TimelineRecordEntry entry = m_recordStack.last();
entry.data->setNumber("endLine", endLine);
- didCompleteCurrentRecord(ParseHTMLTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::ParseHTML);
}
}
@@ -195,7 +225,7 @@ void InspectorTimelineAgent::didInstallTimer(int timerId, int timeout, bool sing
pushGCEventRecords();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
record->setObject("data", TimelineRecordFactory::createTimerInstallData(timerId, timeout, singleShot));
- addRecordToTimeline(record.release(), TimerInstallTimelineRecordType);
+ addRecordToTimeline(record.release(), TimelineRecordType::TimerInstall);
}
void InspectorTimelineAgent::didRemoveTimer(int timerId)
@@ -203,47 +233,47 @@ void InspectorTimelineAgent::didRemoveTimer(int timerId)
pushGCEventRecords();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
record->setObject("data", TimelineRecordFactory::createGenericTimerData(timerId));
- addRecordToTimeline(record.release(), TimerRemoveTimelineRecordType);
+ addRecordToTimeline(record.release(), TimelineRecordType::TimerRemove);
}
void InspectorTimelineAgent::willFireTimer(int timerId)
{
- pushCurrentRecord(TimelineRecordFactory::createGenericTimerData(timerId), TimerFireTimelineRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createGenericTimerData(timerId), TimelineRecordType::TimerFire);
}
void InspectorTimelineAgent::didFireTimer()
{
- didCompleteCurrentRecord(TimerFireTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::TimerFire);
}
void InspectorTimelineAgent::willChangeXHRReadyState(const String& url, int readyState)
{
- pushCurrentRecord(TimelineRecordFactory::createXHRReadyStateChangeData(url, readyState), XHRReadyStateChangeRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createXHRReadyStateChangeData(url, readyState), TimelineRecordType::XHRReadyStateChange);
}
void InspectorTimelineAgent::didChangeXHRReadyState()
{
- didCompleteCurrentRecord(XHRReadyStateChangeRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::XHRReadyStateChange);
}
void InspectorTimelineAgent::willLoadXHR(const String& url)
{
- pushCurrentRecord(TimelineRecordFactory::createXHRLoadData(url), XHRLoadRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createXHRLoadData(url), TimelineRecordType::XHRLoad);
}
void InspectorTimelineAgent::didLoadXHR()
{
- didCompleteCurrentRecord(XHRLoadRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::XHRLoad);
}
void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber)
{
- pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), EvaluateScriptTimelineRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript);
}
void InspectorTimelineAgent::didEvaluateScript()
{
- didCompleteCurrentRecord(EvaluateScriptTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::EvaluateScript);
}
void InspectorTimelineAgent::didScheduleResourceRequest(const String& url)
@@ -251,8 +281,8 @@ void InspectorTimelineAgent::didScheduleResourceRequest(const String& url)
pushGCEventRecords();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
record->setObject("data", TimelineRecordFactory::createScheduleResourceRequestData(url));
- record->setNumber("type", ScheduleResourceRequestTimelineRecordType);
- addRecordToTimeline(record.release(), ScheduleResourceRequestTimelineRecordType);
+ record->setString("type", TimelineRecordType::ScheduleResourceRequest);
+ addRecordToTimeline(record.release(), TimelineRecordType::ScheduleResourceRequest);
}
void InspectorTimelineAgent::willSendResourceRequest(unsigned long identifier, const ResourceRequest& request)
@@ -260,29 +290,29 @@ void InspectorTimelineAgent::willSendResourceRequest(unsigned long identifier, c
pushGCEventRecords();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
record->setObject("data", TimelineRecordFactory::createResourceSendRequestData(identifier, request));
- record->setNumber("type", ResourceSendRequestTimelineRecordType);
+ record->setString("type", TimelineRecordType::ResourceSendRequest);
setHeapSizeStatistic(record.get());
- m_frontend->addRecordToTimeline(record.release());
+ m_frontend->eventRecorded(record.release());
}
void InspectorTimelineAgent::willReceiveResourceData(unsigned long identifier)
{
- pushCurrentRecord(TimelineRecordFactory::createReceiveResourceData(identifier), ReceiveResourceDataTimelineRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createReceiveResourceData(identifier), TimelineRecordType::ResourceReceivedData);
}
void InspectorTimelineAgent::didReceiveResourceData()
{
- didCompleteCurrentRecord(ReceiveResourceDataTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::ResourceReceivedData);
}
void InspectorTimelineAgent::willReceiveResourceResponse(unsigned long identifier, const ResourceResponse& response)
{
- pushCurrentRecord(TimelineRecordFactory::createResourceReceiveResponseData(identifier, response), ResourceReceiveResponseTimelineRecordType);
+ pushCurrentRecord(TimelineRecordFactory::createResourceReceiveResponseData(identifier, response), TimelineRecordType::ResourceReceiveResponse);
}
void InspectorTimelineAgent::didReceiveResourceResponse()
{
- didCompleteCurrentRecord(ResourceReceiveResponseTimelineRecordType);
+ didCompleteCurrentRecord(TimelineRecordType::ResourceReceiveResponse);
}
void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, bool didFail, double finishTime)
@@ -291,9 +321,9 @@ void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier,
// Sometimes network stack can provide for us exact finish loading time. In the other case we will use currentTime.
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
record->setObject("data", TimelineRecordFactory::createResourceFinishData(identifier, didFail, finishTime * 1000));
- record->setNumber("type", ResourceFinishTimelineRecordType);
+ record->setString("type", TimelineRecordType::ResourceFinish);
setHeapSizeStatistic(record.get());
- m_frontend->addRecordToTimeline(record.release());
+ m_frontend->eventRecorded(record.release());
}
void InspectorTimelineAgent::didMarkTimeline(const String& message)
@@ -301,21 +331,21 @@ void InspectorTimelineAgent::didMarkTimeline(const String& message)
pushGCEventRecords();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
record->setObject("data", TimelineRecordFactory::createMarkTimelineData(message));
- addRecordToTimeline(record.release(), MarkTimelineRecordType);
+ addRecordToTimeline(record.release(), TimelineRecordType::MarkTimeline);
}
void InspectorTimelineAgent::didMarkDOMContentEvent()
{
pushGCEventRecords();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
- addRecordToTimeline(record.release(), MarkDOMContentEventType);
+ addRecordToTimeline(record.release(), TimelineRecordType::MarkDOMContent);
}
void InspectorTimelineAgent::didMarkLoadEvent()
{
pushGCEventRecords();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
- addRecordToTimeline(record.release(), MarkLoadEventType);
+ addRecordToTimeline(record.release(), TimelineRecordType::MarkLoad);
}
void InspectorTimelineAgent::didCommitLoad()
@@ -323,13 +353,13 @@ void InspectorTimelineAgent::didCommitLoad()
clearRecordStack();
}
-void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> prpRecord, TimelineRecordType type)
+void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> prpRecord, const String& type)
{
RefPtr<InspectorObject> record(prpRecord);
- record->setNumber("type", type);
+ record->setString("type", type);
setHeapSizeStatistic(record.get());
if (m_recordStack.isEmpty())
- m_frontend->addRecordToTimeline(record.release());
+ m_frontend->eventRecorded(record.release());
else {
TimelineRecordEntry parent = m_recordStack.last();
parent.children->pushObject(record.release());
@@ -346,7 +376,7 @@ void InspectorTimelineAgent::setHeapSizeStatistic(InspectorObject* record)
record->setNumber("totalHeapSize", totalHeapSize);
}
-void InspectorTimelineAgent::didCompleteCurrentRecord(TimelineRecordType type)
+void InspectorTimelineAgent::didCompleteCurrentRecord(const String& type)
{
// An empty stack could merely mean that the timeline agent was turned on in the middle of
// an event. Don't treat as an error.
@@ -370,7 +400,7 @@ InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentin
{
}
-void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, TimelineRecordType type)
+void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, const String& type)
{
pushGCEventRecords();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS());
diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.h b/Source/WebCore/inspector/InspectorTimelineAgent.h
index c4c0f3b..3d8e973 100644
--- a/Source/WebCore/inspector/InspectorTimelineAgent.h
+++ b/Source/WebCore/inspector/InspectorTimelineAgent.h
@@ -51,31 +51,6 @@ class ResourceResponse;
typedef String ErrorString;
-// Must be kept in sync with TimelineAgent.js
-enum TimelineRecordType {
- EventDispatchTimelineRecordType = 0,
- LayoutTimelineRecordType = 1,
- RecalculateStylesTimelineRecordType = 2,
- PaintTimelineRecordType = 3,
- ParseHTMLTimelineRecordType = 4,
- TimerInstallTimelineRecordType = 5,
- TimerRemoveTimelineRecordType = 6,
- TimerFireTimelineRecordType = 7,
- XHRReadyStateChangeRecordType = 8,
- XHRLoadRecordType = 9,
- EvaluateScriptTimelineRecordType = 10,
- MarkTimelineRecordType = 11,
- ResourceSendRequestTimelineRecordType = 12,
- ResourceReceiveResponseTimelineRecordType = 13,
- ResourceFinishTimelineRecordType = 14,
- FunctionCallTimelineRecordType = 15,
- ReceiveResourceDataTimelineRecordType = 16,
- GCEventTimelineRecordType = 17,
- MarkDOMContentEventType = 18,
- MarkLoadEventType = 19,
- ScheduleResourceRequestTimelineRecordType = 20
-};
-
class InspectorTimelineAgent : ScriptGCEventListener {
WTF_MAKE_NONCOPYABLE(InspectorTimelineAgent);
public:
@@ -148,24 +123,24 @@ public:
private:
struct TimelineRecordEntry {
- TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, TimelineRecordType type)
+ TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type)
: record(record), data(data), children(children), type(type)
{
}
RefPtr<InspectorObject> record;
RefPtr<InspectorObject> data;
RefPtr<InspectorArray> children;
- TimelineRecordType type;
+ String type;
};
InspectorTimelineAgent(InstrumentingAgents*, InspectorState*);
- void pushCurrentRecord(PassRefPtr<InspectorObject>, TimelineRecordType);
+ void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type);
void setHeapSizeStatistic(InspectorObject* record);
- void didCompleteCurrentRecord(TimelineRecordType);
+ void didCompleteCurrentRecord(const String& type);
- void addRecordToTimeline(PassRefPtr<InspectorObject>, TimelineRecordType);
+ void addRecordToTimeline(PassRefPtr<InspectorObject>, const String& type);
void pushGCEventRecords();
void clearRecordStack();
diff --git a/Source/WebCore/inspector/InstrumentingAgents.h b/Source/WebCore/inspector/InstrumentingAgents.h
index c53ef00..3b67edd 100644
--- a/Source/WebCore/inspector/InstrumentingAgents.h
+++ b/Source/WebCore/inspector/InstrumentingAgents.h
@@ -36,7 +36,9 @@
namespace WebCore {
+class InspectorAgent;
class InspectorApplicationCacheAgent;
+class InspectorPageAgent;
class InspectorBrowserDebuggerAgent;
class InspectorCSSAgent;
class InspectorConsoleAgent;
@@ -54,7 +56,9 @@ class InstrumentingAgents {
WTF_MAKE_FAST_ALLOCATED;
public:
InstrumentingAgents()
- : m_inspectorCSSAgent(0)
+ : m_inspectorAgent(0)
+ , m_inspectorPageAgent(0)
+ , m_inspectorCSSAgent(0)
, m_inspectorConsoleAgent(0)
, m_inspectorDOMAgent(0)
, m_inspectorResourceAgent(0)
@@ -77,6 +81,12 @@ public:
{ }
~InstrumentingAgents() { }
+ InspectorAgent* inspectorAgent() const { return m_inspectorAgent; }
+ void setInspectorAgent(InspectorAgent* agent) { m_inspectorAgent = agent; }
+
+ InspectorPageAgent* inspectorPageAgent() const { return m_inspectorPageAgent; }
+ void setInspectorPageAgent(InspectorPageAgent* agent) { m_inspectorPageAgent = agent; }
+
InspectorCSSAgent* inspectorCSSAgent() const { return m_inspectorCSSAgent; }
void setInspectorCSSAgent(InspectorCSSAgent* agent) { m_inspectorCSSAgent = agent; }
@@ -119,6 +129,8 @@ public:
#endif
private:
+ InspectorAgent* m_inspectorAgent;
+ InspectorPageAgent* m_inspectorPageAgent;
InspectorCSSAgent* m_inspectorCSSAgent;
InspectorConsoleAgent* m_inspectorConsoleAgent;
InspectorDOMAgent* m_inspectorDOMAgent;
diff --git a/Source/WebCore/inspector/PageDebuggerAgent.cpp b/Source/WebCore/inspector/PageDebuggerAgent.cpp
new file mode 100755
index 0000000..6b86232
--- /dev/null
+++ b/Source/WebCore/inspector/PageDebuggerAgent.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PageDebuggerAgent.h"
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+
+#include "PageScriptDebugServer.h"
+
+namespace WebCore {
+
+PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager)
+{
+ return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager));
+}
+
+PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager)
+ : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager)
+ , m_inspectedPage(inspectedPage)
+{
+}
+
+PageDebuggerAgent::~PageDebuggerAgent()
+{
+}
+
+void PageDebuggerAgent::startListeningScriptDebugServer()
+{
+ scriptDebugServer().addListener(this, m_inspectedPage);
+}
+
+void PageDebuggerAgent::stopListeningScriptDebugServer()
+{
+ scriptDebugServer().removeListener(this, m_inspectedPage);
+}
+
+PageScriptDebugServer& PageDebuggerAgent::scriptDebugServer()
+{
+ return PageScriptDebugServer::shared();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/PageDebuggerAgent.h b/Source/WebCore/inspector/PageDebuggerAgent.h
new file mode 100755
index 0000000..7d6af6c
--- /dev/null
+++ b/Source/WebCore/inspector/PageDebuggerAgent.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageDebuggerAgent_h
+#define PageDebuggerAgent_h
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+#include "InspectorDebuggerAgent.h"
+#include "PageScriptDebugServer.h"
+
+namespace WebCore {
+
+class Page;
+class PageScriptDebugServer;
+
+class PageDebuggerAgent : public InspectorDebuggerAgent {
+ WTF_MAKE_NONCOPYABLE(PageDebuggerAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*);
+ virtual ~PageDebuggerAgent();
+
+private:
+ virtual void startListeningScriptDebugServer();
+ virtual void stopListeningScriptDebugServer();
+ virtual PageScriptDebugServer& scriptDebugServer();
+
+ PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*);
+ Page* const m_inspectedPage;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+
+#endif // !defined(PageDebuggerAgent_h)
diff --git a/Source/WebCore/inspector/ScriptCallStack.cpp b/Source/WebCore/inspector/ScriptCallStack.cpp
index 70229e5..06b5e30 100644
--- a/Source/WebCore/inspector/ScriptCallStack.cpp
+++ b/Source/WebCore/inspector/ScriptCallStack.cpp
@@ -78,7 +78,7 @@ bool ScriptCallStack::isEqual(ScriptCallStack* o) const
}
#if ENABLE(INSPECTOR)
-PassRefPtr<InspectorArray> ScriptCallStack::buildInspectorObject() const
+PassRefPtr<InspectorArray> ScriptCallStack::buildInspectorArray() const
{
RefPtr<InspectorArray> frames = InspectorArray::create();
for (size_t i = 0; i < m_frames.size(); i++)
diff --git a/Source/WebCore/inspector/ScriptCallStack.h b/Source/WebCore/inspector/ScriptCallStack.h
index 4cb152f..df67006 100644
--- a/Source/WebCore/inspector/ScriptCallStack.h
+++ b/Source/WebCore/inspector/ScriptCallStack.h
@@ -52,7 +52,7 @@ public:
size_t size() const;
bool isEqual(ScriptCallStack*) const;
- PassRefPtr<InspectorArray> buildInspectorObject() const;
+ PassRefPtr<InspectorArray> buildInspectorArray() const;
private:
ScriptCallStack(Vector<ScriptCallFrame>&);
diff --git a/Source/WebCore/inspector/TimelineRecordFactory.cpp b/Source/WebCore/inspector/TimelineRecordFactory.cpp
index dd7f2be..ff47ed4 100644
--- a/Source/WebCore/inspector/TimelineRecordFactory.cpp
+++ b/Source/WebCore/inspector/TimelineRecordFactory.cpp
@@ -50,7 +50,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createGenericRecord(double st
RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(5, true);
if (stackTrace && stackTrace->size())
- record->setArray("stackTrace", stackTrace->buildInspectorObject());
+ record->setArray("stackTrace", stackTrace->buildInspectorArray());
return record.release();
}
@@ -144,7 +144,6 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createResourceReceiveResponse
data->setNumber("identifier", identifier);
data->setNumber("statusCode", response.httpStatusCode());
data->setString("mimeType", response.mimeType());
- data->setNumber("expectedContentLength", response.expectedContentLength());
return data.release();
}
diff --git a/Source/WebCore/inspector/WorkerDebuggerAgent.cpp b/Source/WebCore/inspector/WorkerDebuggerAgent.cpp
new file mode 100755
index 0000000..afd00a5
--- /dev/null
+++ b/Source/WebCore/inspector/WorkerDebuggerAgent.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WorkerDebuggerAgent.h"
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) && ENABLE(WORKERS)
+#include "ScriptDebugServer.h"
+#include "WorkerContext.h"
+
+namespace WebCore {
+
+PassOwnPtr<WorkerDebuggerAgent> WorkerDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, WorkerContext* inspectedWorkerContext, InjectedScriptManager* injectedScriptManager)
+{
+ return adoptPtr(new WorkerDebuggerAgent(instrumentingAgents, inspectorState, inspectedWorkerContext, injectedScriptManager));
+}
+
+WorkerDebuggerAgent::WorkerDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, WorkerContext* inspectedWorkerContext, InjectedScriptManager* injectedScriptManager)
+ : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager)
+ , m_inspectedWorkerContext(inspectedWorkerContext)
+{
+}
+
+WorkerDebuggerAgent::~WorkerDebuggerAgent()
+{
+}
+
+void WorkerDebuggerAgent::startListeningScriptDebugServer()
+{
+}
+
+void WorkerDebuggerAgent::stopListeningScriptDebugServer()
+{
+}
+
+WorkerScriptDebugServer& WorkerDebuggerAgent::scriptDebugServer()
+{
+ return m_scriptDebugServer;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) && ENABLE(WORKERS)
diff --git a/Source/WebCore/inspector/WorkerDebuggerAgent.h b/Source/WebCore/inspector/WorkerDebuggerAgent.h
new file mode 100755
index 0000000..e88fd89
--- /dev/null
+++ b/Source/WebCore/inspector/WorkerDebuggerAgent.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WorkerDebuggerAgent_h
+#define WorkerDebuggerAgent_h
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) && ENABLE(WORKERS)
+#include "InspectorDebuggerAgent.h"
+#include "WorkerScriptDebugServer.h"
+
+namespace WebCore {
+
+class WorkerContext;
+
+class WorkerDebuggerAgent : public InspectorDebuggerAgent {
+ WTF_MAKE_NONCOPYABLE(WorkerDebuggerAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static PassOwnPtr<WorkerDebuggerAgent> create(InstrumentingAgents*, InspectorState*, WorkerContext*, InjectedScriptManager*);
+ virtual ~WorkerDebuggerAgent();
+
+private:
+ WorkerDebuggerAgent(InstrumentingAgents*, InspectorState*, WorkerContext*, InjectedScriptManager*);
+
+ virtual void startListeningScriptDebugServer();
+ virtual void stopListeningScriptDebugServer();
+ virtual WorkerScriptDebugServer& scriptDebugServer();
+
+ WorkerScriptDebugServer m_scriptDebugServer;
+ WorkerContext* m_inspectedWorkerContext;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) && ENABLE(WORKERS)
+
+#endif // !defined(WorkerDebuggerAgent_h)
diff --git a/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js b/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js
index b345749..f181907 100644
--- a/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js
+++ b/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js
@@ -268,3 +268,33 @@ WebInspector.ApplicationCacheItemsView.prototype = {
}
WebInspector.ApplicationCacheItemsView.prototype.__proto__ = WebInspector.View.prototype;
+
+WebInspector.ApplicationCacheDispatcher = function()
+{
+}
+
+WebInspector.ApplicationCacheDispatcher.getApplicationCachesAsync = function(callback)
+{
+ function mycallback(error, applicationCaches)
+ {
+ // FIXME: Currently, this list only returns a single application cache.
+ if (!error && applicationCaches)
+ callback(applicationCaches);
+ }
+
+ ApplicationCacheAgent.getApplicationCaches(mycallback);
+}
+
+WebInspector.ApplicationCacheDispatcher.prototype = {
+ updateApplicationCacheStatus: function(status)
+ {
+ WebInspector.panels.resources.updateApplicationCacheStatus(status);
+ },
+
+ updateNetworkState: function(isNowOnline)
+ {
+ WebInspector.panels.resources.updateNetworkState(isNowOnline);
+ }
+}
+
+InspectorBackend.registerDomainDispatcher("ApplicationCache", new WebInspector.ApplicationCacheDispatcher());
diff --git a/Source/WebCore/inspector/front-end/AuditFormatters.js b/Source/WebCore/inspector/front-end/AuditFormatters.js
index 1bc1803..6545dd4 100644
--- a/Source/WebCore/inspector/front-end/AuditFormatters.js
+++ b/Source/WebCore/inspector/front-end/AuditFormatters.js
@@ -66,7 +66,7 @@ WebInspector.AuditFormatters = {
snippet: function(snippetText)
{
var div = document.createElement("div");
- div.innerText = snippetText;
+ div.textContent = snippetText;
div.className = "source-code";
return div;
},
diff --git a/Source/WebCore/inspector/front-end/AuditRules.js b/Source/WebCore/inspector/front-end/AuditRules.js
index 803e9e0..ddab1df 100644
--- a/Source/WebCore/inspector/front-end/AuditRules.js
+++ b/Source/WebCore/inspector/front-end/AuditRules.js
@@ -65,9 +65,9 @@ WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, nee
WebInspector.AuditRules.evaluateInTargetWindow = function(func, args, callback)
{
- function mycallback(result)
+ function mycallback(error, result)
{
- if (result)
+ if (!error && result)
callback(JSON.parse(result.description));
else
callback(null);
@@ -377,24 +377,28 @@ WebInspector.AuditRules.UnusedCssRule.prototype = {
WebInspector.AuditRules.evaluateInTargetWindow(routine, [selectors], selectorsCallback.bind(null, callback, styleSheets, testedSelectors));
}
- function styleSheetCallback(styleSheets, continuation, styleSheet)
+ function styleSheetCallback(styleSheets, sourceURL, continuation, styleSheet)
{
- if (styleSheet)
+ if (styleSheet) {
+ styleSheet.sourceURL = sourceURL;
styleSheets.push(styleSheet);
+ }
if (continuation)
continuation(styleSheets);
}
- function allStylesCallback(styleSheetIds)
+ function allStylesCallback(error, styleSheetInfos)
{
- if (!styleSheetIds || !styleSheetIds.length)
+ if (error || !styleSheetInfos || !styleSheetInfos.length)
return evalCallback([]);
var styleSheets = [];
- for (var i = 0; i < styleSheetIds.length; ++i)
- WebInspector.CSSStyleSheet.createForId(styleSheetIds[i], styleSheetCallback.bind(null, styleSheets, i == styleSheetIds.length - 1 ? evalCallback : null));
+ for (var i = 0; i < styleSheetInfos.length; ++i) {
+ var info = styleSheetInfos[i];
+ WebInspector.CSSStyleSheet.createForId(info.styleSheetId, styleSheetCallback.bind(null, styleSheets, info.sourceURL, i == styleSheetInfos.length - 1 ? evalCallback : null));
+ }
}
- CSSAgent.getAllStyles(allStylesCallback);
+ CSSAgent.getAllStyleSheets(allStylesCallback);
}
}
@@ -717,13 +721,20 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
doneCallback();
}
- function getStyles(nodeIds)
+ function getStyles(error, nodeIds)
{
+ if (error)
+ return;
for (var i = 0; i < nodeIds.length; ++i)
WebInspector.cssModel.getStylesAsync(nodeIds[i], imageStylesReady.bind(this, nodeIds[i], i === nodeIds.length - 1));
}
- DOMAgent.querySelectorAll(0, "img[src]", true, getStyles);
+ function getImages()
+ {
+ DOMAgent.querySelectorAll(0, "img[src]", true, getStyles);
+ }
+
+ WebInspector.domAgent.requestDocument(getImages);
}
}
diff --git a/Source/WebCore/inspector/front-end/AuditsPanel.js b/Source/WebCore/inspector/front-end/AuditsPanel.js
index 3144c78..7f56f41 100644
--- a/Source/WebCore/inspector/front-end/AuditsPanel.js
+++ b/Source/WebCore/inspector/front-end/AuditsPanel.js
@@ -192,7 +192,7 @@ WebInspector.AuditsPanel.prototype = {
_reloadResources: function(callback)
{
this._pageReloadCallback = callback;
- InspectorAgent.reloadPage(false);
+ PageAgent.reloadPage(false);
},
_didMainResourceLoad: function()
diff --git a/Source/WebCore/inspector/front-end/BreakpointManager.js b/Source/WebCore/inspector/front-end/BreakpointManager.js
index b62820e..76348ff 100644
--- a/Source/WebCore/inspector/front-end/BreakpointManager.js
+++ b/Source/WebCore/inspector/front-end/BreakpointManager.js
@@ -51,8 +51,6 @@ WebInspector.BreakpointManager.BreakpointTypes = {
WebInspector.BreakpointManager.Events = {
DOMBreakpointAdded: "dom-breakpoint-added",
- EventListenerBreakpointAdded: "event-listener-breakpoint-added",
- XHRBreakpointAdded: "xhr-breakpoint-added",
ProjectChanged: "project-changed"
}
@@ -81,42 +79,6 @@ WebInspector.BreakpointManager.prototype = {
this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.DOMBreakpointAdded, breakpoint.view);
},
- createEventListenerBreakpoint: function(eventName)
- {
- this._createEventListenerBreakpoint(eventName, true, false);
- },
-
- _createEventListenerBreakpoint: function(eventName, enabled, restored)
- {
- var breakpointId = this._createEventListenerBreakpointId(eventName);
- if (breakpointId in this._breakpoints)
- return;
-
- var breakpoint = new WebInspector.EventListenerBreakpoint(eventName);
- this._setBreakpoint(breakpointId, breakpoint, enabled, restored);
-
- breakpoint.view = new WebInspector.EventListenerBreakpointView(this, breakpointId, enabled, eventName);
- this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.EventListenerBreakpointAdded, breakpoint.view);
- },
-
- createXHRBreakpoint: function(url)
- {
- this._createXHRBreakpoint(url, true, false);
- },
-
- _createXHRBreakpoint: function(url, enabled, restored)
- {
- var breakpointId = this._createXHRBreakpointId(url);
- if (breakpointId in this._breakpoints)
- return;
-
- var breakpoint = new WebInspector.XHRBreakpoint(url);
- this._setBreakpoint(breakpointId, breakpoint, enabled, restored);
-
- breakpoint.view = new WebInspector.XHRBreakpointView(this, breakpointId, enabled, url);
- this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.XHRBreakpointAdded, breakpoint.view);
- },
-
_setBreakpoint: function(breakpointId, breakpoint, enabled, restored)
{
this._breakpoints[breakpointId] = breakpoint;
@@ -155,10 +117,6 @@ WebInspector.BreakpointManager.prototype = {
var breakpointId;
if (eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.DOM)
breakpointId = this._createDOMBreakpointId(eventData.nodeId, eventData.type);
- else if (eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.EventListener)
- breakpointId = this._createEventListenerBreakpointId(eventData.eventName);
- else if (eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.XHR)
- breakpointId = this._createXHRBreakpointId(eventData.breakpointURL);
else
return;
@@ -196,20 +154,6 @@ WebInspector.BreakpointManager.prototype = {
this._breakpoints = {};
this._domBreakpointsRestored = false;
this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.ProjectChanged);
-
- var breakpoints = this._stickyBreakpoints[WebInspector.settings.projectId] || [];
- for (var i = 0; i < breakpoints.length; ++i) {
- var breakpoint = breakpoints[i];
- if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.EventListener)
- this._createEventListenerBreakpoint(breakpoint.condition.eventName, breakpoint.enabled, true);
- else if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.XHR)
- this._createXHRBreakpoint(breakpoint.condition.url, breakpoint.enabled, true);
- }
-
- if (!this._breakpointsPushedToFrontend) {
- BrowserDebuggerAgent.setAllBrowserBreakpoints(this._stickyBreakpoints);
- this._breakpointsPushedToFrontend = true;
- }
},
restoreDOMBreakpoints: function()
@@ -271,7 +215,6 @@ WebInspector.BreakpointManager.prototype = {
WebInspector.settings.nativeBreakpoints = breakpoints;
this._stickyBreakpoints[WebInspector.settings.projectId] = breakpoints;
- BrowserDebuggerAgent.setAllBrowserBreakpoints(this._stickyBreakpoints);
},
_validateBreakpoints: function(persistentBreakpoints)
@@ -288,16 +231,9 @@ WebInspector.BreakpointManager.prototype = {
if (typeof condition.path !== "string" || typeof condition.type !== "number")
continue;
id += condition.path + ":" + condition.type;
- } else if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.EventListener) {
- if (typeof condition.eventName !== "string")
- continue;
- id += condition.eventName;
- } else if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.XHR) {
- if (typeof condition.url !== "string")
- continue;
- id += condition.url;
} else
continue;
+
if (id in breakpointsSet)
continue;
breakpointsSet[id] = true;
@@ -309,16 +245,6 @@ WebInspector.BreakpointManager.prototype = {
_createDOMBreakpointId: function(nodeId, type)
{
return "dom:" + nodeId + ":" + type;
- },
-
- _createEventListenerBreakpointId: function(eventName)
- {
- return "eventListner:" + eventName;
- },
-
- _createXHRBreakpointId: function(url)
- {
- return "xhr:" + url;
}
}
@@ -349,54 +275,6 @@ WebInspector.DOMBreakpoint.prototype = {
}
}
-WebInspector.EventListenerBreakpoint = function(eventName)
-{
- this._eventName = eventName;
-}
-
-WebInspector.EventListenerBreakpoint.prototype = {
- _enable: function()
- {
- BrowserDebuggerAgent.setEventListenerBreakpoint(this._eventName);
- },
-
- _disable: function()
- {
- BrowserDebuggerAgent.removeEventListenerBreakpoint(this._eventName);
- },
-
- _serializeToJSON: function()
- {
- var type = WebInspector.BreakpointManager.BreakpointTypes.EventListener;
- return { type: type, condition: { eventName: this._eventName } };
- }
-}
-
-WebInspector.XHRBreakpoint = function(url)
-{
- this._url = url;
-}
-
-WebInspector.XHRBreakpoint.prototype = {
- _enable: function()
- {
- BrowserDebuggerAgent.setXHRBreakpoint(this._url);
- },
-
- _disable: function()
- {
- BrowserDebuggerAgent.removeXHRBreakpoint(this._url);
- },
-
- _serializeToJSON: function()
- {
- var type = WebInspector.BreakpointManager.BreakpointTypes.XHR;
- return { type: type, condition: { url: this._url } };
- }
-}
-
-
-
WebInspector.NativeBreakpointView = function(manager, id, enabled)
{
this._manager = manager;
@@ -487,7 +365,7 @@ WebInspector.DOMBreakpointView.prototype = {
if (!targetNodeId)
return;
- RuntimeAgent.releaseObject(eventData.targetNode);
+ targetNodeObject.release();
var targetNode = WebInspector.panels.elements.linkifyNodeById(targetNodeId);
if (eventData.insertion) {
if (targetNodeId !== this._nodeId)
@@ -530,91 +408,6 @@ WebInspector.DOMBreakpointView.prototype = {
WebInspector.DOMBreakpointView.prototype.__proto__ = WebInspector.NativeBreakpointView.prototype;
-WebInspector.EventListenerBreakpointView = function(manager, id, enabled, eventName)
-{
- WebInspector.NativeBreakpointView.call(this, manager, id, enabled);
- this._eventName = eventName;
-}
-
-WebInspector.EventListenerBreakpointView.eventNameForUI = function(eventName)
-{
- if (!WebInspector.EventListenerBreakpointView._eventNamesForUI) {
- WebInspector.EventListenerBreakpointView._eventNamesForUI = {
- "instrumentation:setTimer": WebInspector.UIString("Set Timer"),
- "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"),
- "instrumentation:timerFired": WebInspector.UIString("Timer Fired")
- };
- }
- return WebInspector.EventListenerBreakpointView._eventNamesForUI[eventName] || eventName.substring(eventName.indexOf(":") + 1);
-}
-
-WebInspector.EventListenerBreakpointView.prototype = {
- get eventName()
- {
- return this._eventName;
- },
-
- compareTo: function(other)
- {
- return this._compare(this._eventName, other._eventName);
- },
-
- populateLabelElement: function(element)
- {
- element.appendChild(document.createTextNode(this._uiEventName()));
- },
-
- populateStatusMessageElement: function(element, eventData)
- {
- var status = WebInspector.UIString("Paused on a \"%s\" Event Listener.", this._uiEventName());
- element.appendChild(document.createTextNode(status));
- },
-
- _uiEventName: function()
- {
- return WebInspector.EventListenerBreakpointView.eventNameForUI(this._eventName);
- }
-}
-
-WebInspector.EventListenerBreakpointView.prototype.__proto__ = WebInspector.NativeBreakpointView.prototype;
-
-WebInspector.XHRBreakpointView = function(manager, id, enabled, url)
-{
- WebInspector.NativeBreakpointView.call(this, manager, id, enabled);
- this._url = url;
-}
-
-WebInspector.XHRBreakpointView.prototype = {
- compareTo: function(other)
- {
- return this._compare(this._url, other._url);
- },
-
- populateEditElement: function(element)
- {
- element.textContent = this._url;
- },
-
- populateLabelElement: function(element)
- {
- var label;
- if (!this._url.length)
- label = WebInspector.UIString("Any XHR");
- else
- label = WebInspector.UIString("URL contains \"%s\"", this._url);
- element.appendChild(document.createTextNode(label));
- element.addStyleClass("cursor-auto");
- },
-
- populateStatusMessageElement: function(element)
- {
- var status = WebInspector.UIString("Paused on a XMLHttpRequest.");
- element.appendChild(document.createTextNode(status));
- }
-}
-
-WebInspector.XHRBreakpointView.prototype.__proto__ = WebInspector.NativeBreakpointView.prototype;
-
WebInspector.DOMBreakpointTypes = {
SubtreeModified: 0,
AttributeModified: 1,
diff --git a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
index 0c46463..63a6e2a 100644
--- a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -23,10 +23,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.JavaScriptBreakpointsSidebarPane = function(title)
+WebInspector.JavaScriptBreakpointsSidebarPane = function(model)
{
WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
+ this._model = model;
+
this.listElement = document.createElement("ol");
this.listElement.className = "breakpoint-list";
@@ -37,36 +39,37 @@ WebInspector.JavaScriptBreakpointsSidebarPane = function(title)
this.bodyElement.appendChild(this.emptyElement);
this._items = {};
-
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, this._breakpointAdded, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointRemoved, this._breakpointRemoved, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
- WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this);
}
WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
- _breakpointAdded: function(event)
+ addBreakpoint: function(breakpoint)
{
- var breakpoint = event.data;
- var breakpointId = breakpoint.id;
-
- if (breakpoint.url && !WebInspector.debuggerModel.scriptsForURL(breakpoint.url).length)
- return;
-
var element = document.createElement("li");
+ element.addStyleClass("cursor-pointer");
+ element.addEventListener("contextmenu", this._contextMenu.bind(this, breakpoint), true);
+ element.addEventListener("click", this._breakpointClicked.bind(this, breakpoint), false);
var checkbox = document.createElement("input");
checkbox.className = "checkbox-elem";
checkbox.type = "checkbox";
checkbox.checked = breakpoint.enabled;
- checkbox.addEventListener("click", this._breakpointItemCheckboxClicked.bind(this, breakpointId), false);
+ checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(this, breakpoint), false);
element.appendChild(checkbox);
- var label = document.createElement("span");
- element.appendChild(label);
+ var displayName = breakpoint.url ? WebInspector.displayNameForURL(breakpoint.url) : WebInspector.UIString("(program)");
+ var labelElement = document.createTextNode(displayName + ":" + (breakpoint.lineNumber + 1));
+ element.appendChild(labelElement);
+
+ var snippetElement = document.createElement("div");
+ snippetElement.className = "source-text monospace";
+ element.appendChild(snippetElement);
+ if (breakpoint.loadSnippet) {
+ function didLoadSnippet(snippet)
+ {
+ snippetElement.textContent = snippet;
+ }
+ breakpoint.loadSnippet(didLoadSnippet);
+ }
element._data = breakpoint;
var currentElement = this.listElement.firstChild;
@@ -77,88 +80,68 @@ WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
}
this._addListElement(element, currentElement);
- element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, breakpointId), true);
-
- this._setupBreakpointElement(breakpoint, element);
-
var breakpointItem = {};
breakpointItem.element = element;
breakpointItem.checkbox = checkbox;
- this._items[breakpointId] = breakpointItem;
+ this._items[this._createBreakpointItemId(breakpoint.sourceFileId, breakpoint.lineNumber)] = breakpointItem;
if (!this.expanded)
this.expanded = true;
},
- _breakpointRemoved: function(event)
+ removeBreakpoint: function(sourceFileId, lineNumber)
{
- var breakpointId = event.data;
- var breakpointItem = this._items[breakpointId];
- if (breakpointItem) {
- delete this._items[breakpointId];
- this._removeListElement(breakpointItem.element);
- }
+ var breakpointItemId = this._createBreakpointItemId(sourceFileId, lineNumber);
+ var breakpointItem = this._items[breakpointItemId];
+ if (!breakpointItem)
+ return;
+ delete this._items[breakpointItemId];
+ this._removeListElement(breakpointItem.element);
},
- _breakpointResolved: function(event)
+ highlightBreakpoint: function(sourceFileId, lineNumber)
{
- var breakpoint = event.data;
- this._breakpointRemoved({ data: breakpoint.id });
- this._breakpointAdded({ data: breakpoint });
+ var breakpointItem = this._items[this._createBreakpointItemId(sourceFileId, lineNumber)];
+ if (!breakpointItem)
+ return;
+ breakpointItem.element.addStyleClass("breakpoint-hit");
+ this._highlightedBreakpointItem = breakpointItem;
},
- _parsedScriptSource: function(event)
+ clearBreakpointHighlight: function()
{
- var url = event.data.sourceURL;
- var breakpoints = WebInspector.debuggerModel.breakpoints;
- for (var id in breakpoints) {
- if (!(id in this._items))
- this._breakpointAdded({ data: breakpoints[id] });
+ if (this._highlightedBreakpointItem) {
+ this._highlightedBreakpointItem.element.removeStyleClass("breakpoint-hit");
+ delete this._highlightedBreakpointItem;
}
},
- _breakpointEnableChanged: function(enabled, event)
+ _createBreakpointItemId: function(sourceFileId, lineNumber)
{
- var breakpointId = event.data;
- var breakpointItem = this._items[breakpointId];
- if (breakpointItem)
- breakpointItem.checkbox.checked = enabled;
+ return sourceFileId + ":" + lineNumber;
},
- _breakpointItemCheckboxClicked: function(breakpointId, event)
+ _breakpointClicked: function(breakpoint, event)
{
- var breakpoint = WebInspector.debuggerModel.breakpointForId(breakpointId);
- WebInspector.debuggerModel.updateBreakpoint(breakpointId, breakpoint.condition, event.target.checked);
+ WebInspector.panels.scripts.showSourceLine(breakpoint.sourceFileId, breakpoint.lineNumber + 1);
+ },
- // Breakpoint element may have it's own click handler.
+ _breakpointCheckboxClicked: function(breakpoint, event)
+ {
+ // Breakpoint element has it's own click handler.
event.stopPropagation();
+
+ this._model.setBreakpointEnabled(breakpoint.sourceFileId, breakpoint.lineNumber, event.target.checked);
},
- _contextMenuEventFired: function(breakpointId, event)
+ _contextMenu: function(breakpoint, event)
{
var contextMenu = new WebInspector.ContextMenu();
- contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._removeBreakpoint.bind(this, breakpointId));
- contextMenu.show(event);
- },
- _debuggerPaused: function(event)
- {
- var breakpoint = event.data.breakpoint;
- if (!breakpoint)
- return;
- var breakpointItem = this._items[breakpoint.id];
- if (!breakpointItem)
- return;
- breakpointItem.element.addStyleClass("breakpoint-hit");
- this._lastHitBreakpointItem = breakpointItem;
- },
+ var removeHandler = this._model.removeBreakpoint.bind(this._model, breakpoint.sourceFileId, breakpoint.lineNumber);
+ contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), removeHandler);
- _debuggerResumed: function()
- {
- if (this._lastHitBreakpointItem) {
- this._lastHitBreakpointItem.element.removeStyleClass("breakpoint-hit");
- delete this._lastHitBreakpointItem;
- }
+ contextMenu.show(event);
},
_addListElement: function(element, beforeElement)
@@ -183,16 +166,6 @@ WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
}
},
- _projectChanged: function()
- {
- this.listElement.removeChildren();
- if (this.listElement.parentElement) {
- this.bodyElement.removeChild(this.listElement);
- this.bodyElement.appendChild(this.emptyElement);
- }
- this._items = {};
- },
-
_compare: function(x, y)
{
if (x !== y)
@@ -205,40 +178,14 @@ WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
return this._compare(b1.url, b2.url) || this._compare(b1.lineNumber, b2.lineNumber);
},
- _setupBreakpointElement: function(data, element)
+ reset: function()
{
- var sourceID;
- var lineNumber = data.lineNumber;
- if (data.locations.length) {
- sourceID = data.locations[0].sourceID;
- lineNumber = data.locations[0].lineNumber;
- }
-
- var displayName = data.url ? WebInspector.displayNameForURL(data.url) : WebInspector.UIString("(program)");
- var labelElement = document.createTextNode(displayName + ":" + (lineNumber + 1));
- element.appendChild(labelElement);
-
- var sourceTextElement = document.createElement("div");
- sourceTextElement.className = "source-text monospace";
- element.appendChild(sourceTextElement);
-
- if (sourceID) {
- function didGetSourceLine(text)
- {
- sourceTextElement.textContent = text;
- }
- var script = WebInspector.debuggerModel.scriptForSourceID(sourceID);
- script.sourceLine(lineNumber, didGetSourceLine.bind(this));
+ this.listElement.removeChildren();
+ if (this.listElement.parentElement) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
}
-
- element.addStyleClass("cursor-pointer");
- var clickHandler = WebInspector.panels.scripts.showSourceLine.bind(WebInspector.panels.scripts, data.url, lineNumber + 1);
- element.addEventListener("click", clickHandler, false);
- },
-
- _removeBreakpoint: function(breakpointId)
- {
- WebInspector.debuggerModel.removeBreakpoint(breakpointId);
+ this._items = {};
}
}
@@ -329,61 +276,177 @@ WebInspector.XHRBreakpointsSidebarPane = function()
{
WebInspector.NativeBreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints"));
- function addButtonClicked(event)
- {
- event.stopPropagation();
- this._startEditingBreakpoint(null);
- }
+ this._breakpointElements = {};
var addButton = document.createElement("button");
addButton.className = "add";
- addButton.addEventListener("click", addButtonClicked.bind(this), false);
+ addButton.addEventListener("click", this._addButtonClicked.bind(this), false);
this.titleElement.appendChild(addButton);
+
+ this._restoreBreakpoints();
}
WebInspector.XHRBreakpointsSidebarPane.prototype = {
- addBreakpointItem: function(breakpointItem)
+ _addButtonClicked: function(event)
{
- WebInspector.NativeBreakpointsSidebarPane.prototype.addBreakpointItem.call(this, breakpointItem);
- breakpointItem._labelElement.addEventListener("dblclick", this._startEditingBreakpoint.bind(this, breakpointItem), false);
+ event.stopPropagation();
+
+ this.expanded = true;
+
+ var inputElement = document.createElement("span");
+ inputElement.className = "breakpoint-condition editing";
+ this._addListElement(inputElement, this.listElement.firstChild);
+
+ function finishEditing(accept, e, text)
+ {
+ this._removeListElement(inputElement);
+ if (accept) {
+ this._setBreakpoint(text, true);
+ this._saveBreakpoints();
+ }
+ }
+
+ WebInspector.startEditing(inputElement, {
+ commitHandler: finishEditing.bind(this, true),
+ cancelHandler: finishEditing.bind(this, false)
+ });
},
- _startEditingBreakpoint: function(breakpointItem)
+ _setBreakpoint: function(url, enabled)
{
- if (this._editingBreakpoint)
+ if (url in this._breakpointElements)
return;
- this._editingBreakpoint = true;
- if (!this.expanded)
- this.expanded = true;
+ var element = document.createElement("li");
+ element._url = url;
+ element.addEventListener("contextmenu", this._contextMenu.bind(this, url), true);
+
+ var checkboxElement = document.createElement("input");
+ checkboxElement.className = "checkbox-elem";
+ checkboxElement.type = "checkbox";
+ checkboxElement.checked = enabled;
+ checkboxElement.addEventListener("click", this._checkboxClicked.bind(this, url), false);
+ element._checkboxElement = checkboxElement;
+ element.appendChild(checkboxElement);
+
+ var labelElement = document.createElement("span");
+ if (!url)
+ labelElement.textContent = WebInspector.UIString("Any XHR");
+ else
+ labelElement.textContent = WebInspector.UIString("URL contains \"%s\"", url);
+ labelElement.addStyleClass("cursor-auto");
+ labelElement.addEventListener("dblclick", this._labelClicked.bind(this, url), false);
+ element.appendChild(labelElement);
+
+ var currentElement = this.listElement.firstChild;
+ while (currentElement) {
+ if (currentElement._url && currentElement._url < element._url)
+ break;
+ currentElement = currentElement.nextSibling;
+ }
+ this._addListElement(element, currentElement);
+ this._breakpointElements[url] = element;
+ if (enabled)
+ BrowserDebuggerAgent.setXHRBreakpoint(url);
+ },
+
+ _removeBreakpoint: function(url)
+ {
+ var element = this._breakpointElements[url];
+ if (!element)
+ return;
+
+ this._removeListElement(element);
+ delete this._breakpointElements[url];
+ if (element._checkboxElement.checked)
+ BrowserDebuggerAgent.removeXHRBreakpoint(url);
+ },
+
+ _contextMenu: function(url, event)
+ {
+ var contextMenu = new WebInspector.ContextMenu();
+ function removeBreakpoint()
+ {
+ this._removeBreakpoint(url);
+ this._saveBreakpoints();
+ }
+ contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), removeBreakpoint.bind(this));
+ contextMenu.show(event);
+ },
+
+ _checkboxClicked: function(url, event)
+ {
+ if (event.target.checked)
+ WebInspector.breakpointManager.setXHRBreakpoint(url);
+ else
+ WebInspector.breakpointManager.removeXHRBreakpoint(url);
+ this._saveBreakpoints();
+ },
+ _labelClicked: function(url)
+ {
+ var element = this._breakpointElements[url];
var inputElement = document.createElement("span");
inputElement.className = "breakpoint-condition editing";
- if (breakpointItem) {
- breakpointItem.populateEditElement(inputElement);
- this.listElement.insertBefore(inputElement, breakpointItem.element);
- breakpointItem.element.addStyleClass("hidden");
- } else
- this._addListElement(inputElement, this.listElement.firstChild);
+ inputElement.textContent = url;
+ this.listElement.insertBefore(inputElement, element);
+ element.addStyleClass("hidden");
+
+ function finishEditing(accept, e, text)
+ {
+ this._removeListElement(inputElement);
+ if (accept) {
+ this._removeBreakpoint(url);
+ this._setBreakpoint(text, element._checkboxElement.checked);
+ this._saveBreakpoints();
+ } else
+ element.removeStyleClass("hidden");
+ }
- var commitHandler = this._hideEditBreakpointDialog.bind(this, inputElement, true, breakpointItem);
- var cancelHandler = this._hideEditBreakpointDialog.bind(this, inputElement, false, breakpointItem);
WebInspector.startEditing(inputElement, {
- commitHandler: commitHandler,
- cancelHandler: cancelHandler
+ commitHandler: finishEditing.bind(this, true),
+ cancelHandler: finishEditing.bind(this, false)
});
},
- _hideEditBreakpointDialog: function(inputElement, accept, breakpointItem)
+ highlightBreakpoint: function(url)
+ {
+ var element = this._breakpointElements[url];
+ if (!element)
+ return;
+ this.expanded = true;
+ element.addStyleClass("breakpoint-hit");
+ this._highlightedElement = element;
+ },
+
+ clearBreakpointHighlight: function()
+ {
+ if (this._highlightedElement) {
+ this._highlightedElement.removeStyleClass("breakpoint-hit");
+ delete this._highlightedElement;
+ }
+ },
+
+ _saveBreakpoints: function()
+ {
+ var breakpoints = [];
+ for (var url in this._breakpointElements)
+ breakpoints.push({ url: url, enabled: this._breakpointElements[url]._checkboxElement.checked });
+ WebInspector.settings.xhrBreakpoints = breakpoints;
+ },
+
+ _restoreBreakpoints: function()
+ {
+ var breakpoints = WebInspector.settings.xhrBreakpoints;
+ for (var i = 0; i < breakpoints.length; ++i) {
+ var breakpoint = breakpoints[i];
+ if (breakpoint && typeof breakpoint.url === "string")
+ this._setBreakpoint(breakpoint.url, breakpoint.enabled);
+ }
+ },
+
+ _projectChanged: function()
{
- this._removeListElement(inputElement);
- this._editingBreakpoint = false;
- if (accept) {
- if (breakpointItem)
- breakpointItem.remove();
- WebInspector.breakpointManager.createXHRBreakpoint(inputElement.textContent.toLowerCase());
- } else if (breakpointItem)
- breakpointItem.element.removeStyleClass("hidden");
}
}
@@ -478,13 +541,11 @@ WebInspector.EventListenerBreakpointsSidebarPane = function()
this.categoriesElement = document.createElement("ol");
this.categoriesElement.tabIndex = 0;
- this.categoriesElement.addStyleClass("properties-tree event-listener-breakpoints");
+ this.categoriesElement.addStyleClass("properties-tree");
+ this.categoriesElement.addStyleClass("event-listener-breakpoints");
this.categoriesTreeOutline = new TreeOutline(this.categoriesElement);
this.bodyElement.appendChild(this.categoriesElement);
- WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this);
- WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.EventListenerBreakpointAdded, this._breakpointAdded, this);
-
this._breakpointItems = {};
this._createCategory(WebInspector.UIString("Keyboard"), "listener", ["keydown", "keyup", "keypress", "textInput"]);
this._createCategory(WebInspector.UIString("Mouse"), "listener", ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
@@ -497,6 +558,20 @@ WebInspector.EventListenerBreakpointsSidebarPane = function()
this._createCategory(WebInspector.UIString("DOM Mutation"), "listener", ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
this._createCategory(WebInspector.UIString("Device"), "listener", ["deviceorientation", "devicemotion"]);
this._createCategory(WebInspector.UIString("Timer"), "instrumentation", ["setTimer", "clearTimer", "timerFired"]);
+
+ this._restoreBreakpoints();
+}
+
+WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(eventName)
+{
+ if (!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI) {
+ WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI = {
+ "instrumentation:setTimer": WebInspector.UIString("Set Timer"),
+ "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"),
+ "instrumentation:timerFired": WebInspector.UIString("Timer Fired")
+ };
+ }
+ return WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI[eventName] || eventName.substring(eventName.indexOf(":") + 1);
}
WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
@@ -516,7 +591,7 @@ WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
var eventName = type + ":" + eventNames[i];
var breakpointItem = {};
- var title = WebInspector.EventListenerBreakpointView.eventNameForUI(eventName);
+ var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName);
breakpointItem.element = new TreeElement(title);
categoryItem.element.appendChild(breakpointItem.element);
var hitMarker = document.createElement("div");
@@ -526,9 +601,8 @@ WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
breakpointItem.element.selectable = true;
breakpointItem.checkbox = this._createCheckbox(breakpointItem.element);
- breakpointItem.checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(this, breakpointItem), true);
+ breakpointItem.checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(this, eventName), true);
breakpointItem.parent = categoryItem;
- breakpointItem.eventName = eventName;
this._breakpointItems[eventName] = breakpointItem;
categoryItem.children[eventName] = breakpointItem;
@@ -549,54 +623,47 @@ WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
var checked = categoryItem.checkbox.checked;
for (var eventName in categoryItem.children) {
var breakpointItem = categoryItem.children[eventName];
- if (breakpointItem.checkbox.checked !== checked) {
- breakpointItem.checkbox.checked = checked;
- this._breakpointCheckboxClicked(breakpointItem);
- }
+ if (breakpointItem.checkbox.checked === checked)
+ continue;
+ if (checked)
+ this._setBreakpoint(eventName);
+ else
+ this._removeBreakpoint(eventName);
}
+ this._saveBreakpoints();
},
- _breakpointCheckboxClicked: function(breakpointItem)
+ _breakpointCheckboxClicked: function(eventName, event)
{
- if (breakpointItem.checkbox.checked)
- WebInspector.breakpointManager.createEventListenerBreakpoint(breakpointItem.eventName);
+ if (event.target.checked)
+ this._setBreakpoint(eventName);
else
- breakpointItem.breakpoint.remove();
+ this._removeBreakpoint(eventName);
+ this._saveBreakpoints();
},
- _breakpointAdded: function(event)
+ _setBreakpoint: function(eventName)
{
- var breakpoint = event.data;
-
- var breakpointItem = this._breakpointItems[breakpoint.eventName];
- breakpointItem.breakpoint = breakpoint;
- breakpoint.addEventListener("hit-state-changed", this._breakpointHitStateChanged.bind(this, breakpointItem));
- breakpoint.addEventListener("removed", this._breakpointRemoved.bind(this, breakpointItem));
+ var breakpointItem = this._breakpointItems[eventName];
+ if (!breakpointItem)
+ return;
breakpointItem.checkbox.checked = true;
- this._updateCategoryCheckbox(breakpointItem);
+ BrowserDebuggerAgent.setEventListenerBreakpoint(eventName);
+ this._updateCategoryCheckbox(breakpointItem.parent);
},
- _breakpointHitStateChanged: function(breakpointItem, event)
+ _removeBreakpoint: function(eventName)
{
- if (event.target.hit) {
- this.expanded = true;
- var categoryItem = breakpointItem.parent;
- categoryItem.element.expand();
- breakpointItem.element.listItemElement.addStyleClass("breakpoint-hit");
- } else
- breakpointItem.element.listItemElement.removeStyleClass("breakpoint-hit");
- },
-
- _breakpointRemoved: function(breakpointItem)
- {
- breakpointItem.breakpoint = null;
+ var breakpointItem = this._breakpointItems[eventName];
+ if (!breakpointItem)
+ return;
breakpointItem.checkbox.checked = false;
- this._updateCategoryCheckbox(breakpointItem);
+ BrowserDebuggerAgent.removeEventListenerBreakpoint(eventName);
+ this._updateCategoryCheckbox(breakpointItem.parent);
},
- _updateCategoryCheckbox: function(breakpointItem)
+ _updateCategoryCheckbox: function(categoryItem)
{
- var categoryItem = breakpointItem.parent;
var hasEnabled = false, hasDisabled = false;
for (var eventName in categoryItem.children) {
var breakpointItem = categoryItem.children[eventName];
@@ -609,13 +676,42 @@ WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
categoryItem.checkbox.indeterminate = hasEnabled && hasDisabled;
},
- _projectChanged: function()
+ highlightBreakpoint: function(eventName)
{
+ var breakpointItem = this._breakpointItems[eventName];
+ if (!breakpointItem)
+ return;
+ this.expanded = true;
+ breakpointItem.parent.element.expand();
+ breakpointItem.element.listItemElement.addStyleClass("breakpoint-hit");
+ this._highlightedElement = breakpointItem.element.listItemElement;
+ },
+
+ clearBreakpointHighlight: function()
+ {
+ if (this._highlightedElement) {
+ this._highlightedElement.removeStyleClass("breakpoint-hit");
+ delete this._highlightedElement;
+ }
+ },
+
+ _saveBreakpoints: function()
+ {
+ var breakpoints = [];
for (var eventName in this._breakpointItems) {
- var breakpointItem = this._breakpointItems[eventName];
- breakpointItem.breakpoint = null;
- breakpointItem.checkbox.checked = false;
- this._updateCategoryCheckbox(breakpointItem);
+ if (this._breakpointItems[eventName].checkbox.checked)
+ breakpoints.push({ eventName: eventName });
+ }
+ WebInspector.settings.eventListenerBreakpoints = breakpoints;
+ },
+
+ _restoreBreakpoints: function()
+ {
+ var breakpoints = WebInspector.settings.eventListenerBreakpoints;
+ for (var i = 0; i < breakpoints.length; ++i) {
+ var breakpoint = breakpoints[i];
+ if (breakpoint && typeof breakpoint.eventName === "string")
+ this._setBreakpoint(breakpoint.eventName);
}
}
}
diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js
index 700417e..148bfd8 100644
--- a/Source/WebCore/inspector/front-end/CSSStyleModel.js
+++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js
@@ -43,9 +43,9 @@ WebInspector.CSSStyleModel.parseRuleArrayPayload = function(ruleArray)
WebInspector.CSSStyleModel.prototype = {
getStylesAsync: function(nodeId, userCallback)
{
- function callback(userCallback, payload)
+ function callback(userCallback, error, payload)
{
- if (!payload) {
+ if (error) {
if (userCallback)
userCallback(null);
return;
@@ -59,8 +59,11 @@ WebInspector.CSSStyleModel.prototype = {
result.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(payload.matchedCSSRules);
result.styleAttributes = {};
- for (var name in payload.styleAttributes)
- result.styleAttributes[name] = WebInspector.CSSStyleDeclaration.parsePayload(payload.styleAttributes[name]);
+ var payloadStyleAttributes = payload.styleAttributes;
+ for (var i = 0; i < payloadStyleAttributes.length; ++i) {
+ var name = payloadStyleAttributes[i].name;
+ result.styleAttributes[name] = WebInspector.CSSStyleDeclaration.parsePayload(payloadStyleAttributes[i].style);
+ }
result.pseudoElements = [];
for (var i = 0; i < payload.pseudoElements.length; ++i) {
@@ -88,9 +91,9 @@ WebInspector.CSSStyleModel.prototype = {
getComputedStyleAsync: function(nodeId, userCallback)
{
- function callback(userCallback, stylePayload)
+ function callback(userCallback, error, stylePayload)
{
- if (!stylePayload)
+ if (error)
userCallback(null);
else
userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
@@ -101,9 +104,9 @@ WebInspector.CSSStyleModel.prototype = {
getInlineStyleAsync: function(nodeId, userCallback)
{
- function callback(userCallback, stylePayload)
+ function callback(userCallback, error, stylePayload)
{
- if (!stylePayload)
+ if (error)
userCallback(null);
else
userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
@@ -114,28 +117,31 @@ WebInspector.CSSStyleModel.prototype = {
setRuleSelector: function(ruleId, nodeId, newSelector, successCallback, failureCallback)
{
- function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
+ function checkAffectsCallback(nodeId, successCallback, rulePayload, error, selectedNodeIds)
{
+ if (error)
+ return;
var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
var rule = WebInspector.CSSRule.parsePayload(rulePayload);
successCallback(rule, doesAffectSelectedNode);
this._styleSheetChanged(rule.id.styleSheetId, true);
}
- function callback(nodeId, successCallback, failureCallback, newSelector, rulePayload)
+ function callback(nodeId, successCallback, failureCallback, error, newSelector, rulePayload)
{
- if (!rulePayload)
+ // FIXME: looks like rulePayload is always null.
+ if (error)
failureCallback();
else
DOMAgent.querySelectorAll(nodeId, newSelector, true, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
}
- CSSAgent.setRuleSelector(ruleId, newSelector, callback.bind(this, nodeId, successCallback, failureCallback));
+ CSSAgent.setRuleSelector(ruleId, newSelector, callback.bind(this, nodeId, successCallback, failureCallback, newSelector));
},
addRule: function(nodeId, selector, successCallback, failureCallback)
{
- function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
+ function checkAffectsCallback(nodeId, successCallback, rulePayload, error, selectedNodeIds)
{
var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
var rule = WebInspector.CSSRule.parsePayload(rulePayload);
@@ -143,9 +149,9 @@ WebInspector.CSSStyleModel.prototype = {
this._styleSheetChanged(rule.id.styleSheetId, true);
}
- function callback(successCallback, failureCallback, selector, rulePayload)
+ function callback(successCallback, failureCallback, selector, error, rulePayload)
{
- if (!rulePayload) {
+ if (error) {
// Invalid syntax for a selector
failureCallback();
} else
@@ -160,21 +166,26 @@ WebInspector.CSSStyleModel.prototype = {
if (!majorChange || !styleSheetId)
return;
- function callback(href, content)
+ function callback(error, href, content)
{
+ if (error)
+ return;
var resource = WebInspector.resourceForURL(href);
- if (resource && resource.type === WebInspector.Resource.Type.Stylesheet)
+ if (resource && resource.type === WebInspector.Resource.Type.Stylesheet) {
resource.setContent(content, this._onRevert.bind(this, styleSheetId));
+ this.dispatchEventToListeners("stylesheet changed");
+ }
}
CSSAgent.getStyleSheetText(styleSheetId, callback.bind(this));
},
_onRevert: function(styleSheetId, contentToRevertTo)
{
- function callback(success)
+ function callback(error, success)
{
+ if (error)
+ return;
this._styleSheetChanged(styleSheetId, true);
- this.dispatchEventToListeners("stylesheet changed");
}
CSSAgent.setStyleSheetText(styleSheetId, contentToRevertTo, callback.bind(this));
}
@@ -335,12 +346,12 @@ WebInspector.CSSStyleDeclaration.prototype = {
insertPropertyAt: function(index, name, value, userCallback)
{
- function callback(userCallback, payload)
+ function callback(userCallback, error, payload)
{
if (!userCallback)
return;
- if (!payload)
+ if (error)
userCallback(null);
else {
userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
@@ -412,8 +423,14 @@ WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, st
WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload)
{
+ // The following default field values are used in the payload:
+ // priority: ""
+ // parsedOk: true
+ // implicit: false
+ // status: "style"
+ // shorthandName: ""
var result = new WebInspector.CSSProperty(
- ownerStyle, index, payload.name, payload.value, payload.priority, payload.status, payload.parsedOk, payload.implicit, payload.shorthandName, payload.text);
+ ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? payload.parsedOk : true, !!payload.implicit, payload.shorthandName || "", payload.text);
return result;
}
@@ -464,9 +481,9 @@ WebInspector.CSSProperty.prototype = {
userCallback(style);
}
- function callback(stylePayload)
+ function callback(error, stylePayload)
{
- if (stylePayload) {
+ if (!error && stylePayload) {
this.text = propertyText;
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
var newProperty = style.allProperties[this.index];
@@ -504,11 +521,11 @@ WebInspector.CSSProperty.prototype = {
if (disabled === this.disabled && userCallback)
userCallback(this.ownerStyle);
- function callback(stylePayload)
+ function callback(error, stylePayload)
{
if (!userCallback)
return;
- if (!stylePayload)
+ if (error)
userCallback(null);
else {
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
@@ -524,9 +541,6 @@ WebInspector.CSSProperty.prototype = {
WebInspector.CSSStyleSheet = function(payload)
{
this.id = payload.styleSheetId;
- this.sourceURL = payload.sourceURL;
- this.title = payload.title;
- this.disabled = payload.disabled;
this.rules = [];
this.styles = {};
for (var i = 0; i < payload.rules.length; ++i) {
@@ -541,9 +555,9 @@ WebInspector.CSSStyleSheet = function(payload)
WebInspector.CSSStyleSheet.createForId = function(styleSheetId, userCallback)
{
- function callback(styleSheetPayload)
+ function callback(error, styleSheetPayload)
{
- if (!styleSheetPayload)
+ if (error)
userCallback(null);
else
userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
@@ -559,14 +573,12 @@ WebInspector.CSSStyleSheet.prototype = {
setText: function(newText, userCallback)
{
- function callback(styleSheetPayload)
+ function callback(error, isChangeSuccessful)
{
- if (!styleSheetPayload)
- userCallback(null);
- else {
- userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
- WebInspector.cssModel._styleSheetChanged(this.id, true);
- }
+ if (userCallback)
+ userCallback(isChangeSuccessful);
+ if (isChangeSuccessful)
+ WebInspector.cssModel._styleSheetChanged(this.id, true);
}
CSSAgent.setStyleSheetText(this.id, newText, callback.bind(this));
diff --git a/Source/WebCore/inspector/front-end/CallStackSidebarPane.js b/Source/WebCore/inspector/front-end/CallStackSidebarPane.js
index e1618b2..3d71101 100644
--- a/Source/WebCore/inspector/front-end/CallStackSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/CallStackSidebarPane.js
@@ -27,16 +27,18 @@ WebInspector.CallStackSidebarPane = function(model)
{
WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack"));
this._model = model;
+
+ this.bodyElement.addEventListener("contextmenu", this._contextMenu.bind(this), true);
}
WebInspector.CallStackSidebarPane.prototype = {
- update: function(details)
+ update: function(callFrames, details)
{
this.bodyElement.removeChildren();
this.placards = [];
- if (!details) {
+ if (!callFrames) {
var infoElement = document.createElement("div");
infoElement.className = "info";
infoElement.textContent = WebInspector.UIString("Not Paused");
@@ -44,7 +46,6 @@ WebInspector.CallStackSidebarPane.prototype = {
return;
}
- var callFrames = details.callFrames;
var title;
var subtitle;
var script;
@@ -60,36 +61,38 @@ WebInspector.CallStackSidebarPane.prototype = {
break;
}
- script = WebInspector.debuggerModel.scriptForSourceID(callFrame.sourceID);
- if (script)
- subtitle = WebInspector.displayNameForURL(script.sourceURL);
+ var subtitle;
+ if (!callFrame.isInternalScript)
+ subtitle = WebInspector.displayNameForURL(callFrame.url);
else
subtitle = WebInspector.UIString("(internal script)");
- if (subtitle)
- subtitle += ":" + (callFrame.line + 1);
- else
- subtitle = WebInspector.UIString("line %d", callFrame.line + 1);
-
var placard = new WebInspector.Placard(title, subtitle);
placard.callFrame = callFrame;
-
- placard.element.addEventListener("click", this._placardSelected.bind(this), false);
+ placard.element.addEventListener("click", this._placardSelected.bind(this, placard), false);
+
+ function didGetSourceLocation(placard, sourceFileId, lineNumber, columnNumber)
+ {
+ if (placard.subtitle)
+ placard.subtitle += ":" + (lineNumber + 1);
+ else
+ placard.subtitle = WebInspector.UIString("line %d", lineNumber + 1);
+ placard._text = WebInspector.UIString("%s() at %s", placard.title, placard.subtitle);
+ }
+ callFrame.sourceLocation(didGetSourceLocation.bind(this, placard));
this.placards.push(placard);
this.bodyElement.appendChild(placard.element);
}
- if (details.breakpoint)
- this._scriptBreakpointHit();
- else if (details.eventType === WebInspector.DebuggerEventTypes.NativeBreakpoint)
- this._nativeBreakpointHit(details.eventData);
+ if (details.eventType === WebInspector.DebuggerEventTypes.NativeBreakpoint) {
+ if (details.eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.DOM)
+ this._domBreakpointHit(details.eventData);
+ }
},
set selectedCallFrame(x)
{
- this._model.selectedCallFrame = x;
-
for (var i = 0; i < this.placards.length; ++i) {
var placard = this.placards[i];
placard.selected = (placard.callFrame === x);
@@ -142,10 +145,27 @@ WebInspector.CallStackSidebarPane.prototype = {
return -1;
},
- _placardSelected: function(event)
+ _placardSelected: function(placard, event)
+ {
+ this._model.selectedCallFrame = placard.callFrame;
+ },
+
+ _contextMenu: function(event)
+ {
+ if (!this.placards.length)
+ return;
+
+ var contextMenu = new WebInspector.ContextMenu();
+ contextMenu.appendItem(WebInspector.UIString("Copy Stack Trace"), this._copyStackTrace.bind(this));
+ contextMenu.show(event);
+ },
+
+ _copyStackTrace: function()
{
- var placardElement = event.target.enclosingNodeOrSelfWithClass("placard");
- this.selectedCallFrame = placardElement.placard.callFrame;
+ var text = "";
+ for (var i = 0; i < this.placards.length; ++i)
+ text += this.placards[i]._text;
+ InspectorFrontendHost.copyText(text);
},
registerShortcuts: function(section)
@@ -163,15 +183,15 @@ WebInspector.CallStackSidebarPane.prototype = {
section.addRelatedKeys([ nextCallFrame.name, prevCallFrame.name ], WebInspector.UIString("Next/previous call frame"));
},
- _scriptBreakpointHit: function()
+ setStatus: function(status)
{
var statusMessageElement = document.createElement("div");
statusMessageElement.className = "info";
- statusMessageElement.appendChild(document.createTextNode(WebInspector.UIString("Paused on a JavaScript breakpoint.")));
+ statusMessageElement.textContent = status;
this.bodyElement.appendChild(statusMessageElement);
},
- _nativeBreakpointHit: function(eventData)
+ _domBreakpointHit: function(eventData)
{
var breakpoint = WebInspector.breakpointManager.breakpointViewForEventData(eventData);
if (!breakpoint)
diff --git a/Source/WebCore/inspector/front-end/Color.js b/Source/WebCore/inspector/front-end/Color.js
index 5e7314c..73e47d4 100644
--- a/Source/WebCore/inspector/front-end/Color.js
+++ b/Source/WebCore/inspector/front-end/Color.js
@@ -597,7 +597,7 @@ WebInspector.Color.Nicknames = {
"mediumaquamarine": "66CDAA",
"mediumblue": "0000CD",
"mediumorchid": "BA55D3",
- "mediumpurple": "9370D8",
+ "mediumpurple": "9370DB",
"mediumseagreen": "3CB371",
"mediumslateblue": "7B68EE",
"mediumspringgreen": "00FA9A",
@@ -618,7 +618,7 @@ WebInspector.Color.Nicknames = {
"palegoldenrod": "EEE8AA",
"palegreen": "98FB98",
"paleturquoise": "AFEEEE",
- "palevioletred": "D87093",
+ "palevioletred": "DB7093",
"papayawhip": "FFEFD5",
"peachpuff": "FFDAB9",
"peru": "CD853F",
diff --git a/Source/WebCore/inspector/front-end/ConsoleView.js b/Source/WebCore/inspector/front-end/ConsoleView.js
index f59d87f..f3e3425 100644
--- a/Source/WebCore/inspector/front-end/ConsoleView.js
+++ b/Source/WebCore/inspector/front-end/ConsoleView.js
@@ -105,7 +105,7 @@ WebInspector.ConsoleView.prototype = {
_registerConsoleDomainDispatcher: function() {
var console = this;
var dispatcher = {
- addConsoleMessage: function(payload)
+ consoleMessage: function(payload)
{
var consoleMessage = new WebInspector.ConsoleMessage(
payload.source,
@@ -121,13 +121,7 @@ WebInspector.ConsoleView.prototype = {
console.addMessage(consoleMessage);
},
- updateConsoleMessageExpiredCount: function(count)
- {
- var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
- console.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
- },
-
- updateConsoleMessageRepeatCount: function(count)
+ consoleMessageRepeatCountUpdated: function(count)
{
var msg = console.previousMessage;
var prevRepeatCount = msg.totalRepeatCount;
@@ -154,6 +148,14 @@ WebInspector.ConsoleView.prototype = {
InspectorBackend.registerDomainDispatcher("Console", dispatcher);
},
+ setConsoleMessageExpiredCount: function(count)
+ {
+ if (count) {
+ var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
+ this.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
+ }
+ },
+
_updateFilter: function(e)
{
var isMac = WebInspector.isMac();
@@ -298,7 +300,8 @@ WebInspector.ConsoleView.prototype = {
this.currentGroup.addMessage(msg);
}
- if (shouldScrollToLastMessage)
+ // Always scroll when command result arrives.
+ if (shouldScrollToLastMessage || (msg instanceof WebInspector.ConsoleCommandResult))
this._scheduleScrollIntoView();
},
@@ -364,7 +367,7 @@ WebInspector.ConsoleView.prototype = {
function evaluatedProperties(properties)
{
- RuntimeAgent.releaseObjectGroup(0, "completion");
+ RuntimeAgent.releaseObjectGroup("completion");
var propertyNames = [];
for (var i = 0; properties && i < properties.length; ++i)
propertyNames.push(properties[i].name);
@@ -531,9 +534,10 @@ WebInspector.ConsoleView.prototype = {
expression = "this";
}
- function evalCallback(result)
+ function evalCallback(error, result)
{
- callback(WebInspector.RemoteObject.fromPayload(result));
+ if (!error)
+ callback(WebInspector.RemoteObject.fromPayload(result));
}
RuntimeAgent.evaluate(expression, objectGroup, includeCommandLineAPI, evalCallback);
},
diff --git a/Source/WebCore/inspector/front-end/CookieItemsView.js b/Source/WebCore/inspector/front-end/CookieItemsView.js
index c8187bb..6bf3326 100644
--- a/Source/WebCore/inspector/front-end/CookieItemsView.js
+++ b/Source/WebCore/inspector/front-end/CookieItemsView.js
@@ -140,7 +140,7 @@ WebInspector.CookieItemsView.prototype = {
_deleteCookie: function(cookie)
{
- InspectorAgent.deleteCookie(cookie.name, this._cookieDomain);
+ PageAgent.deleteCookie(cookie.name, this._cookieDomain);
this._update();
},
@@ -199,3 +199,57 @@ WebInspector.SimpleCookiesTable.prototype = {
this._dataGrid.updateWidths();
}
}
+
+
+WebInspector.Cookies = {}
+
+WebInspector.Cookies.getCookiesAsync = function(callback)
+{
+ function mycallback(error, cookies, cookiesString)
+ {
+ if (error)
+ return;
+ if (cookiesString)
+ callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false);
+ else
+ callback(cookies, true);
+ }
+
+ PageAgent.getCookies(mycallback);
+}
+
+WebInspector.Cookies.buildCookiesFromString = function(rawCookieString)
+{
+ var rawCookies = rawCookieString.split(/;\s*/);
+ var cookies = [];
+
+ if (!(/^\s*$/.test(rawCookieString))) {
+ for (var i = 0; i < rawCookies.length; ++i) {
+ var cookie = rawCookies[i];
+ var delimIndex = cookie.indexOf("=");
+ var name = cookie.substring(0, delimIndex);
+ var value = cookie.substring(delimIndex + 1);
+ var size = name.length + value.length;
+ cookies.push({ name: name, value: value, size: size });
+ }
+ }
+
+ return cookies;
+}
+
+WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL)
+{
+ var url = resourceURL.asParsedURL();
+ if (!url || !this.cookieDomainMatchesResourceDomain(cookie.domain, url.host))
+ return false;
+ return (url.path.indexOf(cookie.path) === 0
+ && (!cookie.port || url.port == cookie.port)
+ && (!cookie.secure || url.scheme === "https"));
+}
+
+WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain)
+{
+ if (cookieDomain.charAt(0) !== '.')
+ return resourceDomain === cookieDomain;
+ return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i");
+}
diff --git a/Source/WebCore/inspector/front-end/DOMAgent.js b/Source/WebCore/inspector/front-end/DOMAgent.js
index cb28aba..a2a9c2d 100644
--- a/Source/WebCore/inspector/front-end/DOMAgent.js
+++ b/Source/WebCore/inspector/front-end/DOMAgent.js
@@ -33,13 +33,12 @@ WebInspector.DOMNode = function(doc, payload) {
this.ownerDocument = doc;
this.id = payload.id;
- this.nodeType = payload.nodeType;
- this.nodeName = payload.nodeName;
- this.localName = payload.localName;
+ this._nodeType = payload.nodeType;
+ this._nodeName = payload.nodeName;
+ this._localName = payload.localName;
this._nodeValue = payload.nodeValue;
- this.textContent = this.nodeValue;
- this.attributes = [];
+ this._attributes = [];
this._attributesMap = {};
if (payload.attributes)
this._setAttributesPayload(payload.attributes);
@@ -62,21 +61,21 @@ WebInspector.DOMNode = function(doc, payload) {
this.breakpoints = {};
- if (this.nodeType === Node.ELEMENT_NODE) {
+ if (this._nodeType === Node.ELEMENT_NODE) {
// HTML and BODY from internal iframes should not overwrite top-level ones.
- if (!this.ownerDocument.documentElement && this.nodeName === "HTML")
+ if (!this.ownerDocument.documentElement && this._nodeName === "HTML")
this.ownerDocument.documentElement = this;
- if (!this.ownerDocument.body && this.nodeName === "BODY")
+ if (!this.ownerDocument.body && this._nodeName === "BODY")
this.ownerDocument.body = this;
if (payload.documentURL)
this.documentURL = payload.documentURL;
- } else if (this.nodeType === Node.DOCUMENT_TYPE_NODE) {
+ } else if (this._nodeType === Node.DOCUMENT_TYPE_NODE) {
this.publicId = payload.publicId;
this.systemId = payload.systemId;
this.internalSubset = payload.internalSubset;
- } else if (this.nodeType === Node.DOCUMENT_NODE) {
+ } else if (this._nodeType === Node.DOCUMENT_NODE) {
this.documentURL = payload.documentURL;
- } else if (this.nodeType === Node.ATTRIBUTE_NODE) {
+ } else if (this._nodeType === Node.ATTRIBUTE_NODE) {
this.name = payload.name;
this.value = payload.value;
}
@@ -85,7 +84,7 @@ WebInspector.DOMNode = function(doc, payload) {
WebInspector.DOMNode.prototype = {
hasAttributes: function()
{
- return this.attributes.length > 0;
+ return this._attributes.length > 0;
},
hasChildNodes: function()
@@ -93,14 +92,34 @@ WebInspector.DOMNode.prototype = {
return this._childNodeCount > 0;
},
- get nodeValue() {
+ nodeType: function()
+ {
+ return this._nodeType;
+ },
+
+ nodeName: function()
+ {
+ return this._nodeName;
+ },
+
+ setNodeName: function(name, callback)
+ {
+ DOMAgent.setNodeName(this.id, name, callback);
+ },
+
+ localName: function()
+ {
+ return this._localName;
+ },
+
+ nodeValue: function()
+ {
return this._nodeValue;
},
- set nodeValue(value) {
- if (this.nodeType != Node.TEXT_NODE)
- return;
- this.ownerDocument._domAgent.setTextNodeValueAsync(this, value, function() {});
+ setNodeValue: function(value, callback)
+ {
+ DOMAgent.setNodeValue(this.id, value, callback);
},
getAttribute: function(name)
@@ -109,42 +128,95 @@ WebInspector.DOMNode.prototype = {
return attr ? attr.value : undefined;
},
- setAttribute: function(name, value)
+ setAttribute: function(name, value, callback)
{
- var self = this;
- var callback = function()
+ function mycallback(error)
{
- var attr = self._attributesMap[name];
- if (attr)
- attr.value = value;
- else
- attr = self._addAttribute(name, value);
- };
- this.ownerDocument._domAgent.setAttributeAsync(this, name, value, callback);
+ if (!error) {
+ var attr = this._attributesMap[name];
+ if (attr)
+ attr.value = value;
+ else
+ attr = this._addAttribute(name, value);
+ }
+
+ if (callback)
+ callback();
+ }
+ DOMAgent.setAttribute(this.id, name, value, mycallback.bind(this));
},
- removeAttribute: function(name)
+ attributes: function()
{
- var self = this;
- var callback = function()
+ return this._attributes;
+ },
+
+ removeAttribute: function(name, callback)
+ {
+ function mycallback(error, success)
{
- delete self._attributesMap[name];
- for (var i = 0; i < self.attributes.length; ++i) {
- if (self.attributes[i].name == name) {
- self.attributes.splice(i, 1);
- break;
+ if (!error) {
+ delete this._attributesMap[name];
+ for (var i = 0; i < this._attributes.length; ++i) {
+ if (this._attributes[i].name === name) {
+ this._attributes.splice(i, 1);
+ break;
+ }
}
}
- };
- this.ownerDocument._domAgent.removeAttributeAsync(this, name, callback);
+
+ if (callback)
+ callback();
+ }
+ DOMAgent.removeAttribute(this.id, name, mycallback.bind(this));
+ },
+
+ getChildNodes: function(callback)
+ {
+ if (this.children) {
+ if (callback)
+ callback(this.children);
+ return;
+ }
+
+ function mycallback(error) {
+ if (!error && callback)
+ callback(this.children);
+ }
+ DOMAgent.getChildNodes(this.id, mycallback.bind(this));
+ },
+
+ getOuterHTML: function(callback)
+ {
+ DOMAgent.getOuterHTML(this.id, callback);
+ },
+
+ setOuterHTML: function(html, callback)
+ {
+ DOMAgent.setOuterHTML(this.id, html, callback);
+ },
+
+ removeNode: function(callback)
+ {
+ DOMAgent.removeNode(this.id, callback);
+ },
+
+ copyNode: function(callback)
+ {
+ DOMAgent.copyNode(this.id, callback);
+ },
+
+ eventListeners: function(callback)
+ {
+ DOMAgent.getEventListenersForNode(this.id, callback);
},
path: function()
{
var path = [];
var node = this;
- while (node && "index" in node && node.nodeName.length) {
- path.push([node.index, node.nodeName]);
+ while (node && "index" in node && node._nodeName.length) {
+ path.push([node.index, node._nodeName]);
node = node.parentNode;
}
path.reverse();
@@ -153,7 +225,7 @@ WebInspector.DOMNode.prototype = {
_setAttributesPayload: function(attrs)
{
- this.attributes = [];
+ this._attributes = [];
this._attributesMap = {};
for (var i = 0; i < attrs.length; i += 2)
this._addAttribute(attrs[i], attrs[i + 1]);
@@ -219,7 +291,7 @@ WebInspector.DOMNode.prototype = {
"_node": this
};
this._attributesMap[name] = attr;
- this.attributes.push(attr);
+ this._attributes.push(attr);
}
}
@@ -230,42 +302,6 @@ WebInspector.DOMDocument = function(domAgent, payload)
this._domAgent = domAgent;
}
-WebInspector.DOMDocument.prototype = {
-
- addEventListener: function(name, callback)
- {
- var listeners = this._listeners[name];
- if (!listeners) {
- listeners = [];
- this._listeners[name] = listeners;
- }
- listeners.push(callback);
- },
-
- removeEventListener: function(name, callback)
- {
- var listeners = this._listeners[name];
- if (!listeners)
- return;
-
- var index = listeners.indexOf(callback);
- if (index != -1)
- listeners.splice(index, 1);
- },
-
- _fireDomEvent: function(name, event)
- {
- var listeners = this._listeners[name];
- if (!listeners)
- return;
-
- for (var i = 0; i < listeners.length; ++i) {
- var listener = listeners[i];
- listener.call(this, event);
- }
- }
-}
-
WebInspector.DOMDocument.prototype.__proto__ = WebInspector.DOMNode.prototype;
WebInspector.DOMAgent = function() {
@@ -274,101 +310,84 @@ WebInspector.DOMAgent = function() {
InspectorBackend.registerDomainDispatcher("DOM", new WebInspector.DOMDispatcher(this));
}
+WebInspector.DOMAgent.Events = {
+ AttrModified: "AttrModified",
+ CharacterDataModified: "CharacterDataModified",
+ NodeInserted: "NodeInserted",
+ NodeRemoved: "NodeRemoved",
+ DocumentUpdated: "DocumentUpdated",
+ ChildNodeCountUpdated: "ChildNodeCountUpdated"
+}
+
WebInspector.DOMAgent.prototype = {
requestDocument: function(callback)
{
if (this._document) {
if (callback)
callback(this._document);
- } else
- this._documentUpdated(callback);
+ return;
+ }
+
+ function mycallback(error, root)
+ {
+ if (!error)
+ this._setDocument(root);
+
+ if (callback)
+ callback(this._document);
+ }
+ DOMAgent.getDocument(mycallback.bind(this));
},
pushNodeToFrontend: function(objectId, callback)
{
+ function callbackWrapper(error, nodeId)
+ {
+ if (callback)
+ callback(error ? 0 : nodeId);
+ }
+
function mycallback()
{
if (this._document)
- DOMAgent.pushNodeToFrontend(objectId, callback);
- else {
- if (callback)
- callback(0);
- }
+ DOMAgent.pushNodeToFrontend(objectId, callbackWrapper);
+ else
+ callbackWrapper("No document");
}
+
this.requestDocument(mycallback.bind(this));
},
pushNodeByPathToFrontend: function(path, callback)
{
+ function callbackWrapper(error, nodeId)
+ {
+ if (callback)
+ callback(error ? 0 : nodeId);
+ }
+
function mycallback()
{
if (this._document)
- DOMAgent.pushNodeByPathToFrontend(path, callback);
- else {
- if (callback)
- callback(0);
- }
+ DOMAgent.pushNodeByPathToFrontend(path, callbackWrapper);
+ else
+ callbackWrapper("No document");
}
this.requestDocument(mycallback.bind(this));
},
- getChildNodesAsync: function(parent, callback)
- {
- var children = parent.children;
- if (children) {
- callback(children);
- return;
- }
- function mycallback() {
- callback(parent.children);
- }
- DOMAgent.getChildNodes(parent.id, mycallback);
- },
-
- setAttributeAsync: function(node, name, value, callback)
- {
- var mycallback = this._didApplyDomChange.bind(this, node, callback);
- DOMAgent.setAttribute(node.id, name, value, mycallback);
- },
-
- removeAttributeAsync: function(node, name, callback)
- {
- var mycallback = this._didApplyDomChange.bind(this, node, callback);
- DOMAgent.removeAttribute(node.id, name, mycallback);
- },
-
- setTextNodeValueAsync: function(node, text, callback)
- {
- var mycallback = this._didApplyDomChange.bind(this, node, callback);
- DOMAgent.setTextNodeValue(node.id, text, mycallback);
- },
-
- _didApplyDomChange: function(node, callback, success)
- {
- if (!success)
- return;
- callback();
- // TODO(pfeldman): Fix this hack.
- var elem = WebInspector.panels.elements.treeOutline.findTreeElement(node);
- if (elem)
- elem.updateTitle();
- },
-
_attributesUpdated: function(nodeId, attrsArray)
{
var node = this._idToDOMNode[nodeId];
node._setAttributesPayload(attrsArray);
- var event = {target: node};
- this._document._fireDomEvent("DOMAttrModified", event);
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified, node);
},
_characterDataModified: function(nodeId, newValue)
{
var node = this._idToDOMNode[nodeId];
node._nodeValue = newValue;
- node.textContent = newValue;
- var event = { target : node };
- this._document._fireDomEvent("DOMCharacterDataModified", event);
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.CharacterDataModified, node);
},
nodeForId: function(nodeId)
@@ -376,15 +395,10 @@ WebInspector.DOMAgent.prototype = {
return this._idToDOMNode[nodeId];
},
- _documentUpdated: function(callback)
+ _documentUpdated: function()
{
- function mycallback(root)
- {
- this._setDocument(root);
- if (callback)
- callback(this._document);
- }
- DOMAgent.getDocument(mycallback.bind(this));
+ this._setDocument(null);
+ this.requestDocument();
},
_setDocument: function(payload)
@@ -393,11 +407,11 @@ WebInspector.DOMAgent.prototype = {
if (payload && "id" in payload) {
this._document = new WebInspector.DOMDocument(this, payload);
this._idToDOMNode[payload.id] = this._document;
- this._bindNodes(this._document.children);
- WebInspector.breakpointManager.restoreDOMBreakpoints();
+ if (this._document.children)
+ this._bindNodes(this._document.children);
} else
this._document = null;
- WebInspector.panels.elements.setDocument(this._document);
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.DocumentUpdated, this._document);
},
_setDetachedRoot: function(payload)
@@ -432,10 +446,7 @@ WebInspector.DOMAgent.prototype = {
{
var node = this._idToDOMNode[nodeId];
node._childNodeCount = newValue;
- var outline = WebInspector.panels.elements.treeOutline;
- var treeElement = outline.findTreeElement(node);
- if (treeElement)
- treeElement.hasChildren = newValue;
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.ChildNodeCountUpdated, node);
},
_childNodeInserted: function(parentId, prevId, payload)
@@ -444,8 +455,7 @@ WebInspector.DOMAgent.prototype = {
var prev = this._idToDOMNode[prevId];
var node = parent._insertChild(prev, payload);
this._idToDOMNode[node.id] = node;
- var event = { target : node, relatedNode : parent };
- this._document._fireDomEvent("DOMNodeInserted", event);
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeInserted, node);
},
_childNodeRemoved: function(parentId, nodeId)
@@ -453,8 +463,7 @@ WebInspector.DOMAgent.prototype = {
var parent = this._idToDOMNode[parentId];
var node = this._idToDOMNode[nodeId];
parent.removeChild_(node);
- var event = { target : node, relatedNode : parent };
- this._document._fireDomEvent("DOMNodeRemoved", event);
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved, {node:node, parent:parent});
delete this._idToDOMNode[nodeId];
this._removeBreakpoints(node);
},
@@ -467,9 +476,23 @@ WebInspector.DOMAgent.prototype = {
return;
for (var i = 0; i < node.children.length; ++i)
this._removeBreakpoints(node.children[i]);
+ },
+
+ performSearch: function(query, searchResultCollector, searchSynchronously)
+ {
+ this._searchResultCollector = searchResultCollector;
+ DOMAgent.performSearch(query, !!searchSynchronously);
+ },
+
+ cancelSearch: function()
+ {
+ delete this._searchResultCollector;
+ DOMAgent.cancelSearch();
}
}
+WebInspector.DOMAgent.prototype.__proto__ = WebInspector.Object.prototype;
+
WebInspector.DOMDispatcher = function(domAgent)
{
this._domAgent = domAgent;
@@ -516,98 +539,9 @@ WebInspector.DOMDispatcher.prototype = {
WebInspector.updateFocusedNode(nodeId);
},
- addNodesToSearchResult: function(nodeIds)
+ searchResults: function(nodeIds)
{
- WebInspector.panels.elements.addNodesToSearchResult(nodeIds);
+ if (this._domAgent._searchResultCollector)
+ this._domAgent._searchResultCollector(nodeIds);
}
}
-
-WebInspector.ApplicationCacheDispatcher = function()
-{
-}
-
-WebInspector.ApplicationCacheDispatcher.getApplicationCachesAsync = function(callback)
-{
- function mycallback(applicationCaches)
- {
- // FIXME: Currently, this list only returns a single application cache.
- if (applicationCaches)
- callback(applicationCaches);
- }
-
- ApplicationCacheAgent.getApplicationCaches(mycallback);
-}
-
-WebInspector.ApplicationCacheDispatcher.prototype = {
- updateApplicationCacheStatus: function(status)
- {
- WebInspector.panels.resources.updateApplicationCacheStatus(status);
- },
-
- updateNetworkState: function(isNowOnline)
- {
- WebInspector.panels.resources.updateNetworkState(isNowOnline);
- }
-}
-
-InspectorBackend.registerDomainDispatcher("ApplicationCache", new WebInspector.ApplicationCacheDispatcher());
-
-WebInspector.Cookies = {}
-
-WebInspector.Cookies.getCookiesAsync = function(callback)
-{
- function mycallback(cookies, cookiesString)
- {
- if (cookiesString)
- callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false);
- else
- callback(cookies, true);
- }
-
- InspectorAgent.getCookies(mycallback);
-}
-
-WebInspector.Cookies.buildCookiesFromString = function(rawCookieString)
-{
- var rawCookies = rawCookieString.split(/;\s*/);
- var cookies = [];
-
- if (!(/^\s*$/.test(rawCookieString))) {
- for (var i = 0; i < rawCookies.length; ++i) {
- var cookie = rawCookies[i];
- var delimIndex = cookie.indexOf("=");
- var name = cookie.substring(0, delimIndex);
- var value = cookie.substring(delimIndex + 1);
- var size = name.length + value.length;
- cookies.push({ name: name, value: value, size: size });
- }
- }
-
- return cookies;
-}
-
-WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL)
-{
- var url = resourceURL.asParsedURL();
- if (!url || !this.cookieDomainMatchesResourceDomain(cookie.domain, url.host))
- return false;
- return (url.path.indexOf(cookie.path) === 0
- && (!cookie.port || url.port == cookie.port)
- && (!cookie.secure || url.scheme === "https"));
-}
-
-WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain)
-{
- if (cookieDomain.charAt(0) !== '.')
- return resourceDomain === cookieDomain;
- return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i");
-}
-
-WebInspector.EventListeners = {}
-
-WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callback)
-{
- if (!node)
- return;
- DOMAgent.getEventListenersForNode(node.id, callback);
-}
diff --git a/Source/WebCore/inspector/front-end/DOMStorageItemsView.js b/Source/WebCore/inspector/front-end/DOMStorageItemsView.js
index dbd736b..b63bc96 100644
--- a/Source/WebCore/inspector/front-end/DOMStorageItemsView.js
+++ b/Source/WebCore/inspector/front-end/DOMStorageItemsView.js
@@ -61,12 +61,14 @@ WebInspector.DOMStorageItemsView.prototype = {
update: function()
{
this.element.removeChildren();
- var callback = this._showDOMStorageEntries.bind(this);
- this.domStorage.getEntries(callback);
+ this.domStorage.getEntries(this._showDOMStorageEntries.bind(this));
},
- _showDOMStorageEntries: function(entries)
+ _showDOMStorageEntries: function(error, entries)
{
+ if (error)
+ return;
+
this._dataGrid = this._dataGridForDOMStorageEntries(entries);
this.element.appendChild(this._dataGrid.element);
this._dataGrid.autoSizeColumns(10);
diff --git a/Source/WebCore/inspector/front-end/Database.js b/Source/WebCore/inspector/front-end/Database.js
index e4bafea..685c288 100644
--- a/Source/WebCore/inspector/front-end/Database.js
+++ b/Source/WebCore/inspector/front-end/Database.js
@@ -77,17 +77,22 @@ WebInspector.Database.prototype = {
getTableNames: function(callback)
{
- function sortingCallback(names)
+ function sortingCallback(error, names)
{
- callback(names.sort());
+ if (!error)
+ callback(names.sort());
}
DatabaseAgent.getDatabaseTableNames(this._id, sortingCallback);
},
executeSql: function(query, onSuccess, onError)
{
- function callback(success, transactionId)
+ function callback(error, success, transactionId)
{
+ if (error) {
+ onError(error);
+ return;
+ }
if (!success) {
onError(WebInspector.UIString("Database not found."));
return;
diff --git a/Source/WebCore/inspector/front-end/DebuggerModel.js b/Source/WebCore/inspector/front-end/DebuggerModel.js
index d31ff24..c1d59b1 100644
--- a/Source/WebCore/inspector/front-end/DebuggerModel.js
+++ b/Source/WebCore/inspector/front-end/DebuggerModel.js
@@ -30,8 +30,7 @@
WebInspector.DebuggerModel = function()
{
- this._paused = false;
- this._callFrames = [];
+ this._debuggerPausedDetails = {};
this._breakpoints = {};
this._scripts = {};
@@ -39,31 +38,20 @@ WebInspector.DebuggerModel = function()
}
WebInspector.DebuggerModel.Events = {
+ DebuggerWasEnabled: "debugger-was-enabled",
+ DebuggerWasDisabled: "debugger-was-disabled",
DebuggerPaused: "debugger-paused",
DebuggerResumed: "debugger-resumed",
ParsedScriptSource: "parsed-script-source",
FailedToParseScriptSource: "failed-to-parse-script-source",
- ScriptSourceChanged: "script-source-changed",
- BreakpointAdded: "breakpoint-added",
- BreakpointRemoved: "breakpoint-removed",
- BreakpointResolved: "breakpoint-resolved"
+ BreakpointResolved: "breakpoint-resolved",
+ Reset: "reset"
}
WebInspector.DebuggerModel.prototype = {
enableDebugger: function()
{
DebuggerAgent.enable();
- if (this._breakpointsPushedToBackend)
- return;
- var breakpoints = WebInspector.settings.breakpoints;
- for (var i = 0; i < breakpoints.length; ++i) {
- var breakpoint = breakpoints[i];
- if (typeof breakpoint.url !== "string" || typeof breakpoint.lineNumber !== "number" || typeof breakpoint.columnNumber !== "number" ||
- typeof breakpoint.condition !== "string" || typeof breakpoint.enabled !== "boolean")
- continue;
- this.setBreakpoint(breakpoint.url, breakpoint.lineNumber, breakpoint.columnNumber, breakpoint.condition, breakpoint.enabled);
- }
- this._breakpointsPushedToBackend = true;
},
disableDebugger: function()
@@ -71,120 +59,98 @@ WebInspector.DebuggerModel.prototype = {
DebuggerAgent.disable();
},
+ _debuggerWasEnabled: function()
+ {
+ this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasEnabled);
+ },
+
+ _debuggerWasDisabled: function()
+ {
+ this._breakpoints = {};
+ this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasDisabled);
+ },
+
continueToLocation: function(sourceID, lineNumber, columnNumber)
{
DebuggerAgent.continueToLocation(sourceID, lineNumber, columnNumber);
},
- setBreakpoint: function(url, lineNumber, columnNumber, condition, enabled)
+ setBreakpoint: function(url, lineNumber, columnNumber, condition, enabled, callback)
{
- function didSetBreakpoint(breakpointsPushedToBackend, breakpointId, locations)
+ // Adjust column if needed.
+ var minColumnNumber = 0;
+ for (var id in this._scripts) {
+ var script = this._scripts[id];
+ if (url === script.sourceURL && lineNumber === script.lineOffset)
+ minColumnNumber = minColumnNumber ? Math.min(minColumnNumber, script.columnOffset) : script.columnOffset;
+ }
+ columnNumber = Math.max(columnNumber, minColumnNumber);
+
+ function didSetBreakpoint(error, breakpointId, locations)
{
- if (!breakpointId)
- return;
- var breakpoint = new WebInspector.Breakpoint(breakpointId, url, "", lineNumber, columnNumber, condition, enabled);
- breakpoint.locations = locations;
- this._breakpoints[breakpointId] = breakpoint;
- if (breakpointsPushedToBackend)
- this._saveBreakpoints();
- this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointAdded, breakpoint);
+ var breakpoint;
+ if (!error && breakpointId) {
+ breakpoint = new WebInspector.Breakpoint(breakpointId, url, "", lineNumber, columnNumber, condition, enabled);
+ breakpoint.locations = locations;
+ this._breakpoints[breakpointId] = breakpoint;
+ }
+ if (callback)
+ callback(breakpoint);
}
- DebuggerAgent.setJavaScriptBreakpoint(url, lineNumber, columnNumber, condition, enabled, didSetBreakpoint.bind(this, this._breakpointsPushedToBackend));
+ DebuggerAgent.setBreakpointByUrl(url, lineNumber, columnNumber, condition, enabled, didSetBreakpoint.bind(this));
},
- setBreakpointBySourceId: function(sourceID, lineNumber, columnNumber, condition, enabled)
+ setBreakpointBySourceId: function(sourceID, lineNumber, columnNumber, condition, enabled, callback)
{
- function didSetBreakpoint(breakpointId, actualLineNumber, actualColumnNumber)
+ function didSetBreakpoint(error, breakpointId, actualLineNumber, actualColumnNumber)
{
- if (!breakpointId)
- return;
- var breakpoint = new WebInspector.Breakpoint(breakpointId, "", sourceID, lineNumber, columnNumber, condition, enabled);
- breakpoint.addLocation(sourceID, actualLineNumber, actualColumnNumber);
- this._breakpoints[breakpointId] = breakpoint;
- this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointAdded, breakpoint);
+ var breakpoint;
+ if (!error && breakpointId) {
+ breakpoint = new WebInspector.Breakpoint(breakpointId, "", sourceID, lineNumber, columnNumber, condition, enabled);
+ breakpoint.addLocation(sourceID, actualLineNumber, actualColumnNumber);
+ this._breakpoints[breakpointId] = breakpoint;
+ }
+ if (callback)
+ callback(breakpoint);
}
- DebuggerAgent.setJavaScriptBreakpointBySourceId(sourceID, lineNumber, columnNumber, condition, enabled, didSetBreakpoint.bind(this));
+ DebuggerAgent.setBreakpoint(sourceID, lineNumber, columnNumber, condition, enabled, didSetBreakpoint.bind(this));
},
removeBreakpoint: function(breakpointId)
{
- DebuggerAgent.removeJavaScriptBreakpoint(breakpointId);
- var breakpoint = this._breakpoints[breakpointId];
+ DebuggerAgent.removeBreakpoint(breakpointId);
delete this._breakpoints[breakpointId];
- this._saveBreakpoints();
- this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointRemoved, breakpointId);
- },
-
- updateBreakpoint: function(breakpointId, condition, enabled)
- {
- var breakpoint = this._breakpoints[breakpointId];
- this.removeBreakpoint(breakpointId);
- if (breakpoint.url)
- this.setBreakpoint(breakpoint.url, breakpoint.lineNumber, breakpoint.columnNumber, condition, enabled);
- else
- this.setBreakpointBySourceId(breakpoint.sourceID, breakpoint.lineNumber, breakpoint.columnNumber, condition, enabled);
},
_breakpointResolved: function(breakpointId, sourceID, lineNumber, columnNumber)
{
var breakpoint = this._breakpoints[breakpointId];
- if (!breakpoint)
- return;
breakpoint.addLocation(sourceID, lineNumber, columnNumber);
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointResolved, breakpoint);
},
- _saveBreakpoints: function()
- {
- var serializedBreakpoints = [];
- for (var id in this._breakpoints) {
- var breakpoint = this._breakpoints[id];
- if (!breakpoint.url)
- continue;
- var serializedBreakpoint = {};
- serializedBreakpoint.url = breakpoint.url;
- serializedBreakpoint.lineNumber = breakpoint.lineNumber;
- serializedBreakpoint.columnNumber = breakpoint.columnNumber;
- serializedBreakpoint.condition = breakpoint.condition;
- serializedBreakpoint.enabled = breakpoint.enabled;
- serializedBreakpoints.push(serializedBreakpoint);
- }
- WebInspector.settings.breakpoints = serializedBreakpoints;
- },
-
get breakpoints()
{
return this._breakpoints;
},
- breakpointForId: function(breakpointId)
- {
- return this._breakpoints[breakpointId];
- },
-
- queryBreakpoints: function(filter)
- {
- var breakpoints = [];
- for (var id in this._breakpoints) {
- var breakpoint = this._breakpoints[id];
- if (filter(breakpoint))
- breakpoints.push(breakpoint);
- }
- return breakpoints;
- },
-
reset: function()
{
- this._paused = false;
- this._callFrames = [];
+ this._debuggerPausedDetails = {};
for (var id in this._breakpoints) {
var breakpoint = this._breakpoints[id];
if (!breakpoint.url)
- this.removeBreakpoint(id);
+ delete this._breakpoints[id];
else
breakpoint.locations = [];
}
this._scripts = {};
+ this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Reset);
+ },
+
+ get scripts()
+ {
+ return this._scripts;
},
scriptForSourceID: function(sourceID)
@@ -208,101 +174,42 @@ WebInspector.DebuggerModel.prototype = {
return scripts;
},
- editScriptSource: function(sourceID, scriptSource)
+ editScriptSource: function(sourceID, newSource, callback)
{
- function didEditScriptSource(success, newBodyOrErrorMessage, callFrames)
- {
- if (success) {
- if (callFrames && callFrames.length)
- this._callFrames = callFrames;
- this._updateScriptSource(sourceID, newBodyOrErrorMessage);
- } else
- WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMessage.MessageLevel.Warning);
- }
- DebuggerAgent.editScriptSource(sourceID, scriptSource, didEditScriptSource.bind(this));
+ DebuggerAgent.editScriptSource(sourceID, newSource, this._didEditScriptSource.bind(this, sourceID, callback));
},
- _updateScriptSource: function(sourceID, scriptSource)
+ _didEditScriptSource: function(sourceID, callback, error, newBody, callFrames)
{
- var script = this._scripts[sourceID];
- var oldSource = script.source;
- script.source = scriptSource;
-
- // Clear and re-create breakpoints according to text diff.
- var diff = Array.diff(oldSource.split("\n"), script.source.split("\n"));
- for (var id in this._breakpoints) {
- var breakpoint = this._breakpoints[id];
- if (breakpoint.url) {
- if (breakpoint.url !== script.sourceURL)
- continue;
- } else {
- if (breakpoint.sourceID !== sourceID)
- continue;
- }
- this.removeBreakpoint(breakpoint.id);
- var lineNumber = breakpoint.lineNumber;
- var newLineNumber = diff.left[lineNumber].row;
- if (newLineNumber === undefined) {
- for (var i = lineNumber - 1; i >= 0; --i) {
- if (diff.left[i].row === undefined)
- continue;
- var shiftedLineNumber = diff.left[i].row + lineNumber - i;
- if (shiftedLineNumber < diff.right.length) {
- var originalLineNumber = diff.right[shiftedLineNumber].row;
- if (originalLineNumber === lineNumber || originalLineNumber === undefined)
- newLineNumber = shiftedLineNumber;
- }
- break;
- }
- }
- if (newLineNumber === undefined)
- continue;
- if (breakpoint.url)
- this.setBreakpoint(breakpoint.url, newLineNumber, breakpoint.columnNumber, breakpoint.condition, breakpoint.enabled);
- else
- this.setBreakpointBySourceId(sourceID, newLineNumber, breakpoint.columnNumber, breakpoint.condition, breakpoint.enabled);
- }
-
- this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ScriptSourceChanged, { sourceID: sourceID, oldSource: oldSource });
+ callback(!error, error || newBody);
+ if (error)
+ return;
+ this._scripts[sourceID].source = newBody;
+ this._debuggerPausedDetails.callFrames = callFrames;
},
get callFrames()
{
- return this._callFrames;
+ return this._debuggerPausedDetails.callFrames;
+ },
+
+ get debuggerPausedDetails()
+ {
+ return this._debuggerPausedDetails;
},
_pausedScript: function(details)
{
- this._paused = true;
- this._callFrames = details.callFrames;
- details.breakpoint = this._breakpointForCallFrame(details.callFrames[0]);
+ this._debuggerPausedDetails = details;
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, details);
},
_resumedScript: function()
{
- this._paused = false;
- this._callFrames = [];
+ this._debuggerPausedDetails = {};
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerResumed);
},
- _breakpointForCallFrame: function(callFrame)
- {
- function match(location)
- {
- if (location.sourceID != callFrame.sourceID)
- return false;
- return location.lineNumber === callFrame.line && location.columnNumber === callFrame.column;
- }
- for (var id in this._breakpoints) {
- var breakpoint = this._breakpoints[id];
- for (var i = 0; i < breakpoint.locations.length; ++i) {
- if (match(breakpoint.locations[i]))
- return breakpoint;
- }
- }
- },
-
_parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType)
{
var script = new WebInspector.Script(sourceID, sourceURL, "", lineOffset, columnOffset, length, undefined, undefined, scriptWorldType);
@@ -331,32 +238,32 @@ WebInspector.DebuggerDispatcher = function(debuggerModel)
}
WebInspector.DebuggerDispatcher.prototype = {
- pausedScript: function(details)
+ paused: function(details)
{
this._debuggerModel._pausedScript(details);
},
- resumedScript: function()
+ resumed: function()
{
this._debuggerModel._resumedScript();
},
debuggerWasEnabled: function()
{
- WebInspector.panels.scripts.debuggerWasEnabled();
+ this._debuggerModel._debuggerWasEnabled();
},
debuggerWasDisabled: function()
{
- WebInspector.panels.scripts.debuggerWasDisabled();
+ this._debuggerModel._debuggerWasDisabled();
},
- parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType)
+ scriptParsed: function(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType)
{
this._debuggerModel._parsedScriptSource(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType);
},
- failedToParseScriptSource: function(sourceURL, source, startingLine, errorLine, errorMessage)
+ scriptFailedToParse: function(sourceURL, source, startingLine, errorLine, errorMessage)
{
this._debuggerModel._failedToParseScriptSource(sourceURL, source, startingLine, errorLine, errorMessage);
},
@@ -364,17 +271,5 @@ WebInspector.DebuggerDispatcher.prototype = {
breakpointResolved: function(breakpointId, sourceID, lineNumber, columnNumber)
{
this._debuggerModel._breakpointResolved(breakpointId, sourceID, lineNumber, columnNumber);
- },
-
- didCreateWorker: function()
- {
- var workersPane = WebInspector.panels.scripts.sidebarPanes.workers;
- workersPane.addWorker.apply(workersPane, arguments);
- },
-
- didDestroyWorker: function()
- {
- var workersPane = WebInspector.panels.scripts.sidebarPanes.workers;
- workersPane.removeWorker.apply(workersPane, arguments);
}
}
diff --git a/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js b/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
index a97db34..d12affe 100644
--- a/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
+++ b/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
@@ -30,102 +30,549 @@
WebInspector.DebuggerPresentationModel = function()
{
- this._breakpoints = {};
- this._sourceLocationToBreakpointId = {};
+ this._sourceFiles = {};
+ this._messages = [];
+ this._presentationBreakpoints = {};
+ this._presentationCallFrames = [];
+ this._selectedCallFrameIndex = 0;
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, this._breakpointAdded, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointRemoved, this._breakpointRemoved, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource, this._failedToParseScriptSource, this);
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Reset, this._reset, this);
}
WebInspector.DebuggerPresentationModel.Events = {
+ SourceFileAdded: "source-file-added",
+ SourceFileChanged: "source-file-changed",
+ ConsoleMessageAdded: "console-message-added",
BreakpointAdded: "breakpoint-added",
- BreakpointRemoved: "breakpoint-removed"
+ BreakpointRemoved: "breakpoint-removed",
+ DebuggerPaused: "debugger-paused",
+ DebuggerResumed: "debugger-resumed",
+ CallFrameSelected: "call-frame-selected"
}
WebInspector.DebuggerPresentationModel.prototype = {
+ _debuggerWasEnabled: function()
+ {
+ this._restoreBreakpoints();
+ },
+
+ sourceFile: function(sourceFileId)
+ {
+ return this._sourceFiles[sourceFileId];
+ },
+
+ requestSourceFileContent: function(sourceFileId, callback)
+ {
+ this._sourceFiles[sourceFileId].requestContent(callback);
+ },
+
+ _parsedScriptSource: function(event)
+ {
+ this._addScript(event.data);
+ this._refreshBreakpoints();
+ },
+
+ _failedToParseScriptSource: function(event)
+ {
+ this._addScript(event.data);
+ this._refreshBreakpoints();
+ },
+
+ _addScript: function(script)
+ {
+ var sourceFileId = script.sourceURL || script.sourceID;
+ var sourceFile = this._sourceFiles[sourceFileId];
+ if (sourceFile) {
+ sourceFile.addScript(script);
+ return;
+ }
+
+ function contentChanged(sourceFile)
+ {
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.SourceFileChanged, this._sourceFiles[sourceFileId]);
+ }
+ if (!this._formatSourceFiles)
+ sourceFile = new WebInspector.SourceFile(sourceFileId, script, contentChanged.bind(this));
+ else
+ sourceFile = new WebInspector.FormattedSourceFile(sourceFileId, script, contentChanged.bind(this), this._formatter);
+ this._sourceFiles[sourceFileId] = sourceFile;
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.SourceFileAdded, sourceFile);
+ },
+
+ _refreshBreakpoints: function()
+ {
+ var breakpoints = WebInspector.debuggerModel.breakpoints;
+ for (var id in breakpoints) {
+ if (!(id in this._presentationBreakpoints))
+ this._breakpointAdded(breakpoints[id]);
+ }
+ },
+
+ canEditScriptSource: function(sourceFileId)
+ {
+ if (!Preferences.canEditScriptSource)
+ return false;
+ var script = this._scriptForSourceFileId(sourceFileId);
+ return !script.lineOffset && !script.columnOffset;
+ },
+
+ editScriptSource: function(sourceFileId, text, callback)
+ {
+ var script = this._scriptForSourceFileId(sourceFileId);
+ var sourceFile = this._sourceFiles[sourceFileId];
+ var oldSource = sourceFile.content;
+ function didEditScriptSource(success, newBodyOrErrorMessage)
+ {
+ if (!success) {
+ callback(false, newBodyOrErrorMessage);
+ return;
+ }
+
+ var newSource = newBodyOrErrorMessage;
+ this._updateBreakpointsAfterLiveEdit(sourceFileId, oldSource, newSource);
+
+ var resource = WebInspector.resourceForURL(script.sourceURL);
+ if (resource) {
+ var revertHandle = this.editScriptSource.bind(this, sourceFileId, oldSource, sourceFile.reload.bind(sourceFile));
+ resource.setContent(newSource, revertHandle);
+ }
+
+ callback(true, newSource);
+
+ if (WebInspector.debuggerModel.callFrames)
+ this._debuggerPaused();
+ }
+ WebInspector.debuggerModel.editScriptSource(script.sourceID, text, didEditScriptSource.bind(this));
+ },
+
+ _updateBreakpointsAfterLiveEdit: function(sourceFileId, oldSource, newSource)
+ {
+ // Clear and re-create breakpoints according to text diff.
+ var diff = Array.diff(oldSource.split("\n"), newSource.split("\n"));
+ for (var id in this._presentationBreakpoints) {
+ var breakpoint = this._presentationBreakpoints[id];
+ if (breakpoint.sourceFileId !== sourceFileId)
+ continue;
+ var lineNumber = breakpoint.lineNumber;
+ this.removeBreakpoint(sourceFileId, lineNumber);
+
+ var newLineNumber = diff.left[lineNumber].row;
+ if (newLineNumber === undefined) {
+ for (var i = lineNumber - 1; i >= 0; --i) {
+ if (diff.left[i].row === undefined)
+ continue;
+ var shiftedLineNumber = diff.left[i].row + lineNumber - i;
+ if (shiftedLineNumber < diff.right.length) {
+ var originalLineNumber = diff.right[shiftedLineNumber].row;
+ if (originalLineNumber === lineNumber || originalLineNumber === undefined)
+ newLineNumber = shiftedLineNumber;
+ }
+ break;
+ }
+ }
+ if (newLineNumber !== undefined)
+ this.setBreakpoint(sourceFileId, newLineNumber, breakpoint.condition, breakpoint.enabled);
+ }
+ },
+
+ toggleFormatSourceFiles: function()
+ {
+ this._formatSourceFiles = !this._formatSourceFiles;
+ if (this._formatSourceFiles && !this._formatter)
+ this._formatter = new WebInspector.ScriptFormatter();
+
+ var messages = this._messages;
+ this._sourceFiles = {};
+ this._messages = [];
+ this._presentationBreakpoints = {};
+
+ var scripts = WebInspector.debuggerModel.scripts;
+ for (var id in scripts)
+ this._addScript(scripts[id]);
+
+ for (var i = 0; i < messages.length; ++i)
+ this.addConsoleMessage(messages[i]);
+
+ this._refreshBreakpoints();
+
+ if (WebInspector.debuggerModel.callFrames)
+ this._debuggerPaused();
+ },
+
+ addConsoleMessage: function(message)
+ {
+ this._messages.push(message);
+
+ var sourceFile = this._sourceFileForScriptURL(message.url);
+ if (!sourceFile)
+ return;
+
+ function didRequestSourceMapping(mapping)
+ {
+ var presentationMessage = {};
+ presentationMessage.sourceFileId = sourceFile.id;
+ presentationMessage.lineNumber = mapping.scriptLocationToSourceLocation(message.line - 1, 0).lineNumber;
+ presentationMessage.originalMessage = message;
+ sourceFile.messages.push(presentationMessage);
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessageAdded, presentationMessage);
+ }
+ sourceFile.requestSourceMapping(didRequestSourceMapping.bind(this));
+ },
+
+ clearConsoleMessages: function()
+ {
+ this._messages = [];
+ for (var id in this._sourceFiles)
+ this._sourceFiles[id].messages = [];
+ },
+
+ continueToLine: function(sourceFileId, lineNumber)
+ {
+ function didRequestSourceMapping(mapping)
+ {
+ var location = mapping.sourceLocationToScriptLocation(lineNumber, 0);
+ WebInspector.debuggerModel.continueToLocation(location.scriptId, location.lineNumber, location.columnNumber);
+ }
+ this._sourceFiles[sourceFileId].requestSourceMapping(didRequestSourceMapping.bind(this));
+ },
+
breakpointsForSourceFileId: function(sourceFileId)
{
+ var sourceFile = this.sourceFile(sourceFileId);
+ if (!sourceFile)
+ return [];
var breakpoints = [];
- for (var id in this._breakpoints) {
- var breakpoint = this._breakpoints[id];
- if (breakpoint.sourceFileId === sourceFileId)
- breakpoints.push(breakpoint);
- }
+ for (var lineNumber in sourceFile.breakpoints)
+ breakpoints.push(sourceFile.breakpoints[lineNumber]);
return breakpoints;
},
- _breakpointAdded: function(event)
+ setBreakpoint: function(sourceFileId, lineNumber, condition, enabled)
{
- var breakpoint = event.data;
- var location = breakpoint.locations.length ? breakpoint.locations[0] : breakpoint;
- var sourceLocation = this._actualLocationToSourceLocation(breakpoint.url || breakpoint.sourceID, location.lineNumber, location.columnNumber);
+ function didSetBreakpoint(breakpoint)
+ {
+ if (breakpoint) {
+ this._breakpointAdded(breakpoint);
+ this._saveBreakpoints();
+ }
+ }
- var encodedSourceLocation = this._encodeSourceLocation(sourceLocation.sourceFileId, sourceLocation.lineNumber);
- if (encodedSourceLocation in this._sourceLocationToBreakpointId) {
- // We can't show more than one breakpoint on a single source frame line. Remove newly added breakpoint.
- WebInspector.debuggerModel.removeBreakpoint(breakpoint.id);
- return;
+ function didRequestSourceMapping(mapping)
+ {
+ var location = mapping.sourceLocationToScriptLocation(lineNumber, 0);
+ var script = WebInspector.debuggerModel.scriptForSourceID(location.scriptId);
+ if (script.sourceURL)
+ WebInspector.debuggerModel.setBreakpoint(script.sourceURL, location.lineNumber, location.columnNumber, condition, enabled, didSetBreakpoint.bind(this));
+ else
+ WebInspector.debuggerModel.setBreakpointBySourceId(script.sourceID, location.lineNumber, location.columnNumber, condition, enabled, didSetBreakpoint.bind(this));
}
+ this._sourceFiles[sourceFileId].requestSourceMapping(didRequestSourceMapping.bind(this));
+ },
- var presentationBreakpoint = {
- sourceFileId: sourceLocation.sourceFileId,
- lineNumber: sourceLocation.lineNumber,
- url: breakpoint.url,
- resolved: !!breakpoint.locations.length,
- condition: breakpoint.condition,
- enabled: breakpoint.enabled
- };
+ setBreakpointEnabled: function(sourceFileId, lineNumber, enabled)
+ {
+ var breakpoint = this.removeBreakpoint(sourceFileId, lineNumber);
+ this.setBreakpoint(sourceFileId, lineNumber, breakpoint.condition, enabled);
+ },
- this._sourceLocationToBreakpointId[encodedSourceLocation] = breakpoint.id;
- this._breakpoints[breakpoint.id] = presentationBreakpoint;
+ updateBreakpoint: function(sourceFileId, lineNumber, condition, enabled)
+ {
+ this.removeBreakpoint(sourceFileId, lineNumber);
+ this.setBreakpoint(sourceFileId, lineNumber, condition, enabled);
+ },
- this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.BreakpointAdded, presentationBreakpoint);
+ removeBreakpoint: function(sourceFileId, lineNumber)
+ {
+ var breakpoint = this.findBreakpoint(sourceFileId, lineNumber);
+ WebInspector.debuggerModel.removeBreakpoint(breakpoint._id);
+ this._breakpointRemoved(breakpoint._id);
+ this._saveBreakpoints();
+ return breakpoint;
+ },
+
+ findBreakpoint: function(sourceFileId, lineNumber)
+ {
+ var sourceFile = this.sourceFile(sourceFileId);
+ if (sourceFile)
+ return sourceFile.breakpoints[lineNumber];
},
- _breakpointRemoved: function(event)
+ _breakpointAdded: function(breakpoint)
{
- var breakpointId = event.data;
- var breakpoint = this._breakpoints[breakpointId];
- var encodedSourceLocation = this._encodeSourceLocation(breakpoint.sourceFileId, breakpoint.lineNumber);
- delete this._breakpoints[breakpointId];
- delete this._sourceLocationToBreakpointId[encodedSourceLocation];
+ var script;
+ if (breakpoint.url)
+ script = WebInspector.debuggerModel.scriptsForURL(breakpoint.url)[0];
+ else
+ script = WebInspector.debuggerModel.scriptForSourceID(breakpoint.sourceID);
+ if (!script)
+ return;
+
+ function didRequestSourceMapping(mapping)
+ {
+ var scriptLocation = breakpoint.locations.length ? breakpoint.locations[0] : breakpoint;
+ var sourceLocation = mapping.scriptLocationToSourceLocation(scriptLocation.lineNumber, scriptLocation.columnNumber);
+ var lineNumber = sourceLocation.lineNumber;
+
+ if (this.findBreakpoint(sourceFile.id, lineNumber)) {
+ // We can't show more than one breakpoint on a single source file line.
+ WebInspector.debuggerModel.removeBreakpoint(breakpoint.id);
+ return;
+ }
+
+ var presentationBreakpoint = new WebInspector.PresentationBreakpoint(breakpoint, sourceFile, lineNumber);
+ presentationBreakpoint._id = breakpoint.id;
+ this._presentationBreakpoints[breakpoint.id] = presentationBreakpoint;
+ sourceFile.breakpoints[lineNumber] = presentationBreakpoint;
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.BreakpointAdded, presentationBreakpoint);
+ }
+ var sourceFile = this._sourceFileForScript(script);
+ sourceFile.requestSourceMapping(didRequestSourceMapping.bind(this));
+ },
+
+ _breakpointRemoved: function(breakpointId)
+ {
+ var breakpoint = this._presentationBreakpoints[breakpointId];
+ delete this._presentationBreakpoints[breakpointId];
+ var sourceFile = this.sourceFile(breakpoint.sourceFileId);
+ delete sourceFile.breakpoints[breakpoint.lineNumber];
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.BreakpointRemoved, breakpoint);
},
_breakpointResolved: function(event)
{
var breakpoint = event.data;
- this._breakpointRemoved({ data: breakpoint.id });
- this._breakpointAdded({ data: breakpoint });
+ if (!(breakpoint.id in this._presentationBreakpoints))
+ return;
+ this._breakpointRemoved(breakpoint.id);
+ this._breakpointAdded(breakpoint);
+ },
+
+ _restoreBreakpoints: function()
+ {
+ function didSetBreakpoint(breakpoint)
+ {
+ if (breakpoint)
+ this._breakpointAdded(breakpoint);
+ }
+ var breakpoints = WebInspector.settings.breakpoints;
+ for (var i = 0; i < breakpoints.length; ++i) {
+ var breakpoint = breakpoints[i];
+ WebInspector.debuggerModel.setBreakpoint(breakpoint.url, breakpoint.lineNumber, breakpoint.columnNumber, breakpoint.condition, breakpoint.enabled, didSetBreakpoint.bind(this));
+ }
},
- _encodeSourceLocation: function(sourceFileId, lineNumber)
+ _saveBreakpoints: function()
{
- return sourceFileId + ":" + lineNumber;
+ var serializedBreakpoints = [];
+ var breakpoints = WebInspector.debuggerModel.breakpoints;
+ for (var id in breakpoints) {
+ var breakpoint = breakpoints[id];
+ if (!breakpoint.url)
+ continue;
+ var serializedBreakpoint = {};
+ serializedBreakpoint.url = breakpoint.url;
+ serializedBreakpoint.lineNumber = breakpoint.lineNumber;
+ serializedBreakpoint.columnNumber = breakpoint.columnNumber;
+ serializedBreakpoint.condition = breakpoint.condition;
+ serializedBreakpoint.enabled = breakpoint.enabled;
+ serializedBreakpoints.push(serializedBreakpoint);
+ }
+ WebInspector.settings.breakpoints = serializedBreakpoints;
},
- set selectedCallFrame(callFrame)
+ _debuggerPaused: function()
{
- this._selectedCallFrame = callFrame;
- if (!callFrame)
- return;
+ var callFrames = WebInspector.debuggerModel.callFrames;
+ this._presentationCallFrames = [];
+ for (var i = 0; i < callFrames.length; ++i) {
+ var callFrame = callFrames[i];
+ var sourceFile;
+ var script = WebInspector.debuggerModel.scriptForSourceID(callFrame.sourceID);
+ if (script)
+ sourceFile = this._sourceFileForScript(script);
+ this._presentationCallFrames.push(new WebInspector.PresenationCallFrame(callFrame, i, sourceFile));
+ }
+ var details = WebInspector.debuggerModel.debuggerPausedDetails;
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.DebuggerPaused, { callFrames: this._presentationCallFrames, details: details });
+
+ this.selectedCallFrame = this._presentationCallFrames[this._selectedCallFrameIndex];
+ },
+
+ _debuggerResumed: function()
+ {
+ this._presentationCallFrames = [];
+ this._selectedCallFrameIndex = 0;
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.DebuggerResumed);
+ },
- var script = WebInspector.debuggerModel.scriptForSourceID(callFrame.sourceID);
- callFrame.sourceLocation = this._actualLocationToSourceLocation(script.sourceURL || script.sourceID, callFrame.line, callFrame.column);
+ set selectedCallFrame(callFrame)
+ {
+ this._selectedCallFrameIndex = callFrame.index;
+ callFrame.select();
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.CallFrameSelected, callFrame);
},
get selectedCallFrame()
{
- return this._selectedCallFrame;
+ return this._presentationCallFrames[this._selectedCallFrameIndex];
+ },
+
+ _sourceFileForScript: function(script)
+ {
+ return this._sourceFiles[script.sourceURL || script.sourceID];
+ },
+
+ _sourceFileForScriptURL: function(scriptURL)
+ {
+ return this._sourceFiles[scriptURL];
+ },
+
+ _scriptForSourceFileId: function(sourceFileId)
+ {
+ function filter(script)
+ {
+ return (script.sourceURL || script.sourceID) === sourceFileId;
+ }
+ return WebInspector.debuggerModel.queryScripts(filter)[0];
},
- _actualLocationToSourceLocation: function(sourceID, lineNumber, columnNumber)
+ _reset: function()
{
- // TODO: use source mapping to obtain source location.
- return { sourceFileId: sourceID, lineNumber: lineNumber, columnNumber: columnNumber };
+ this._sourceFiles = {};
+ this._messages = [];
+ this._presentationBreakpoints = {};
+ this._presentationCallFrames = [];
+ this._selectedCallFrameIndex = 0;
}
}
WebInspector.DebuggerPresentationModel.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.PresentationBreakpoint = function(breakpoint, sourceFile, lineNumber)
+{
+ this._breakpoint = breakpoint;
+ this._sourceFile = sourceFile;
+ this._lineNumber = lineNumber;
+}
+
+WebInspector.PresentationBreakpoint.prototype = {
+ get sourceFileId()
+ {
+ return this._sourceFile.id;
+ },
+
+ get lineNumber()
+ {
+ return this._lineNumber;
+ },
+
+ get condition()
+ {
+ return this._breakpoint.condition;
+ },
+
+ get enabled()
+ {
+ return this._breakpoint.enabled;
+ },
+
+ get url()
+ {
+ return this._sourceFile.url;
+ },
+
+ get resolved()
+ {
+ return !!this._breakpoint.locations.length
+ },
+
+ loadSnippet: function(callback)
+ {
+ function didRequestContent(mimeType, content)
+ {
+ var lineEndings = content.lineEndings();
+ var snippet = "";
+ if (this.lineNumber < lineEndings.length)
+ snippet = content.substring(lineEndings[this.lineNumber - 1], lineEndings[this.lineNumber]);
+ callback(snippet);
+ }
+ this._sourceFile.requestContent(didRequestContent.bind(this));
+ }
+}
+
+WebInspector.PresenationCallFrame = function(callFrame, index, sourceFile)
+{
+ this._callFrame = callFrame;
+ this._index = index;
+ this._sourceFile = sourceFile;
+ this._script = WebInspector.debuggerModel.scriptForSourceID(callFrame.sourceID);
+}
+
+WebInspector.PresenationCallFrame.prototype = {
+ get functionName()
+ {
+ return this._callFrame.functionName;
+ },
+
+ get type()
+ {
+ return this._callFrame.type;
+ },
+
+ get isInternalScript()
+ {
+ return !this._script;
+ },
+
+ get url()
+ {
+ if (this._sourceFile)
+ return this._sourceFile.url;
+ },
+
+ get scopeChain()
+ {
+ return this._callFrame.scopeChain;
+ },
+
+ get index()
+ {
+ return this._index;
+ },
+
+ select: function()
+ {
+ if (this._sourceFile)
+ this._sourceFile.forceLoadContent(this._script);
+ },
+
+ evaluate: function(code, objectGroup, includeCommandLineAPI, callback)
+ {
+ function didEvaluateOnCallFrame(error, result)
+ {
+ callback(WebInspector.RemoteObject.fromPayload(result));
+ }
+ DebuggerAgent.evaluateOnCallFrame(this._callFrame.id, code, objectGroup, includeCommandLineAPI, didEvaluateOnCallFrame.bind(this));
+ },
+
+ sourceLocation: function(callback)
+ {
+ if (!this._sourceFile) {
+ callback(undefined, this._callFrame.line, this._callFrame.column);
+ return;
+ }
+
+ function didRequestSourceMapping(mapping)
+ {
+ var sourceLocation = mapping.scriptLocationToSourceLocation(this._callFrame.line, this._callFrame.column);
+ callback(this._sourceFile.id, sourceLocation.lineNumber, sourceLocation.columnNumber);
+ }
+ this._sourceFile.requestSourceMapping(didRequestSourceMapping.bind(this));
+ }
+}
diff --git a/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js b/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js
index 14ba142..4fc1844 100644
--- a/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js
+++ b/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js
@@ -61,8 +61,8 @@ WebInspector.HeapSnapshotGridNode.prototype = {
populateChildren: function(provider, howMany, atIndex)
{
if (!howMany && provider) {
- howMany = provider.instancesCount;
- provider.resetInstancesCount();
+ howMany = provider.instanceCount;
+ provider.instanceCount = 0;
}
provider = provider || this._provider;
howMany = howMany || this._defaultPopulateCount;
@@ -75,7 +75,7 @@ WebInspector.HeapSnapshotGridNode.prototype = {
break;
}
}
- for ( ; howMany > 0 && provider.hasNext(); provider.next(), provider.incInstancesCount(), --howMany) {
+ for ( ; howMany > 0 && provider.hasNext(); provider.next(), ++provider.instanceCount, --howMany) {
var item = provider.item;
if (haveSavedChildren) {
var hash = this._childHashForEntity(item);
@@ -131,7 +131,6 @@ WebInspector.HeapSnapshotGenericObjectNode = function(tree, node, hasChildren, p
this._type = node.type;
this._shallowSize = node.selfSize;
this._retainedSize = node.retainedSize;
- this._retainedSizeExact = this._shallowSize === this._retainedSize;
this.snapshotNodeId = node.id;
this.snapshotNodeIndex = node.nodeIndex;
};
@@ -168,7 +167,7 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = {
get _countPercent()
{
- return this._count / this.tree.snapshot.nodesCount * 100.0;
+ return this._count / this.tree.snapshot.nodeCount * 100.0;
},
get data()
@@ -204,18 +203,11 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = {
var view = this.dataGrid.snapshotView;
data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.bytesToString(this._shallowSize);
- data["retainedSize"] = (this._retainedSizeExact ? "" : "\u2248") + (view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.bytesToString(this._retainedSize));
+ data["retainedSize"] = view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.bytesToString(this._retainedSize);
return this._enhanceData ? this._enhanceData(data) : data;
},
- set exactRetainedSize(size)
- {
- this._retainedSize = size;
- this._retainedSizeExact = true;
- this.refresh();
- },
-
get _retainedSizePercent()
{
return this._retainedSize / this.dataGrid.snapshot.totalSize * 100.0;
@@ -231,9 +223,8 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype.__proto__ = WebInspector.He
WebInspector.HeapSnapshotObjectNode = function(tree, edge)
{
- var node = edge.node;
- var provider = this._createProvider(tree.snapshot, node.rawEdges);
- WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node, !provider.isEmpty, 100);
+ var provider = this._createProvider(tree.snapshot, edge.nodeIndex);
+ WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, edge.node, !provider.isEmpty, 100);
this._referenceName = edge.name;
this._referenceType = edge.type;
this._provider = provider;
@@ -245,12 +236,12 @@ WebInspector.HeapSnapshotObjectNode.prototype = {
return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, provider.item);
},
- _createProvider: function(snapshot, rawEdges)
+ _createProvider: function(snapshot, nodeIndex)
{
var showHiddenData = WebInspector.DetailedHeapshotView.prototype.showHiddenData;
return new WebInspector.HeapSnapshotEdgesProvider(
snapshot,
- rawEdges,
+ nodeIndex,
function(edge) {
return !edge.isInvisible
&& (showHiddenData || (!edge.isHidden && !edge.node.isHidden));
@@ -321,7 +312,7 @@ WebInspector.HeapSnapshotObjectNode.prototype.__proto__ = WebInspector.HeapSnaps
WebInspector.HeapSnapshotInstanceNode = function(tree, baseSnapshot, snapshot, node)
{
- var provider = this._createProvider(baseSnapshot || snapshot, node.rawEdges);
+ var provider = this._createProvider(baseSnapshot || snapshot, node.nodeIndex);
WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node, !provider.isEmpty, 100);
this._isDeletedNode = !!baseSnapshot;
this._provider = provider;
@@ -333,12 +324,12 @@ WebInspector.HeapSnapshotInstanceNode.prototype = {
return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, provider.item);
},
- _createProvider: function(snapshot, rawEdges)
+ _createProvider: function(snapshot, nodeIndex)
{
var showHiddenData = WebInspector.DetailedHeapshotView.prototype.showHiddenData;
return new WebInspector.HeapSnapshotEdgesProvider(
snapshot,
- rawEdges,
+ nodeIndex,
function(edge) {
return !edge.isInvisible
&& (showHiddenData || (!edge.isHidden && !edge.node.isHidden));
@@ -394,14 +385,14 @@ WebInspector.HeapSnapshotInstanceNode.prototype = {
WebInspector.HeapSnapshotInstanceNode.prototype.__proto__ = WebInspector.HeapSnapshotGenericObjectNode.prototype;
-WebInspector.HeapSnapshotConstructorNode = function(tree, constructor, aggregate)
+WebInspector.HeapSnapshotConstructorNode = function(tree, className, aggregate)
{
WebInspector.HeapSnapshotGridNode.call(this, tree, aggregate.count > 0, 100);
- this._name = constructor;
+ this._name = className;
this._count = aggregate.count;
this._shallowSize = aggregate.self;
this._retainedSize = aggregate.maxRet;
- this._provider = this._createNodesProvider(tree.snapshot, aggregate.type, aggregate.name);
+ this._provider = this._createNodesProvider(tree.snapshot, aggregate.type, className);
}
WebInspector.HeapSnapshotConstructorNode.prototype = {
@@ -410,14 +401,13 @@ WebInspector.HeapSnapshotConstructorNode.prototype = {
return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, null, this.dataGrid.snapshot, provider.item);
},
- _createNodesProvider: function(snapshot, nodeType, nodeName)
+ _createNodesProvider: function(snapshot, nodeType, nodeClassName)
{
return new WebInspector.HeapSnapshotNodesProvider(
snapshot,
- snapshot.allNodes,
function (node) {
return node.type === nodeType
- && (nodeName === null || node.name === nodeName);
+ && (nodeClassName === null || node.className === nodeClassName);
});
},
@@ -456,7 +446,7 @@ WebInspector.HeapSnapshotConstructorNode.prototype = {
get _countPercent()
{
- return this._count / this.dataGrid.snapshot.nodesCount * 100.0;
+ return this._count / this.dataGrid.snapshot.nodeCount * 100.0;
},
get _retainedSizePercent()
@@ -485,12 +475,6 @@ WebInspector.HeapSnapshotIteratorsTuple.prototype = {
this._it2.first();
},
- resetInstancesCount: function()
- {
- this._it1.resetInstancesCount();
- this._it2.resetInstancesCount();
- },
-
sort: function(comparator)
{
this._it1.sort(comparator);
@@ -498,16 +482,16 @@ WebInspector.HeapSnapshotIteratorsTuple.prototype = {
}
};
-WebInspector.HeapSnapshotDiffNode = function(tree, constructor, baseAggregate, aggregate)
+WebInspector.HeapSnapshotDiffNode = function(tree, className, baseAggregate, aggregate)
{
if (!baseAggregate)
baseAggregate = { count: 0, self: 0, maxRet: 0, type:aggregate.type, name:aggregate.name, idxs: [] };
if (!aggregate)
aggregate = { count: 0, self: 0, maxRet: 0, type:baseAggregate.type, name:baseAggregate.name, idxs: [] };
WebInspector.HeapSnapshotGridNode.call(this, tree, true, 50);
- this._name = constructor;
+ this._name = className;
this._calculateDiff(tree.baseSnapshot, tree.snapshot, baseAggregate.idxs, aggregate.idxs);
- this._provider = this._createNodesProvider(tree.baseSnapshot, tree.snapshot, aggregate.type, aggregate.name);
+ this._provider = this._createNodesProvider(tree.baseSnapshot, tree.snapshot, aggregate.type, className);
}
WebInspector.HeapSnapshotDiffNode.prototype = {
@@ -559,7 +543,7 @@ WebInspector.HeapSnapshotDiffNode.prototype = {
return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, provider.snapshot, null, provider.item);
},
- _createNodesProvider: function(baseSnapshot, snapshot, nodeType, nodeName)
+ _createNodesProvider: function(baseSnapshot, snapshot, nodeType, nodeClassName)
{
return new WebInspector.HeapSnapshotIteratorsTuple(
createProvider(snapshot, baseSnapshot), createProvider(baseSnapshot, snapshot));
@@ -568,11 +552,10 @@ WebInspector.HeapSnapshotDiffNode.prototype = {
{
return new WebInspector.HeapSnapshotNodesProvider(
snapshot,
- snapshot.allNodes,
function (node) {
return node.type === nodeType
- && (nodeName === null || node.name === nodeName)
- && !(node.id in otherSnapshot.idsMap);
+ && (nodeClassName === null || node.className === nodeClassName)
+ && !otherSnapshot.hasId(node.id);
});
}
},
@@ -655,9 +638,8 @@ WebInspector.HeapSnapshotDominatorObjectNode.prototype = {
var showHiddenData = WebInspector.DetailedHeapshotView.prototype.showHiddenData;
return new WebInspector.HeapSnapshotNodesProvider(
snapshot,
- snapshot.allNodes,
function (node) {
- var dominatorIndex = node.dominatorIndex();
+ var dominatorIndex = node.dominatorIndex;
return dominatorIndex === nodeIndex
&& dominatorIndex !== node.nodeIndex
&& (showHiddenData || !node.isHidden);
diff --git a/Source/WebCore/inspector/front-end/DetailedHeapshotView.js b/Source/WebCore/inspector/front-end/DetailedHeapshotView.js
index ffce1dd..21d0fa9 100644
--- a/Source/WebCore/inspector/front-end/DetailedHeapshotView.js
+++ b/Source/WebCore/inspector/front-end/DetailedHeapshotView.js
@@ -45,8 +45,8 @@ WebInspector.HeapSnapshotContainmentDataGrid.prototype = {
{
this.snapshotView = snapshotView;
this.snapshot = snapshot;
- this.snapshotNodeIndex = this.snapshot._rootNodeIndex;
- this._provider = this._createProvider(snapshot, snapshot.rootNode.rawEdges);
+ this.snapshotNodeIndex = this.snapshot.rootNodeIndex;
+ this._provider = this._createProvider(snapshot, this.snapshotNodeIndex);
this.sort();
}
};
@@ -227,7 +227,7 @@ WebInspector.HeapSnapshotDominatorsDataGrid.prototype = {
{
this.snapshotView = snapshotView;
this.snapshot = snapshot;
- this.snapshotNodeIndex = this.snapshot._rootNodeIndex;
+ this.snapshotNodeIndex = this.snapshot.rootNodeIndex;
this._provider = this._createProvider(snapshot, this.snapshotNodeIndex);
this.sort();
}
@@ -263,11 +263,21 @@ WebInspector.HeapSnapshotRetainingPathsList.prototype = {
this.searchCancelled();
this.pathFinder = new WebInspector.HeapSnapshotPathFinder(snapshot, nodeIndex);
+ this._setRootChildrenForFinder();
this.removeChildren();
this._counter = 0;
- this.showNext(10);
+ this.showNext(100);
+ },
+
+ refresh: function()
+ {
+ this.removeChildren();
+ this._counter = 0;
+ delete this._cancel;
+ this._setRootChildrenForFinder();
+ this.showNext(100);
},
showNext: function(pathsCount)
@@ -283,7 +293,7 @@ WebInspector.HeapSnapshotRetainingPathsList.prototype = {
if (result === null) {
WebInspector.PleaseWaitMessage.prototype.hide();
if (!this.children.length)
- this.appendChild(new WebInspector.DataGridNode({path:WebInspector.UIString("This object is either only accessible via hidden properties, or current path search depth isn't enough."), len:""}, false));
+ this.appendChild(new WebInspector.DataGridNode({path:WebInspector.UIString("Can't find any paths."), len:""}, false));
return;
} else if (result !== false) {
if (this._prefix)
@@ -311,6 +321,19 @@ WebInspector.HeapSnapshotRetainingPathsList.prototype = {
}
},
+ _setRootChildrenForFinder: function()
+ {
+ function FilterDOMWindow(node)
+ {
+ return node.name === "DOMWindow";
+ }
+
+ if (this.snapshotView.isTracingToWindowObjects)
+ this.pathFinder.updateRoots(FilterDOMWindow);
+ else
+ this.pathFinder.updateRoots();
+ },
+
_performSorting: function(sortFunction)
{
function DataExtractorWrapper(nodeA, nodeB)
@@ -341,7 +364,6 @@ WebInspector.DetailedHeapshotView = function(parent, profile)
this.containmentView.element.addStyleClass("view");
this.containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid();
this.containmentDataGrid.element.addEventListener("click", this._mouseClickInContainmentGrid.bind(this), true);
- this.containmentDataGrid.element.addEventListener("dblclick", this._dblClickInContainmentGrid.bind(this), true);
this.containmentView.element.appendChild(this.containmentDataGrid.element);
this.element.appendChild(this.containmentView.element);
@@ -349,7 +371,6 @@ WebInspector.DetailedHeapshotView = function(parent, profile)
this.constructorsView.element.addStyleClass("view");
this.constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGrid();
this.constructorsDataGrid.element.addEventListener("click", this._mouseClickInContainmentGrid.bind(this), true);
- this.constructorsDataGrid.element.addEventListener("dblclick", this._dblClickInContainmentGrid.bind(this), true);
this.constructorsView.element.appendChild(this.constructorsDataGrid.element);
this.element.appendChild(this.constructorsView.element);
@@ -357,7 +378,6 @@ WebInspector.DetailedHeapshotView = function(parent, profile)
this.diffView.element.addStyleClass("view");
this.diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid();
this.diffDataGrid.element.addEventListener("click", this._mouseClickInContainmentGrid.bind(this), true);
- this.diffDataGrid.element.addEventListener("dblclick", this._dblClickInContainmentGrid.bind(this), true);
this.diffView.element.appendChild(this.diffDataGrid.element);
this.element.appendChild(this.diffView.element);
@@ -365,17 +385,27 @@ WebInspector.DetailedHeapshotView = function(parent, profile)
this.dominatorView.element.addStyleClass("view");
this.dominatorDataGrid = new WebInspector.HeapSnapshotDominatorsDataGrid();
this.dominatorDataGrid.element.addEventListener("click", this._mouseClickInContainmentGrid.bind(this), true);
- this.dominatorDataGrid.element.addEventListener("dblclick", this._dblClickInContainmentGrid.bind(this), true);
this.dominatorView.element.appendChild(this.dominatorDataGrid.element);
this.element.appendChild(this.dominatorView.element);
var retainmentView = new WebInspector.View();
- retainmentView.element.addStyleClass("view retaining-paths-view");
+ retainmentView.element.addStyleClass("view");
+ retainmentView.element.addStyleClass("retaining-paths-view");
var retainingPathsTitleDiv = document.createElement("div");
retainingPathsTitleDiv.className = "title";
var retainingPathsTitle = document.createElement("span");
- retainingPathsTitle.textContent = WebInspector.UIString("Retaining paths of the selected object");
+ retainingPathsTitle.textContent = WebInspector.UIString("Paths from the selected object");
+ this.retainingPathsRoot = document.createElement("select");
+ this.retainingPathsRoot.className = "status-bar-item";
+ this.retainingPathsRoot.addEventListener("change", this._changeRetainingPathsRoot.bind(this), false);
+ var toGCRootsTraceOption = document.createElement("option");
+ toGCRootsTraceOption.label = WebInspector.UIString("to GC roots");
+ var toWindowObjectsTraceOption = document.createElement("option");
+ toWindowObjectsTraceOption.label = WebInspector.UIString("to window objects");
+ this.retainingPathsRoot.appendChild(toGCRootsTraceOption);
+ this.retainingPathsRoot.appendChild(toWindowObjectsTraceOption);
retainingPathsTitleDiv.appendChild(retainingPathsTitle);
+ retainingPathsTitleDiv.appendChild(this.retainingPathsRoot);
retainmentView.element.appendChild(retainingPathsTitleDiv);
this.retainmentDataGrid = new WebInspector.HeapSnapshotRetainingPathsList();
retainmentView.element.appendChild(this.retainmentDataGrid.element);
@@ -416,6 +446,8 @@ WebInspector.DetailedHeapshotView = function(parent, profile)
this.helpButton = new WebInspector.StatusBarButton("", "heapshot-help-status-bar-item status-bar-item");
this.helpButton.addEventListener("click", this._helpClicked.bind(this), false);
+ var popoverHelper = new WebInspector.PopoverHelper(this.element, this._getHoverAnchor.bind(this), this._showStringContentPopup.bind(this));
+
this._loadProfile(this._profileUid, profileCallback.bind(this));
function profileCallback(profile)
@@ -714,24 +746,10 @@ WebInspector.DetailedHeapshotView.prototype = {
profile.sideBarElement.subtitle = Number.bytesToString(s.totalSize);
},
- _dblClickInContainmentGrid: function(event)
- {
- var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
- if (!cell || (!cell.hasStyleClass("retainedSize-column")))
- return;
- var nodeItem = event.target.enclosingNodeOrSelfWithNodeName("tr")._dataGridNode;
- ProfilerAgent.getExactHeapSnapshotNodeRetainedSize(this._profileUid, nodeItem.snapshotNodeId, setExactRetainedSize);
-
- function setExactRetainedSize(exactSize) {
- if (exactSize && exactSize != -1)
- nodeItem.exactRetainedSize = exactSize;
- }
- },
-
_mouseClickInContainmentGrid: function(event)
{
var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
- if (!cell || !(cell.hasStyleClass("object-column") || cell.hasStyleClass("shallowSize-column")))
+ if (!cell || (!cell.hasStyleClass("object-column") && !cell.hasStyleClass("shallowSize-column") && !cell.hasStyleClass("retainedSize-column")))
return;
var row = event.target.enclosingNodeOrSelfWithNodeName("tr");
if (!row)
@@ -794,6 +812,33 @@ WebInspector.DetailedHeapshotView.prototype = {
this.performSearch(this.currentQuery, this._searchFinishedCallback);
},
+ _changeRetainingPathsRoot: function(event)
+ {
+ if (!event)
+ return;
+ this.retainmentDataGrid.refresh();
+ },
+
+ _getHoverAnchor: function(target)
+ {
+ var span = target.enclosingNodeOrSelfWithNodeName("span");
+ if (!span || !span.hasStyleClass("console-formatted-string"))
+ return;
+ var row = target.enclosingNodeOrSelfWithNodeName("tr");
+ if (!row)
+ return;
+ var gridNode = row._dataGridNode;
+ if (!gridNode.snapshotNodeIndex)
+ return;
+ span.snapshotNodeIndex = gridNode.snapshotNodeIndex;
+ return span;
+ },
+
+ get isTracingToWindowObjects()
+ {
+ return this.retainingPathsRoot.selectedIndex === 1;
+ },
+
get _isShowingAsPercent()
{
return this.showCountAsPercent && this.showShallowSizeAsPercent && this.showRetainedSizeAsPercent;
@@ -808,6 +853,18 @@ WebInspector.DetailedHeapshotView.prototype = {
this.refreshShowAsPercents();
},
+ _showStringContentPopup: function(span)
+ {
+ var snapshotNode = new WebInspector.HeapSnapshotNode(this.profileWrapper, span.snapshotNodeIndex);
+ var stringContentElement = document.createElement("span");
+ stringContentElement.className = "monospace console-formatted-string";
+ stringContentElement.style.whiteSpace = "pre";
+ stringContentElement.textContent = "\"" + snapshotNode.name + "\"";
+ var popover = new WebInspector.Popover(stringContentElement);
+ popover.show(span);
+ return popover;
+ },
+
_helpClicked: function(event)
{
if (!this.helpPopover) {
diff --git a/Source/WebCore/inspector/front-end/ElementsPanel.js b/Source/WebCore/inspector/front-end/ElementsPanel.js
index 246abe8..724e0e2 100644
--- a/Source/WebCore/inspector/front-end/ElementsPanel.js
+++ b/Source/WebCore/inspector/front-end/ElementsPanel.js
@@ -35,6 +35,10 @@ WebInspector.ElementsPanel = function()
this.contentElement = document.createElement("div");
this.contentElement.id = "elements-content";
this.contentElement.className = "outline-disclosure source-code";
+ if (!WebInspector.settings.domWordWrap)
+ this.contentElement.classList.add("nowrap");
+
+ this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
this.treeOutline = new WebInspector.ElementsTreeOutline();
this.treeOutline.panel = this;
@@ -57,7 +61,7 @@ WebInspector.ElementsPanel = function()
this.panel.updateEventListeners();
if (this._focusedDOMNode) {
- DOMAgent.addInspectedNode(this._focusedDOMNode.id);
+ ConsoleAgent.addInspectedNode(this._focusedDOMNode.id);
WebInspector.extensionServer.notifyObjectSelected(this.panel.name);
}
};
@@ -109,7 +113,14 @@ WebInspector.ElementsPanel = function()
this._registerShortcuts();
- this.reset();
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeInserted, this._nodeInserted, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeRemoved, this._nodeRemoved, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._attributesUpdated, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.CharacterDataModified, this._characterDataModified, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdated, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.ChildNodeCountUpdated, this._childNodeCountUpdated, this);
+
+ this.recentlyModifiedNodes = [];
}
WebInspector.ElementsPanel.prototype = {
@@ -160,7 +171,7 @@ WebInspector.ElementsPanel.prototype = {
this.updateBreadcrumbSizes();
},
- reset: function()
+ _reset: function()
{
if (this.focusedDOMNode)
this._selectedPathOnReset = this.focusedDOMNode.path();
@@ -175,18 +186,21 @@ WebInspector.ElementsPanel.prototype = {
delete this.currentQuery;
},
- setDocument: function(inspectedRootDocument)
+ _documentUpdated: function(event)
+ {
+ this._setDocument(event.data);
+ },
+
+ _setDocument: function(inspectedRootDocument)
{
- this.reset();
+ this._reset();
this.searchCanceled();
if (!inspectedRootDocument)
return;
- inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this));
- inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this));
- inspectedRootDocument.addEventListener("DOMAttrModified", this._attributesUpdated.bind(this));
- inspectedRootDocument.addEventListener("DOMCharacterDataModified", this._characterDataModified.bind(this));
+ WebInspector.breakpointManager.restoreDOMBreakpoints();
+
this.rootDOMNode = inspectedRootDocument;
@@ -229,7 +243,7 @@ WebInspector.ElementsPanel.prototype = {
delete this._currentSearchResultIndex;
this._searchResults = [];
- DOMAgent.searchCanceled();
+ WebInspector.domAgent.cancelSearch();
},
performSearch: function(query)
@@ -245,7 +259,34 @@ WebInspector.ElementsPanel.prototype = {
this._matchesCountUpdateTimeout = null;
this._searchQuery = query;
- DOMAgent.performSearch(whitespaceTrimmedQuery, false);
+ WebInspector.domAgent.performSearch(whitespaceTrimmedQuery, this._addNodesToSearchResult.bind(this));
+ },
+
+ _contextMenuEventFired: function(event)
+ {
+ function isTextWrapped()
+ {
+ return !this.contentElement.hasStyleClass("nowrap");
+ }
+
+ function toggleWordWrap()
+ {
+ this.contentElement.classList.toggle("nowrap");
+ WebInspector.settings.domWordWrap = !this.contentElement.classList.contains("nowrap");
+
+ var treeElement = this.treeOutline.findTreeElement(this.focusedDOMNode);
+ if (treeElement)
+ treeElement.updateSelection(); // Recalculate selection highlight dimensions.
+ }
+
+ var contextMenu = new WebInspector.ContextMenu();
+
+ var populated = this.treeOutline.populateContextMenu(contextMenu, event);
+ if (populated)
+ contextMenu.appendSeparator();
+ contextMenu.appendCheckboxItem(WebInspector.UIString("Word Wrap"), toggleWordWrap.bind(this), isTextWrapped.call(this));
+
+ contextMenu.show(event);
},
populateHrefContextMenu: function(contextMenu, event, anchorElement)
@@ -289,7 +330,7 @@ WebInspector.ElementsPanel.prototype = {
this._matchesCountUpdateTimeout = setTimeout(this._updateMatchesCount.bind(this), 500);
},
- addNodesToSearchResult: function(nodeIds)
+ _addNodesToSearchResult: function(nodeIds)
{
if (!nodeIds.length)
return;
@@ -379,35 +420,42 @@ WebInspector.ElementsPanel.prototype = {
_attributesUpdated: function(event)
{
- this.recentlyModifiedNodes.push({node: event.target, updated: true});
+ this.recentlyModifiedNodes.push({node: event.data, updated: true});
if (this.visible)
this._updateModifiedNodesSoon();
- if (!this.sidebarPanes.styles.isModifyingStyle && event.target === this.focusedDOMNode)
+ if (!this.sidebarPanes.styles.isModifyingStyle && event.data === this.focusedDOMNode)
this._styleSheetChanged();
},
_characterDataModified: function(event)
{
- this.recentlyModifiedNodes.push({node: event.target, updated: true});
+ this.recentlyModifiedNodes.push({node: event.data, updated: true});
if (this.visible)
this._updateModifiedNodesSoon();
},
_nodeInserted: function(event)
{
- this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true});
+ this.recentlyModifiedNodes.push({node: event.data, parent: event.data.parentNode, inserted: true});
if (this.visible)
this._updateModifiedNodesSoon();
},
_nodeRemoved: function(event)
{
- this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, removed: true});
+ this.recentlyModifiedNodes.push({node: event.data.node, parent: event.data.parent, removed: true});
if (this.visible)
this._updateModifiedNodesSoon();
},
+ _childNodeCountUpdated: function(event)
+ {
+ var treeElement = this.treeOutline.findTreeElement(event.data);
+ if (treeElement)
+ treeElement.hasChildren = event.data.hasChildNodes();
+ },
+
_updateModifiedNodesSoon: function()
{
if ("_updateModifiedNodesTimeout" in this)
@@ -426,7 +474,6 @@ WebInspector.ElementsPanel.prototype = {
var updateBreadcrumbs = false;
for (var i = 0; i < this.recentlyModifiedNodes.length; ++i) {
- var replaced = this.recentlyModifiedNodes[i].replaced;
var parent = this.recentlyModifiedNodes[i].parent;
var node = this.recentlyModifiedNodes[i].node;
@@ -442,7 +489,7 @@ WebInspector.ElementsPanel.prototype = {
var parentNodeItem = this.treeOutline.findTreeElement(parent);
if (parentNodeItem && !parentNodeItem.alreadyUpdatedChildren) {
- parentNodeItem.updateChildren(replaced);
+ parentNodeItem.updateChildren();
parentNodeItem.alreadyUpdatedChildren = true;
updatedParentTreeElements.push(parentNodeItem);
}
@@ -577,7 +624,7 @@ WebInspector.ElementsPanel.prototype = {
foundRoot = false;
for (var current = this.focusedDOMNode; current; current = current.parentNode) {
- if (current.nodeType === Node.DOCUMENT_NODE)
+ if (current.nodeType() === Node.DOCUMENT_NODE)
continue;
if (current === this.rootDOMNode)
@@ -589,7 +636,7 @@ WebInspector.ElementsPanel.prototype = {
crumb.addEventListener("mousedown", selectCrumbFunction, false);
var crumbTitle;
- switch (current.nodeType) {
+ switch (current.nodeType()) {
case Node.ELEMENT_NODE:
this.decorateNodeLabel(current, crumb);
break;
@@ -610,7 +657,7 @@ WebInspector.ElementsPanel.prototype = {
break;
default:
- crumbTitle = this.treeOutline.nodeNameToCorrectCase(current.nodeName);
+ crumbTitle = this.treeOutline.nodeNameToCorrectCase(current.nodeName());
}
if (!crumb.childNodes.length) {
@@ -638,7 +685,7 @@ WebInspector.ElementsPanel.prototype = {
decorateNodeLabel: function(node, parentElement)
{
- var title = this.treeOutline.nodeNameToCorrectCase(node.nodeName);
+ var title = this.treeOutline.nodeNameToCorrectCase(node.nodeName());
var nameElement = document.createElement("span");
nameElement.textContent = title;
@@ -1033,7 +1080,7 @@ WebInspector.ElementsPanel.prototype = {
return;
event.clipboardData.clearData();
event.preventDefault();
- DOMAgent.copyNode(this.focusedDOMNode.id);
+ this.focusedDOMNode.copyNode();
},
rightSidebarResizerDragStart: function(event)
@@ -1073,14 +1120,15 @@ WebInspector.ElementsPanel.prototype = {
this._nodeSearchButton.toggled = false;
},
- _setSearchingForNode: function(enabled)
+ _setSearchingForNode: function(error, enabled)
{
- this._nodeSearchButton.toggled = enabled;
+ if (!error)
+ this._nodeSearchButton.toggled = enabled;
},
setSearchingForNode: function(enabled)
{
- InspectorAgent.setSearchingForNode(enabled, this._setSearchingForNode.bind(this));
+ DOMAgent.setSearchingForNode(enabled, this._setSearchingForNode.bind(this));
},
toggleSearchingForNode: function()
diff --git a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js
index 7b5ff2f..dd99db1 100644
--- a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -41,8 +41,6 @@ WebInspector.ElementsTreeOutline = function() {
this.showInElementsPanelEnabled = false;
this.rootDOMNode = null;
this.focusedDOMNode = null;
-
- this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
}
WebInspector.ElementsTreeOutline.prototype = {
@@ -144,7 +142,7 @@ WebInspector.ElementsTreeOutline.prototype = {
findTreeElement: function(node)
{
var treeElement = TreeOutline.prototype.findTreeElement.call(this, node, isAncestorNode, parentNode);
- if (!treeElement && node.nodeType === Node.TEXT_NODE) {
+ if (!treeElement && node.nodeType() === Node.TEXT_NODE) {
// The text node might have been inlined if it was short, so try to find the parent element.
treeElement = TreeOutline.prototype.findTreeElement.call(this, node.parentNode, isAncestorNode, parentNode);
}
@@ -189,11 +187,13 @@ WebInspector.ElementsTreeOutline.prototype = {
_treeElementFromEvent: function(event)
{
- var root = this.element;
+ var scrollContainer = this.element.parentElement;
// We choose this X coordinate based on the knowledge that our list
- // items extend nearly to the right edge of the outer <ol>.
- var x = root.totalOffsetLeft + root.offsetWidth - 20;
+ // items extend at least to the right edge of the outer <ol> container.
+ // In the no-word-wrap mode the outer <ol> may be wider than the tree container
+ // (and partially hidden), in which case we are left to use only its right boundary.
+ var x = scrollContainer.totalOffsetLeft + scrollContainer.offsetWidth - 36;
var y = event.pageY;
@@ -258,37 +258,40 @@ WebInspector.ElementsTreeOutline.prototype = {
WebInspector.highlightDOMNode(0);
},
- _contextMenuEventFired: function(event)
+ populateContextMenu: function(contextMenu, event)
{
var listItem = event.target.enclosingNodeOrSelfWithNodeName("LI");
if (!listItem || !listItem.treeElement)
- return;
+ return false;
- var contextMenu = new WebInspector.ContextMenu();
+ var populated;
if (this.showInElementsPanelEnabled) {
function focusElement()
{
WebInspector.panels.elements.switchToAndFocus(listItem.treeElement.representedObject);
}
contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), focusElement.bind(this));
+ populated = true;
} else {
var href = event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link") || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
- var needSeparator;
if (href)
- needSeparator = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
+ populated = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
if (tag && listItem.treeElement._populateTagContextMenu) {
- if (needSeparator)
+ if (populated)
contextMenu.appendSeparator();
listItem.treeElement._populateTagContextMenu(contextMenu, event);
+ populated = true;
} else if (textNode && listItem.treeElement._populateTextContextMenu) {
- if (needSeparator)
+ if (populated)
contextMenu.appendSeparator();
listItem.treeElement._populateTextContextMenu(contextMenu, textNode);
+ populated = true;
}
}
- contextMenu.show(event);
+
+ return populated;
}
}
@@ -302,7 +305,7 @@ WebInspector.ElementsTreeElement = function(node, elementCloseTag)
// The title will be updated in onattach.
TreeElement.call(this, "", node, hasChildrenOverride);
- if (this.representedObject.nodeType == Node.ELEMENT_NODE && !elementCloseTag)
+ if (this.representedObject.nodeType() == Node.ELEMENT_NODE && !elementCloseTag)
this._canAddAttributes = true;
this._searchQuery = null;
this._expandedChildrenLimit = WebInspector.ElementsTreeElement.InitialChildrenLimit;
@@ -400,12 +403,12 @@ WebInspector.ElementsTreeElement.prototype = {
_createTooltipForNode: function()
{
var node = this.representedObject;
- if (!node.nodeName || node.nodeName.toLowerCase() !== "img")
+ if (!node.nodeName() || node.nodeName().toLowerCase() !== "img")
return;
- function setTooltip(result)
+ function setTooltip(error, result)
{
- if (!result || result.type !== "string")
+ if (error || !result || result.type !== "string")
return;
try {
@@ -423,15 +426,15 @@ WebInspector.ElementsTreeElement.prototype = {
}
}
- function resolvedNode(objectPayload)
+ function resolvedNode(object)
{
- if (!objectPayload)
+ if (!object)
return;
- var object = WebInspector.RemoteObject.fromPayload(objectPayload);
object.evaluate("return '[' + this.offsetWidth + ',' + this.offsetHeight + ',' + this.naturalWidth + ',' + this.naturalHeight + ']'", setTooltip.bind(this));
+ object.release();
}
- DOMAgent.resolveNode(node.id, "", resolvedNode.bind(this));
+ WebInspector.RemoteObject.resolveNode(node, resolvedNode.bind(this));
},
updateSelection: function()
@@ -489,8 +492,7 @@ WebInspector.ElementsTreeElement.prototype = {
{
if (this._elementCloseTag)
return;
-
- WebInspector.domAgent.getChildNodesAsync(this.representedObject, this._updateChildren.bind(this, fullRefresh));
+ this.representedObject.getChildNodes(this._updateChildren.bind(this, fullRefresh));
},
insertChildElement: function(child, index, closingTag)
@@ -587,7 +589,7 @@ WebInspector.ElementsTreeElement.prototype = {
this.adjustCollapsedRange(false);
var lastChild = this.children[this.children.length - 1];
- if (this.representedObject.nodeType == Node.ELEMENT_NODE && (!lastChild || !lastChild._elementCloseTag))
+ if (this.representedObject.nodeType() == Node.ELEMENT_NODE && (!lastChild || !lastChild._elementCloseTag))
this.insertChildElement(this.representedObject, this.children.length, true);
// We want to restore the original selection and tree scroll position after a full refresh, if possible.
@@ -660,8 +662,13 @@ WebInspector.ElementsTreeElement.prototype = {
onreveal: function()
{
- if (this.listItemElement)
- this.listItemElement.scrollIntoViewIfNeeded(false);
+ if (this.listItemElement) {
+ var tagSpans = this.listItemElement.getElementsByClassName("webkit-html-tag-name");
+ if (tagSpans.length)
+ tagSpans[0].scrollIntoViewIfNeeded(false);
+ else
+ this.listItemElement.scrollIntoViewIfNeeded(false);
+ }
},
onselect: function(treeElement, selectedByUser)
@@ -743,7 +750,7 @@ WebInspector.ElementsTreeElement.prototype = {
if (this.treeOutline.focusedDOMNode != this.representedObject)
return;
- if (this.representedObject.nodeType != Node.ELEMENT_NODE && this.representedObject.nodeType != Node.TEXT_NODE)
+ if (this.representedObject.nodeType() != Node.ELEMENT_NODE && this.representedObject.nodeType() != Node.TEXT_NODE)
return false;
var textNode = eventTarget.enclosingNodeOrSelfWithClass("webkit-html-text-node");
@@ -824,7 +831,7 @@ WebInspector.ElementsTreeElement.prototype = {
return this._addNewAttribute();
}
- if (this.representedObject.nodeType === Node.TEXT_NODE) {
+ if (this.representedObject.nodeType() === Node.TEXT_NODE) {
var textNode = listItem.getElementsByClassName("webkit-html-text-node")[0];
if (textNode)
return this._startEditingTextNode(textNode);
@@ -872,7 +879,7 @@ WebInspector.ElementsTreeElement.prototype = {
if (!attributeNameElement)
return false;
- var attributeName = attributeNameElement.innerText;
+ var attributeName = attributeNameElement.textContent;
function removeZeroWidthSpaceRecursive(node)
{
@@ -962,10 +969,12 @@ WebInspector.ElementsTreeElement.prototype = {
return true;
},
- _startEditingAsHTML: function(commitCallback, initialValue)
+ _startEditingAsHTML: function(commitCallback, error, initialValue)
{
+ if (error)
+ return;
if (this._htmlEditElement && WebInspector.isBeingEdited(this._htmlEditElement))
- return true;
+ return;
this._htmlEditElement = document.createElement("div");
this._htmlEditElement.className = "source-code elements-tree-editor";
@@ -1030,7 +1039,7 @@ WebInspector.ElementsTreeElement.prototype = {
var found = false;
// Search for the attribute's position, and then decide where to move to.
- var attributes = this.representedObject.attributes;
+ var attributes = this.representedObject.attributes();
for (var i = 0; i < attributes.length; ++i) {
if (attributes[i].name === attributeName) {
found = true;
@@ -1095,7 +1104,7 @@ WebInspector.ElementsTreeElement.prototype = {
}
if (!parseElement.hasAttributes()) {
- this.representedObject.removeAttribute(attributeName);
+ this.representedObject.removeAttribute(attributeName, this.updateTitle.bind(this));
this.treeOutline.focusedNodeChanged(true);
moveToNextAttributeIfNeeded.call(this);
return;
@@ -1106,13 +1115,13 @@ WebInspector.ElementsTreeElement.prototype = {
var attr = parseElement.attributes[i];
foundOriginalAttribute = foundOriginalAttribute || attr.name === attributeName;
try {
- this.representedObject.setAttribute(attr.name, attr.value);
+ this.representedObject.setAttribute(attr.name, attr.value, this.updateTitle.bind(this));
regenerateStyledAttribute.call(this, attr.name, attr.value);
} catch(e) {} // ignore invalid attribute (innerHTML doesn't throw errors, but this can)
}
if (!foundOriginalAttribute)
- this.representedObject.removeAttribute(attributeName);
+ this.representedObject.removeAttribute(attributeName, this.updateTitle.bind(this));
this.treeOutline.focusedNodeChanged(true);
@@ -1141,7 +1150,7 @@ WebInspector.ElementsTreeElement.prototype = {
return;
}
- var attributes = this.representedObject.attributes;
+ var attributes = this.representedObject.attributes();
if (attributes.length > 0)
this._triggerEditAttribute(attributes[0].name);
else
@@ -1157,9 +1166,9 @@ WebInspector.ElementsTreeElement.prototype = {
var treeOutline = this.treeOutline;
var wasExpanded = this.expanded;
- function changeTagNameCallback(nodeId)
+ function changeTagNameCallback(error, nodeId)
{
- if (!nodeId) {
+ if (error || !nodeId) {
cancel();
return;
}
@@ -1175,7 +1184,7 @@ WebInspector.ElementsTreeElement.prototype = {
moveToNextAttributeIfNeeded.call(newTreeItem);
}
- DOMAgent.changeTagName(this.representedObject.id, newText, changeTagNameCallback);
+ this.representedObject.setNodeName(newText, changeTagNameCallback);
},
_textNodeEditingCommitted: function(element, newText)
@@ -1183,14 +1192,14 @@ WebInspector.ElementsTreeElement.prototype = {
delete this._editing;
var textNode;
- if (this.representedObject.nodeType === Node.ELEMENT_NODE) {
+ if (this.representedObject.nodeType() === Node.ELEMENT_NODE) {
// We only show text nodes inline in elements if the element only
// has a single child, and that child is a text node.
textNode = this.representedObject.firstChild;
- } else if (this.representedObject.nodeType == Node.TEXT_NODE)
+ } else if (this.representedObject.nodeType() == Node.TEXT_NODE)
textNode = this.representedObject;
- textNode.nodeValue = newText;
+ textNode.setNodeValue(newText, this.updateTitle.bind(this));
},
_editingCancelled: function(element, context)
@@ -1250,7 +1259,7 @@ WebInspector.ElementsTreeElement.prototype = {
if (linkify && (name === "src" || name === "href")) {
var rewrittenHref = WebInspector.resourceURLForRelatedNode(node, value);
value = value.replace(/([\/;:\)\]\}])/g, "$1\u200B");
- html += linkify(rewrittenHref, value, "webkit-html-attribute-value", node.nodeName.toLowerCase() === "a");
+ html += linkify(rewrittenHref, value, "webkit-html-attribute-value", node.nodeName().toLowerCase() === "a");
} else {
value = value.escapeHTML().replace(/([\/;:\)\]\}])/g, "$1&#8203;");
html += "<span class=\"webkit-html-attribute-value\">" + value + "</span>";
@@ -1269,8 +1278,9 @@ WebInspector.ElementsTreeElement.prototype = {
var result = "<span class=\"webkit-html-tag" + (isClosingTag && isDistinctTreeElement ? " close" : "") + "\">&lt;";
result += "<span " + (isClosingTag ? "" : "class=\"webkit-html-tag-name\"") + ">" + (isClosingTag ? "/" : "") + tagName + "</span>";
if (!isClosingTag && node.hasAttributes()) {
- for (var i = 0; i < node.attributes.length; ++i) {
- var attr = node.attributes[i];
+ var attributes = node.attributes();
+ for (var i = 0; i < attributes.length; ++i) {
+ var attr = attributes[i];
result += " " + this._attributeHTML(attr.name, attr.value, node, linkify);
}
}
@@ -1284,7 +1294,7 @@ WebInspector.ElementsTreeElement.prototype = {
var node = this.representedObject;
var info = {titleHTML: "", hasChildren: this.hasChildren};
- switch (node.nodeType) {
+ switch (node.nodeType()) {
case Node.DOCUMENT_NODE:
info.titleHTML = "Document";
break;
@@ -1299,7 +1309,7 @@ WebInspector.ElementsTreeElement.prototype = {
break;
case Node.ELEMENT_NODE:
- var tagName = this.treeOutline.nodeNameToCorrectCase(node.nodeName).escapeHTML();
+ var tagName = this.treeOutline.nodeNameToCorrectCase(node.nodeName()).escapeHTML();
if (this._elementCloseTag) {
info.titleHTML = this._tagHTML(tagName, true, true);
info.hasChildren = false;
@@ -1308,8 +1318,8 @@ WebInspector.ElementsTreeElement.prototype = {
var titleHTML = this._tagHTML(tagName, false, false, linkify);
- var textChild = onlyTextChild.call(node);
- var showInlineText = textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength;
+ var textChild = this._singleTextChild(node);
+ var showInlineText = textChild && textChild.nodeValue().length < Preferences.maxInlineTextChildLength;
if (!this.expanded && (!showInlineText && (this.treeOutline.isXMLMimeType || !WebInspector.ElementsTreeElement.ForbiddenClosingTagElements[tagName]))) {
if (this.hasChildren)
@@ -1321,7 +1331,7 @@ WebInspector.ElementsTreeElement.prototype = {
// just show that text and the closing tag inline rather than
// create a subtree for them
if (showInlineText) {
- titleHTML += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>&#8203;" + this._tagHTML(tagName, true, false);
+ titleHTML += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue().escapeHTML() + "</span>&#8203;" + this._tagHTML(tagName, true, false);
info.hasChildren = false;
}
info.titleHTML = titleHTML;
@@ -1331,33 +1341,33 @@ WebInspector.ElementsTreeElement.prototype = {
if (isNodeWhitespace.call(node))
info.titleHTML = "(whitespace)";
else {
- if (node.parentNode && node.parentNode.nodeName.toLowerCase() === "script") {
+ if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "script") {
var newNode = document.createElement("span");
- newNode.textContent = node.textContent;
+ newNode.textContent = node.nodeValue();
var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript");
javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);
info.titleHTML = "<span class=\"webkit-html-text-node webkit-html-js-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
- } else if (node.parentNode && node.parentNode.nodeName.toLowerCase() === "style") {
+ } else if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "style") {
var newNode = document.createElement("span");
- newNode.textContent = node.textContent;
+ newNode.textContent = node.nodeValue();
var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css");
cssSyntaxHighlighter.syntaxHighlightNode(newNode);
info.titleHTML = "<span class=\"webkit-html-text-node webkit-html-css-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
} else
- info.titleHTML = "\"<span class=\"webkit-html-text-node\">" + node.nodeValue.escapeHTML() + "</span>\"";
+ info.titleHTML = "\"<span class=\"webkit-html-text-node\">" + node.nodeValue().escapeHTML() + "</span>\"";
}
break;
case Node.COMMENT_NODE:
- info.titleHTML = "<span class=\"webkit-html-comment\">&lt;!--" + node.nodeValue.escapeHTML() + "--&gt;</span>";
+ info.titleHTML = "<span class=\"webkit-html-comment\">&lt;!--" + node.nodeValue().escapeHTML() + "--&gt;</span>";
break;
case Node.DOCUMENT_TYPE_NODE:
- var titleHTML = "<span class=\"webkit-html-doctype\">&lt;!DOCTYPE " + node.nodeName;
+ var titleHTML = "<span class=\"webkit-html-doctype\">&lt;!DOCTYPE " + node.nodeName();
if (node.publicId) {
titleHTML += " PUBLIC \"" + node.publicId + "\"";
if (node.systemId)
@@ -1371,20 +1381,33 @@ WebInspector.ElementsTreeElement.prototype = {
break;
case Node.CDATA_SECTION_NODE:
- info.titleHTML = "<span class=\"webkit-html-text-node\">&lt;![CDATA[" + node.nodeValue.escapeHTML() + "]]&gt;</span>";
+ info.titleHTML = "<span class=\"webkit-html-text-node\">&lt;![CDATA[" + node.nodeValue().escapeHTML() + "]]&gt;</span>";
break;
default:
- info.titleHTML = this.treeOutline.nodeNameToCorrectCase(node.nodeName).collapseWhitespace().escapeHTML();
+ info.titleHTML = this.treeOutline.nodeNameToCorrectCase(node.nodeName()).collapseWhitespace().escapeHTML();
}
return info;
},
+ _singleTextChild: function(node)
+ {
+ if (!node)
+ return null;
+
+ var firstChild = node.firstChild;
+ if (!firstChild || firstChild.nodeType() !== Node.TEXT_NODE)
+ return null;
+
+ var sibling = firstChild.nextSibling;
+ return sibling ? null : firstChild;
+ },
+
_showInlineText: function(node)
{
- if (node.nodeType === Node.ELEMENT_NODE) {
- var textChild = onlyTextChild.call(node);
- if (textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength)
+ if (node.nodeType() === Node.ELEMENT_NODE) {
+ var textChild = this._singleTextChild(node);
+ if (textChild && textChild.nodeValue().length < Preferences.maxInlineTextChildLength)
return true;
}
return false;
@@ -1397,18 +1420,16 @@ WebInspector.ElementsTreeElement.prototype = {
return;
var self = this;
- function removeNodeCallback(removedNodeId)
+ function removeNodeCallback(error, removedNodeId)
{
- // -1 is an error code, which means removing the node from the DOM failed,
- // so we shouldn't remove it from the tree.
- if (removedNodeId === -1)
+ if (error)
return;
parentElement.removeChild(self);
parentElement.adjustCollapsedRange(true);
}
- DOMAgent.removeNode(this.representedObject.id, removeNodeCallback);
+ this.representedObject.removeNode(removeNodeCallback);
},
_editAsHTML: function()
@@ -1417,9 +1438,9 @@ WebInspector.ElementsTreeElement.prototype = {
var node = this.representedObject;
var wasExpanded = this.expanded;
- function selectNode(nodeId)
+ function selectNode(error, nodeId)
{
- if (!nodeId)
+ if (error || !nodeId)
return;
// Select it and expand if necessary. We force tree update so that it processes dom events and is up to date.
@@ -1435,15 +1456,15 @@ WebInspector.ElementsTreeElement.prototype = {
function commitChange(value)
{
- DOMAgent.setOuterHTML(node.id, value, selectNode);
+ node.setOuterHTML(value, selectNode);
}
- DOMAgent.getOuterHTML(node.id, this._startEditingAsHTML.bind(this, commitChange));
+ node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange));
},
_copyHTML: function()
{
- DOMAgent.copyNode(this.representedObject.id);
+ this.representedObject.copyNode();
},
_highlightSearchResults: function()
@@ -1468,6 +1489,11 @@ WebInspector.ElementsTreeElement.prototype = {
matchRanges.push({ offset: match.index, length: match[0].length });
match = regexObject.exec(text);
}
+
+ // Fall back for XPath, etc. matches.
+ if (!matchRanges.length)
+ matchRanges.push({ offset: 0, length: text.length });
+
highlightSearchResults(this.listItemElement, matchRanges);
this._searchHighlightedHTML = this.listItemElement.innerHTML;
}
diff --git a/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js b/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js
index bc8bb12..00576f1 100644
--- a/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js
@@ -65,7 +65,10 @@ WebInspector.EventListenersSidebarPane.prototype = {
this.sections = [];
var self = this;
- function callback(nodeId, eventListeners) {
+ function callback(error, eventListeners) {
+ if (error)
+ return;
+
var sectionNames = [];
var sectionMap = {};
for (var i = 0; i < eventListeners.length; ++i) {
@@ -77,7 +80,7 @@ WebInspector.EventListenersSidebarPane.prototype = {
var type = eventListener.type;
var section = sectionMap[type];
if (!section) {
- section = new WebInspector.EventListenersSection(type, nodeId);
+ section = new WebInspector.EventListenersSection(type, node.id);
sectionMap[type] = section;
sectionNames.push(type);
self.sections.push(section);
@@ -101,7 +104,8 @@ WebInspector.EventListenersSidebarPane.prototype = {
}
}
- WebInspector.EventListeners.getEventListenersForNodeAsync(node, callback);
+ if (node)
+ node.eventListeners(callback);
},
_changeSetting: function(event)
@@ -190,6 +194,8 @@ WebInspector.EventListenerBar.prototype = {
properties.push(new WebInspector.RemoteObjectProperty(propertyName, value));
}
this.updateProperties(properties);
+ if (nodeObject)
+ nodeObject.release();
}
var node = this.eventListener.node;
delete this.eventListener.node;
@@ -202,7 +208,7 @@ WebInspector.EventListenerBar.prototype = {
if (!node)
return;
- if (node.nodeType === Node.DOCUMENT_NODE) {
+ if (node.nodeType() === Node.DOCUMENT_NODE) {
this.titleElement.textContent = "document";
return;
}
diff --git a/Source/WebCore/inspector/front-end/ExtensionAPI.js b/Source/WebCore/inspector/front-end/ExtensionAPI.js
index 6a11d62..ea7324c 100644
--- a/Source/WebCore/inspector/front-end/ExtensionAPI.js
+++ b/Source/WebCore/inspector/front-end/ExtensionAPI.js
@@ -516,5 +516,7 @@ var WatchExpressionSidebarPane = declareInterfaceClass(WatchExpressionSidebarPan
var extensionServer = new ExtensionServerClient();
webInspector = new InspectorExtensionAPI();
+experimental = window.experimental || {};
+experimental.webInspector = webInspector;
}
diff --git a/Source/WebCore/inspector/front-end/ExtensionAPISchema.json b/Source/WebCore/inspector/front-end/ExtensionAPISchema.json
index 28084ba..0aa7aa8 100755
--- a/Source/WebCore/inspector/front-end/ExtensionAPISchema.json
+++ b/Source/WebCore/inspector/front-end/ExtensionAPISchema.json
@@ -1,57 +1,5 @@
[
{
- "namespace": "experimental.webInspector.inspectedWindow",
- "description": "Provides access to the window being inspected.",
- "functions": [
- {
- "name": "eval",
- "type": "function",
- "description": "Evaluates a JavaScript expression in the context of inspected page (NOTE: the expression must evaluate to a JSON-compliant object, otherwise the exception is thrown)",
- "parameters": [
- {
- "name": "expression",
- "type": "string",
- "description": "An expression to evaluate."
- },
- {
- "name": "callback",
- "type": "function",
- "description": "A function called when evaluation completes.",
- "parameters": [
- {
- "name": "result",
- "type": "object",
- "description": "The result of evaluation"
- },
- {
- "name": "isException",
- "type": "boolean",
- "description": "Set if an exception was caught while evaluating the expression"
- }
- ]
- }
- ]
- }
- ],
- "events": [
- {
- "name": "onDOMContentLoaded",
- "type": "function",
- "description": "Fired after DOMContentLoaded event on inspected page is fired."
- },
- {
- "name": "onLoaded",
- "type": "function",
- "description": "Fired after load event on inspected page is fired."
- },
- {
- "name": "onNavigated",
- "type": "function",
- "description": "Fired when navigation occurs in the window being inspected."
- }
- ]
- },
- {
"namespace": "experimental.webInspector.panels",
"types": [
{
@@ -150,7 +98,7 @@
}
]
}
- ]
+ ]
},
{
"id": "ExtensionSidebarPane",
diff --git a/Source/WebCore/inspector/front-end/ExtensionPanel.js b/Source/WebCore/inspector/front-end/ExtensionPanel.js
index 142b8c1..4249b2c 100644
--- a/Source/WebCore/inspector/front-end/ExtensionPanel.js
+++ b/Source/WebCore/inspector/front-end/ExtensionPanel.js
@@ -98,9 +98,10 @@ WebInspector.ExtensionWatchSidebarPane.prototype = {
RuntimeAgent.evaluate(expression, "extension-watch", false, this._onEvaluate.bind(this, title));
},
- _onEvaluate: function(title, result)
+ _onEvaluate: function(title, error, result)
{
- this._setObject(WebInspector.RemoteObject.fromPayload(result), title);
+ if (!error)
+ this._setObject(WebInspector.RemoteObject.fromPayload(result), title);
},
_setObject: function(object, title)
diff --git a/Source/WebCore/inspector/front-end/ExtensionServer.js b/Source/WebCore/inspector/front-end/ExtensionServer.js
index f9af7dc..9554dfa 100644
--- a/Source/WebCore/inspector/front-end/ExtensionServer.js
+++ b/Source/WebCore/inspector/front-end/ExtensionServer.js
@@ -118,7 +118,13 @@ WebInspector.ExtensionServer.prototype = {
_notifyResourceFinished: function(event)
{
var resource = event.data;
- this._postNotification("resource-finished", this._resourceId(resource), (new WebInspector.HAREntry(resource)).build());
+ if (this._hasSubscribers("resource-finished"))
+ this._postNotification("resource-finished", this._resourceId(resource), (new WebInspector.HAREntry(resource)).build());
+ },
+
+ _hasSubscribers: function(type)
+ {
+ return !!this._subscribers[type];
},
_postNotification: function(type, details)
@@ -261,16 +267,18 @@ WebInspector.ExtensionServer.prototype = {
_onReload: function(message)
{
if (typeof message.userAgent === "string")
- InspectorAgent.setUserAgentOverride(message.userAgent);
+ PageAgent.setUserAgentOverride(message.userAgent);
- InspectorAgent.reloadPage(false);
+ PageAgent.reloadPage(false);
return this._status.OK();
},
_onEvaluateOnInspectedPage: function(message, port)
{
- function callback(resultPayload)
+ function callback(error, resultPayload)
{
+ if (error)
+ return;
var resultObject = WebInspector.RemoteObject.fromPayload(resultPayload);
var result = {};
if (resultObject.isError())
diff --git a/Source/WebCore/inspector/front-end/GoToLineDialog.js b/Source/WebCore/inspector/front-end/GoToLineDialog.js
index f246159..9f4504d 100644
--- a/Source/WebCore/inspector/front-end/GoToLineDialog.js
+++ b/Source/WebCore/inspector/front-end/GoToLineDialog.js
@@ -40,7 +40,7 @@ WebInspector.GoToLineDialog = function(view)
var dialogWindow = this._element;
- dialogWindow.createChild("label").innerText = WebInspector.UIString("Go to line: ");
+ dialogWindow.createChild("label").textContent = WebInspector.UIString("Go to line: ");
this._input = dialogWindow.createChild("input");
this._input.setAttribute("type", "text");
@@ -53,7 +53,7 @@ WebInspector.GoToLineDialog = function(view)
var go = dialogWindow.createChild("button");
- go.innerText = WebInspector.UIString("Go");
+ go.textContent = WebInspector.UIString("Go");
go.addEventListener("click", this._onClick.bind(this), false);
go.addEventListener("mousedown", function(e) {
// Ok button click will close the dialog, removing onBlur listener
diff --git a/Source/WebCore/inspector/front-end/HeapSnapshot.js b/Source/WebCore/inspector/front-end/HeapSnapshot.js
index 215f31c..c9d1e30 100644
--- a/Source/WebCore/inspector/front-end/HeapSnapshot.js
+++ b/Source/WebCore/inspector/front-end/HeapSnapshot.js
@@ -197,6 +197,134 @@ WebInspector.HeapSnapshotEdgeIterator.prototype = {
}
};
+WebInspector.HeapSnapshotRetainerEdge = function(snapshot, retainers, retainerIndex)
+{
+ this._snapshot = snapshot;
+ this._retainers = retainers;
+ this.retainerIndex = retainerIndex || 0;
+}
+
+WebInspector.HeapSnapshotRetainerEdge.prototype = {
+ clone: function()
+ {
+ return new WebInspector.HeapSnapshotRetainerEdge(this._snapshot, this._retainers, this.retainerIndex);
+ },
+
+ get hasStringName()
+ {
+ return this._edge.hasStringName;
+ },
+
+ get isElement()
+ {
+ return this._edge.isElement;
+ },
+
+ get isHidden()
+ {
+ return this._edge.isHidden;
+ },
+
+ get isInternal()
+ {
+ return this._edge.isInternal;
+ },
+
+ get isInvisible()
+ {
+ return this._edge.isInvisible;
+ },
+
+ get isShortcut()
+ {
+ return this._edge.isShortcut;
+ },
+
+ get name()
+ {
+ return this._edge.name;
+ },
+
+ get node()
+ {
+ return this._node;
+ },
+
+ get nodeIndex()
+ {
+ return this._nodeIndex;
+ },
+
+ get retainerIndex()
+ {
+ return this._retainerIndex;
+ },
+
+ set retainerIndex(newIndex)
+ {
+ if (newIndex !== this._retainerIndex) {
+ this._retainerIndex = newIndex;
+ this._setupEdge();
+ }
+ },
+
+ _setupEdge: function()
+ {
+ var globalEdgeIndex = this._retainers.item(this._retainerIndex);
+ this._nodeIndex = this._snapshot._findNearestNodeIndex(globalEdgeIndex);
+ this._node = new WebInspector.HeapSnapshotNode(this._snapshot, this._nodeIndex);
+ var edgeIndex = globalEdgeIndex - this._nodeIndex - this._snapshot._firstEdgeOffset;
+ this._edge = new WebInspector.HeapSnapshotEdge(this._snapshot, this._node.rawEdges, edgeIndex);
+ },
+
+ toString: function()
+ {
+ return this._edge.toString();
+ },
+
+ get type()
+ {
+ return this._edge.type;
+ }
+}
+
+WebInspector.HeapSnapshotRetainerEdgeIterator = function(retainer)
+{
+ this.retainer = retainer;
+}
+
+WebInspector.HeapSnapshotRetainerEdgeIterator.prototype = {
+ first: function()
+ {
+ this.retainer.retainerIndex = 0;
+ },
+
+ hasNext: function()
+ {
+ return this.retainer.retainerIndex < this.retainer._retainers.length;
+ },
+
+ get index()
+ {
+ return this.retainer.retainerIndex;
+ },
+
+ set index(newIndex)
+ {
+ this.retainer.retainerIndex = newIndex;
+ },
+
+ get item()
+ {
+ return this.retainer;
+ },
+
+ next: function()
+ {
+ ++this.retainer.retainerIndex;
+ }
+};
+
WebInspector.HeapSnapshotNode = function(snapshot, nodeIndex)
{
this._snapshot = snapshot;
@@ -212,6 +340,10 @@ WebInspector.HeapSnapshotNode.prototype = {
return WebInspector.UIString("(system)");
case "object":
return this.name;
+ case "native": {
+ var entitiesCountPos = this.name.indexOf("/");
+ return entitiesCountPos !== -1 ? this.name.substring(0, entitiesCountPos).trimRight() : this.name;
+ }
case "code":
return WebInspector.UIString("(compiled code)");
default:
@@ -219,7 +351,7 @@ WebInspector.HeapSnapshotNode.prototype = {
}
},
- dominatorIndex: function()
+ get dominatorIndex()
{
return this._nodes[this.nodeIndex + this._snapshot._dominatorOffset];
},
@@ -272,7 +404,7 @@ WebInspector.HeapSnapshotNode.prototype = {
get retainers()
{
- return new WebInspector.HeapSnapshotEdgeIterator(new WebInspector.HeapSnapshotEdge(this._snapshot, this._snapshot.retainers(this)));
+ return new WebInspector.HeapSnapshotRetainerEdgeIterator(new WebInspector.HeapSnapshotRetainerEdge(this._snapshot, this._snapshot._retainersForNode(this)));
},
get selfSize()
@@ -350,6 +482,7 @@ WebInspector.HeapSnapshotNodeIterator.prototype = {
WebInspector.HeapSnapshot = function(profile)
{
+ this.uid = profile.uid;
this._nodes = profile.nodes;
this._strings = profile.strings;
@@ -393,32 +526,30 @@ WebInspector.HeapSnapshot.prototype = {
{
delete this._nodes;
delete this._strings;
- if (this._idsMap)
- delete this._idsMap;
- if (this._retainers) {
- delete this._retainers;
- delete this._nodesToRetainers;
- }
+ delete this._idsList;
+ delete this._retainers;
+ delete this._retainerIndex;
+ delete this._nodeIndex;
if (this._aggregates) {
delete this._aggregates;
this._aggregatesWithIndexes = false;
}
},
- get allNodes()
+ get _allNodes()
{
return new WebInspector.HeapSnapshotNodeIterator(this.rootNode);
},
- get nodesCount()
+ get nodeCount()
{
- if (this._nodesCount)
- return this._nodesCount;
+ if (this._nodeCount)
+ return this._nodeCount;
- this._nodesCount = 0;
- for (var iter = this.allNodes; iter.hasNext(); iter.next())
- ++this._nodesCount;
- return this._nodesCount;
+ this._nodeCount = 0;
+ for (var iter = this._allNodes; iter.hasNext(); iter.next())
+ ++this._nodeCount;
+ return this._nodeCount;
},
restore: function(profile)
@@ -432,30 +563,35 @@ WebInspector.HeapSnapshot.prototype = {
return new WebInspector.HeapSnapshotNode(this, this._rootNodeIndex);
},
+ get rootNodeIndex()
+ {
+ return this._rootNodeIndex;
+ },
+
get totalSize()
{
return this.rootNode.retainedSize;
},
- get idsMap()
+ hasId: function(id)
{
- if (this._idsMap)
- return this._idsMap;
+ return this.nodeIds.binaryIndexOf(id, this._numbersComparator) >= 0;
+ },
- this._idsMap = [];
- for (var iter = this.allNodes; iter.hasNext(); iter.next()) {
- this._idsMap[iter.node.id] = true;
- }
- return this._idsMap;
+ get nodeIds()
+ {
+ if (!this._idsList)
+ this._buildIdsList();
+ return this._idsList;
},
- retainers: function(node)
+ _retainersForNode: function(node)
{
if (!this._retainers)
this._buildRetainers();
- var retIndexFrom = this._nodesToRetainers[node.nodeIndex];
- var retIndexTo = this._nodesToRetainers[node._nextNodeIndex];
+ var retIndexFrom = this._getRetainerIndex(node.nodeIndex);
+ var retIndexTo = this._getRetainerIndex(node._nextNodeIndex);
return new WebInspector.HeapSnapshotArraySlice(this, "_retainers", retIndexFrom, retIndexTo);
},
@@ -470,51 +606,39 @@ WebInspector.HeapSnapshot.prototype = {
_buildRetainers: function()
{
- this._nodesToRetainers = [];
- for (var nodesIter = this.allNodes; nodesIter.hasNext(); nodesIter.next()) {
+ if (!this._nodeIndex)
+ this._buildNodeIndex();
+
+ this._retainerIndex = new Array(this._nodeIndex.length);
+ for (var i = 0, l = this._retainerIndex.length; i < l; ++i)
+ this._retainerIndex[i] = 0;
+ for (var nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next()) {
var node = nodesIter.node;
- if (!(node.nodeIndex in this._nodesToRetainers))
- this._nodesToRetainers[node.nodeIndex] = 0;
for (var edgesIter = node.edges; edgesIter.hasNext(); edgesIter.next()) {
var edge = edgesIter.edge;
var nodeIndex = edge.nodeIndex;
- if (!(nodeIndex in this._nodesToRetainers))
- this._nodesToRetainers[nodeIndex] = 0;
- this._nodesToRetainers[nodeIndex] += this._edgeFieldsCount;
+ var position = this._findNodePositionInIndex(nodeIndex);
+ ++this._retainerIndex[position];
}
}
- nodesIter = this.allNodes;
- var node = nodesIter.node;
- var prevIndex = this._nodesToRetainers[node.nodeIndex] = 0;
- var prevRetsCount = this._nodesToRetainers[node.nodeIndex];
- nodesIter.next();
- for (; nodesIter.hasNext(); nodesIter.next()) {
- node = nodesIter.node;
- var savedRefsCount = this._nodesToRetainers[node.nodeIndex];
- this._nodesToRetainers[node.nodeIndex] = prevIndex + prevRetsCount;
- prevIndex = this._nodesToRetainers[node.nodeIndex];
- prevRetsCount = savedRefsCount;
- }
- this._retainers = new Array(prevIndex + prevRetsCount);
- this._nodesToRetainers[this._nodes.length] = this._retainers.length;
- for (nodesIter = this.allNodes; nodesIter.hasNext(); nodesIter.next()) {
- node = nodesIter.node;
- var retsCount = this._nodesToRetainers[node._nextNodeIndex] - this._nodesToRetainers[node.nodeIndex];
- if (retsCount > 0) {
- this._retainers[this._nodesToRetainers[node.nodeIndex]] = retsCount;
- }
+ var retainerCount = 0;
+ for (i = 0, l = this._retainerIndex.length; i < l; ++i)
+ retainerCount += this._retainerIndex[i];
+ this._retainers = new Array(retainerCount + 1);
+ var retainerPosition = 0;
+ for (i = 0, l = this._retainerIndex.length; i < l; ++i) {
+ retainerCount = this._retainers[retainerPosition] = this._retainerIndex[i];
+ this._retainerIndex[i] = retainerPosition;
+ retainerPosition += retainerCount;
}
- for (nodesIter = this.allNodes; nodesIter.hasNext(); nodesIter.next()) {
- node = nodesIter.node;
+ for (nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next()) {
+ var node = nodesIter.node;
for (var edgesIter = node.edges; edgesIter.hasNext(); edgesIter.next()) {
var edge = edgesIter.edge;
var nodeIndex = edge.nodeIndex;
- var retIndex = this._nodesToRetainers[nodeIndex];
- this._retainers[retIndex] -= this._edgeFieldsCount;
- var idx = retIndex + this._retainers[retIndex];
- this._retainers[idx + this._edgeTypeOffset] = edge._type();
- this._retainers[idx + this._edgeNameOffset] = edge._nameOrIndex;
- this._retainers[idx + this._edgeToNodeOffset] = node.nodeIndex;
+ var retIndex = this._getRetainerIndex(nodeIndex);
+ var idx = retIndex + (--this._retainers[retIndex]);
+ this._retainers[idx] = node.nodeIndex + this._firstEdgeOffset + edge.edgeIndex;
}
}
},
@@ -522,11 +646,11 @@ WebInspector.HeapSnapshot.prototype = {
_buildAggregates: function()
{
this._aggregates = {};
- for (var iter = this.allNodes; iter.hasNext(); iter.next()) {
+ for (var iter = this._allNodes; iter.hasNext(); iter.next()) {
var node = iter.node;
var className = node.className;
- var nameMatters = node.type === "object";
- if (node.selfSize === 0)
+ var nameMatters = node.type === "object" || node.type === "native";
+ if (node.type !== "native" && node.selfSize === 0)
continue;
if (!(className in this._aggregates))
this._aggregates[className] = { count: 0, self: 0, maxRet: 0, type: node.type, name: nameMatters ? node.name : null, idxs: [] };
@@ -540,7 +664,7 @@ WebInspector.HeapSnapshot.prototype = {
_buildAggregatesIndexes: function()
{
- for (var iter = this.allNodes; iter.hasNext(); iter.next()) {
+ for (var iter = this._allNodes; iter.hasNext(); iter.next()) {
var node = iter.node;
var className = node.className;
var clss = this._aggregates[className];
@@ -561,6 +685,53 @@ WebInspector.HeapSnapshot.prototype = {
this._aggregatesWithIndexes = true;
},
+ _buildIdsList: function()
+ {
+ var count = 0;
+ for (var nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next(), ++count);
+ this._idsList = new Array(count);
+ count = 0;
+ for (nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next(), ++count)
+ this._idsList[count] = nodesIter.node.id;
+ this._idsList.sort(this._numbersComparator);
+ },
+
+ _buildNodeIndex: function()
+ {
+ var count = 0;
+ for (var nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next(), ++count);
+ this._nodeIndex = new Array(count + 1);
+ count = 0;
+ for (nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next(), ++count)
+ this._nodeIndex[count] = nodesIter.index;
+ this._nodeIndex[count] = this._nodes.length;
+ },
+
+ _findNodePositionInIndex: function(index)
+ {
+ return binarySearch(index, this._nodeIndex, this._numbersComparator);
+ },
+
+ _findNearestNodeIndex: function(index)
+ {
+ var result = this._findNodePositionInIndex(index);
+ if (result < 0) {
+ result = -result - 1;
+ nodeIndex = this._nodeIndex[result];
+ // Binary search can return either maximum lower value, or minimum higher value.
+ if (nodeIndex > index)
+ nodeIndex = this._nodeIndex[result - 1];
+ } else
+ var nodeIndex = this._nodeIndex[result];
+ return nodeIndex;
+ },
+
+ _getRetainerIndex: function(nodeIndex)
+ {
+ var nodePosition = this._findNodePositionInIndex(nodeIndex);
+ return this._retainerIndex[nodePosition];
+ },
+
_markInvisibleEdges: function()
{
// Mark hidden edges of global objects as invisible.
@@ -586,6 +757,11 @@ WebInspector.HeapSnapshot.prototype = {
this._nodes[globalObjEdge._edges._start + globalObjEdge.edgeIndex + this._edgeTypeOffset] = this._edgeInvisibleType;
}
}
+ },
+
+ _numbersComparator: function(a, b)
+ {
+ return a < b ? -1 : (a > b ? 1 : 0);
}
};
@@ -596,7 +772,6 @@ WebInspector.HeapSnapshotFilteredOrderedIterator = function(iterator, filter)
this._iterationOrder = null;
this._position = 0;
this._lastComparator = null;
- this._instancesCount = 0;
}
WebInspector.HeapSnapshotFilteredOrderedIterator.prototype = {
@@ -625,16 +800,6 @@ WebInspector.HeapSnapshotFilteredOrderedIterator.prototype = {
return this._position < this._iterationOrder.length;
},
- incInstancesCount: function()
- {
- ++this._instancesCount;
- },
-
- get instancesCount()
- {
- return this._instancesCount;
- },
-
get isEmpty()
{
if (this._iterationOrder)
@@ -655,11 +820,6 @@ WebInspector.HeapSnapshotFilteredOrderedIterator.prototype = {
return this._iterator.item;
},
- get lastComparator()
- {
- return this._lastComparator;
- },
-
get length()
{
if (!this._iterationOrder)
@@ -671,11 +831,6 @@ WebInspector.HeapSnapshotFilteredOrderedIterator.prototype = {
{
++this._position;
},
-
- resetInstancesCount: function()
- {
- this._instancesCount = 0;
- }
}
WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator = function(fieldNames)
@@ -683,10 +838,11 @@ WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator = fu
return {fieldName1:fieldNames[0], ascending1:fieldNames[1], fieldName2:fieldNames[2], ascending2:fieldNames[3]};
}
-WebInspector.HeapSnapshotEdgesProvider = function(snapshot, rawEdges, filter)
+WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter)
{
this.snapshot = snapshot;
- WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, new WebInspector.HeapSnapshotEdgeIterator(new WebInspector.HeapSnapshotEdge(snapshot, rawEdges)), filter);
+ var node = new WebInspector.HeapSnapshotNode(snapshot, nodeIndex);
+ WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, new WebInspector.HeapSnapshotEdgeIterator(new WebInspector.HeapSnapshotEdge(snapshot, node.rawEdges)), filter);
}
WebInspector.HeapSnapshotEdgesProvider.prototype = {
@@ -766,10 +922,10 @@ WebInspector.HeapSnapshotEdgesProvider.prototype = {
WebInspector.HeapSnapshotEdgesProvider.prototype.__proto__ = WebInspector.HeapSnapshotFilteredOrderedIterator.prototype;
-WebInspector.HeapSnapshotNodesProvider = function(snapshot, nodes, filter)
+WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter)
{
this.snapshot = snapshot;
- WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, nodes, filter);
+ WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, snapshot._allNodes, filter);
}
WebInspector.HeapSnapshotNodesProvider.prototype = {
@@ -842,11 +998,18 @@ WebInspector.HeapSnapshotPathFinder.prototype = {
return false;
},
- _fillRootChildren: function()
+ updateRoots: function(filter)
+ {
+ this._rootChildren = this._fillRootChildren(filter);
+ },
+
+ _fillRootChildren: function(filter)
{
var result = [];
- for (var iter = this._snapshot.rootNode.edges; iter.hasNext(); iter.next())
- result[iter.edge.nodeIndex] = true;
+ for (var iter = this._snapshot.rootNode.edges; iter.hasNext(); iter.next()) {
+ if (!filter || filter(iter.edge.node))
+ result[iter.edge.nodeIndex] = true;
+ }
return result;
},
@@ -881,7 +1044,7 @@ WebInspector.HeapSnapshotPathFinder.prototype = {
get _lastEdge()
{
- return this._lastEdgeIter.edge;
+ return this._lastEdgeIter.item;
},
_skipEdge: function(edge)
@@ -894,7 +1057,7 @@ WebInspector.HeapSnapshotPathFinder.prototype = {
_nextEdgeIter: function()
{
var iter = this._lastEdgeIter;
- while (this._skipEdge(iter.edge) && iter.hasNext())
+ while (this._skipEdge(iter.item) && iter.hasNext())
iter.next();
return iter;
},
@@ -917,7 +1080,7 @@ WebInspector.HeapSnapshotPathFinder.prototype = {
while (this._currentPath.length < this._maxLength) {
iter = this._nextEdgeIter();
if (iter.hasNext())
- this._appendToCurrentPath(iter.edge.node.retainers);
+ this._appendToCurrentPath(iter.item.node.retainers);
else
return true;
}
@@ -934,7 +1097,7 @@ WebInspector.HeapSnapshotPathFinder.prototype = {
while (this._currentPath.length < this._maxLength) {
var iter = this._nextEdgeIter();
if (iter.hasNext())
- this._appendToCurrentPath(iter.edge.node.retainers);
+ this._appendToCurrentPath(iter.item.node.retainers);
else
break;
}
@@ -956,8 +1119,8 @@ WebInspector.HeapSnapshotPathFinder.prototype = {
return "";
var sPath = [];
for (var j = 0; j < path.length; ++j)
- sPath.push(path[j].edge.toString());
- sPath.push(this._nodeToString(path[path.length - 1].edge.node));
+ sPath.push(path[j].item.toString());
+ sPath.push(this._nodeToString(path[path.length - 1].item.node));
sPath.reverse();
return sPath.join("");
}
diff --git a/Source/WebCore/inspector/front-end/HelpScreen.js b/Source/WebCore/inspector/front-end/HelpScreen.js
index a1bbf1e..aa47712 100644
--- a/Source/WebCore/inspector/front-end/HelpScreen.js
+++ b/Source/WebCore/inspector/front-end/HelpScreen.js
@@ -40,9 +40,9 @@ WebInspector.HelpScreen = function(title)
this.contentElement = mainWindow.createChild("div", "help-content");
this.contentElement.tabIndex = 0;
this.contentElement.addEventListener("blur", this._onBlur.bind(this), false);
- captionWindow.createChild("h1", "help-window-title").innerText = title;
+ captionWindow.createChild("h1", "help-window-title").textContent = title;
- closeButton.innerText = "\u2716"; // Code stands for HEAVY MULTIPLICATION X.
+ closeButton.textContent = "\u2716"; // Code stands for HEAVY MULTIPLICATION X.
closeButton.addEventListener("click", this._hide.bind(this), false);
this._closeKeys = [
WebInspector.KeyboardShortcut.Keys.Enter.code,
diff --git a/Source/WebCore/inspector/front-end/Images/applicationCache.png b/Source/WebCore/inspector/front-end/Images/applicationCache.png
index 50bad87..fb18e75 100644
--- a/Source/WebCore/inspector/front-end/Images/applicationCache.png
+++ b/Source/WebCore/inspector/front-end/Images/applicationCache.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/auditsIcon.png b/Source/WebCore/inspector/front-end/Images/auditsIcon.png
index ebeafdc..9f9dd8b 100644
--- a/Source/WebCore/inspector/front-end/Images/auditsIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/auditsIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/back.png b/Source/WebCore/inspector/front-end/Images/back.png
index 9363960..b1c0c19 100644
--- a/Source/WebCore/inspector/front-end/Images/back.png
+++ b/Source/WebCore/inspector/front-end/Images/back.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/breakpointBorder.png b/Source/WebCore/inspector/front-end/Images/breakpointBorder.png
index 0b1b550..a4c74d5 100644
--- a/Source/WebCore/inspector/front-end/Images/breakpointBorder.png
+++ b/Source/WebCore/inspector/front-end/Images/breakpointBorder.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/breakpointConditionalBorder.png b/Source/WebCore/inspector/front-end/Images/breakpointConditionalBorder.png
index 430e37e..5fda706 100644
--- a/Source/WebCore/inspector/front-end/Images/breakpointConditionalBorder.png
+++ b/Source/WebCore/inspector/front-end/Images/breakpointConditionalBorder.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/breakpointConditionalCounterBorder.png b/Source/WebCore/inspector/front-end/Images/breakpointConditionalCounterBorder.png
index b4a5030..a173c9d 100644
--- a/Source/WebCore/inspector/front-end/Images/breakpointConditionalCounterBorder.png
+++ b/Source/WebCore/inspector/front-end/Images/breakpointConditionalCounterBorder.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/breakpointCounterBorder.png b/Source/WebCore/inspector/front-end/Images/breakpointCounterBorder.png
index 8b77b61..d078545 100644
--- a/Source/WebCore/inspector/front-end/Images/breakpointCounterBorder.png
+++ b/Source/WebCore/inspector/front-end/Images/breakpointCounterBorder.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/breakpointsActivateButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/breakpointsActivateButtonGlyph.png
index ce49aac..6307d13 100644
--- a/Source/WebCore/inspector/front-end/Images/breakpointsActivateButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/breakpointsActivateButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/breakpointsDeactivateButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/breakpointsDeactivateButtonGlyph.png
index 5c5fcf6..bf1c5bb 100644
--- a/Source/WebCore/inspector/front-end/Images/breakpointsDeactivateButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/breakpointsDeactivateButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/checker.png b/Source/WebCore/inspector/front-end/Images/checker.png
index 8349908..816a4ec 100644
--- a/Source/WebCore/inspector/front-end/Images/checker.png
+++ b/Source/WebCore/inspector/front-end/Images/checker.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/clearConsoleButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/clearConsoleButtonGlyph.png
index b1f9465..c243f7d 100644
--- a/Source/WebCore/inspector/front-end/Images/clearConsoleButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/clearConsoleButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/closeButtons.png b/Source/WebCore/inspector/front-end/Images/closeButtons.png
index 28158a4..a574061 100644
--- a/Source/WebCore/inspector/front-end/Images/closeButtons.png
+++ b/Source/WebCore/inspector/front-end/Images/closeButtons.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/consoleButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/consoleButtonGlyph.png
index d10d43c..7ae29c2 100644
--- a/Source/WebCore/inspector/front-end/Images/consoleButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/consoleButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/consoleIcon.png b/Source/WebCore/inspector/front-end/Images/consoleIcon.png
index 94ffa95..24bb164 100644
--- a/Source/WebCore/inspector/front-end/Images/consoleIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/consoleIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/cookie.png b/Source/WebCore/inspector/front-end/Images/cookie.png
index 90c3c15..69af785 100644
--- a/Source/WebCore/inspector/front-end/Images/cookie.png
+++ b/Source/WebCore/inspector/front-end/Images/cookie.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/database.png b/Source/WebCore/inspector/front-end/Images/database.png
index 339efa6..5ffb12e 100644
--- a/Source/WebCore/inspector/front-end/Images/database.png
+++ b/Source/WebCore/inspector/front-end/Images/database.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/databaseTable.png b/Source/WebCore/inspector/front-end/Images/databaseTable.png
index 3718708..2359352 100644
--- a/Source/WebCore/inspector/front-end/Images/databaseTable.png
+++ b/Source/WebCore/inspector/front-end/Images/databaseTable.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/debuggerContinue.png b/Source/WebCore/inspector/front-end/Images/debuggerContinue.png
index d90a855..01d99ee 100644
--- a/Source/WebCore/inspector/front-end/Images/debuggerContinue.png
+++ b/Source/WebCore/inspector/front-end/Images/debuggerContinue.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/debuggerPause.png b/Source/WebCore/inspector/front-end/Images/debuggerPause.png
index 97f958a..c173868 100644
--- a/Source/WebCore/inspector/front-end/Images/debuggerPause.png
+++ b/Source/WebCore/inspector/front-end/Images/debuggerPause.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/debuggerStepInto.png b/Source/WebCore/inspector/front-end/Images/debuggerStepInto.png
index 277f126..68ec92f 100644
--- a/Source/WebCore/inspector/front-end/Images/debuggerStepInto.png
+++ b/Source/WebCore/inspector/front-end/Images/debuggerStepInto.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/debuggerStepOut.png b/Source/WebCore/inspector/front-end/Images/debuggerStepOut.png
index 3032e32..caf1394 100644
--- a/Source/WebCore/inspector/front-end/Images/debuggerStepOut.png
+++ b/Source/WebCore/inspector/front-end/Images/debuggerStepOut.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/debuggerStepOver.png b/Source/WebCore/inspector/front-end/Images/debuggerStepOver.png
index 7d47245..94f116d 100644
--- a/Source/WebCore/inspector/front-end/Images/debuggerStepOver.png
+++ b/Source/WebCore/inspector/front-end/Images/debuggerStepOver.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDown.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDown.png
index cffc835..02ecfa4 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDown.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDown.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownBlack.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownBlack.png
index 4b49c13..e100043 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownBlack.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownBlack.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownWhite.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownWhite.png
index aebae12..38a7aff 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownWhite.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallDownWhite.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRight.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRight.png
index a3102ea..b21f351 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRight.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRight.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightBlack.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightBlack.png
index 2c45859..5bc717f 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightBlack.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightBlack.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDown.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDown.png
index 035c069..be65ed7 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDown.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDown.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownBlack.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownBlack.png
index 86f67bd..44f304f 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownBlack.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownBlack.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownWhite.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownWhite.png
index 972d794..71ee8cc 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownWhite.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightDownWhite.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightWhite.png b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightWhite.png
index a10168f..f4e705c 100644
--- a/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightWhite.png
+++ b/Source/WebCore/inspector/front-end/Images/disclosureTriangleSmallRightWhite.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/dockButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/dockButtonGlyph.png
index 7052f4b..29e511d 100644
--- a/Source/WebCore/inspector/front-end/Images/dockButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/dockButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/elementsIcon.png b/Source/WebCore/inspector/front-end/Images/elementsIcon.png
index fde3db9..4f3dbcc 100644
--- a/Source/WebCore/inspector/front-end/Images/elementsIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/elementsIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/enableOutlineButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/enableOutlineButtonGlyph.png
index 85e0bd6..84e44d2 100644
--- a/Source/WebCore/inspector/front-end/Images/enableOutlineButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/enableOutlineButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/enableSolidButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/enableSolidButtonGlyph.png
index 25b2e96..7fb146b 100644
--- a/Source/WebCore/inspector/front-end/Images/enableSolidButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/enableSolidButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/errorIcon.png b/Source/WebCore/inspector/front-end/Images/errorIcon.png
index c697263..a921076 100644
--- a/Source/WebCore/inspector/front-end/Images/errorIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/errorIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/errorMediumIcon.png b/Source/WebCore/inspector/front-end/Images/errorMediumIcon.png
index 6ca32bb..e0d05d6 100644
--- a/Source/WebCore/inspector/front-end/Images/errorMediumIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/errorMediumIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/errorRedDot.png b/Source/WebCore/inspector/front-end/Images/errorRedDot.png
index 6f0b164..2acc65d 100644
--- a/Source/WebCore/inspector/front-end/Images/errorRedDot.png
+++ b/Source/WebCore/inspector/front-end/Images/errorRedDot.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/excludeButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/excludeButtonGlyph.png
index 5128576..0dd3e19 100644
--- a/Source/WebCore/inspector/front-end/Images/excludeButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/excludeButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/focusButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/focusButtonGlyph.png
index b71807c..7f331b5 100644
--- a/Source/WebCore/inspector/front-end/Images/focusButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/focusButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/forward.png b/Source/WebCore/inspector/front-end/Images/forward.png
index ad70f3e..843392b 100644
--- a/Source/WebCore/inspector/front-end/Images/forward.png
+++ b/Source/WebCore/inspector/front-end/Images/forward.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/frame.png b/Source/WebCore/inspector/front-end/Images/frame.png
index 0d1953c..27f5ea4 100644
--- a/Source/WebCore/inspector/front-end/Images/frame.png
+++ b/Source/WebCore/inspector/front-end/Images/frame.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/garbageCollectButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/garbageCollectButtonGlyph.png
new file mode 100644
index 0000000..699f5ee
--- /dev/null
+++ b/Source/WebCore/inspector/front-end/Images/garbageCollectButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/gearButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/gearButtonGlyph.png
index 19659c9..4b59250 100644
--- a/Source/WebCore/inspector/front-end/Images/gearButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/gearButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/glossyHeader.png b/Source/WebCore/inspector/front-end/Images/glossyHeader.png
index 6cbefb7..e85c596 100644
--- a/Source/WebCore/inspector/front-end/Images/glossyHeader.png
+++ b/Source/WebCore/inspector/front-end/Images/glossyHeader.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/glossyHeaderPressed.png b/Source/WebCore/inspector/front-end/Images/glossyHeaderPressed.png
index 1153506..01872cd 100644
--- a/Source/WebCore/inspector/front-end/Images/glossyHeaderPressed.png
+++ b/Source/WebCore/inspector/front-end/Images/glossyHeaderPressed.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/glossyHeaderSelected.png b/Source/WebCore/inspector/front-end/Images/glossyHeaderSelected.png
index 71d5af6..f7d615c 100644
--- a/Source/WebCore/inspector/front-end/Images/glossyHeaderSelected.png
+++ b/Source/WebCore/inspector/front-end/Images/glossyHeaderSelected.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/glossyHeaderSelectedPressed.png b/Source/WebCore/inspector/front-end/Images/glossyHeaderSelectedPressed.png
index 7047dbe..75d37fb 100644
--- a/Source/WebCore/inspector/front-end/Images/glossyHeaderSelectedPressed.png
+++ b/Source/WebCore/inspector/front-end/Images/glossyHeaderSelectedPressed.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/goArrow.png b/Source/WebCore/inspector/front-end/Images/goArrow.png
index f318a56..980e159 100644
--- a/Source/WebCore/inspector/front-end/Images/goArrow.png
+++ b/Source/WebCore/inspector/front-end/Images/goArrow.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/graphLabelCalloutLeft.png b/Source/WebCore/inspector/front-end/Images/graphLabelCalloutLeft.png
index 6426dbd..f80dccf 100644
--- a/Source/WebCore/inspector/front-end/Images/graphLabelCalloutLeft.png
+++ b/Source/WebCore/inspector/front-end/Images/graphLabelCalloutLeft.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/graphLabelCalloutRight.png b/Source/WebCore/inspector/front-end/Images/graphLabelCalloutRight.png
index 8c87eae..3ee8221 100644
--- a/Source/WebCore/inspector/front-end/Images/graphLabelCalloutRight.png
+++ b/Source/WebCore/inspector/front-end/Images/graphLabelCalloutRight.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/helpButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/helpButtonGlyph.png
index 92fe59a..83f0425 100644
--- a/Source/WebCore/inspector/front-end/Images/helpButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/helpButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/largerResourcesButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/largerResourcesButtonGlyph.png
index 71256d6..4884c8c 100644
--- a/Source/WebCore/inspector/front-end/Images/largerResourcesButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/largerResourcesButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/localStorage.png b/Source/WebCore/inspector/front-end/Images/localStorage.png
index 44a3019..0e615ce 100644
--- a/Source/WebCore/inspector/front-end/Images/localStorage.png
+++ b/Source/WebCore/inspector/front-end/Images/localStorage.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/networkIcon.png b/Source/WebCore/inspector/front-end/Images/networkIcon.png
index ba10bba..f34338e 100644
--- a/Source/WebCore/inspector/front-end/Images/networkIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/networkIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/nodeSearchButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/nodeSearchButtonGlyph.png
index faf5df2..bcaf651 100644
--- a/Source/WebCore/inspector/front-end/Images/nodeSearchButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/nodeSearchButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/paneAddButtons.png b/Source/WebCore/inspector/front-end/Images/paneAddButtons.png
index f1c0047..8790f53 100644
--- a/Source/WebCore/inspector/front-end/Images/paneAddButtons.png
+++ b/Source/WebCore/inspector/front-end/Images/paneAddButtons.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/paneBottomGrow.png b/Source/WebCore/inspector/front-end/Images/paneBottomGrow.png
index d55b865..c215657 100644
--- a/Source/WebCore/inspector/front-end/Images/paneBottomGrow.png
+++ b/Source/WebCore/inspector/front-end/Images/paneBottomGrow.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/paneBottomGrowActive.png b/Source/WebCore/inspector/front-end/Images/paneBottomGrowActive.png
index ef3f259..5a8d068 100644
--- a/Source/WebCore/inspector/front-end/Images/paneBottomGrowActive.png
+++ b/Source/WebCore/inspector/front-end/Images/paneBottomGrowActive.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/paneGrowHandleLine.png b/Source/WebCore/inspector/front-end/Images/paneGrowHandleLine.png
index 4eaf61b..87cc2c4 100644
--- a/Source/WebCore/inspector/front-end/Images/paneGrowHandleLine.png
+++ b/Source/WebCore/inspector/front-end/Images/paneGrowHandleLine.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/paneSettingsButtons.png b/Source/WebCore/inspector/front-end/Images/paneSettingsButtons.png
index 36a6244..1288b89 100644
--- a/Source/WebCore/inspector/front-end/Images/paneSettingsButtons.png
+++ b/Source/WebCore/inspector/front-end/Images/paneSettingsButtons.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/pauseOnExceptionButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/pauseOnExceptionButtonGlyph.png
index c3cec5f..13bd54e 100644
--- a/Source/WebCore/inspector/front-end/Images/pauseOnExceptionButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/pauseOnExceptionButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/percentButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/percentButtonGlyph.png
index 0ace3b7..cdbc120 100644
--- a/Source/WebCore/inspector/front-end/Images/percentButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/percentButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/popoverArrows.png b/Source/WebCore/inspector/front-end/Images/popoverArrows.png
index ccefa16..a1fc766 100644
--- a/Source/WebCore/inspector/front-end/Images/popoverArrows.png
+++ b/Source/WebCore/inspector/front-end/Images/popoverArrows.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/popoverBackground.png b/Source/WebCore/inspector/front-end/Images/popoverBackground.png
index f20c988..fd8fc99 100644
--- a/Source/WebCore/inspector/front-end/Images/popoverBackground.png
+++ b/Source/WebCore/inspector/front-end/Images/popoverBackground.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/profileGroupIcon.png b/Source/WebCore/inspector/front-end/Images/profileGroupIcon.png
index 44616d4..a25de24 100644
--- a/Source/WebCore/inspector/front-end/Images/profileGroupIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/profileGroupIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/profileIcon.png b/Source/WebCore/inspector/front-end/Images/profileIcon.png
index 8008f9b..015c791 100644
--- a/Source/WebCore/inspector/front-end/Images/profileIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/profileIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/profileSmallIcon.png b/Source/WebCore/inspector/front-end/Images/profileSmallIcon.png
index 7935520..cbdcac2 100644
--- a/Source/WebCore/inspector/front-end/Images/profileSmallIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/profileSmallIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/profilesIcon.png b/Source/WebCore/inspector/front-end/Images/profilesIcon.png
index ecd5b04..91630ae 100644
--- a/Source/WebCore/inspector/front-end/Images/profilesIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/profilesIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/profilesSilhouette.png b/Source/WebCore/inspector/front-end/Images/profilesSilhouette.png
index 42bb966..42daec2 100644
--- a/Source/WebCore/inspector/front-end/Images/profilesSilhouette.png
+++ b/Source/WebCore/inspector/front-end/Images/profilesSilhouette.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/programCounterBorder.png b/Source/WebCore/inspector/front-end/Images/programCounterBorder.png
index fed2f3e..5e7717e 100644
--- a/Source/WebCore/inspector/front-end/Images/programCounterBorder.png
+++ b/Source/WebCore/inspector/front-end/Images/programCounterBorder.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/radioDot.png b/Source/WebCore/inspector/front-end/Images/radioDot.png
index 609878f..1a99f93 100644
--- a/Source/WebCore/inspector/front-end/Images/radioDot.png
+++ b/Source/WebCore/inspector/front-end/Images/radioDot.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/recordButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/recordButtonGlyph.png
index bfdad1a..9ffac9a 100644
--- a/Source/WebCore/inspector/front-end/Images/recordButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/recordButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/recordToggledButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/recordToggledButtonGlyph.png
index 2c22f87..ee02021 100644
--- a/Source/WebCore/inspector/front-end/Images/recordToggledButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/recordToggledButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/reloadButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/reloadButtonGlyph.png
index 28e047a..c8739f2 100644
--- a/Source/WebCore/inspector/front-end/Images/reloadButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/reloadButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourceCSSIcon.png b/Source/WebCore/inspector/front-end/Images/resourceCSSIcon.png
index aead6a7..3782125 100644
--- a/Source/WebCore/inspector/front-end/Images/resourceCSSIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/resourceCSSIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourceDocumentIcon.png b/Source/WebCore/inspector/front-end/Images/resourceDocumentIcon.png
index 1683a09..5ef6559 100644
--- a/Source/WebCore/inspector/front-end/Images/resourceDocumentIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/resourceDocumentIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourceDocumentIconSmall.png b/Source/WebCore/inspector/front-end/Images/resourceDocumentIconSmall.png
index 468ced9..b70bd50 100644
--- a/Source/WebCore/inspector/front-end/Images/resourceDocumentIconSmall.png
+++ b/Source/WebCore/inspector/front-end/Images/resourceDocumentIconSmall.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourceJSIcon.png b/Source/WebCore/inspector/front-end/Images/resourceJSIcon.png
index 9ef6ed0..73bc05d 100644
--- a/Source/WebCore/inspector/front-end/Images/resourceJSIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/resourceJSIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourcePlainIcon.png b/Source/WebCore/inspector/front-end/Images/resourcePlainIcon.png
index 0ed37b6..2cd9e06 100644
--- a/Source/WebCore/inspector/front-end/Images/resourcePlainIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/resourcePlainIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourcePlainIconSmall.png b/Source/WebCore/inspector/front-end/Images/resourcePlainIconSmall.png
index 0fa967d..1adf8ac 100644
--- a/Source/WebCore/inspector/front-end/Images/resourcePlainIconSmall.png
+++ b/Source/WebCore/inspector/front-end/Images/resourcePlainIconSmall.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourcesIcon.png b/Source/WebCore/inspector/front-end/Images/resourcesIcon.png
index 982424d..c472dbd 100644
--- a/Source/WebCore/inspector/front-end/Images/resourcesIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/resourcesIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourcesSizeGraphIcon.png b/Source/WebCore/inspector/front-end/Images/resourcesSizeGraphIcon.png
index e60dbe5..4765e02 100644
--- a/Source/WebCore/inspector/front-end/Images/resourcesSizeGraphIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/resourcesSizeGraphIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/resourcesTimeGraphIcon.png b/Source/WebCore/inspector/front-end/Images/resourcesTimeGraphIcon.png
index c6953e9..27acd35 100644
--- a/Source/WebCore/inspector/front-end/Images/resourcesTimeGraphIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/resourcesTimeGraphIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/scriptsIcon.png b/Source/WebCore/inspector/front-end/Images/scriptsIcon.png
index 213b31e..4cda81f 100644
--- a/Source/WebCore/inspector/front-end/Images/scriptsIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/scriptsIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/scriptsSilhouette.png b/Source/WebCore/inspector/front-end/Images/scriptsSilhouette.png
index 206396f..09c4fcc 100644
--- a/Source/WebCore/inspector/front-end/Images/scriptsSilhouette.png
+++ b/Source/WebCore/inspector/front-end/Images/scriptsSilhouette.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/searchSmallBlue.png b/Source/WebCore/inspector/front-end/Images/searchSmallBlue.png
index 9c990f4..08350f7 100644
--- a/Source/WebCore/inspector/front-end/Images/searchSmallBlue.png
+++ b/Source/WebCore/inspector/front-end/Images/searchSmallBlue.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/searchSmallBrightBlue.png b/Source/WebCore/inspector/front-end/Images/searchSmallBrightBlue.png
index b1d8055..09813af 100644
--- a/Source/WebCore/inspector/front-end/Images/searchSmallBrightBlue.png
+++ b/Source/WebCore/inspector/front-end/Images/searchSmallBrightBlue.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/searchSmallGray.png b/Source/WebCore/inspector/front-end/Images/searchSmallGray.png
index 4f3c068..7780820 100644
--- a/Source/WebCore/inspector/front-end/Images/searchSmallGray.png
+++ b/Source/WebCore/inspector/front-end/Images/searchSmallGray.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/searchSmallWhite.png b/Source/WebCore/inspector/front-end/Images/searchSmallWhite.png
index 85f430d..8b57eaa 100644
--- a/Source/WebCore/inspector/front-end/Images/searchSmallWhite.png
+++ b/Source/WebCore/inspector/front-end/Images/searchSmallWhite.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/segment.png b/Source/WebCore/inspector/front-end/Images/segment.png
index 759266e..735ec1a 100644
--- a/Source/WebCore/inspector/front-end/Images/segment.png
+++ b/Source/WebCore/inspector/front-end/Images/segment.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/segmentEnd.png b/Source/WebCore/inspector/front-end/Images/segmentEnd.png
index 72672ff..a262b7d 100644
--- a/Source/WebCore/inspector/front-end/Images/segmentEnd.png
+++ b/Source/WebCore/inspector/front-end/Images/segmentEnd.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/segmentHover.png b/Source/WebCore/inspector/front-end/Images/segmentHover.png
index c5017f4..ffe99ee 100644
--- a/Source/WebCore/inspector/front-end/Images/segmentHover.png
+++ b/Source/WebCore/inspector/front-end/Images/segmentHover.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/segmentHoverEnd.png b/Source/WebCore/inspector/front-end/Images/segmentHoverEnd.png
index d51363d..c2c27fa 100644
--- a/Source/WebCore/inspector/front-end/Images/segmentHoverEnd.png
+++ b/Source/WebCore/inspector/front-end/Images/segmentHoverEnd.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/segmentSelected.png b/Source/WebCore/inspector/front-end/Images/segmentSelected.png
index c92f584..114ffc9 100644
--- a/Source/WebCore/inspector/front-end/Images/segmentSelected.png
+++ b/Source/WebCore/inspector/front-end/Images/segmentSelected.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/segmentSelectedEnd.png b/Source/WebCore/inspector/front-end/Images/segmentSelectedEnd.png
index be5e085..6cb3ac5 100644
--- a/Source/WebCore/inspector/front-end/Images/segmentSelectedEnd.png
+++ b/Source/WebCore/inspector/front-end/Images/segmentSelectedEnd.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/sessionStorage.png b/Source/WebCore/inspector/front-end/Images/sessionStorage.png
index 4d50e35..144ef65 100644
--- a/Source/WebCore/inspector/front-end/Images/sessionStorage.png
+++ b/Source/WebCore/inspector/front-end/Images/sessionStorage.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/splitviewDimple.png b/Source/WebCore/inspector/front-end/Images/splitviewDimple.png
index 584ffd4..23b88b5 100644
--- a/Source/WebCore/inspector/front-end/Images/splitviewDimple.png
+++ b/Source/WebCore/inspector/front-end/Images/splitviewDimple.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/splitviewDividerBackground.png b/Source/WebCore/inspector/front-end/Images/splitviewDividerBackground.png
index 1120a7f..2e48b06 100644
--- a/Source/WebCore/inspector/front-end/Images/splitviewDividerBackground.png
+++ b/Source/WebCore/inspector/front-end/Images/splitviewDividerBackground.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/statusbarButtons.png b/Source/WebCore/inspector/front-end/Images/statusbarButtons.png
index e8090cb..163d7b5 100644
--- a/Source/WebCore/inspector/front-end/Images/statusbarButtons.png
+++ b/Source/WebCore/inspector/front-end/Images/statusbarButtons.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png b/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png
index 9b3abdd..8904217 100644
--- a/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png
+++ b/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png b/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png
index 8189c43..74fe953 100644
--- a/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png
+++ b/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/statusbarResizerHorizontal.png b/Source/WebCore/inspector/front-end/Images/statusbarResizerHorizontal.png
index 56deeab..674b895 100644
--- a/Source/WebCore/inspector/front-end/Images/statusbarResizerHorizontal.png
+++ b/Source/WebCore/inspector/front-end/Images/statusbarResizerHorizontal.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/statusbarResizerVertical.png b/Source/WebCore/inspector/front-end/Images/statusbarResizerVertical.png
index 7fc1452..bf84d1e 100644
--- a/Source/WebCore/inspector/front-end/Images/statusbarResizerVertical.png
+++ b/Source/WebCore/inspector/front-end/Images/statusbarResizerVertical.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/successGreenDot.png b/Source/WebCore/inspector/front-end/Images/successGreenDot.png
index 8b9319c..8a3232a 100644
--- a/Source/WebCore/inspector/front-end/Images/successGreenDot.png
+++ b/Source/WebCore/inspector/front-end/Images/successGreenDot.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/thumbActiveHoriz.png b/Source/WebCore/inspector/front-end/Images/thumbActiveHoriz.png
index a6ee561..8648eb1 100644
--- a/Source/WebCore/inspector/front-end/Images/thumbActiveHoriz.png
+++ b/Source/WebCore/inspector/front-end/Images/thumbActiveHoriz.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/thumbActiveVert.png b/Source/WebCore/inspector/front-end/Images/thumbActiveVert.png
index a3eabe8..10b71b7 100644
--- a/Source/WebCore/inspector/front-end/Images/thumbActiveVert.png
+++ b/Source/WebCore/inspector/front-end/Images/thumbActiveVert.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/thumbHoriz.png b/Source/WebCore/inspector/front-end/Images/thumbHoriz.png
index c16559a..f4b8694 100644
--- a/Source/WebCore/inspector/front-end/Images/thumbHoriz.png
+++ b/Source/WebCore/inspector/front-end/Images/thumbHoriz.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/thumbHoverHoriz.png b/Source/WebCore/inspector/front-end/Images/thumbHoverHoriz.png
index 0fe8d6a..74e43b8 100644
--- a/Source/WebCore/inspector/front-end/Images/thumbHoverHoriz.png
+++ b/Source/WebCore/inspector/front-end/Images/thumbHoverHoriz.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/thumbHoverVert.png b/Source/WebCore/inspector/front-end/Images/thumbHoverVert.png
index 30e315a..140ab8e 100644
--- a/Source/WebCore/inspector/front-end/Images/thumbHoverVert.png
+++ b/Source/WebCore/inspector/front-end/Images/thumbHoverVert.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/thumbVert.png b/Source/WebCore/inspector/front-end/Images/thumbVert.png
index 61fbc06..460815e 100644
--- a/Source/WebCore/inspector/front-end/Images/thumbVert.png
+++ b/Source/WebCore/inspector/front-end/Images/thumbVert.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineBarBlue.png b/Source/WebCore/inspector/front-end/Images/timelineBarBlue.png
index 22641b5..5af3195 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineBarBlue.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineBarBlue.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineBarGray.png b/Source/WebCore/inspector/front-end/Images/timelineBarGray.png
index f66cf43..4e11aa4 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineBarGray.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineBarGray.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineBarGreen.png b/Source/WebCore/inspector/front-end/Images/timelineBarGreen.png
index cc59082..ec1955c 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineBarGreen.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineBarGreen.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineBarOrange.png b/Source/WebCore/inspector/front-end/Images/timelineBarOrange.png
index e5ae6f5..435b0f1 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineBarOrange.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineBarOrange.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineBarPurple.png b/Source/WebCore/inspector/front-end/Images/timelineBarPurple.png
index f891252..02649cd 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineBarPurple.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineBarPurple.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineBarRed.png b/Source/WebCore/inspector/front-end/Images/timelineBarRed.png
index b850037..9c47280 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineBarRed.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineBarRed.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineBarYellow.png b/Source/WebCore/inspector/front-end/Images/timelineBarYellow.png
index 2b3e9a7..39716ea 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineBarYellow.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineBarYellow.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.png b/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.png
index 9afa9bb..1b32449 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineDots.png b/Source/WebCore/inspector/front-end/Images/timelineDots.png
index e9ba4d3..325f2ab 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineDots.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineDots.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineHollowPillBlue.png b/Source/WebCore/inspector/front-end/Images/timelineHollowPillBlue.png
index c7c273b..92f7f72 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineHollowPillBlue.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineHollowPillBlue.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineHollowPillGray.png b/Source/WebCore/inspector/front-end/Images/timelineHollowPillGray.png
index 9ff37ef..fd8afe1 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineHollowPillGray.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineHollowPillGray.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineHollowPillGreen.png b/Source/WebCore/inspector/front-end/Images/timelineHollowPillGreen.png
index cc5a8f3..af34c30 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineHollowPillGreen.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineHollowPillGreen.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineHollowPillOrange.png b/Source/WebCore/inspector/front-end/Images/timelineHollowPillOrange.png
index 08a81e4..b46edde 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineHollowPillOrange.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineHollowPillOrange.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineHollowPillPurple.png b/Source/WebCore/inspector/front-end/Images/timelineHollowPillPurple.png
index 565a05c..6ce6640 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineHollowPillPurple.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineHollowPillPurple.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineHollowPillRed.png b/Source/WebCore/inspector/front-end/Images/timelineHollowPillRed.png
index c3a1b9b..67cccfd 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineHollowPillRed.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineHollowPillRed.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineHollowPillYellow.png b/Source/WebCore/inspector/front-end/Images/timelineHollowPillYellow.png
index 780045b..9e71a9a 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineHollowPillYellow.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineHollowPillYellow.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelineIcon.png b/Source/WebCore/inspector/front-end/Images/timelineIcon.png
index 09bcf30..6ab8621 100644
--- a/Source/WebCore/inspector/front-end/Images/timelineIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/timelineIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelinePillBlue.png b/Source/WebCore/inspector/front-end/Images/timelinePillBlue.png
index c897faa..aef3652 100644
--- a/Source/WebCore/inspector/front-end/Images/timelinePillBlue.png
+++ b/Source/WebCore/inspector/front-end/Images/timelinePillBlue.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelinePillGray.png b/Source/WebCore/inspector/front-end/Images/timelinePillGray.png
index 2128896..82ea80a 100644
--- a/Source/WebCore/inspector/front-end/Images/timelinePillGray.png
+++ b/Source/WebCore/inspector/front-end/Images/timelinePillGray.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelinePillGreen.png b/Source/WebCore/inspector/front-end/Images/timelinePillGreen.png
index 9b66125..6973fdb 100644
--- a/Source/WebCore/inspector/front-end/Images/timelinePillGreen.png
+++ b/Source/WebCore/inspector/front-end/Images/timelinePillGreen.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelinePillOrange.png b/Source/WebCore/inspector/front-end/Images/timelinePillOrange.png
index dd944fb..09cfa4a 100644
--- a/Source/WebCore/inspector/front-end/Images/timelinePillOrange.png
+++ b/Source/WebCore/inspector/front-end/Images/timelinePillOrange.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelinePillPurple.png b/Source/WebCore/inspector/front-end/Images/timelinePillPurple.png
index 21b96f7..6fb5b35 100644
--- a/Source/WebCore/inspector/front-end/Images/timelinePillPurple.png
+++ b/Source/WebCore/inspector/front-end/Images/timelinePillPurple.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelinePillRed.png b/Source/WebCore/inspector/front-end/Images/timelinePillRed.png
index f5e213b..64234f7 100644
--- a/Source/WebCore/inspector/front-end/Images/timelinePillRed.png
+++ b/Source/WebCore/inspector/front-end/Images/timelinePillRed.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/timelinePillYellow.png b/Source/WebCore/inspector/front-end/Images/timelinePillYellow.png
index ae2a5a2..a2deee6 100644
--- a/Source/WebCore/inspector/front-end/Images/timelinePillYellow.png
+++ b/Source/WebCore/inspector/front-end/Images/timelinePillYellow.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/toolbarItemSelected.png b/Source/WebCore/inspector/front-end/Images/toolbarItemSelected.png
index bd681f1..dab787e 100644
--- a/Source/WebCore/inspector/front-end/Images/toolbarItemSelected.png
+++ b/Source/WebCore/inspector/front-end/Images/toolbarItemSelected.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/trackHoriz.png b/Source/WebCore/inspector/front-end/Images/trackHoriz.png
index 517d306..541dd11 100644
--- a/Source/WebCore/inspector/front-end/Images/trackHoriz.png
+++ b/Source/WebCore/inspector/front-end/Images/trackHoriz.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/trackVert.png b/Source/WebCore/inspector/front-end/Images/trackVert.png
index d49620d..1375a14 100644
--- a/Source/WebCore/inspector/front-end/Images/trackVert.png
+++ b/Source/WebCore/inspector/front-end/Images/trackVert.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/treeDownTriangleBlack.png b/Source/WebCore/inspector/front-end/Images/treeDownTriangleBlack.png
index 0821112..f797585 100644
--- a/Source/WebCore/inspector/front-end/Images/treeDownTriangleBlack.png
+++ b/Source/WebCore/inspector/front-end/Images/treeDownTriangleBlack.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/treeDownTriangleWhite.png b/Source/WebCore/inspector/front-end/Images/treeDownTriangleWhite.png
index 1667b51..24d3d55 100644
--- a/Source/WebCore/inspector/front-end/Images/treeDownTriangleWhite.png
+++ b/Source/WebCore/inspector/front-end/Images/treeDownTriangleWhite.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/treeRightTriangleBlack.png b/Source/WebCore/inspector/front-end/Images/treeRightTriangleBlack.png
index 90de820..9b4c2f1 100644
--- a/Source/WebCore/inspector/front-end/Images/treeRightTriangleBlack.png
+++ b/Source/WebCore/inspector/front-end/Images/treeRightTriangleBlack.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/treeRightTriangleWhite.png b/Source/WebCore/inspector/front-end/Images/treeRightTriangleWhite.png
index 2b6a82f..fcb2eb6 100644
--- a/Source/WebCore/inspector/front-end/Images/treeRightTriangleWhite.png
+++ b/Source/WebCore/inspector/front-end/Images/treeRightTriangleWhite.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/treeUpTriangleBlack.png b/Source/WebCore/inspector/front-end/Images/treeUpTriangleBlack.png
index ef69dbc..91bde8a 100644
--- a/Source/WebCore/inspector/front-end/Images/treeUpTriangleBlack.png
+++ b/Source/WebCore/inspector/front-end/Images/treeUpTriangleBlack.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/treeUpTriangleWhite.png b/Source/WebCore/inspector/front-end/Images/treeUpTriangleWhite.png
index 43ce4be..c49a0ae 100644
--- a/Source/WebCore/inspector/front-end/Images/treeUpTriangleWhite.png
+++ b/Source/WebCore/inspector/front-end/Images/treeUpTriangleWhite.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/undockButtonGlyph.png b/Source/WebCore/inspector/front-end/Images/undockButtonGlyph.png
index eed2b65..bf0a081 100644
--- a/Source/WebCore/inspector/front-end/Images/undockButtonGlyph.png
+++ b/Source/WebCore/inspector/front-end/Images/undockButtonGlyph.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/userInputIcon.png b/Source/WebCore/inspector/front-end/Images/userInputIcon.png
index 325023f..d00819f 100644
--- a/Source/WebCore/inspector/front-end/Images/userInputIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/userInputIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/userInputPreviousIcon.png b/Source/WebCore/inspector/front-end/Images/userInputPreviousIcon.png
index 068d572..779f815 100644
--- a/Source/WebCore/inspector/front-end/Images/userInputPreviousIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/userInputPreviousIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/userInputResultIcon.png b/Source/WebCore/inspector/front-end/Images/userInputResultIcon.png
index 794a5ca..9f77181 100644
--- a/Source/WebCore/inspector/front-end/Images/userInputResultIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/userInputResultIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/warningIcon.png b/Source/WebCore/inspector/front-end/Images/warningIcon.png
index d5e4c82..3637420 100644
--- a/Source/WebCore/inspector/front-end/Images/warningIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/warningIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/warningMediumIcon.png b/Source/WebCore/inspector/front-end/Images/warningMediumIcon.png
index 291e111..6a92f67 100644
--- a/Source/WebCore/inspector/front-end/Images/warningMediumIcon.png
+++ b/Source/WebCore/inspector/front-end/Images/warningMediumIcon.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/warningOrangeDot.png b/Source/WebCore/inspector/front-end/Images/warningOrangeDot.png
index 8c8b635..a193712 100644
--- a/Source/WebCore/inspector/front-end/Images/warningOrangeDot.png
+++ b/Source/WebCore/inspector/front-end/Images/warningOrangeDot.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/Images/warningsErrors.png b/Source/WebCore/inspector/front-end/Images/warningsErrors.png
index 878b593..c005698 100644
--- a/Source/WebCore/inspector/front-end/Images/warningsErrors.png
+++ b/Source/WebCore/inspector/front-end/Images/warningsErrors.png
Binary files differ
diff --git a/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
index 07f392d..c0bc273 100644
--- a/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
+++ b/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
@@ -122,6 +122,10 @@ WebInspector.InspectorFrontendHostStub.prototype = {
sendMessageToBackend: function(message)
{
+ },
+
+ loadSessionSetting: function()
+ {
}
}
diff --git a/Source/WebCore/inspector/front-end/MetricsSidebarPane.js b/Source/WebCore/inspector/front-end/MetricsSidebarPane.js
index 14039ef..1288973 100644
--- a/Source/WebCore/inspector/front-end/MetricsSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/MetricsSidebarPane.js
@@ -40,7 +40,7 @@ WebInspector.MetricsSidebarPane.prototype = {
else
node = this.node;
- if (!node || node.nodeType !== Node.ELEMENT_NODE) {
+ if (!node || node.nodeType() !== Node.ELEMENT_NODE) {
this.bodyElement.removeChildren();
return;
}
diff --git a/Source/WebCore/inspector/front-end/NetworkItemView.js b/Source/WebCore/inspector/front-end/NetworkItemView.js
index 418f559..0e5d14c 100644
--- a/Source/WebCore/inspector/front-end/NetworkItemView.js
+++ b/Source/WebCore/inspector/front-end/NetworkItemView.js
@@ -40,15 +40,26 @@ WebInspector.NetworkItemView = function(resource)
this._tabbedPane = new WebInspector.TabbedPane(this.element);
this._tabbedPane.appendTab("headers", WebInspector.UIString("Headers"), this._headersView);
+
if (contentView.hasContent()) {
// Reusing this view, so hide it at first.
contentView.visible = false;
this._tabbedPane.appendTab("content", WebInspector.UIString("Content"), contentView);
}
+
+ if (resource.type === WebInspector.Resource.Type.XHR && resource.content) {
+ var parsedJSON = WebInspector.ResourceJSONView.parseJSON(resource.content);
+ if (parsedJSON) {
+ var jsonView = new WebInspector.ResourceJSONView(resource, parsedJSON);
+ this._tabbedPane.appendTab("json", WebInspector.UIString("JSON"), jsonView);
+ }
+ }
+
if (Preferences.showCookiesTab) {
this._cookiesView = new WebInspector.ResourceCookiesView(resource);
this._tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView);
}
+
if (Preferences.showTimingTab) {
var timingView = new WebInspector.ResourceTimingView(resource);
this._tabbedPane.appendTab("timing", WebInspector.UIString("Timing"), timingView);
diff --git a/Source/WebCore/inspector/front-end/NetworkManager.js b/Source/WebCore/inspector/front-end/NetworkManager.js
index 246b53c..98aa060 100644
--- a/Source/WebCore/inspector/front-end/NetworkManager.js
+++ b/Source/WebCore/inspector/front-end/NetworkManager.js
@@ -28,43 +28,34 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.NetworkManager = function(resourceTreeModel)
+WebInspector.NetworkManager = function()
{
WebInspector.Object.call(this);
- this._resourceTreeModel = resourceTreeModel;
- this._dispatcher = new WebInspector.NetworkDispatcher(resourceTreeModel, this);
- NetworkAgent.enable(this._processCachedResources.bind(this));
+ this._dispatcher = new WebInspector.NetworkDispatcher(this);
+ NetworkAgent.enable();
}
WebInspector.NetworkManager.EventTypes = {
ResourceStarted: "ResourceStarted",
ResourceUpdated: "ResourceUpdated",
ResourceFinished: "ResourceFinished",
- MainResourceCommitLoad: "MainResourceCommitLoad"
+ FrameCommittedLoad: "FrameCommittedLoad",
+ FrameDetached: "FrameDetached"
}
WebInspector.NetworkManager.prototype = {
frontendReused: function()
{
- WebInspector.panels.network.clear();
- this._resourceTreeModel.reset();
- NetworkAgent.enable(this._processCachedResources.bind(this));
+ NetworkAgent.enable();
},
requestContent: function(resource, base64Encode, callback)
{
- function callbackWrapper(success, content)
+ function callbackWrapper(error, content)
{
- callback(success ? content : null);
+ callback(!error ? content : null);
}
- NetworkAgent.resourceContent(resource.loader.frameId, resource.url, base64Encode, callbackWrapper);
- },
-
- _processCachedResources: function(mainFramePayload)
- {
- var mainResource = this._dispatcher._addFramesRecursively(mainFramePayload);
- WebInspector.mainResource = mainResource;
- mainResource.isMainResource = true;
+ NetworkAgent.getResourceContent(resource.frameId, resource.url, base64Encode, callbackWrapper);
},
inflightResourceForURL: function(url)
@@ -75,12 +66,11 @@ WebInspector.NetworkManager.prototype = {
WebInspector.NetworkManager.prototype.__proto__ = WebInspector.Object.prototype;
-WebInspector.NetworkDispatcher = function(resourceTreeModel, manager)
+WebInspector.NetworkDispatcher = function(manager)
{
this._manager = manager;
this._inflightResourcesById = {};
this._inflightResourcesByURL = {};
- this._resourceTreeModel = resourceTreeModel;
this._lastIdentifierForCachedResource = 0;
InspectorBackend.registerDomainDispatcher("Network", this);
}
@@ -88,78 +78,55 @@ WebInspector.NetworkDispatcher = function(resourceTreeModel, manager)
WebInspector.NetworkDispatcher.prototype = {
_updateResourceWithRequest: function(resource, request)
{
- resource.requestMethod = request.httpMethod;
- resource.requestHeaders = request.httpHeaderFields;
- resource.requestFormData = request.requestFormData;
+ resource.requestMethod = request.method;
+ resource.requestHeaders = request.headers;
+ resource.requestFormData = request.postData;
},
_updateResourceWithResponse: function(resource, response)
{
- if (resource.isNull)
+ if (!("status" in response))
return;
resource.mimeType = response.mimeType;
- resource.expectedContentLength = response.expectedContentLength;
- resource.textEncodingName = response.textEncodingName;
- resource.suggestedFilename = response.suggestedFilename;
- resource.statusCode = response.httpStatusCode;
- resource.statusText = response.httpStatusText;
+ resource.statusCode = response.status;
+ resource.statusText = response.statusText;
+ resource.responseHeaders = response.headers;
+ // Raw request headers can be a part of response as well.
+ if (response.requestHeaders)
+ resource.requestHeaders = response.requestHeaders;
- resource.responseHeaders = response.httpHeaderFields;
resource.connectionReused = response.connectionReused;
resource.connectionID = response.connectionID;
- if (response.wasCached)
+ if (response.fromDiskCache)
resource.cached = true;
else
resource.timing = response.timing;
-
- if (response.loadInfo) {
- if (response.loadInfo.httpStatusCode)
- resource.statusCode = response.loadInfo.httpStatusCode;
- if (response.loadInfo.httpStatusText)
- resource.statusText = response.loadInfo.httpStatusText;
- resource.requestHeaders = response.loadInfo.requestHeaders;
- resource.responseHeaders = response.loadInfo.responseHeaders;
- }
},
_updateResourceWithCachedResource: function(resource, cachedResource)
{
resource.type = WebInspector.Resource.Type[cachedResource.type];
- resource.resourceSize = cachedResource.encodedSize;
+ resource.resourceSize = cachedResource.bodySize;
this._updateResourceWithResponse(resource, cachedResource.response);
},
- identifierForInitialRequest: function(identifier, url, loader, callStack)
- {
- this._startResource(this._createResource(identifier, url, loader, callStack));
- },
-
- willSendRequest: function(identifier, time, request, redirectResponse)
+ requestWillBeSent: function(identifier, frameId, loaderId, documentURL, request, redirectResponse, time, callStack)
{
var resource = this._inflightResourcesById[identifier];
- if (!resource)
- return;
-
- // Redirect may have empty URL and we'd like to not crash with invalid HashMap entry.
- // See http/tests/misc/will-send-request-returns-null-on-redirect.html
- var isRedirect = !redirectResponse.isNull && request.url.length;
- if (isRedirect) {
- this.didReceiveResponse(identifier, time, "Other", redirectResponse);
- resource = this._appendRedirect(resource.identifier, time, request.url);
- }
-
+ if (resource) {
+ this.responseReceived(identifier, time, "Other", redirectResponse);
+ resource = this._appendRedirect(identifier, time, request.url);
+ } else
+ resource = this._createResource(identifier, frameId, loaderId, request.url, documentURL, callStack);
this._updateResourceWithRequest(resource, request);
resource.startTime = time;
- if (isRedirect)
- this._startResource(resource);
- else
- this._updateResource(resource);
+ this._startResource(resource);
},
- markResourceAsCached: function(identifier)
+ resourceMarkedAsCached: function(identifier)
{
var resource = this._inflightResourcesById[identifier];
if (!resource)
@@ -169,7 +136,7 @@ WebInspector.NetworkDispatcher.prototype = {
this._updateResource(resource);
},
- didReceiveResponse: function(identifier, time, resourceType, response)
+ responseReceived: function(identifier, time, resourceType, response)
{
var resource = this._inflightResourcesById[identifier];
if (!resource)
@@ -181,22 +148,23 @@ WebInspector.NetworkDispatcher.prototype = {
this._updateResourceWithResponse(resource, response);
this._updateResource(resource);
- this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
},
- didReceiveContentLength: function(identifier, time, lengthReceived)
+ dataReceived: function(identifier, time, dataLength, lengthReceived)
{
var resource = this._inflightResourcesById[identifier];
if (!resource)
return;
- resource.resourceSize += lengthReceived;
+ resource.resourceSize += dataLength;
+ if (lengthReceived != -1)
+ resource.increaseTransferSize(lengthReceived);
resource.endTime = time;
this._updateResource(resource);
},
- didFinishLoading: function(identifier, finishTime)
+ loadingFinished: function(identifier, finishTime)
{
var resource = this._inflightResourcesById[identifier];
if (!resource)
@@ -205,7 +173,7 @@ WebInspector.NetworkDispatcher.prototype = {
this._finishResource(resource, finishTime);
},
- didFailLoading: function(identifier, time, localizedDescription)
+ loadingFailed: function(identifier, time, localizedDescription)
{
var resource = this._inflightResourcesById[identifier];
if (!resource)
@@ -216,24 +184,23 @@ WebInspector.NetworkDispatcher.prototype = {
this._finishResource(resource, time);
},
- didLoadResourceFromMemoryCache: function(time, cachedResource)
+ resourceLoadedFromMemoryCache: function(frameId, loaderId, documentURL, time, cachedResource)
{
- var resource = this._createResource("cached:" + ++this._lastIdentifierForCachedResource, cachedResource.url, cachedResource.loader);
+ var resource = this._createResource("cached:" + ++this._lastIdentifierForCachedResource, frameId, loaderId, cachedResource.url, documentURL);
this._updateResourceWithCachedResource(resource, cachedResource);
resource.cached = true;
resource.requestMethod = "GET";
this._startResource(resource);
resource.startTime = resource.responseReceivedTime = time;
this._finishResource(resource, time);
- this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
},
- frameDetachedFromParent: function(frameId)
+ frameDetached: function(frameId)
{
- this._resourceTreeModel.frameDetachedFromParent(frameId);
+ this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.FrameDetached, frameId);
},
- setInitialContent: function(identifier, sourceString, type)
+ initialContentSet: function(identifier, sourceString, type)
{
var resource = WebInspector.networkResourceById(identifier);
if (!resource)
@@ -244,56 +211,48 @@ WebInspector.NetworkDispatcher.prototype = {
this._updateResource(resource);
},
- didCommitLoadForFrame: function(frame, loader)
+ frameNavigated: function(frame, loaderId)
{
- this._resourceTreeModel.didCommitLoadForFrame(frame, loader);
- if (!frame.parentId) {
- var mainResource = this._resourceTreeModel.resourceForURL(frame.url);
- if (mainResource) {
- WebInspector.mainResource = mainResource;
- mainResource.isMainResource = true;
- this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.MainResourceCommitLoad, mainResource);
- }
- }
+ this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.FrameCommittedLoad, { frame: frame, loaderId: loaderId });
},
- didCreateWebSocket: function(identifier, requestURL)
+ webSocketCreated: function(identifier, requestURL)
{
- var resource = this._createResource(identifier, requestURL);
+ var resource = this._createResource(identifier, null, null, requestURL);
resource.type = WebInspector.Resource.Type.WebSocket;
this._startResource(resource);
},
- willSendWebSocketHandshakeRequest: function(identifier, time, request)
+ webSocketWillSendHandshakeRequest: function(identifier, time, request)
{
var resource = this._inflightResourcesById[identifier];
if (!resource)
return;
resource.requestMethod = "GET";
- resource.requestHeaders = request.webSocketHeaderFields;
- resource.webSocketRequestKey3 = request.webSocketRequestKey3;
+ resource.requestHeaders = request.headers;
+ resource.webSocketRequestKey3 = request.requestKey3;
resource.startTime = time;
this._updateResource(resource);
},
- didReceiveWebSocketHandshakeResponse: function(identifier, time, response)
+ webSocketHandshakeResponseReceived: function(identifier, time, response)
{
var resource = this._inflightResourcesById[identifier];
if (!resource)
return;
- resource.statusCode = response.statusCode;
+ resource.statusCode = response.status;
resource.statusText = response.statusText;
- resource.responseHeaders = response.webSocketHeaderFields;
- resource.webSocketChallengeResponse = response.webSocketChallengeResponse;
+ resource.responseHeaders = response.headers;
+ resource.webSocketChallengeResponse = response.challengeResponse;
resource.responseReceivedTime = time;
this._updateResource(resource);
},
- didCloseWebSocket: function(identifier, time)
+ webSocketClosed: function(identifier, time)
{
var resource = this._inflightResourcesById[identifier];
if (!resource)
@@ -308,7 +267,8 @@ WebInspector.NetworkDispatcher.prototype = {
originalResource.identifier = "redirected:" + identifier + "." + previousRedirects.length;
delete originalResource.redirects;
this._finishResource(originalResource, time);
- var newResource = this._createResource(identifier, redirectURL, originalResource.loader, originalResource.stackTrace);
+ var newResource = this._createResource(identifier, originalResource.frameId, originalResource.loaderId,
+ redirectURL, originalResource.documentURL, originalResource.stackTrace);
newResource.redirects = previousRedirects.concat(originalResource);
return newResource;
},
@@ -334,44 +294,17 @@ WebInspector.NetworkDispatcher.prototype = {
delete this._inflightResourcesByURL[resource.url];
},
- _addFramesRecursively: function(framePayload)
- {
- var frameResource = this._createResource(null, framePayload.resource.url, framePayload.resource.loader);
- this._updateResourceWithRequest(frameResource, framePayload.resource.request);
- this._updateResourceWithResponse(frameResource, framePayload.resource.response);
- frameResource.type = WebInspector.Resource.Type["Document"];
- frameResource.finished = true;
-
- this._resourceTreeModel.addOrUpdateFrame(framePayload);
- this._resourceTreeModel.addResourceToFrame(framePayload.id, frameResource);
-
- for (var i = 0; framePayload.children && i < framePayload.children.length; ++i)
- this._addFramesRecursively(framePayload.children[i]);
-
- if (!framePayload.subresources)
- return;
-
- for (var i = 0; i < framePayload.subresources.length; ++i) {
- var cachedResource = framePayload.subresources[i];
- var resource = this._createResource(null, cachedResource.url, cachedResource.loader);
- this._updateResourceWithCachedResource(resource, cachedResource);
- resource.finished = true;
- this._resourceTreeModel.addResourceToFrame(framePayload.id, resource);
- }
- return frameResource;
- },
-
_dispatchEventToListeners: function(eventType, resource)
{
this._manager.dispatchEventToListeners(eventType, resource);
},
- _createResource: function(identifier, url, loader, stackTrace)
+ _createResource: function(identifier, frameId, loaderId, url, documentURL, stackTrace)
{
var resource = new WebInspector.Resource(identifier, url);
- resource.loader = loader;
- if (loader)
- resource.documentURL = loader.url;
+ resource.documentURL = documentURL;
+ resource.frameId = frameId;
+ resource.loaderId = loaderId;
resource.stackTrace = stackTrace;
return resource;
}
diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js
index 06983f0..3c497d6 100644
--- a/Source/WebCore/inspector/front-end/NetworkPanel.js
+++ b/Source/WebCore/inspector/front-end/NetworkPanel.js
@@ -40,6 +40,7 @@ WebInspector.NetworkPanel = function()
this._resourcesByURL = {};
this._staleResources = [];
this._resourceGridNodes = {};
+ this._lastResourceGridNodeId = 0;
this._mainResourceLoadTime = -1;
this._mainResourceDOMContentTime = -1;
this._hiddenCategories = {};
@@ -82,7 +83,7 @@ WebInspector.NetworkPanel = function()
WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this);
WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._onResourceUpdated, this);
WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceUpdated, this);
- WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.MainResourceCommitLoad, this._onMainResourceCommitLoad, this);
+ WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.FrameCommittedLoad, this._onFrameCommitLoad, this);
}
WebInspector.NetworkPanel.prototype = {
@@ -367,7 +368,7 @@ WebInspector.NetworkPanel.prototype = {
for (var i = 0; i < this._resources.length; ++i) {
var resource = this._resources[i];
transferSize += (resource.cached || !resource.transferSize) ? 0 : resource.transferSize;
- if (resource.isMainResource)
+ if (resource === WebInspector.mainResource)
baseTime = resource.startTime;
if (resource.endTime > maxTime)
maxTime = resource.endTime;
@@ -564,7 +565,15 @@ WebInspector.NetworkPanel.prototype = {
_resourceGridNode: function(resource)
{
- return this._resourceGridNodes[resource.identifier];
+ return this._resourceGridNodes[resource.__gridNodeId];
+ },
+
+ _createResourceGridNode: function(resource)
+ {
+ var node = new WebInspector.NetworkDataGridNode(this, resource);
+ resource.__gridNodeId = this._lastResourceGridNodeId++;
+ this._resourceGridNodes[resource.__gridNodeId] = node;
+ return node;
},
revealAndSelectItem: function(resource)
@@ -671,8 +680,7 @@ WebInspector.NetworkPanel.prototype = {
var node = this._resourceGridNode(resource);
if (!node) {
// Create the timeline tree element and graph.
- node = new WebInspector.NetworkDataGridNode(this, resource);
- this._resourceGridNodes[resource.identifier] = node;
+ node = this._createResourceGridNode(resource);
this._dataGrid.appendChild(node);
}
node.refreshResource();
@@ -794,15 +802,29 @@ WebInspector.NetworkPanel.prototype = {
this._reset();
},
- _onMainResourceCommitLoad: function()
+ _onFrameCommitLoad: function(event)
{
+ if (event.data.frame.parentId)
+ return;
+
+ // Main frame committed load.
if (this._preserveLogToggle.toggled)
return;
+ // Preserve provisional load resources.
+ var loaderId = event.data.loaderId;
+ var resourcesToPreserve = [];
+ for (var i = 0; i < this._resources.length; ++i) {
+ var resource = this._resources[i];
+ if (resource.loaderId === loaderId)
+ resourcesToPreserve.push(resource);
+ }
+
this._reset();
- // Now resurrect the main resource along with all redirects that lead to it.
- var resourcesToAppend = (WebInspector.mainResource.redirects || []).concat(WebInspector.mainResource);
- resourcesToAppend.forEach(this._appendResource, this);
+
+ // Restore preserved items.
+ for (var i = 0; i < resourcesToPreserve.length; ++i)
+ this._appendResource(resourcesToPreserve[i]);
},
canShowSourceLine: function(url, line)
@@ -972,16 +994,12 @@ WebInspector.NetworkPanel.prototype = {
_contextMenu: function(event)
{
- // createBlobURL is enabled conditionally, do not expose resource export if it's not available.
- if ((window.webkitURL && typeof window.webkitURL.createObjectURL !== "function") || !Preferences.resourceExportEnabled)
- return;
-
var contextMenu = new WebInspector.ContextMenu();
var gridNode = this._dataGrid.dataGridNodeFromNode(event.target);
var resource = gridNode && gridNode._resource;
if (resource)
- contextMenu.appendItem(WebInspector.UIString("Export to HAR"), this._exportResource.bind(this, resource));
- contextMenu.appendItem(WebInspector.UIString("Export all to HAR"), this._exportAll.bind(this));
+ contextMenu.appendItem(WebInspector.UIString("Copy entry as HAR"), this._exportResource.bind(this, resource));
+ contextMenu.appendItem(WebInspector.UIString("Copy network log as HAR"), this._exportAll.bind(this));
contextMenu.show(event);
},
@@ -1359,7 +1377,7 @@ WebInspector.NetworkDataGridNode.prototype = {
_openInNewTab: function()
{
- InspectorAgent.openInInspectedWindow(this._resource.url);
+ PageAgent.openInInspectedWindow(this._resource.url);
},
get selectable()
diff --git a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
index 88fddd6..1795843 100644
--- a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
+++ b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
@@ -184,7 +184,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
var description = this.property.value.description;
// Render \n as a nice unicode cr symbol.
if (this.property.value.type === "string" && typeof description === "string")
- description = description.replace(/\n/g, "\u21B5");
+ description = "\"" + description.replace(/\n/g, "\u21B5") + "\"";
this.valueElement.textContent = description;
if (this.property.isGetter)
@@ -278,23 +278,23 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
{
expression = expression.trim();
var expressionLength = expression.length;
- var self = this;
- var callback = function(success) {
+ function callback(error)
+ {
if (!updateInterface)
return;
- if (!success)
- self.update();
+ if (error)
+ this.update();
if (!expressionLength) {
// The property was deleted, so remove this tree element.
- self.parent.removeChild(this);
+ this.parent.removeChild(this);
} else {
// Call updateSiblings since their value might be based on the value that just changed.
- self.updateSiblings();
+ this.updateSiblings();
}
};
- this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback);
+ this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback.bind(this));
}
}
diff --git a/Source/WebCore/inspector/front-end/ProfileView.js b/Source/WebCore/inspector/front-end/ProfileView.js
index 335bf03..a8c5ff4 100644
--- a/Source/WebCore/inspector/front-end/ProfileView.js
+++ b/Source/WebCore/inspector/front-end/ProfileView.js
@@ -81,8 +81,10 @@ WebInspector.CPUProfileView = function(profile)
this.profile = profile;
var self = this;
- function profileCallback(profile)
+ function profileCallback(error, profile)
{
+ if (error)
+ return;
self.profile.head = profile.head;
self._assignParentsInProfile();
@@ -593,9 +595,9 @@ WebInspector.CPUProfileType.prototype = {
this._recording = !this._recording;
if (this._recording)
- InspectorAgent.startProfiling();
+ ProfilerAgent.start();
else
- InspectorAgent.stopProfiling();
+ ProfilerAgent.stop();
},
get welcomeMessage()
diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js
index e5fb49e..ea5327b 100644
--- a/Source/WebCore/inspector/front-end/ProfilesPanel.js
+++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js
@@ -124,7 +124,26 @@ WebInspector.ProfilesPanel = function()
this._profiles = [];
this._profilerEnabled = Preferences.profilerAlwaysEnabled;
this._reset();
+
+ this._registerProfileType(new WebInspector.CPUProfileType());
+ if (Preferences.heapProfilerPresent) {
+ if (!Preferences.detailedHeapProfiles)
+ this._registerProfileType(new WebInspector.HeapSnapshotProfileType());
+ else
+ this._registerProfileType(new WebInspector.DetailedHeapshotProfileType());
+ }
+
InspectorBackend.registerDomainDispatcher("Profiler", new WebInspector.ProfilerDispatcher(this));
+
+ if (Preferences.profilerAlwaysEnabled || WebInspector.settings.profilerEnabled)
+ ProfilerAgent.enable();
+ else {
+ function onProfilerEnebled(error, value) {
+ if (value)
+ this._profilerWasEnabled();
+ }
+ ProfilerAgent.isEnabled(onProfilerEnebled.bind(this));
+ }
}
WebInspector.ProfilesPanel.prototype = {
@@ -230,7 +249,7 @@ WebInspector.ProfilesPanel.prototype = {
this._reset();
},
- registerProfileType: function(profileType)
+ _registerProfileType: function(profileType)
{
this._profileTypesByIdMap[profileType.id] = profileType;
profileType.treeElement = new WebInspector.SidebarSectionTreeElement(profileType.name, null, true);
@@ -614,10 +633,10 @@ WebInspector.ProfilesPanel.prototype = {
{
if (this._profilerEnabled) {
WebInspector.settings.profilerEnabled = false;
- InspectorAgent.disableProfiler(true);
+ ProfilerAgent.disable();
} else {
WebInspector.settings.profilerEnabled = !!optionalAlways;
- InspectorAgent.enableProfiler();
+ ProfilerAgent.enable();
}
},
@@ -626,7 +645,9 @@ WebInspector.ProfilesPanel.prototype = {
if (!this._profilerEnabled || this._profilesWereRequested)
return;
- function populateCallback(profileHeaders) {
+ function populateCallback(error, profileHeaders) {
+ if (error)
+ return;
profileHeaders.sort(function(a, b) { return a.uid - b.uid; });
var profileHeadersLength = profileHeaders.length;
for (var i = 0; i < profileHeadersLength; ++i)
diff --git a/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js b/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js
index 0c314bc..4df313c 100644
--- a/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js
@@ -42,20 +42,19 @@ WebInspector.PropertiesSidebarPane.prototype = {
return;
}
- RuntimeAgent.releaseObjectGroup(0, "dom-selection");
WebInspector.RemoteObject.resolveNode(node, nodeResolved.bind(this));
- function nodeResolved(objectPayload)
+ function nodeResolved(object)
{
- if (!objectPayload)
+ if (!object)
return;
- var object = WebInspector.RemoteObject.fromPayload(objectPayload);
object.evaluate("var proto = this; result = {}; var counter = 1; while (proto) { result[counter++] = proto; proto = proto.__proto__ }; return result;", nodePrototypesReady.bind(this));
+ object.release();
}
- function nodePrototypesReady(objectPayload)
+ function nodePrototypesReady(error, objectPayload)
{
- if (!objectPayload)
+ if (error || !objectPayload)
return;
var object = WebInspector.RemoteObject.fromPayload(objectPayload);
object.getOwnProperties(false, fillSection.bind(this));
diff --git a/Source/WebCore/inspector/front-end/RemoteObject.js b/Source/WebCore/inspector/front-end/RemoteObject.js
index 4a20cf1..294be50 100644
--- a/Source/WebCore/inspector/front-end/RemoteObject.js
+++ b/Source/WebCore/inspector/front-end/RemoteObject.js
@@ -48,11 +48,17 @@ WebInspector.RemoteObject.fromLocalObject = function(value)
WebInspector.RemoteObject.resolveNode = function(node, callback)
{
- function mycallback(object)
+ function mycallback(error, object)
{
- callback(object ? WebInspector.RemoteObject.fromPayload(object) : null);
+ if (!callback)
+ return;
+
+ if (error || !object)
+ callback(null);
+ else
+ callback(WebInspector.RemoteObject.fromPayload(object));
}
- DOMAgent.resolveNode(node.id, "dom-selection", mycallback);
+ DOMAgent.resolveNode(node.id, mycallback);
}
WebInspector.RemoteObject.fromPayload = function(payload)
@@ -112,8 +118,10 @@ WebInspector.RemoteObject.prototype = {
callback([]);
return;
}
- function remoteObjectBinder(properties)
+ function remoteObjectBinder(error, properties)
{
+ if (error)
+ return;
for (var i = 0; properties && i < properties.length; ++i)
properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value);
callback(properties);
@@ -124,7 +132,7 @@ WebInspector.RemoteObject.prototype = {
setPropertyValue: function(name, value, callback)
{
if (!this._objectId) {
- callback(false);
+ callback("Can't get a property of non-object.");
return;
}
RuntimeAgent.setPropertyValue(this._objectId, name, value, callback);
@@ -141,6 +149,11 @@ WebInspector.RemoteObject.prototype = {
evaluate: function(expression, callback)
{
RuntimeAgent.evaluateOn(this._objectId, expression, callback);
+ },
+
+ release: function()
+ {
+ RuntimeAgent.releaseObject(this._objectId);
}
}
@@ -164,15 +177,50 @@ WebInspector.LocalJSONObject = function(value)
WebInspector.LocalJSONObject.prototype = {
get description()
{
+ if (this._cachedDescription)
+ return this._cachedDescription;
+
var type = this.type;
+
switch (type) {
case "array":
- return "[" + this._value.length + "]";
+ function formatArrayItem(property)
+ {
+ return property.value.description;
+ }
+ this._cachedDescription = this._concatenate("[", "]", formatArrayItem);
+ break;
case "object":
- return this.hasChildren ? "{...}" : "{ }";
+ function formatObjectItem(property)
+ {
+ return property.name + ":" + property.value.description;
+ }
+ this._cachedDescription = this._concatenate("{", "}", formatObjectItem);
+ break;
default:
- return JSON.stringify(this._value);
+ this._cachedDescription = String(this._value);
}
+ return this._cachedDescription;
+ },
+
+ _concatenate: function(prefix, suffix, formatProperty)
+ {
+ const previewChars = 100;
+
+ var buffer = prefix;
+ var children = this._children();
+ for (var i = 0; i < children.length; ++i) {
+ var itemDescription = formatProperty(children[i]);
+ if (buffer.length + itemDescription.length > previewChars) {
+ buffer += ",\u2026";
+ break;
+ }
+ if (i)
+ buffer += ", ";
+ buffer += itemDescription;
+ }
+ buffer += suffix;
+ return buffer;
},
get type()
@@ -196,11 +244,18 @@ WebInspector.LocalJSONObject.prototype = {
getProperties: function(ignoreHasOwnProperty, abbreviate, callback)
{
+ callback(this._children());
+ },
+
+ _children: function()
+ {
function buildProperty(propName)
{
return new WebInspector.RemoteObjectProperty(propName, new WebInspector.LocalJSONObject(this._value[propName]));
}
- callback(Object.keys(this._value).map(buildProperty.bind(this)));
+ if (!this._cachedChildren)
+ this._cachedChildren = Object.keys(this._value).map(buildProperty.bind(this));
+ return this._cachedChildren;
},
isError: function()
diff --git a/Source/WebCore/inspector/front-end/Resource.js b/Source/WebCore/inspector/front-end/Resource.js
index 6cf5b9c..8035fd8 100644
--- a/Source/WebCore/inspector/front-end/Resource.js
+++ b/Source/WebCore/inspector/front-end/Resource.js
@@ -241,7 +241,10 @@ WebInspector.Resource.prototype = {
return 0;
if (this.statusCode === 304) // Not modified
return this._responseHeadersSize;
- // FIXME: We prefer using Content-Length over resourceSize as
+ if (this._transferSize !== undefined)
+ return this._transferSize;
+ // If we did not receive actual transfer size from network
+ // stack, we prefer using Content-Length over resourceSize as
// resourceSize may differ from actual transfer size if platform's
// network stack performed decoding (e.g. gzip decompression).
// The Content-Length, though, is expected to come from raw
@@ -249,19 +252,14 @@ WebInspector.Resource.prototype = {
// This won't work for chunked content encoding, so fall back to
// resourceSize when we don't have Content-Length. This still won't
// work for chunks with non-trivial encodings. We need a way to
- // get actaul transfer size from the network stack.
+ // get actual transfer size from the network stack.
var bodySize = Number(this.responseHeaders["Content-Length"] || this.resourceSize);
return this._responseHeadersSize + bodySize;
},
- get expectedContentLength()
+ increaseTransferSize: function(x)
{
- return this._expectedContentLength || 0;
- },
-
- set expectedContentLength(x)
- {
- this._expectedContentLength = x;
+ this._transferSize = (this._transferSize || 0) + x;
},
get finished()
diff --git a/Source/WebCore/inspector/front-end/ResourceJSONView.js b/Source/WebCore/inspector/front-end/ResourceJSONView.js
new file mode 100644
index 0000000..694b100
--- /dev/null
+++ b/Source/WebCore/inspector/front-end/ResourceJSONView.js
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.ResourceJSONView = function(resource, parsedJSON)
+{
+ WebInspector.ResourceView.call(this, resource);
+ this._parsedJSON = parsedJSON;
+ this.element.addStyleClass("json");
+}
+
+WebInspector.ResourceJSONView.parseJSON = function(text)
+{
+ // Trim while(1), for(;;), weird numbers, etc. We need JSON start.
+ var start = /[{[]/.exec(text);
+ if (start && start.index)
+ text = text.substring(start.index);
+
+ try {
+ return JSON.parse(text);
+ } catch (e) {
+ return;
+ }
+}
+
+WebInspector.ResourceJSONView.prototype = {
+ hasContent: function()
+ {
+ return true;
+ },
+
+ show: function(parentElement)
+ {
+ WebInspector.ResourceView.prototype.show.call(this, parentElement);
+ this._initialize();
+ },
+
+ _initialize: function()
+ {
+ if (this._initialized)
+ return;
+ this._initialized = true;
+
+ var obj = WebInspector.RemoteObject.fromLocalObject(this._parsedJSON);
+ this.element.appendChild(new WebInspector.ObjectPropertiesSection(obj, obj.description, null, true).element);
+ }
+}
+
+WebInspector.ResourceJSONView.prototype.__proto__ = WebInspector.ResourceView.prototype;
diff --git a/Source/WebCore/inspector/front-end/ResourceTreeModel.js b/Source/WebCore/inspector/front-end/ResourceTreeModel.js
index da2d47a..fa2c44e 100644
--- a/Source/WebCore/inspector/front-end/ResourceTreeModel.js
+++ b/Source/WebCore/inspector/front-end/ResourceTreeModel.js
@@ -29,62 +29,131 @@
*/
-WebInspector.ResourceTreeModel = function()
+WebInspector.ResourceTreeModel = function(networkManager)
{
- this.reset();
+ WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceUpdated, this);
+ WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._onResourceUpdated, this);
+ WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.FrameDetached, this._onFrameDetachedFromParent, this);
+ WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.FrameCommittedLoad, this._onCommitLoad, this);
+
+ this.frontendReused();
+}
+
+WebInspector.ResourceTreeModel.EventTypes = {
+ FrameAdded: "FrameAdded",
+ FrameNavigated: "FrameNavigated",
+ FrameDetached: "FrameDetached",
+ ResourceAdded: "ResourceAdded"
}
WebInspector.ResourceTreeModel.prototype = {
- reset: function()
+ frontendReused: function()
{
this._resourcesByURL = {};
this._resourcesByFrameId = {};
this._subframes = {};
- if (WebInspector.panels)
- WebInspector.panels.resources.clear();
+ NetworkAgent.getCachedResources(this._processCachedResources.bind(this));
+ },
+
+ _processCachedResources: function(error, mainFramePayload)
+ {
+ if (error)
+ return;
+
+ this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, 0);
+
+ WebInspector.mainResource = this._addFramesRecursively(mainFramePayload);
+ this._cachedResourcesProcessed = true;
},
- addOrUpdateFrame: function(frame)
+ _addOrUpdateFrame: function(frame)
{
- var tmpResource = new WebInspector.Resource(null, frame.url);
- WebInspector.panels.resources.addOrUpdateFrame(frame.parentId, frame.id, frame.name, tmpResource.displayName);
+ this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, frame);
+
var subframes = this._subframes[frame.parentId];
if (!subframes) {
- subframes = {};
+ subframes = [];
this._subframes[frame.parentId || 0] = subframes;
}
- subframes[frame.id] = true;
+ subframes.push(frame);
},
- didCommitLoadForFrame: function(frame, loader)
+ frames: function(parentFrameId)
{
+ return this._subframes[parentFrameId] || [];
+ },
+
+ subframes: function(parentFrameId)
+ {
+ return this._subframes[parentFrameId] || [];
+ },
+
+ resources: function(frameId)
+ {
+ var result = [];
+ var resources = this._resourcesByFrameId[frameId] || {};
+ for (var url in resources)
+ result.push(resources[url]);
+ return result;
+ },
+
+ _onCommitLoad: function(event)
+ {
+ if (!this._cachedResourcesProcessed)
+ return;
+
+ var frame = event.data.frame;
+ var loaderId = event.data.loaderId;
+ var isMainFrame = !frame.parentId;
+
// frame.parentId === 0 is when main frame navigation happens.
- this._clearChildFramesAndResources(frame.parentId ? frame.id : 0, loader.loaderId);
+ this._clearChildFramesAndResources(isMainFrame ? 0 : frame.id, loaderId);
- this.addOrUpdateFrame(frame);
+ this._addOrUpdateFrame(frame);
var resourcesForFrame = this._resourcesByFrameId[frame.id];
- for (var i = 0; resourcesForFrame && i < resourcesForFrame.length; ++i)
- WebInspector.panels.resources.addResourceToFrame(frame.id, resourcesForFrame[i]);
+ if (resourcesForFrame) {
+ for (var url in resourcesForFrame)
+ this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, resourcesForFrame[url]);
+ }
+
+ if (isMainFrame && this.resourceForURL(frame.url))
+ WebInspector.mainResource = this.resourceForURL(frame.url);
},
- frameDetachedFromParent: function(frameId)
+ _onFrameDetachedFromParent: function(event)
{
+ if (!this._cachedResourcesProcessed)
+ return;
+
+ var frameId = event.data;
this._clearChildFramesAndResources(frameId, 0);
- WebInspector.panels.resources.removeFrame(frameId);
+ this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, frameId);
+ },
+
+ _onResourceUpdated: function(event)
+ {
+ if (!this._cachedResourcesProcessed)
+ return;
+ this._addResourceToFrame(event.data);
},
- addResourceToFrame: function(frameId, resource)
+ _addResourceToFrame: function(resource)
{
+ var frameId = resource.frameId;
var resourcesForFrame = this._resourcesByFrameId[frameId];
if (!resourcesForFrame) {
- resourcesForFrame = [];
+ resourcesForFrame = {};
this._resourcesByFrameId[frameId] = resourcesForFrame;
}
- resourcesForFrame.push(resource);
- this._bindResourceURL(resource);
+ if (resourcesForFrame[resource.url] === resource) {
+ // Already in the tree, we just got an extra update.
+ return;
+ }
- WebInspector.panels.resources.addResourceToFrame(frameId, resource);
+ resourcesForFrame[resource.url] = resource;
+ this._bindResourceURL(resource);
+ this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, resource);
},
forAllResources: function(callback)
@@ -108,7 +177,7 @@ WebInspector.ResourceTreeModel.prototype = {
}
var view = WebInspector.ResourceView.resourceViewForResource(resource);
- if (view.addMessage)
+ if (view.addMessage && msg.isErrorOrWarning() && msg.message)
view.addMessage(msg);
},
@@ -123,36 +192,23 @@ WebInspector.ResourceTreeModel.prototype = {
resourceForURL: function(url)
{
- // FIXME: receive frameId here.
- var entry = this._resourcesByURL[url];
- if (entry instanceof Array)
- return entry[0];
- return entry;
+ return this._resourcesByURL[url];
},
_bindResourceURL: function(resource)
{
- var resourceForURL = this._resourcesByURL[resource.url];
- if (!resourceForURL)
- this._resourcesByURL[resource.url] = resource;
- else if (resourceForURL instanceof Array)
- resourceForURL.push(resource);
- else
- this._resourcesByURL[resource.url] = [resourceForURL, resource];
+ this._resourcesByURL[resource.url] = resource;
},
- _clearChildFramesAndResources: function(frameId, loaderId)
+ _clearChildFramesAndResources: function(frameId, loaderToPreserveId)
{
- WebInspector.panels.resources.removeResourcesFromFrame(frameId);
+ this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, frameId);
- this._clearResources(frameId, loaderId);
+ this._clearResources(frameId, loaderToPreserveId);
var subframes = this._subframes[frameId];
- if (!subframes)
- return;
-
- for (var childFrameId in subframes) {
- WebInspector.panels.resources.removeFrame(childFrameId);
- this._clearChildFramesAndResources(childFrameId, loaderId);
+ for (var i = 0; subframes && i < subframes.length; ++ i) {
+ this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameRemoved, subframes[i].id);
+ this._clearChildFramesAndResources(subframes[i].id, loaderToPreserveId);
}
delete this._subframes[frameId];
},
@@ -164,51 +220,81 @@ WebInspector.ResourceTreeModel.prototype = {
return;
var preservedResourcesForFrame = [];
- for (var i = 0; i < resourcesForFrame.length; ++i) {
- var resource = resourcesForFrame[i];
- if (resource.loader.loaderId === loaderToPreserveId) {
- preservedResourcesForFrame.push(resource);
+ for (var url in resourcesForFrame) {
+ var resource = resourcesForFrame[url];
+ if (resource.loaderId === loaderToPreserveId) {
+ preservedResourcesForFrame[url] = resource;
continue;
}
this._unbindResourceURL(resource);
}
delete this._resourcesByFrameId[frameId];
- if (preservedResourcesForFrame.length)
+ if (preservedResourcesForFrame.length) {
this._resourcesByFrameId[frameId] = preservedResourcesForFrame;
+ }
},
_callForFrameResources: function(frameId, callback)
{
var resources = this._resourcesByFrameId[frameId];
- for (var i = 0; resources && i < resources.length; ++i) {
- if (callback(resources[i]))
+ if (!resources)
+ return;
+
+ for (var url in resources) {
+ if (callback(resources[url]))
return true;
}
var frames = this._subframes[frameId];
- if (frames) {
- for (var id in frames) {
- if (this._callForFrameResources(id, callback))
- return true;
- }
+ for (var i = 0; frames && i < frames.length; ++i) {
+ if (this._callForFrameResources(frames[i].id, callback))
+ return true;
}
return false;
},
_unbindResourceURL: function(resource)
{
- var resourceForURL = this._resourcesByURL[resource.url];
- if (!resourceForURL)
- return;
+ delete this._resourcesByURL[resource.url];
+ },
+
+ _addFramesRecursively: function(frameTreePayload)
+ {
+ var framePayload = frameTreePayload.frame;
+
+ // Create frame resource.
+ var frameResource = this._createResource(framePayload, framePayload.url);
+ frameResource.type = WebInspector.Resource.Type.Document;
+ frameResource.finished = true;
+
+ this._addOrUpdateFrame(framePayload);
+ this._addResourceToFrame(frameResource);
- if (resourceForURL instanceof Array) {
- resourceForURL.remove(resource, true);
- if (resourceForURL.length === 1)
- this._resourcesByURL[resource.url] = resourceForURL[0];
+ for (var i = 0; frameTreePayload.childFrames && i < frameTreePayload.childFrames.length; ++i)
+ this._addFramesRecursively(frameTreePayload.childFrames[i]);
+
+ if (!frameTreePayload.resources)
return;
+
+ // Create frame subresources.
+ for (var i = 0; i < frameTreePayload.resources.length; ++i) {
+ var subresource = frameTreePayload.resources[i];
+ var resource = this._createResource(framePayload, subresource.url);
+ resource.type = WebInspector.Resource.Type[subresource.type];
+ resource.finished = true;
+ this._addResourceToFrame(resource);
}
+ return frameResource;
+ },
- delete this._resourcesByURL[resource.url];
+ _createResource: function(frame, url)
+ {
+ var resource = new WebInspector.Resource(null, url);
+ resource.frameId = frame.id;
+ resource.loaderId = frame.loaderId;
+ return resource;
}
}
+
+WebInspector.ResourceTreeModel.prototype.__proto__ = WebInspector.Object.prototype;
diff --git a/Source/WebCore/inspector/front-end/ResourceView.js b/Source/WebCore/inspector/front-end/ResourceView.js
index 83cf99d5..ffd9062 100644
--- a/Source/WebCore/inspector/front-end/ResourceView.js
+++ b/Source/WebCore/inspector/front-end/ResourceView.js
@@ -45,15 +45,20 @@ WebInspector.ResourceView.prototype.__proto__ = WebInspector.View.prototype;
WebInspector.ResourceView.createResourceView = function(resource)
{
+ function sourceFrameForDelegateAndURL(delegate, url)
+ {
+ var view = new WebInspector.SourceFrame(delegate, url);
+ view.resource = resource;
+ return view;
+ }
+
switch (resource.category) {
case WebInspector.resourceCategories.documents:
- case WebInspector.resourceCategories.stylesheets:
case WebInspector.resourceCategories.scripts:
case WebInspector.resourceCategories.xhr:
- var delegate = new WebInspector.SourceFrameDelegateForResourcesPanel(resource);
- var view = new WebInspector.SourceFrame(delegate, resource.url);
- view.resource = resource;
- return view;
+ return sourceFrameForDelegateAndURL(new WebInspector.SourceFrameDelegateForResourcesPanel(resource), resource.url);
+ case WebInspector.resourceCategories.stylesheets:
+ return sourceFrameForDelegateAndURL(new WebInspector.CSSSourceFrameDelegateForResourcesPanel(resource), resource.url);
case WebInspector.resourceCategories.images:
return new WebInspector.ImageView(resource);
case WebInspector.resourceCategories.fonts:
@@ -147,3 +152,56 @@ WebInspector.SourceFrameDelegateForResourcesPanel.prototype = {
}
WebInspector.SourceFrameDelegateForResourcesPanel.prototype.__proto__ = WebInspector.SourceFrameDelegate.prototype;
+
+
+WebInspector.CSSSourceFrameDelegateForResourcesPanel = function(resource)
+{
+ WebInspector.SourceFrameDelegateForResourcesPanel.call(this, resource);
+}
+
+WebInspector.CSSSourceFrameDelegateForResourcesPanel.prototype = {
+ canEditScriptSource: function()
+ {
+ return true;
+ },
+
+ editScriptSource: function(newText)
+ {
+ function handleStyleSheet(newText, styleSheet)
+ {
+ this._styleSheet = styleSheet;
+ this._saveStyleSheet(newText);
+ }
+
+ function handleInfos(newText, error, infos)
+ {
+ if (error)
+ return;
+ for (var i = 0; i < infos.length; ++i) {
+ var info = infos[i];
+ if (info.sourceURL === this._resource.url) {
+ WebInspector.CSSStyleSheet.createForId(info.styleSheetId, handleStyleSheet.bind(this, newText));
+ break;
+ }
+ }
+ }
+
+ if (this._styleSheet)
+ this._saveStyleSheet(newText);
+ else
+ CSSAgent.getAllStyleSheets(handleInfos.bind(this, newText));
+ },
+
+ _saveStyleSheet: function(newText)
+ {
+ function callback(success)
+ {
+ if (!success)
+ console.error("Failed to save modified stylesheet %s", this._resource.url);
+ }
+
+ this._styleSheet.setText(newText, callback.bind(this));
+ }
+}
+
+WebInspector.CSSSourceFrameDelegateForResourcesPanel.prototype.__proto__ = WebInspector.SourceFrameDelegateForResourcesPanel.prototype;
diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js
index 3c85892..c65e6b7 100644
--- a/Source/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js
@@ -34,26 +34,28 @@ WebInspector.ResourcesPanel = function(database)
WebInspector.settings.installApplicationSetting("resourcesLastSelectedItem", {});
this.createSidebar();
- this.sidebarElement.addStyleClass("outline-disclosure filter-all children small");
+ this.sidebarElement.addStyleClass("outline-disclosure");
+ this.sidebarElement.addStyleClass("filter-all");
+ this.sidebarElement.addStyleClass("children");
+ this.sidebarElement.addStyleClass("small");
this.sidebarTreeElement.removeStyleClass("sidebar-tree");
- this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Frames"), "Frames", "frame-storage-tree-item");
+ this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Frames"), "Frames", ["frame-storage-tree-item"]);
this.sidebarTree.appendChild(this.resourcesListTreeElement);
- this._treeElementForFrameId = {};
- this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Databases"), "Databases", "database-storage-tree-item");
+ this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Databases"), "Databases", ["database-storage-tree-item"]);
this.sidebarTree.appendChild(this.databasesListTreeElement);
- this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Local Storage"), "LocalStorage", "domstorage-storage-tree-item local-storage");
+ this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Local Storage"), "LocalStorage", ["domstorage-storage-tree-item", "local-storage"]);
this.sidebarTree.appendChild(this.localStorageListTreeElement);
- this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Session Storage"), "SessionStorage", "domstorage-storage-tree-item session-storage");
+ this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Session Storage"), "SessionStorage", ["domstorage-storage-tree-item", "session-storage"]);
this.sidebarTree.appendChild(this.sessionStorageListTreeElement);
- this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Cookies"), "Cookies", "cookie-storage-tree-item");
+ this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Cookies"), "Cookies", ["cookie-storage-tree-item"]);
this.sidebarTree.appendChild(this.cookieListTreeElement);
- this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", "application-cache-storage-tree-item");
+ this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["application-cache-storage-tree-item"]);
this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
this.storageViews = document.createElement("div");
@@ -96,10 +98,10 @@ WebInspector.ResourcesPanel.prototype = {
{
WebInspector.Panel.prototype.show.call(this);
+ this._populateResourceTree();
+
if (this.visibleView && this.visibleView.resource)
this._showResourceView(this.visibleView.resource);
-
- this._initDefaultSelection();
},
loadEventFired: function()
@@ -165,15 +167,42 @@ WebInspector.ResourcesPanel.prototype = {
this.sidebarTree.selectedTreeElement.deselect();
},
- clear: function()
+ _populateResourceTree: function()
{
- this.resourcesListTreeElement.removeChildren();
+ if (this._treeElementForFrameId)
+ return;
+
this._treeElementForFrameId = {};
- this.reset();
+ WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameAdded, this);
+ WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
+ WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
+ WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
+
+ function populateFrame(frameId)
+ {
+ var subframes = WebInspector.resourceTreeModel.subframes(frameId);
+ for (var i = 0; i < subframes.length; ++i) {
+ this._frameAdded({data:subframes[i]});
+ populateFrame.call(this, subframes[i].id);
+ }
+
+ var resources = WebInspector.resourceTreeModel.resources(frameId);
+ for (var i = 0; i < resources.length; ++i)
+ this._resourceAdded({data:resources[i]});
+ }
+ populateFrame.call(this, 0);
+ this._initDefaultSelection();
},
- addOrUpdateFrame: function(parentFrameId, frameId, title, subtitle)
+ _frameAdded: function(event)
{
+ var frame = event.data;
+ var frameId = frame.id;
+ var parentFrameId = frame.parentId;
+ var title = frame.name;
+ var subtitle = new WebInspector.Resource(null, frame.url).displayName;
+ this.addDocumentURL(frame.url);
+
var frameTreeElement = this._treeElementForFrameId[frameId];
if (frameTreeElement) {
frameTreeElement.setTitles(title, subtitle);
@@ -182,7 +211,7 @@ WebInspector.ResourcesPanel.prototype = {
var parentTreeElement = parentFrameId ? this._treeElementForFrameId[parentFrameId] : this.resourcesListTreeElement;
if (!parentTreeElement) {
- console.warning("No frame with id:" + parentFrameId + " to route " + displayName + " to.")
+ console.warn("No frame with id:" + parentFrameId + " to route " + title + "/" + subtitle + " to.")
return;
}
@@ -205,8 +234,9 @@ WebInspector.ResourcesPanel.prototype = {
parentTreeElement.appendChild(frameTreeElement);
},
- removeFrame: function(frameId)
+ _frameDetached: function(event)
{
+ var frameId = event.data;
var frameTreeElement = this._treeElementForFrameId[frameId];
if (!frameTreeElement)
return;
@@ -215,9 +245,10 @@ WebInspector.ResourcesPanel.prototype = {
frameTreeElement.parent.removeChild(frameTreeElement);
},
- addResourceToFrame: function(frameId, resource)
+ _resourceAdded: function(event)
{
- this.addDocumentURL(resource.documentURL);
+ var resource = event.data;
+ var frameId = resource.frameId;
if (resource.statusCode >= 301 && resource.statusCode <= 303)
return;
@@ -247,11 +278,20 @@ WebInspector.ResourcesPanel.prototype = {
frameTreeElement.appendChild(resourceTreeElement);
},
- removeResourcesFromFrame: function(frameId)
+ _frameNavigated: function(event)
{
+ var frameId = event.data;
+ if (!frameId) {
+ // Total update.
+ this.resourcesListTreeElement.removeChildren();
+ this._treeElementForFrameId = {};
+ this.reset();
+ return;
+ }
+
var frameTreeElement = this._treeElementForFrameId[frameId];
if (frameTreeElement)
- frameTreeElement.removeChildren();
+ frameTreeElement.removeChildren();
},
_refreshResource: function(event)
@@ -379,8 +419,8 @@ WebInspector.ResourcesPanel.prototype = {
},
_applyDiffMarkup: function(view, baseContent, newContent) {
- var oldLines = baseContent.split("\n");
- var newLines = newContent.split("\n");
+ var oldLines = baseContent.split(/\r?\n/);
+ var newLines = newContent.split(/\r?\n/);
var diff = Array.diff(oldLines, newLines);
@@ -770,19 +810,22 @@ WebInspector.ResourcesPanel.prototype = {
WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
-WebInspector.BaseStorageTreeElement = function(storagePanel, representedObject, title, iconClass, hasChildren)
+WebInspector.BaseStorageTreeElement = function(storagePanel, representedObject, title, iconClasses, hasChildren)
{
TreeElement.call(this, "", representedObject, hasChildren);
this._storagePanel = storagePanel;
this._titleText = title;
- this._iconClass = iconClass;
+ this._iconClasses = iconClasses;
}
WebInspector.BaseStorageTreeElement.prototype = {
onattach: function()
{
this.listItemElement.removeChildren();
- this.listItemElement.addStyleClass(this._iconClass);
+ if (this._iconClasses) {
+ for (var i = 0; i < this._iconClasses.length; ++i)
+ this.listItemElement.addStyleClass(this._iconClasses[i]);
+ }
var selectionElement = document.createElement("div");
selectionElement.className = "selection";
@@ -836,9 +879,9 @@ WebInspector.BaseStorageTreeElement.prototype = {
WebInspector.BaseStorageTreeElement.prototype.__proto__ = TreeElement.prototype;
-WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, settingsKey, iconClass)
+WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, settingsKey, iconClasses)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClass, true);
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClasses, true);
this._expandedSettingKey = "resources" + settingsKey + "Expanded";
WebInspector.settings.installApplicationSetting(this._expandedSettingKey, settingsKey === "Frames");
this._categoryName = categoryName;
@@ -877,7 +920,7 @@ WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseS
WebInspector.FrameTreeElement = function(storagePanel, frameId, title, subtitle)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, "", "frame-storage-tree-item");
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, "", ["frame-storage-tree-item"]);
this._frameId = frameId;
this.setTitles(title, subtitle);
}
@@ -904,7 +947,7 @@ WebInspector.FrameTreeElement.prototype = {
this._storagePanel.showCategoryView(this._displayName);
this.listItemElement.removeStyleClass("hovered");
- InspectorAgent.hideFrameHighlight();
+ DOMAgent.hideFrameHighlight();
},
get displayName()
@@ -916,10 +959,8 @@ WebInspector.FrameTreeElement.prototype = {
{
this._displayName = "";
if (this.parent) {
- if (title) {
- this.titleElement.textContent = title;
- this._displayName = title;
- }
+ this.titleElement.textContent = title || "";
+ this._displayName = title || "";
if (subtitle) {
var subtitleElement = document.createElement("span");
subtitleElement.className = "base-storage-tree-element-subtitle";
@@ -937,10 +978,10 @@ WebInspector.FrameTreeElement.prototype = {
{
if (hovered) {
this.listItemElement.addStyleClass("hovered");
- InspectorAgent.highlightFrame(this._frameId);
+ DOMAgent.highlightFrame(this._frameId);
} else {
this.listItemElement.removeStyleClass("hovered");
- InspectorAgent.hideFrameHighlight();
+ DOMAgent.hideFrameHighlight();
}
}
}
@@ -948,7 +989,7 @@ WebInspector.FrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTree
WebInspector.FrameResourceTreeElement = function(storagePanel, resource)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, ["resource-sidebar-tree-item", "resources-category-" + resource.category.name]);
this._resource = resource;
this._resource.addEventListener("errors-warnings-updated", this._errorsWarningsUpdated, this);
this._resource.addEventListener("content-changed", this._contentChanged, this);
@@ -969,7 +1010,7 @@ WebInspector.FrameResourceTreeElement.prototype = {
ondblclick: function(event)
{
- InspectorAgent.openInInspectedWindow(this._resource.url);
+ PageAgent.openInInspectedWindow(this._resource.url);
},
onattach: function()
@@ -1070,7 +1111,7 @@ WebInspector.FrameResourceTreeElement.prototype = {
if (oldView) {
var newView = WebInspector.ResourceView.recreateResourceView(this._resource);
if (oldView === this._storagePanel.visibleView)
- this._storagePanel.visibleView = newView;
+ this._storagePanel._showResourceView(this._resource);
}
}
}
@@ -1079,7 +1120,7 @@ WebInspector.FrameResourceTreeElement.prototype.__proto__ = WebInspector.BaseSto
WebInspector.DatabaseTreeElement = function(storagePanel, database)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, database.name, "database-storage-tree-item", true);
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, database.name, ["database-storage-tree-item"], true);
this._database = database;
}
@@ -1120,7 +1161,7 @@ WebInspector.DatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageT
WebInspector.DatabaseTableTreeElement = function(storagePanel, database, tableName)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, tableName, "database-storage-tree-item");
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, tableName, ["database-storage-tree-item"]);
this._database = database;
this._tableName = tableName;
}
@@ -1141,7 +1182,7 @@ WebInspector.DatabaseTableTreeElement.prototype.__proto__ = WebInspector.BaseSto
WebInspector.DOMStorageTreeElement = function(storagePanel, domStorage, className)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), "domstorage-storage-tree-item " + className);
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), ["domstorage-storage-tree-item", className]);
this._domStorage = domStorage;
}
@@ -1161,7 +1202,7 @@ WebInspector.DOMStorageTreeElement.prototype.__proto__ = WebInspector.BaseStorag
WebInspector.CookieTreeElement = function(storagePanel, cookieDomain)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), "cookie-storage-tree-item");
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), ["cookie-storage-tree-item"]);
this._cookieDomain = cookieDomain;
}
@@ -1181,7 +1222,7 @@ WebInspector.CookieTreeElement.prototype.__proto__ = WebInspector.BaseStorageTre
WebInspector.ApplicationCacheTreeElement = function(storagePanel, appcacheDomain)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), "application-cache-storage-tree-item");
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), ["application-cache-storage-tree-item"]);
this._appcacheDomain = appcacheDomain;
}
@@ -1202,7 +1243,7 @@ WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.Base
WebInspector.ResourceRevisionTreeElement = function(storagePanel, revision)
{
var title = revision.timestamp ? revision.timestamp.toLocaleTimeString() : WebInspector.UIString("(original)");
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, title, "resource-sidebar-tree-item resources-category-" + revision.category.name);
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, title, ["resource-sidebar-tree-item", "resources-category-" + revision.category.name]);
if (revision.timestamp)
this.tooltip = revision.timestamp.toLocaleString();
this._resource = revision;
diff --git a/Source/WebCore/inspector/front-end/Script.js b/Source/WebCore/inspector/front-end/Script.js
index 3f27485..805e191 100644
--- a/Source/WebCore/inspector/front-end/Script.js
+++ b/Source/WebCore/inspector/front-end/Script.js
@@ -115,8 +115,10 @@ WebInspector.Script.prototype = {
return;
}
- function didGetScriptSource(source)
+ function didGetScriptSource(error, source)
{
+ if (error)
+ return;
this._source = source;
callback(this._source);
}
diff --git a/Source/WebCore/inspector/front-end/ScriptFormatter.js b/Source/WebCore/inspector/front-end/ScriptFormatter.js
index f70d6c6..2e166f4 100644
--- a/Source/WebCore/inspector/front-end/ScriptFormatter.js
+++ b/Source/WebCore/inspector/front-end/ScriptFormatter.js
@@ -69,25 +69,15 @@ WebInspector.ScriptFormatter.findScriptRanges = function(lineEndings, scripts)
}
WebInspector.ScriptFormatter.prototype = {
- formatContent: function(content, callback)
+ formatContent: function(text, scripts, callback)
{
- var chunks = this._splitContentIntoChunks(content.text, content.scriptRanges);
+ var scriptRanges = WebInspector.ScriptFormatter.findScriptRanges(text.lineEndings(), scripts);
+ var chunks = this._splitContentIntoChunks(text, scriptRanges);
function didFormatChunks()
{
var result = this._buildContentFromChunks(chunks);
-
- var sourceMapping = new WebInspector.SourceMappingForFormattedScript(content.text.lineEndings(), result.text.lineEndings(), result.mapping);
- var formattedScriptRanges = [];
- for (var i = 0; i < content.scriptRanges.length; ++i) {
- var scriptRange = content.scriptRanges[i];
- formattedScriptRange = {};
- formattedScriptRange.start = sourceMapping.originalPositionToFormattedLocation(scriptRange.start.position);
- formattedScriptRange.end = sourceMapping.originalPositionToFormattedLocation(scriptRange.end.position);
- formattedScriptRange.sourceID = scriptRange.sourceID;
- formattedScriptRanges.push(formattedScriptRange);
- }
- callback(new WebInspector.SourceFrameContent(result.text, sourceMapping, formattedScriptRanges));
+ callback(result.text, result.mapping);
}
this._formatChunks(chunks, 0, didFormatChunks.bind(this));
},
@@ -186,48 +176,3 @@ WebInspector.ScriptFormatter.prototype = {
task.callback(task.source, { original: [], formatted: [] });
}
}
-
-
-WebInspector.SourceMappingForFormattedScript = function(originalLineEndings, formattedLineEndings, mapping)
-{
- WebInspector.SourceMapping.call(this);
- this._originalLineEndings = originalLineEndings;
- this._formattedLineEndings = formattedLineEndings;
- this._mapping = mapping;
-}
-
-WebInspector.SourceMappingForFormattedScript.prototype = {
- actualLocationToSourceLocation: function(lineNumber, columnNumber)
- {
- var position = WebInspector.ScriptFormatter.locationToPosition(this._originalLineEndings, lineNumber, columnNumber);
- return this.originalPositionToFormattedLocation(position);
- },
-
- sourceLocationToActualLocation: function(lineNumber, columnNumber)
- {
- var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(this._formattedLineEndings, lineNumber, columnNumber);
- var position = this._convertPosition(this._mapping.formatted, this._mapping.original, formattedPosition);
- return WebInspector.ScriptFormatter.positionToLocation(this._originalLineEndings, position);
- },
-
- originalPositionToFormattedLocation: function(position)
- {
- var formattedPosition = this._convertPosition(this._mapping.original, this._mapping.formatted, position);
- var location = WebInspector.ScriptFormatter.positionToLocation(this._formattedLineEndings, formattedPosition);
- location.position = formattedPosition;
- return location;
- },
-
- _convertPosition: function(positions1, positions2, position)
- {
- var index = positions1.upperBound(position);
- var range1 = positions1[index] - positions1[index - 1];
- var range2 = positions2[index] - positions2[index - 1];
- var position2 = positions2[index - 1];
- if (range1)
- position2 += Math.round((position - positions1[index - 1]) * range2 / range1);
- return position2;
- }
-}
-
-WebInspector.SourceMappingForFormattedScript.prototype.__proto__ = WebInspector.SourceMapping.prototype;
diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js
index 2647cee..7547c36 100644
--- a/Source/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js
@@ -70,7 +70,7 @@ WebInspector.ScriptsPanel = function()
this.formatButton.id = "format-script";
this.formatButton.title = WebInspector.UIString("Format script.");
this.formatButton.appendChild(document.createElement("img"));
- this.formatButton.addEventListener("click", this._formatScript.bind(this), false);
+ this.formatButton.addEventListener("click", this._toggleFormatSourceFiles.bind(this), false);
if (Preferences.debugMode)
this.topStatusBar.appendChild(this.formatButton);
@@ -142,10 +142,10 @@ WebInspector.ScriptsPanel = function()
this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSidebarPane();
this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(this._presentationModel);
this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
- this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSidebarPane();
+ this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSidebarPane(this._presentationModel);
if (Preferences.nativeInstrumentationEnabled) {
this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane();
- this.sidebarPanes.xhrBreakpoints = WebInspector.createXHRBreakpointsSidebarPane();
+ this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPane();
this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerBreakpointsSidebarPane();
}
@@ -185,14 +185,21 @@ WebInspector.ScriptsPanel = function()
this.reset();
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource, this._failedToParseScriptSource, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ScriptSourceChanged, this._scriptSourceChanged, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
- WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._debuggerWasDisabled, this);
+
+ this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.SourceFileAdded, this._sourceFileAdded, this)
+ this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.SourceFileChanged, this._sourceFileChanged, this);
+ this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.ConsoleMessageAdded, this._consoleMessageAdded, this);
this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.BreakpointAdded, this._breakpointAdded, this);
this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.BreakpointRemoved, this._breakpointRemoved, this);
+ this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.DebuggerPaused, this._debuggerPaused, this);
+ this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.DebuggerResumed, this._debuggerResumed, this);
this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.CallFrameSelected, this._callFrameSelected, this);
+
+ var enableDebugger = Preferences.debuggerAlwaysEnabled || WebInspector.settings.debuggerEnabled;
+ if (enableDebugger || InspectorFrontendHost.loadSessionSetting("debugger-enabled") === "true")
+ WebInspector.debuggerModel.enableDebugger();
}
// Keep these in sync with WebCore::ScriptDebugServer
@@ -244,115 +251,36 @@ WebInspector.ScriptsPanel.prototype = {
return this.toggleBreakpointsButton.toggled;
},
- _parsedScriptSource: function(event)
- {
- this._addScript(event.data);
- },
-
- _failedToParseScriptSource: function(event)
- {
- this._addScript(event.data);
- },
-
- _scriptSourceChanged: function(event)
+ _sourceFileAdded: function(event)
{
- var sourceID = event.data.sourceID;
- var oldSource = event.data.oldSource;
-
- var script = WebInspector.debuggerModel.scriptForSourceID(sourceID);
- if (script.resource) {
- var revertHandle = WebInspector.debuggerModel.editScriptSource.bind(WebInspector.debuggerModel, sourceID, oldSource);
- script.resource.setContent(script.source, revertHandle);
- }
-
- var sourceFileId = this._sourceFileIdForScript(script);
- this._recreateSourceFrame(sourceFileId);
+ var sourceFile = event.data;
- var callFrames = WebInspector.debuggerModel.callFrames;
- if (callFrames.length)
- this._debuggerPaused({ data: { callFrames: callFrames } });
- },
-
- _addScript: function(script)
- {
- if (!script.sourceURL) {
- // Anonymous scripts are shown only when stepping.
+ if (!sourceFile.url) {
+ // Anonymous sources are shown only when stepping.
return;
}
- var resource = this._resourceForURL(script.sourceURL);
- if (resource) {
- if (resource.finished) {
- // Resource is finished, bind the script right away.
- script.resource = resource;
-
- // Add resource url to files select if not already added while debugging inlined scripts.
- if (!(resource.url in this._sourceFileIdToFilesSelectOption))
- this._addOptionToFilesSelectAndShowSourceFrameIfNeeded(resource.url);
- } else {
- // Resource is not finished, bind the script later.
- if (!resource._scriptsPendingResourceLoad) {
- resource._scriptsPendingResourceLoad = [];
- resource.addEventListener("finished", this._resourceLoadingFinished, this);
- }
- resource._scriptsPendingResourceLoad.push(script);
-
- // Source frame content is outdated since we have new script parsed.
- this._recreateSourceFrame(script.sourceURL);
- }
- } else if (!(script.sourceURL in this._sourceFileIdToFilesSelectOption)) {
- // This is a dynamic script with "//@ sourceURL=" comment.
- this._addOptionToFilesSelectAndShowSourceFrameIfNeeded(script.sourceURL);
- }
- },
-
- _resourceForURL: function(url)
- {
- return WebInspector.networkManager.inflightResourceForURL(url) || WebInspector.resourceForURL(url);
- },
-
- _resourceLoadingFinished: function(e)
- {
- var resource = e.target;
-
- // Bind scripts to resource.
- for (var i = 0; i < resource._scriptsPendingResourceLoad.length; ++i) {
- var script = resource._scriptsPendingResourceLoad[i];
- script.resource = resource;
- }
- delete resource._scriptsPendingResourceLoad;
-
- // Recreate source frame to show resource content.
- this._recreateSourceFrame(resource.url);
-
- // Add resource url to files select if not already added while debugging inlined scripts.
- if (!(resource.url in this._sourceFileIdToFilesSelectOption))
- this._addOptionToFilesSelectAndShowSourceFrameIfNeeded(resource.url);
- },
-
- _addOptionToFilesSelectAndShowSourceFrameIfNeeded: function(url)
- {
- this._addOptionToFilesSelect(url);
+ this._addOptionToFilesSelect(sourceFile.id);
var lastViewedURL = WebInspector.settings.lastViewedScriptFile;
if (this._filesSelectElement.length === 1) {
// Option we just added is the only option in files select.
// We have to show corresponding source frame immediately.
- this._showSourceFrameAndAddToHistory(url);
+ this._showSourceFrameAndAddToHistory(sourceFile.id);
// Restore original value of lastViewedScriptFile because
// source frame was shown as a result of initial load.
WebInspector.settings.lastViewedScriptFile = lastViewedURL;
- } else if (url === lastViewedURL)
- this._showSourceFrameAndAddToHistory(url);
+ } else if (sourceFile.url === lastViewedURL)
+ this._showSourceFrameAndAddToHistory(sourceFile.id);
},
_addOptionToFilesSelect: function(sourceFileId)
{
- var script = this._scriptForSourceFileId(sourceFileId);
+ var sourceFile = this._presentationModel.sourceFile(sourceFileId);
var select = this._filesSelectElement;
var option = document.createElement("option");
- option.text = script.sourceURL ? WebInspector.displayNameForURL(script.sourceURL) : WebInspector.UIString("(program)");
- if (script.worldType === WebInspector.Script.WorldType.EXTENSIONS_WORLD)
+ option.text = sourceFile.url ? WebInspector.displayNameForURL(sourceFile.url) : WebInspector.UIString("(program)");
+ if (sourceFile.isExtensionScript)
option.addStyleClass("extension-script");
function optionCompare(a, b)
{
@@ -370,19 +298,37 @@ WebInspector.ScriptsPanel.prototype = {
this._sourceFileIdToFilesSelectOption[sourceFileId] = option;
},
+ setScriptSourceIsBeingEdited: function(sourceFileId, inEditMode)
+ {
+ var option = this._sourceFileIdToFilesSelectOption[sourceFileId];
+ if (!option)
+ return;
+ if (inEditMode)
+ option.text = option.text.replace(/[^*]$/, "$&*");
+ else
+ option.text = option.text.replace(/[*]$/, "");
+ },
+
addConsoleMessage: function(message)
{
- this._messages.push(message);
- var sourceFrame = this._sourceFileIdToSourceFrame[message.url];
- if (sourceFrame)
- sourceFrame.addMessage(message);
+ if (message.isErrorOrWarning() && message.message)
+ this._presentationModel.addConsoleMessage(message);
},
clearConsoleMessages: function()
{
- this._messages = [];
- for (var url in this._sourceFileIdToSourceFrame)
- this._sourceFileIdToSourceFrame[url].clearMessages();
+ this._presentationModel.clearConsoleMessages();
+ for (var sourceFileId in this._sourceFileIdToSourceFrame)
+ this._sourceFileIdToSourceFrame[sourceFileId].clearMessages();
+ },
+
+ _consoleMessageAdded: function(event)
+ {
+ var message = event.data;
+
+ var sourceFrame = this._sourceFileIdToSourceFrame[message.sourceFileId];
+ if (sourceFrame && sourceFrame.loaded)
+ sourceFrame.addMessageToSource(message.lineNumber, message.originalMessage);
},
_breakpointAdded: function(event)
@@ -392,6 +338,8 @@ WebInspector.ScriptsPanel.prototype = {
var sourceFrame = this._sourceFileIdToSourceFrame[breakpoint.sourceFileId];
if (sourceFrame && sourceFrame.loaded)
sourceFrame.addBreakpoint(breakpoint.lineNumber, breakpoint.resolved, breakpoint.condition, breakpoint.enabled);
+
+ this.sidebarPanes.jsBreakpoints.addBreakpoint(breakpoint);
},
_breakpointRemoved: function(event)
@@ -401,25 +349,20 @@ WebInspector.ScriptsPanel.prototype = {
var sourceFrame = this._sourceFileIdToSourceFrame[breakpoint.sourceFileId];
if (sourceFrame && sourceFrame.loaded)
sourceFrame.removeBreakpoint(breakpoint.lineNumber);
+
+ this.sidebarPanes.jsBreakpoints.removeBreakpoint(breakpoint.sourceFileId, breakpoint.lineNumber);
},
evaluateInSelectedCallFrame: function(code, objectGroup, includeCommandLineAPI, callback)
{
var selectedCallFrame = this._presentationModel.selectedCallFrame;
- if (!this._paused || !selectedCallFrame)
- return;
-
- function updatingCallbackWrapper(result)
- {
- if (result)
- callback(WebInspector.RemoteObject.fromPayload(result));
- }
- DebuggerAgent.evaluateOnCallFrame(selectedCallFrame.id, code, objectGroup, includeCommandLineAPI, updatingCallbackWrapper.bind(this));
+ selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, callback);
},
_debuggerPaused: function(event)
{
var callFrames = event.data.callFrames;
+ var details = event.data.details;
this._paused = true;
this._waitingToPause = false;
@@ -429,8 +372,32 @@ WebInspector.ScriptsPanel.prototype = {
WebInspector.currentPanel = this;
- this.sidebarPanes.callstack.update(event.data);
- this.sidebarPanes.callstack.selectedCallFrame = callFrames[0];
+ this.sidebarPanes.callstack.update(callFrames, details);
+ this.sidebarPanes.callstack.selectedCallFrame = this._presentationModel.selectedCallFrame;
+
+ var status;
+ if (details.eventType === WebInspector.DebuggerEventTypes.NativeBreakpoint) {
+ if (details.eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.EventListener) {
+ var eventName = details.eventData.eventName;
+ this.sidebarPanes.eventListenerBreakpoints.highlightBreakpoint(details.eventData.eventName);
+ var eventNameForUI = WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName);
+ status = WebInspector.UIString("Paused on a \"%s\" Event Listener.", eventNameForUI);
+ } else if (details.eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.XHR) {
+ this.sidebarPanes.xhrBreakpoints.highlightBreakpoint(details.eventData.breakpointURL);
+ status = WebInspector.UIString("Paused on a XMLHttpRequest.");
+ }
+ } else {
+ function didGetSourceLocation(sourceFileId, lineNumber, columnNumber)
+ {
+ if (!sourceFileId || !this._presentationModel.findBreakpoint(sourceFileId, lineNumber))
+ return;
+ this.sidebarPanes.jsBreakpoints.highlightBreakpoint(sourceFileId, lineNumber);
+ status = WebInspector.UIString("Paused on a JavaScript breakpoint.");
+ }
+ callFrames[0].sourceLocation(didGetSourceLocation.bind(this));
+ }
+ if (status)
+ this.sidebarPanes.callstack.setStatus(status);
window.focus();
InspectorFrontendHost.bringToFront();
@@ -438,8 +405,6 @@ WebInspector.ScriptsPanel.prototype = {
_debuggerResumed: function()
{
- this._presentationModel.selectedCallFrame = null;
-
this._paused = false;
this._waitingToPause = false;
this._stepping = false;
@@ -447,21 +412,24 @@ WebInspector.ScriptsPanel.prototype = {
this._clearInterface();
},
- debuggerWasEnabled: function()
+ _debuggerWasEnabled: function()
{
this._setPauseOnExceptions(WebInspector.settings.pauseOnExceptionState);
if (this._debuggerEnabled)
return;
+
+ InspectorFrontendHost.saveSessionSetting("debugger-enabled", "true");
this._debuggerEnabled = true;
this.reset(true);
},
- debuggerWasDisabled: function()
+ _debuggerWasDisabled: function()
{
if (!this._debuggerEnabled)
return;
+ InspectorFrontendHost.saveSessionSetting("debugger-enabled", "false");
this._debuggerEnabled = false;
this.reset(true);
},
@@ -481,11 +449,11 @@ WebInspector.ScriptsPanel.prototype = {
this._sourceFileIdToSourceFrame = {};
this._sourceFileIdToFilesSelectOption = {};
- this._messages = [];
this._filesSelectElement.removeChildren();
this.functionsSelectElement.removeChildren();
this.viewsContainerElement.removeChildren();
+ this.sidebarPanes.jsBreakpoints.reset();
this.sidebarPanes.watchExpressions.refreshExpressions();
if (!preserveItems)
this.sidebarPanes.workers.reset();
@@ -564,9 +532,9 @@ WebInspector.ScriptsPanel.prototype = {
var sourceFrame = this._sourceFrameForSourceFileId(sourceFileId);
this.visibleView = sourceFrame;
- var script = this._scriptForSourceFileId(sourceFileId);
- if (script.sourceURL)
- WebInspector.settings.lastViewedScriptFile = script.sourceURL;
+ var sourceFile = this._presentationModel.sourceFile(sourceFileId);
+ if (sourceFile.url)
+ WebInspector.settings.lastViewedScriptFile = sourceFile.url;
return sourceFrame;
},
@@ -579,23 +547,24 @@ WebInspector.ScriptsPanel.prototype = {
_createSourceFrame: function(sourceFileId)
{
- var script = this._scriptForSourceFileId(sourceFileId);
- var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(script);
- var sourceFrame = new WebInspector.SourceFrame(delegate, script.sourceURL);
+ var sourceFile = this._presentationModel.sourceFile(sourceFileId);
+ var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(this._presentationModel, sourceFileId);
+ var sourceFrame = new WebInspector.SourceFrame(delegate, sourceFile.url);
sourceFrame._sourceFileId = sourceFileId;
sourceFrame.addEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this);
this._sourceFileIdToSourceFrame[sourceFileId] = sourceFrame;
return sourceFrame;
},
- _recreateSourceFrame: function(sourceFileId)
+ _sourceFileChanged: function(event)
{
+ var sourceFileId = event.data.id;
+
var oldSourceFrame = this._sourceFileIdToSourceFrame[sourceFileId];
if (!oldSourceFrame)
return;
oldSourceFrame.removeEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this);
delete this._sourceFileIdToSourceFrame[sourceFileId];
- oldSourceFrame.removeEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this);
if (this.visibleView !== oldSourceFrame)
return;
@@ -608,11 +577,12 @@ WebInspector.ScriptsPanel.prototype = {
{
var sourceFrame = event.target;
var sourceFileId = sourceFrame._sourceFileId;
+ var sourceFile = this._presentationModel.sourceFile(sourceFileId);
- for (var i = 0; i < this._messages.length; ++i) {
- var message = this._messages[i];
- if (message.url === sourceFileId)
- sourceFrame.addMessage(message);
+ var messages = sourceFile.messages;
+ for (var i = 0; i < messages.length; ++i) {
+ var message = messages[i];
+ sourceFrame.addMessageToSource(message.lineNumber, message.originalMessage);
}
var breakpoints = this._presentationModel.breakpointsForSourceFileId(sourceFileId);
@@ -620,28 +590,6 @@ WebInspector.ScriptsPanel.prototype = {
var breakpoint = breakpoints[i];
sourceFrame.addBreakpoint(breakpoint.lineNumber, breakpoint.resolved, breakpoint.condition, breakpoint.enabled);
}
-
- var selectedCallFrame = this._presentationModel.selectedCallFrame;
- if (selectedCallFrame) {
- if (selectedCallFrame.sourceLocation.sourceFileId === sourceFileId) {
- sourceFrame.setExecutionLine(selectedCallFrame.sourceLocation.lineNumber);
- this._executionSourceFrame = sourceFrame;
- }
- }
- },
-
- _sourceFileIdForScript: function(script)
- {
- return script.sourceURL || script.sourceID;
- },
-
- _scriptForSourceFileId: function(sourceFileId)
- {
- function filter(script)
- {
- return (script.sourceURL || script.sourceID) === sourceFileId;
- }
- return WebInspector.debuggerModel.queryScripts(filter)[0];
},
_clearCurrentExecutionLine: function()
@@ -662,19 +610,22 @@ WebInspector.ScriptsPanel.prototype = {
this.sidebarPanes.scopechain.update(callFrame);
this.sidebarPanes.watchExpressions.refreshExpressions();
+ this.sidebarPanes.callstack.selectedCallFrame = this._presentationModel.selectedCallFrame;
- var sourceFileId = callFrame.sourceLocation.sourceFileId;
- if (!(sourceFileId in this._sourceFileIdToFilesSelectOption)) {
- // This happens in two cases:
- // 1) Current call frame function is defined in anonymous script (anonymous scripts aren't added to files select by default)
- // 2) We are debugging synchronously executed inlined script and there is no resource so far
- this._addOptionToFilesSelect(sourceFileId);
- }
- var sourceFrame = this._showSourceFrameAndAddToHistory(sourceFileId);
- if (sourceFrame.loaded) {
- sourceFrame.setExecutionLine(callFrame.sourceLocation.lineNumber);
+ function didGetSourceLocation(sourceFileId, lineNumber, columnNumber)
+ {
+ if (!sourceFileId)
+ return;
+
+ if (!(sourceFileId in this._sourceFileIdToFilesSelectOption)) {
+ // Anonymous scripts are not added to files select by default.
+ this._addOptionToFilesSelect(sourceFileId);
+ }
+ var sourceFrame = this._showSourceFrameAndAddToHistory(sourceFileId);
+ sourceFrame.setExecutionLine(lineNumber);
this._executionSourceFrame = sourceFrame;
}
+ callFrame.sourceLocation(didGetSourceLocation.bind(this));
},
_filesSelectChanged: function()
@@ -721,8 +672,10 @@ WebInspector.ScriptsPanel.prototype = {
_setPauseOnExceptions: function(pauseOnExceptionsState)
{
- function callback(pauseOnExceptionsState)
+ function callback(error)
{
+ if (error)
+ return;
if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions)
this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");
else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions)
@@ -786,6 +739,11 @@ WebInspector.ScriptsPanel.prototype = {
{
this.sidebarPanes.callstack.update(null);
this.sidebarPanes.scopechain.update(null);
+ this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight();
+ if (Preferences.nativeInstrumentationEnabled) {
+ this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight();
+ this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight();
+ }
this._clearCurrentExecutionLine();
this._updateDebuggerButtons();
@@ -813,10 +771,10 @@ WebInspector.ScriptsPanel.prototype = {
this._updateBackAndForwardButtons();
},
- _formatScript: function()
+ _toggleFormatSourceFiles: function()
{
- if (this.visibleView)
- this.visibleView.formatSource();
+ this.reset();
+ this._presentationModel.toggleFormatSourceFiles();
},
_enableDebugging: function()
@@ -895,11 +853,11 @@ WebInspector.ScriptsPanel.prototype = {
{
this.toggleBreakpointsButton.toggled = !this.toggleBreakpointsButton.toggled;
if (this.toggleBreakpointsButton.toggled) {
- DebuggerAgent.activateBreakpoints();
+ DebuggerAgent.setBreakpointsActive(true);
this.toggleBreakpointsButton.title = WebInspector.UIString("Deactivate all breakpoints.");
document.getElementById("main-panels").removeStyleClass("breakpoints-deactivated");
} else {
- DebuggerAgent.deactivateBreakpoints();
+ DebuggerAgent.setBreakpointsActive(false);
this.toggleBreakpointsButton.title = WebInspector.UIString("Activate all breakpoints.");
document.getElementById("main-panels").addStyleClass("breakpoints-deactivated");
}
@@ -1039,119 +997,22 @@ WebInspector.ScriptsPanel.prototype = {
WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
-WebInspector.SourceFrameDelegateForScriptsPanel = function(script)
+WebInspector.SourceFrameDelegateForScriptsPanel = function(model, sourceFileId)
{
WebInspector.SourceFrameDelegate.call(this);
- this._script = script;
+ this._model = model;
+ this._sourceFileId = sourceFileId;
this._popoverObjectGroup = "popover";
}
WebInspector.SourceFrameDelegateForScriptsPanel.prototype = {
requestContent: function(callback)
{
- function didGetTextAndScriptRanges(mimeType, text, scriptRanges)
- {
- this._content = new WebInspector.SourceFrameContent(text, new WebInspector.IdenticalSourceMapping(), scriptRanges);
- callback(mimeType, this._content);
- }
-
- if (this._script.resource)
- this._loadResourceContent(this._script.resource, didGetTextAndScriptRanges.bind(this));
- else
- this._loadAndConcatenateScriptsContent(didGetTextAndScriptRanges.bind(this));
- },
-
- _loadResourceContent: function(resource, callback)
- {
- function didRequestContent(text)
+ function didRequestSourceFileContent(mimeType, text)
{
- var mimeType = "text/javascript";
- if (resource.type !== WebInspector.Resource.Type.Script) {
- mimeType = "text/html";
- // WebKit html lexer normalizes line endings and scripts are passed to VM with "\n" line endings.
- // However, resource content has original line endings, so we have to normalize line endings here.
- text = text.replace(/\r\n/g, "\n");
- }
- var scripts = this._scripts();
- var scriptRanges = WebInspector.ScriptFormatter.findScriptRanges(text.lineEndings(), scripts);
- callback(mimeType, text, scriptRanges);
+ callback(mimeType, { text: text });
}
- resource.requestContent(didRequestContent.bind(this));
- },
-
- _loadAndConcatenateScriptsContent: function(callback)
- {
- var scripts = this._scripts();
- var scriptsLeft = scripts.length;
- var sources = [];
- function didRequestSource(index, source)
- {
- sources[index] = source;
- if (--scriptsLeft)
- return;
- var result = this._buildSource(scripts, sources);
- callback(result.mimeType, result.source, result.scriptRanges);
- }
- for (var i = 0; i < scripts.length; ++i)
- scripts[i].requestSource(didRequestSource.bind(this, i));
- },
-
- _buildSource: function(scripts, sources)
- {
- var source = "";
- var lineNumber = 0;
- var columnNumber = 0;
- var scriptRanges = [];
- function appendChunk(chunk, script)
- {
- var start = { lineNumber: lineNumber, columnNumber: columnNumber };
- source += chunk;
- var lineEndings = chunk.lineEndings();
- var lineCount = lineEndings.length;
- if (lineCount === 1)
- columnNumber += chunk.length;
- else {
- lineNumber += lineCount - 1;
- columnNumber = lineEndings[lineCount - 1] - lineEndings[lineCount - 2] - 1;
- }
- var end = { lineNumber: lineNumber, columnNumber: columnNumber };
- if (script)
- scriptRanges.push({ start: start, end: end, sourceID: script.sourceID });
- }
-
- var mimeType;
- if (scripts.length === 1 && !scripts[0].lineOffset && !scripts[0].columnOffset) {
- // Single script source.
- mimeType = "text/javascript";
- appendChunk(sources[0], scripts[0]);
- } else {
- // Scripts inlined in html document.
- mimeType = "text/html";
- var scriptOpenTag = "<script>";
- var scriptCloseTag = "</script>";
- for (var i = 0; i < scripts.length; ++i) {
- // Fill the gap with whitespace characters.
- while (lineNumber < scripts[i].lineOffset)
- appendChunk("\n");
- while (columnNumber < scripts[i].columnOffset - scriptOpenTag.length)
- appendChunk(" ");
-
- // Add script tag.
- appendChunk(scriptOpenTag);
- appendChunk(sources[i], scripts[i]);
- appendChunk(scriptCloseTag);
- }
- }
- return { mimeType: mimeType, source: source, scriptRanges: scriptRanges };
- },
-
- _scripts: function()
- {
- var scripts = [this._script];
- if (this._script.sourceURL)
- scripts = WebInspector.debuggerModel.scriptsForURL(this._script.sourceURL);
- scripts.sort(function(x, y) { return x.lineOffset - y.lineOffset || x.columnOffset - y.columnOffset; });
- return scripts;
+ this._model.requestSourceFileContent(this._sourceFileId, didRequestSourceFileContent.bind(this));
},
debuggingSupported: function()
@@ -1161,62 +1022,45 @@ WebInspector.SourceFrameDelegateForScriptsPanel.prototype = {
setBreakpoint: function(lineNumber, condition, enabled)
{
- var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber);
- if (this._script.sourceURL)
- WebInspector.debuggerModel.setBreakpoint(this._script.sourceURL, location.lineNumber, location.columnNumber, condition, enabled);
- else if (location.sourceID)
- WebInspector.debuggerModel.setBreakpointBySourceId(location.sourceID, location.lineNumber, location.columnNumber, condition, enabled);
- else
- return;
+ this._model.setBreakpoint(this._sourceFileId, lineNumber, condition, enabled);
if (!WebInspector.panels.scripts.breakpointsActivated)
WebInspector.panels.scripts.toggleBreakpointsClicked();
},
- removeBreakpoint: function(breakpointId)
+ updateBreakpoint: function(lineNumber, condition, enabled)
{
- WebInspector.debuggerModel.removeBreakpoint(breakpointId);
+ this._model.updateBreakpoint(this._sourceFileId, lineNumber, condition, enabled);
},
- updateBreakpoint: function(breakpointId, condition, enabled)
+ removeBreakpoint: function(lineNumber)
{
- WebInspector.debuggerModel.updateBreakpoint(breakpointId, condition, enabled);
+ this._model.removeBreakpoint(this._sourceFileId, lineNumber);
},
findBreakpoint: function(lineNumber)
{
- var url = this._script.sourceURL;
- var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber);
- function filter(breakpoint)
- {
- if (breakpoint.url) {
- if (breakpoint.url !== url)
- return false;
- } else {
- if (breakpoint.sourceID !== location.sourceID)
- return false;
- }
- var lineNumber = breakpoint.locations.length ? breakpoint.locations[0].lineNumber : breakpoint.lineNumber;
- return lineNumber === location.lineNumber;
- }
- return WebInspector.debuggerModel.queryBreakpoints(filter)[0];
+ return this._model.findBreakpoint(this._sourceFileId, lineNumber);
},
continueToLine: function(lineNumber)
{
- var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber);
- if (location.sourceID)
- WebInspector.debuggerModel.continueToLocation(location.sourceID, location.lineNumber, location.columnNumber);
+ this._model.continueToLine(this._sourceFileId, lineNumber);
},
canEditScriptSource: function()
{
- return Preferences.canEditScriptSource && !this._script.lineOffset && !this._script.columnOffset;
+ return this._model.canEditScriptSource(this._sourceFileId);
+ },
+
+ editScriptSource: function(text, callback)
+ {
+ this._model.editScriptSource(this._sourceFileId, text, callback);
},
- editScriptSource: function(text)
+ setScriptSourceIsBeingEdited: function(inEditMode)
{
- WebInspector.debuggerModel.editScriptSource(this._script.sourceID, text);
+ WebInspector.panels.scripts.setScriptSourceIsBeingEdited(this._sourceFileId, inEditMode);
},
debuggerPaused: function()
@@ -1226,17 +1070,12 @@ WebInspector.SourceFrameDelegateForScriptsPanel.prototype = {
evaluateInSelectedCallFrame: function(string, callback)
{
- function didEvaluateInSelectedCallFrame(result)
- {
- if (!result.isError() && this.debuggerPaused())
- callback(result);
- }
- WebInspector.panels.scripts.evaluateInSelectedCallFrame(string, this._popoverObjectGroup, false, didEvaluateInSelectedCallFrame.bind(this));
+ WebInspector.panels.scripts.evaluateInSelectedCallFrame(string, this._popoverObjectGroup, false, callback);
},
releaseEvaluationResult: function()
{
- RuntimeAgent.releaseObjectGroup(0, this._popoverObjectGroup);
+ RuntimeAgent.releaseObjectGroup(this._popoverObjectGroup);
}
}
diff --git a/Source/WebCore/inspector/front-end/Section.js b/Source/WebCore/inspector/front-end/Section.js
index 5caa78b..623e537 100644
--- a/Source/WebCore/inspector/front-end/Section.js
+++ b/Source/WebCore/inspector/front-end/Section.js
@@ -45,7 +45,7 @@ WebInspector.Section = function(title, subtitle)
this.headerElement.appendChild(this.subtitleElement);
this.headerElement.appendChild(this.titleElement);
- this.headerElement.addEventListener("click", this.toggleExpanded.bind(this), false);
+ this.headerElement.addEventListener("click", this.handleClick.bind(this), false);
this.element.appendChild(this.headerElement);
this.title = title;
@@ -168,5 +168,11 @@ WebInspector.Section.prototype = {
toggleExpanded: function()
{
this.expanded = !this.expanded;
+ },
+
+ handleClick: function(e)
+ {
+ this.toggleExpanded();
+ e.stopPropagation();
}
}
diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js
index 68b81a5..9995ca2 100644
--- a/Source/WebCore/inspector/front-end/Settings.js
+++ b/Source/WebCore/inspector/front-end/Settings.js
@@ -44,7 +44,6 @@ var Preferences = {
profilerAlwaysEnabled: false,
onlineDetectionEnabled: true,
nativeInstrumentationEnabled: false,
- resourceExportEnabled: false,
useDataURLForResourceImageIcons: true,
showTimingTab: false,
showCookiesTab: false,
@@ -58,6 +57,7 @@ WebInspector.Settings = function()
this.installApplicationSetting("colorFormat", "hex");
this.installApplicationSetting("consoleHistory", []);
this.installApplicationSetting("debuggerEnabled", false);
+ this.installApplicationSetting("domWordWrap", true);
this.installApplicationSetting("profilerEnabled", false);
this.installApplicationSetting("eventListenersFilter", "all");
this.installApplicationSetting("lastActivePanel", "elements");
@@ -71,6 +71,8 @@ WebInspector.Settings = function()
this.installApplicationSetting("showUserAgentStyles", true);
this.installApplicationSetting("watchExpressions", []);
this.installApplicationSetting("breakpoints", []);
+ this.installApplicationSetting("eventListenerBreakpoints", []);
+ this.installApplicationSetting("xhrBreakpoints", []);
this.installProjectSetting("nativeBreakpoints", []);
}
@@ -112,6 +114,9 @@ WebInspector.Settings.prototype = {
findSettingForAllProjects: function(key)
{
var result = {};
+ if (window.localStorage == null)
+ return result;
+
var regexp = "^" + key + ":(.*)";
for (var i = 0; i < window.localStorage.length; ++i) {
var fullKey = window.localStorage.key(i);
@@ -129,7 +134,7 @@ WebInspector.Settings.prototype = {
_get: function(key, defaultValue)
{
- if (key in window.localStorage) {
+ if (window.localStorage != null && key in window.localStorage) {
try {
return JSON.parse(window.localStorage[key]);
} catch(e) {
@@ -141,7 +146,8 @@ WebInspector.Settings.prototype = {
_set: function(key, value)
{
- window.localStorage[key] = JSON.stringify(value);
+ if (window.localStorage != null)
+ window.localStorage[key] = JSON.stringify(value);
},
_getProjectSetting: function(key, defaultValue)
diff --git a/Source/WebCore/inspector/front-end/ShortcutsHelp.js b/Source/WebCore/inspector/front-end/ShortcutsHelp.js
index 004ed48..ab395c8 100644
--- a/Source/WebCore/inspector/front-end/ShortcutsHelp.js
+++ b/Source/WebCore/inspector/front-end/ShortcutsHelp.js
@@ -125,7 +125,7 @@ WebInspector.ShortcutsSection.prototype = {
for (var line = 0; line < this._lines.length; ++line) {
var tr = parent.createChild("tr");
tr.createChild("td", "help-key-cell").innerHTML = this._lines[line].key + " : ";
- tr.createChild("td").innerText = this._lines[line].text;
+ tr.createChild("td").textContent = this._lines[line].text;
}
},
@@ -134,7 +134,7 @@ WebInspector.ShortcutsSection.prototype = {
var trHead = parent.createChild("tr");
trHead.createChild("th");
- trHead.createChild("th").innerText = this.name;
+ trHead.createChild("th").textContent = this.name;
},
_renderSequence: function(sequence, delimiter)
diff --git a/Source/WebCore/inspector/front-end/SourceFile.js b/Source/WebCore/inspector/front-end/SourceFile.js
new file mode 100644
index 0000000..4f56c00
--- /dev/null
+++ b/Source/WebCore/inspector/front-end/SourceFile.js
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.SourceFile = function(id, script, contentChangedDelegate)
+{
+ this._scripts = [script];
+ this._contentChangedDelegate = contentChangedDelegate;
+ if (script.sourceURL)
+ this._resource = WebInspector.networkManager.inflightResourceForURL(script.sourceURL) || WebInspector.resourceForURL(script.sourceURL);
+ this._requestContentCallbacks = [];
+
+ this.id = id;
+ this.url = script.sourceURL;
+ this.isExtensionScript = script.worldType === WebInspector.Script.WorldType.EXTENSIONS_WORLD;
+ this.messages = [];
+ this.breakpoints = {};
+
+ if (this._hasPendingResource())
+ this._resource.addEventListener("finished", this.reload.bind(this));
+}
+
+WebInspector.SourceFile.prototype = {
+ addScript: function(script)
+ {
+ this._scripts.push(script);
+ },
+
+ requestContent: function(callback)
+ {
+ if (this._contentLoaded) {
+ callback(this._mimeType, this._content);
+ return;
+ }
+
+ this._requestContentCallbacks.push(callback);
+ this._requestContent();
+ },
+
+ get content()
+ {
+ return this._content;
+ },
+
+ requestSourceMapping: function(callback)
+ {
+ if (!this._mapping)
+ this._mapping = new WebInspector.SourceMapping(this._scripts);
+ callback(this._mapping);
+ },
+
+ forceLoadContent: function(script)
+ {
+ if (!this._hasPendingResource())
+ return;
+
+ if (!this._concatenatedScripts)
+ this._concatenatedScripts = {};
+ if (this._concatenatedScripts[script.sourceID])
+ return;
+ for (var i = 0; i < this._scripts.length; ++i)
+ this._concatenatedScripts[this._scripts[i].sourceID] = true;
+
+ this.reload();
+
+ if (!this._contentRequested) {
+ this._contentRequested = true;
+ this._loadAndConcatenateScriptsContent();
+ }
+ },
+
+ reload: function()
+ {
+ if (this._contentLoaded) {
+ this._contentLoaded = false;
+ this._contentChangedDelegate();
+ } else if (this._contentRequested)
+ this._reloadContent = true;
+ else if (this._requestContentCallbacks.length)
+ this._requestContent();
+ },
+
+ _requestContent: function()
+ {
+ if (this._contentRequested)
+ return;
+
+ this._contentRequested = true;
+ if (this._resource && this._resource.finished)
+ this._loadResourceContent(this._resource);
+ else if (!this._resource)
+ this._loadScriptContent();
+ else if (this._concatenatedScripts)
+ this._loadAndConcatenateScriptsContent();
+ else
+ this._contentRequested = false;
+ },
+
+ _loadResourceContent: function(resource)
+ {
+ function didRequestContent(text)
+ {
+ if (resource.type === WebInspector.Resource.Type.Script)
+ this._didRequestContent("text/javascript", text);
+ else {
+ // WebKit html lexer normalizes line endings and scripts are passed to VM with "\n" line endings.
+ // However, resource content has original line endings, so we have to normalize line endings here.
+ this._didRequestContent("text/html", text.replace(/\r\n/g, "\n"));
+ }
+ }
+ resource.requestContent(didRequestContent.bind(this));
+ },
+
+ _loadScriptContent: function()
+ {
+ this._scripts[0].requestSource(this._didRequestContent.bind(this, "text/javascript"));
+ },
+
+ _loadAndConcatenateScriptsContent: function()
+ {
+ var scripts = this._scripts.slice();
+ scripts.sort(function(x, y) { return x.lineOffset - y.lineOffset || x.columnOffset - y.columnOffset; });
+ var sources = [];
+ function didRequestSource(source)
+ {
+ sources.push(source);
+ if (sources.length === scripts.length)
+ this._concatenateScriptsContent(scripts, sources);
+ }
+ for (var i = 0; i < scripts.length; ++i)
+ scripts[i].requestSource(didRequestSource.bind(this));
+ },
+
+ _concatenateScriptsContent: function(scripts, sources)
+ {
+ var content = "";
+ var lineNumber = 0;
+ var columnNumber = 0;
+ var scriptRanges = [];
+ function appendChunk(chunk, script)
+ {
+ var start = { lineNumber: lineNumber, columnNumber: columnNumber };
+ content += chunk;
+ var lineEndings = chunk.lineEndings();
+ var lineCount = lineEndings.length;
+ if (lineCount === 1)
+ columnNumber += chunk.length;
+ else {
+ lineNumber += lineCount - 1;
+ columnNumber = lineEndings[lineCount - 1] - lineEndings[lineCount - 2] - 1;
+ }
+ var end = { lineNumber: lineNumber, columnNumber: columnNumber };
+ if (script)
+ scriptRanges.push({ start: start, end: end, sourceID: script.sourceID });
+ }
+
+ var scriptOpenTag = "<script>";
+ var scriptCloseTag = "</script>";
+ for (var i = 0; i < scripts.length; ++i) {
+ // Fill the gap with whitespace characters.
+ while (lineNumber < scripts[i].lineOffset)
+ appendChunk("\n");
+ while (columnNumber < scripts[i].columnOffset - scriptOpenTag.length)
+ appendChunk(" ");
+
+ // Add script tag.
+ appendChunk(scriptOpenTag);
+ appendChunk(sources[i], scripts[i]);
+ appendChunk(scriptCloseTag);
+ }
+
+ this._didRequestContent("text/html", content);
+ },
+
+ _didRequestContent: function(mimeType, content)
+ {
+ this._contentLoaded = true;
+ this._contentRequested = false;
+ this._mimeType = mimeType;
+ this._content = content;
+
+ for (var i = 0; i < this._requestContentCallbacks.length; ++i)
+ this._requestContentCallbacks[i](mimeType, content);
+ this._requestContentCallbacks = [];
+
+ if (this._reloadContent)
+ this.reload();
+ },
+
+ _hasPendingResource: function()
+ {
+ return this._resource && !this._resource.finished;
+ }
+}
+
+WebInspector.FormattedSourceFile = function(sourceFileId, script, contentChangedDelegate, formatter)
+{
+ WebInspector.SourceFile.call(this, sourceFileId, script, contentChangedDelegate);
+ this._formatter = formatter;
+}
+
+WebInspector.FormattedSourceFile.prototype = {
+ requestSourceMapping: function(callback)
+ {
+ function didRequestContent()
+ {
+ callback(this._mapping);
+ }
+ this.requestContent(didRequestContent.bind(this));
+ },
+
+ _didRequestContent: function(mimeType, text)
+ {
+ function didFormatContent(formattedText, mapping)
+ {
+ this._mapping = new WebInspector.FormattedSourceMapping(this._scripts, text, formattedText, mapping);
+ WebInspector.SourceFile.prototype._didRequestContent.call(this, mimeType, formattedText);
+ }
+ this._formatter.formatContent(text, this._scripts, didFormatContent.bind(this));
+ }
+}
+
+WebInspector.FormattedSourceFile.prototype.__proto__ = WebInspector.SourceFile.prototype;
+
+WebInspector.SourceMapping = function(sortedScripts)
+{
+ this._sortedScripts = sortedScripts;
+}
+
+WebInspector.SourceMapping.prototype = {
+ scriptLocationToSourceLocation: function(lineNumber, columnNumber)
+ {
+ return { lineNumber: lineNumber, columnNumber: columnNumber };
+ },
+
+ sourceLocationToScriptLocation: function(lineNumber, columnNumber)
+ {
+ var closestScript = this._sortedScripts[0];
+ for (var i = 1; i < this._sortedScripts.length; ++i) {
+ script = this._sortedScripts[i];
+ if (script.lineOffset > lineNumber || (script.lineOffset === lineNumber && script.columnOffset > columnNumber))
+ break;
+ closestScript = script;
+ }
+ return { scriptId: closestScript.sourceID, lineNumber: lineNumber, columnNumber: columnNumber };
+ }
+}
+
+WebInspector.FormattedSourceMapping = function(sortedScripts, originalText, formattedText, mapping)
+{
+ WebInspector.SourceMapping.call(this, sortedScripts);
+ this._originalLineEndings = originalText.lineEndings();
+ this._formattedLineEndings = formattedText.lineEndings();
+ this._mapping = mapping;
+}
+
+WebInspector.FormattedSourceMapping.prototype = {
+ scriptLocationToSourceLocation: function(lineNumber, columnNumber)
+ {
+ var originalPosition = WebInspector.ScriptFormatter.locationToPosition(this._originalLineEndings, lineNumber, columnNumber);
+ var formattedPosition = this._convertPosition(this._mapping.original, this._mapping.formatted, originalPosition);
+ return WebInspector.ScriptFormatter.positionToLocation(this._formattedLineEndings, formattedPosition);
+ },
+
+ sourceLocationToScriptLocation: function(lineNumber, columnNumber)
+ {
+ var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(this._formattedLineEndings, lineNumber, columnNumber);
+ var originalPosition = this._convertPosition(this._mapping.formatted, this._mapping.original, formattedPosition);
+ var originalLocation = WebInspector.ScriptFormatter.positionToLocation(this._originalLineEndings, originalPosition);
+ return WebInspector.SourceMapping.prototype.sourceLocationToScriptLocation.call(this, originalLocation.lineNumber, originalLocation.columnNumber);
+ },
+
+ _convertPosition: function(positions1, positions2, position)
+ {
+ var index = positions1.upperBound(position);
+ var range1 = positions1[index] - positions1[index - 1];
+ var range2 = positions2[index] - positions2[index - 1];
+ var position2 = positions2[index - 1];
+ if (range1)
+ position2 += Math.round((position - positions1[index - 1]) * range2 / range1);
+ return position2;
+ }
+}
+
+WebInspector.FormattedSourceMapping.prototype.__proto__ = WebInspector.SourceMapping.prototype;
diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js
index 3120159..7482f34 100644
--- a/Source/WebCore/inspector/front-end/SourceFrame.js
+++ b/Source/WebCore/inspector/front-end/SourceFrame.js
@@ -46,6 +46,9 @@ WebInspector.SourceFrame = function(delegate, url)
this._messages = [];
this._rowMessages = {};
this._messageBubbles = {};
+
+ this._registerShortcuts();
+ this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
}
WebInspector.SourceFrame.Events = {
@@ -116,12 +119,9 @@ WebInspector.SourceFrame.prototype = {
addMessage: function(msg)
{
- // Don't add the message if there is no message or valid line or if the msg isn't an error or warning.
- if (!msg.message || msg.line <= 0 || !msg.isErrorOrWarning())
- return;
this._messages.push(msg);
if (this._textViewer)
- this._addMessageToSource(msg);
+ this.addMessageToSource(msg.line - 1, msg);
},
clearMessages: function()
@@ -173,6 +173,11 @@ WebInspector.SourceFrame.prototype = {
_startEditing: function()
{
+ if (this._originalTextModelContent === undefined) {
+ this._originalTextModelContent = this._textModel.text;
+ this._delegate.setScriptSourceIsBeingEdited(true);
+ }
+
WebInspector.searchController.cancelSearch();
this.clearMessages();
},
@@ -196,9 +201,12 @@ WebInspector.SourceFrame.prototype = {
element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
element.addEventListener("mousedown", this._mouseDown.bind(this), true);
element.addEventListener("mousemove", this._mouseMove.bind(this), true);
- element.addEventListener("dblclick", this._doubleClick.bind(this), true);
element.addEventListener("scroll", this._scroll.bind(this), true);
}
+
+ if (this._delegate.canEditScriptSource())
+ element.addEventListener("dblclick", this._doubleClick.bind(this), true);
+
this.element.appendChild(element);
this._textViewer.beginUpdates();
@@ -206,6 +214,9 @@ WebInspector.SourceFrame.prototype = {
this._textViewer.mimeType = mimeType;
this._setTextViewerDecorations();
+ if ("_executionLineNumber" in this)
+ this.setExecutionLine(this._executionLineNumber);
+
if (this._lineNumberToReveal) {
this.revealLine(this._lineNumberToReveal);
delete this._lineNumberToReveal;
@@ -357,13 +368,16 @@ WebInspector.SourceFrame.prototype = {
setExecutionLine: function(lineNumber)
{
this._executionLineNumber = lineNumber;
- this._textViewer.addDecoration(lineNumber, "webkit-execution-line");
- this._textViewer.revealLine(lineNumber);
+ if (this._textViewer) {
+ this._textViewer.addDecoration(lineNumber, "webkit-execution-line");
+ this._textViewer.revealLine(lineNumber);
+ }
},
clearExecutionLine: function()
{
- this._textViewer.removeDecoration(this._executionLineNumber, "webkit-execution-line");
+ if (this._textViewer)
+ this._textViewer.removeDecoration(this._executionLineNumber, "webkit-execution-line");
delete this._executionLineNumber;
},
@@ -398,26 +412,26 @@ WebInspector.SourceFrame.prototype = {
{
var length = this._messages.length;
for (var i = 0; i < length; ++i)
- this._addMessageToSource(this._messages[i]);
+ this.addMessageToSource(this._messages[i].line - 1, this._messages[i]);
},
- _addMessageToSource: function(msg)
+ addMessageToSource: function(lineNumber, msg)
{
- if (msg.line > this._textModel.linesCount)
+ if (lineNumber >= this._textModel.linesCount)
return;
- var messageBubbleElement = this._messageBubbles[msg.line];
+ var messageBubbleElement = this._messageBubbles[lineNumber];
if (!messageBubbleElement || messageBubbleElement.nodeType !== Node.ELEMENT_NODE || !messageBubbleElement.hasStyleClass("webkit-html-message-bubble")) {
messageBubbleElement = document.createElement("div");
messageBubbleElement.className = "webkit-html-message-bubble";
- this._messageBubbles[msg.line] = messageBubbleElement;
- this._textViewer.addDecoration(msg.line - 1, messageBubbleElement);
+ this._messageBubbles[lineNumber] = messageBubbleElement;
+ this._textViewer.addDecoration(lineNumber, messageBubbleElement);
}
- var rowMessages = this._rowMessages[msg.line];
+ var rowMessages = this._rowMessages[lineNumber];
if (!rowMessages) {
rowMessages = [];
- this._rowMessages[msg.line] = rowMessages;
+ this._rowMessages[lineNumber] = rowMessages;
}
for (var i = 0; i < rowMessages.length; ++i) {
@@ -505,20 +519,20 @@ WebInspector.SourceFrame.prototype = {
contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this));
} else {
// This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
- contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._delegate.removeBreakpoint.bind(this._delegate, breakpoint.id));
+ contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._delegate.removeBreakpoint.bind(this._delegate, lineNumber));
function editBreakpointCondition()
{
function didEditBreakpointCondition(committed, condition)
{
if (committed)
- this._delegate.updateBreakpoint(breakpoint.id, condition, breakpoint.enabled);
+ this._delegate.updateBreakpoint(lineNumber, condition, breakpoint.enabled);
}
this._editBreakpointCondition(lineNumber, breakpoint.condition, didEditBreakpointCondition.bind(this));
}
contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), editBreakpointCondition.bind(this));
function setBreakpointEnabled(enabled)
{
- this._delegate.updateBreakpoint(breakpoint.id, breakpoint.condition, enabled);
+ this._delegate.updateBreakpoint(lineNumber, breakpoint.condition, enabled);
}
if (breakpoint.enabled)
contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), setBreakpointEnabled.bind(this, false));
@@ -547,9 +561,9 @@ WebInspector.SourceFrame.prototype = {
var breakpoint = this._delegate.findBreakpoint(lineNumber);
if (breakpoint) {
if (event.shiftKey)
- this._delegate.updateBreakpoint(breakpoint.id, breakpoint.condition, !breakpoint.enabled);
+ this._delegate.updateBreakpoint(lineNumber, breakpoint.condition, !breakpoint.enabled);
else
- this._delegate.removeBreakpoint(breakpoint.id);
+ this._delegate.removeBreakpoint(lineNumber);
} else
this._delegate.setBreakpoint(lineNumber, "", true);
event.preventDefault();
@@ -648,6 +662,9 @@ WebInspector.SourceFrame.prototype = {
_showPopup: function(element)
{
+ if (!this._delegate.debuggerPaused())
+ return;
+
function killHidePopupTimer()
{
if (this._hidePopupTimer) {
@@ -662,6 +679,9 @@ WebInspector.SourceFrame.prototype = {
function showObjectPopup(result)
{
+ if (result.isError() || !this._delegate.debuggerPaused())
+ return;
+
var popupContentElement = null;
if (result.type !== "object" && result.type !== "node" && result.type !== "array") {
popupContentElement = document.createElement("span");
@@ -763,6 +783,71 @@ WebInspector.SourceFrame.prototype = {
formatter.formatContent(this._content, didFormat.bind(this))
},
+ _registerShortcuts: function()
+ {
+ this._shortcuts = {};
+ var handleSaveCallback = this._handleSave.bind(this);
+ this._shortcuts[WebInspector.KeyboardShortcut.makeKey("s", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)] = handleSaveCallback;
+ this._shortcuts[WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.Keys.Enter.code, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)] = handleSaveCallback;
+ this._shortcuts[WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.Keys.Esc.code)] = this._handleRevertEditing.bind(this);
+ },
+
+ _handleKeyDown: function(e)
+ {
+ var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(e);
+ var handler = this._shortcuts[shortcutKey];
+ if (handler && handler.call(this)) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ },
+
+ _handleSave: function()
+ {
+ if (this._textViewer.readOnly || !this._delegate.canEditScriptSource())
+ return false;
+
+ if (this._originalTextModelContent === undefined) {
+ // No editing was actually done.
+ this._textViewer.readOnly = true;
+ this._delegate.setScriptSourceIsBeingEdited(false);
+ return true;
+ }
+
+ var originalTextModelContent = this._originalTextModelContent;
+ var newSource = this._textModel.text;
+
+ delete this._originalTextModelContent;
+ this._textViewer.readOnly = true;
+ this._delegate.setScriptSourceIsBeingEdited(false);
+
+ function didEditScriptSource(success, newBodyOrErrorMessage)
+ {
+ if (!success && this._originalTextModelContent === undefined && this._textModel.text === newSource) {
+ this._originalTextModelContent = originalTextModelContent;
+ this._textViewer.readOnly = false;
+ this._delegate.setScriptSourceIsBeingEdited(true);
+ WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMessage.MessageLevel.Error);
+ WebInspector.showConsole();
+ }
+ }
+ this._delegate.editScriptSource(newSource, didEditScriptSource.bind(this));
+ return true;
+ },
+
+ _handleRevertEditing: function()
+ {
+ if (this._textViewer.readOnly)
+ return false;
+
+ if (this._originalTextModelContent !== undefined)
+ this._textModel.setText(null, this._originalTextModelContent);
+ delete this._originalTextModelContent;
+ this._textViewer.readOnly = true;
+ this._delegate.setScriptSourceIsBeingEdited(false);
+ return true;
+ },
+
_doubleClick: function(event)
{
if (!this._delegate.canEditScriptSource())
@@ -772,20 +857,10 @@ WebInspector.SourceFrame.prototype = {
if (!lineRow)
return; // Do not trigger editing from line numbers.
- this._textViewer.editLine(lineRow, this._didEditLine.bind(this, lineRow.lineNumber));
- },
-
- _didEditLine: function(lineNumber, newContent)
- {
- var lines = [];
- var oldLines = this._content.text.split('\n');
- for (var i = 0; i < oldLines.length; ++i) {
- if (i === lineNumber)
- lines.push(newContent);
- else
- lines.push(oldLines[i]);
+ if (this._textViewer.readOnly) {
+ this._textViewer.readOnly = false;
+ window.getSelection().collapseToStart();
}
- this._delegate.editScriptSource(lines.join("\n"));
}
}
@@ -812,12 +887,12 @@ WebInspector.SourceFrameDelegate.prototype = {
// Should be implemented by subclasses.
},
- removeBreakpoint: function(breakpointId)
+ removeBreakpoint: function(lineNumber)
{
// Should be implemented by subclasses.
},
- updateBreakpoint: function(breakpointId, condition, enabled)
+ updateBreakpoint: function(lineNumber, condition, enabled)
{
// Should be implemented by subclasses.
},
@@ -837,7 +912,12 @@ WebInspector.SourceFrameDelegate.prototype = {
return false;
},
- editScriptSource: function(text)
+ editScriptSource: function(text, callback)
+ {
+ // Should be implemented by subclasses.
+ },
+
+ setScriptSourceIsBeingEdited: function(inEditMode)
{
// Should be implemented by subclasses.
},
diff --git a/Source/WebCore/inspector/front-end/SourceFrameContent.js b/Source/WebCore/inspector/front-end/SourceFrameContent.js
index 91b397b..3f3a8e9 100644
--- a/Source/WebCore/inspector/front-end/SourceFrameContent.js
+++ b/Source/WebCore/inspector/front-end/SourceFrameContent.js
@@ -48,18 +48,7 @@ WebInspector.SourceFrameContent.prototype = {
sourceFrameLineNumberToActualLocation: function(lineNumber)
{
- // Script content may start right after <script> tag without new line (e.g. "<script>function f()...").
- // In that case, column number should be equal to script column offset.
- var columnNumber = 0;
- for (var i = 0; i < this._scriptRanges.length; ++i) {
- var scriptRange = this._scriptRanges[i];
- if (scriptRange.start.lineNumber < lineNumber)
- continue;
- if (scriptRange.start.lineNumber === lineNumber)
- columnNumber = scriptRange.start.columnNumber;
- break;
- }
- var location = this._mapping.sourceLocationToActualLocation(lineNumber, columnNumber);
+ var location = this._mapping.sourceLocationToActualLocation(lineNumber, 0);
location.sourceID = this._sourceIDForSourceFrameLineNumber(lineNumber);
return location;
},
diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js
index c7d151a..29d0317 100644
--- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -132,10 +132,10 @@ WebInspector.StylesSidebarPane.prototype = {
if (!forceUpdate && (!node || node === this.node))
refresh = true;
- if (node && node.nodeType === Node.TEXT_NODE && node.parentNode)
+ if (node && node.nodeType() === Node.TEXT_NODE && node.parentNode)
node = node.parentNode;
- if (node && node.nodeType !== Node.ELEMENT_NODE)
+ if (node && node.nodeType() !== Node.ELEMENT_NODE)
node = null;
if (node)
@@ -244,7 +244,7 @@ WebInspector.StylesSidebarPane.prototype = {
var styleAttributes = {};
for (var name in styles.styleAttributes) {
var attrStyle = { style: styles.styleAttributes[name], editable: false };
- attrStyle.selectorText = WebInspector.panels.elements.treeOutline.nodeNameToCorrectCase(node.nodeName) + "[" + name;
+ attrStyle.selectorText = WebInspector.panels.elements.treeOutline.nodeNameToCorrectCase(node.nodeName()) + "[" + name;
if (node.getAttribute(name))
attrStyle.selectorText += "=" + node.getAttribute(name);
attrStyle.selectorText += "]";
@@ -252,7 +252,7 @@ WebInspector.StylesSidebarPane.prototype = {
}
// Show element's Style Attributes
- if (styles.inlineStyle && node.nodeType === Node.ELEMENT_NODE) {
+ if (styles.inlineStyle && node.nodeType() === Node.ELEMENT_NODE) {
var inlineStyle = { selectorText: "element.style", style: styles.inlineStyle, isAttribute: true };
styleRules.push(inlineStyle);
}
@@ -1964,6 +1964,9 @@ WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype = {
_buildPropertyCompletions: function(wordRange, bestMatchOnly, completionsReadyCallback)
{
var prefix = wordRange.toString().toLowerCase();
+ if (!prefix && bestMatchOnly)
+ return;
+
var results;
if (bestMatchOnly) {
results = [];
diff --git a/Source/WebCore/inspector/front-end/TextEditorHighlighter.js b/Source/WebCore/inspector/front-end/TextEditorHighlighter.js
index 9bdcc82..75453fa 100644
--- a/Source/WebCore/inspector/front-end/TextEditorHighlighter.js
+++ b/Source/WebCore/inspector/front-end/TextEditorHighlighter.js
@@ -35,17 +35,14 @@ WebInspector.TextEditorHighlighter = function(textModel, damageCallback)
this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/html");
this._damageCallback = damageCallback;
this._highlightChunkLimit = 1000;
- this.reset();
}
WebInspector.TextEditorHighlighter.prototype = {
set mimeType(mimeType)
{
var tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType);
- if (tokenizer) {
+ if (tokenizer)
this._tokenizer = tokenizer;
- this._tokenizerConditionStringified = JSON.stringify(this._tokenizer.initialCondition);
- }
},
set highlightChunkLimit(highlightChunkLimit)
@@ -53,18 +50,14 @@ WebInspector.TextEditorHighlighter.prototype = {
this._highlightChunkLimit = highlightChunkLimit;
},
- reset: function()
- {
- this._lastHighlightedLine = 0;
- this._lastHighlightedColumn = 0;
- this._tokenizerConditionStringified = JSON.stringify(this._tokenizer.initialCondition);
- },
-
highlight: function(endLine, opt_forceRun)
{
// First check if we have work to do.
- if (endLine <= this._lastHighlightedLine)
+ var state = this._textModel.getAttribute(endLine - 1, "highlight");
+ if (state && state.postConditionStringified) {
+ // Last line is highlighted, just exit.
return;
+ }
this._requestedEndLine = endLine;
@@ -73,77 +66,63 @@ WebInspector.TextEditorHighlighter.prototype = {
return;
}
- // Do small highlight synchronously. This will provide instant highlight on PageUp / PageDown, gentle scrolling.
- this._highlightInChunks(endLine);
+ // We will be highlighting. First rewind to the last highlighted line to gain proper highlighter context.
+ var startLine = endLine;
+ while (startLine > 0) {
+ var state = this._textModel.getAttribute(startLine - 1, "highlight");
+ if (state && state.postConditionStringified)
+ break;
+ startLine--;
+ }
- // Schedule tail highlight if necessary.
- if (this._lastHighlightedLine < endLine)
- this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, endLine), 100);
+ // Do small highlight synchronously. This will provide instant highlight on PageUp / PageDown, gentle scrolling.
+ this._highlightInChunks(startLine, endLine);
},
updateHighlight: function(startLine, endLine)
{
- if (this._lastHighlightedLine < startLine) {
- // Highlighter did not reach this point yet, nothing to update. It will reach it on subsequent timer tick and do the job.
- return false;
- }
-
- var savedLastHighlightedLine = this._lastHighlightedLine;
- var savedLastHighlightedColumn = this._lastHighlightedColumn;
- var savedTokenizerCondition = this._tokenizerConditionStringified;
-
- this._lastHighlightedLine = startLine;
- this._lastHighlightedColumn = 0;
-
- // Restore highlighter context taken from the previous line.
- var attributes = this._textModel.getAttribute(startLine - 1, "highlight") || {};
- this._tokenizerConditionStringified = attributes.postConditionStringified || JSON.stringify(this._tokenizer.initialCondition);
-
- // Try to update highlight synchronously.
- this._highlightLines(endLine);
-
- if (this._lastHighlightedLine >= this._textModel.linesCount) {
- // All is done up to the end.
- return true;
+ // Start line was edited, we should highlight everything until endLine.
+ this._clearHighlightState(startLine);
+
+ if (startLine) {
+ var state = this._textModel.getAttribute(startLine - 1, "highlight");
+ if (!state || !state.postConditionStringified) {
+ // Highlighter did not reach this point yet, nothing to update. It will reach it on subsequent timer tick and do the job.
+ return false;
+ }
}
- var attributes1 = this._textModel.getAttribute(this._lastHighlightedLine - 1, "highlight") || {};
- var attributes2 = this._textModel.getAttribute(this._lastHighlightedLine, "highlight") || {};
- if (this._lastHighlightedColumn === 0 && attributes2.preConditionStringified && attributes1.postConditionStringified === attributes2.preConditionStringified) {
- // Highlighting ended ahead of time. Restore previously saved state, unless we have done more than it was before.
- if (savedLastHighlightedLine >= this._lastHighlightedLine) {
- this._lastHighlightedLine = savedLastHighlightedLine;
- this._lastHighlightedColumn = savedLastHighlightedColumn;
- this._tokenizerConditionStringified = savedTokenizerCondition;
- }
- return true;
- } else {
- // If failed to update highlight synchronously, invalidate highlight data for the subsequent lines.
- if (this._lastHighlightedColumn === 0)
- this._textModel.removeAttribute(this._lastHighlightedLine, "highlight");
- for (var i = this._lastHighlightedLine + 1; i < this._textModel.linesCount; ++i)
+ var restored = this._highlightLines(startLine, endLine);
+ if (!restored) {
+ for (var i = this._lastHighlightedLine; i < this._textModel.linesCount; ++i) {
+ var state = this._textModel.getAttribute(i, "highlight");
+ if (!state && i > endLine)
+ break;
+ this._textModel.setAttribute(i, "highlight-outdated", state);
this._textModel.removeAttribute(i, "highlight");
+ }
- // Continue highlighting on subsequent timer ticks.
- this._requestedEndLine = endLine;
- if (!this._highlightTimer)
- this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, endLine), 100);
-
- return false;
+ if (this._highlightTimer) {
+ clearTimeout(this._highlightTimer);
+ this._requestedEndLine = endLine;
+ this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._lastHighlightedLine, this._requestedEndLine), 10);
+ }
}
+ return restored;
},
- _highlightInChunks: function(endLine)
+ _highlightInChunks: function(startLine, endLine)
{
delete this._highlightTimer;
// First we always check if we have work to do. Could be that user scrolled back and we can quit.
- if (this._requestedEndLine <= this._lastHighlightedLine)
+ var state = this._textModel.getAttribute(this._requestedEndLine - 1, "highlight");
+ if (state && state.postConditionStringified)
return;
if (this._requestedEndLine !== endLine) {
// User keeps updating the job in between of our timer ticks. Just reschedule self, don't eat CPU (they must be scrolling).
- this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._requestedEndLine), 100);
+ this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, startLine, this._requestedEndLine), 100);
return;
}
@@ -151,58 +130,109 @@ WebInspector.TextEditorHighlighter.prototype = {
if (this._requestedEndLine > this._textModel.linesCount)
this._requestedEndLine = this._textModel.linesCount;
- this._highlightLines(this._requestedEndLine);
+ this._highlightLines(startLine, this._requestedEndLine);
// Schedule tail highlight if necessary.
if (this._lastHighlightedLine < this._requestedEndLine)
- this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._requestedEndLine), 10);
+ this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._lastHighlightedLine, this._requestedEndLine), 10);
},
- _highlightLines: function(endLine)
+ _highlightLines: function(startLine, endLine)
{
- // Tokenizer is stateless and reused across viewers, restore its condition before highlight and save it after.
- this._tokenizer.condition = JSON.parse(this._tokenizerConditionStringified);
- var tokensCount = 0;
- for (var lineNumber = this._lastHighlightedLine; lineNumber < endLine; ++lineNumber) {
- var line = this._textModel.line(lineNumber);
- this._tokenizer.line = line;
-
- if (this._lastHighlightedColumn === 0) {
- var attributes = {};
- attributes.preConditionStringified = JSON.stringify(this._tokenizer.condition);
- this._textModel.setAttribute(lineNumber, "highlight", attributes);
- } else
- var attributes = this._textModel.getAttribute(lineNumber, "highlight");
-
- // Highlight line.
- do {
- var newColumn = this._tokenizer.nextToken(this._lastHighlightedColumn);
- var tokenType = this._tokenizer.tokenType;
- if (tokenType)
- attributes[this._lastHighlightedColumn] = { length: newColumn - this._lastHighlightedColumn, tokenType: tokenType };
- this._lastHighlightedColumn = newColumn;
- if (++tokensCount > this._highlightChunkLimit)
- break;
- } while (this._lastHighlightedColumn < line.length);
+ // Restore highlighter context taken from previous line.
+ var state = this._textModel.getAttribute(startLine - 1, "highlight");
+ var postConditionStringified = state ? state.postConditionStringified : JSON.stringify(this._tokenizer.initialCondition);
- if (this._lastHighlightedColumn < line.length) {
- // Too much work for single chunk - exit.
- break;
+ var tokensCount = 0;
+ for (var lineNumber = startLine; lineNumber < endLine; ++lineNumber) {
+ var state = this._selectHighlightState(lineNumber, postConditionStringified);
+ if (state.postConditionStringified) {
+ // This line is already highlighted.
+ postConditionStringified = state.postConditionStringified;
} else {
- this._lastHighlightedColumn = 0;
- attributes.postConditionStringified = JSON.stringify(this._tokenizer.condition);
+ var lastHighlightedColumn = 0;
+ if (state.midConditionStringified) {
+ lastHighlightedColumn = state.lastHighlightedColumn;
+ postConditionStringified = state.midConditionStringified;
+ }
- var nextAttributes = this._textModel.getAttribute(lineNumber + 1, "highlight") || {};
- if (nextAttributes.preConditionStringified === attributes.postConditionStringified) {
- // Following lines are up to date, no need to re-highlight.
- ++lineNumber;
+ var line = this._textModel.line(lineNumber);
+ this._tokenizer.line = line;
+ this._tokenizer.condition = JSON.parse(postConditionStringified);
+
+ // Highlight line.
+ do {
+ var newColumn = this._tokenizer.nextToken(lastHighlightedColumn);
+ var tokenType = this._tokenizer.tokenType;
+ if (tokenType)
+ state[lastHighlightedColumn] = { length: newColumn - lastHighlightedColumn, tokenType: tokenType };
+ lastHighlightedColumn = newColumn;
+ if (++tokensCount > this._highlightChunkLimit)
+ break;
+ } while (lastHighlightedColumn < line.length);
+
+ postConditionStringified = JSON.stringify(this._tokenizer.condition);
+
+ if (lastHighlightedColumn < line.length) {
+ // Too much work for single chunk - exit.
+ state.lastHighlightedColumn = lastHighlightedColumn;
+ state.midConditionStringified = postConditionStringified;
break;
+ } else {
+ delete state.lastHighlightedColumn;
+ delete state.midConditionStringified;
+ state.postConditionStringified = postConditionStringified;
+ }
+ }
+
+ var nextLineState = this._textModel.getAttribute(lineNumber + 1, "highlight");
+ if (nextLineState && nextLineState.preConditionStringified === state.postConditionStringified) {
+ // Following lines are up to date, no need re-highlight.
+ ++lineNumber;
+ this._damageCallback(startLine, lineNumber);
+
+ // Advance the "pointer" to the last highlighted line within the given chunk.
+ for (; lineNumber < endLine; ++lineNumber) {
+ var state = this._textModel.getAttribute(lineNumber, "highlight");
+ if (!state || !state.postConditionStringified)
+ break;
}
+ this._lastHighlightedLine = lineNumber;
+ return true;
}
}
- this._damageCallback(this._lastHighlightedLine, lineNumber);
- this._tokenizerConditionStringified = JSON.stringify(this._tokenizer.condition);
+ this._damageCallback(startLine, lineNumber);
this._lastHighlightedLine = lineNumber;
+ return false;
+ },
+
+ _selectHighlightState: function(lineNumber, preConditionStringified)
+ {
+ var state = this._textModel.getAttribute(lineNumber, "highlight");
+ if (state && state.preConditionStringified === preConditionStringified)
+ return state;
+
+ var outdatedState = this._textModel.getAttribute(lineNumber, "highlight-outdated");
+ if (outdatedState && outdatedState.preConditionStringified === preConditionStringified) {
+ // Swap states.
+ this._textModel.setAttribute(lineNumber, "highlight", outdatedState);
+ this._textModel.setAttribute(lineNumber, "highlight-outdated", state);
+ return outdatedState;
+ }
+
+ if (state)
+ this._textModel.setAttribute(lineNumber, "highlight-outdated", state);
+
+ state = {};
+ state.preConditionStringified = preConditionStringified;
+ this._textModel.setAttribute(lineNumber, "highlight", state);
+ return state;
+ },
+
+ _clearHighlightState: function(lineNumber)
+ {
+ this._textModel.removeAttribute(lineNumber, "highlight");
+ this._textModel.removeAttribute(lineNumber, "highlight-outdated");
}
}
diff --git a/Source/WebCore/inspector/front-end/TextEditorModel.js b/Source/WebCore/inspector/front-end/TextEditorModel.js
index f23ce76..b14a3b7 100644
--- a/Source/WebCore/inspector/front-end/TextEditorModel.js
+++ b/Source/WebCore/inspector/front-end/TextEditorModel.js
@@ -72,6 +72,11 @@ WebInspector.TextEditorModel.prototype = {
return this._lines.length;
},
+ get text()
+ {
+ return this._lines.join("\n");
+ },
+
line: function(lineNumber)
{
if (lineNumber >= this._lines.length)
diff --git a/Source/WebCore/inspector/front-end/TextViewer.js b/Source/WebCore/inspector/front-end/TextViewer.js
index 65b4724..43b34f6 100644
--- a/Source/WebCore/inspector/front-end/TextViewer.js
+++ b/Source/WebCore/inspector/front-end/TextViewer.js
@@ -45,6 +45,11 @@ WebInspector.TextViewer = function(textModel, platform, url)
this._gutterPanel = new WebInspector.TextEditorGutterPanel(this._textModel, syncDecorationsForLineListener);
this.element.appendChild(this._mainPanel.element);
this.element.appendChild(this._gutterPanel.element);
+
+ // Forward mouse wheel events from the unscrollable gutter to the main panel.
+ this._gutterPanel.element.addEventListener("mousewheel", function(e) {
+ this._mainPanel.element.dispatchEvent(e);
+ }.bind(this), false)
}
WebInspector.TextViewer.prototype = {
@@ -58,6 +63,11 @@ WebInspector.TextViewer.prototype = {
this._mainPanel.readOnly = readOnly;
},
+ get readOnly()
+ {
+ return this._mainPanel.readOnly;
+ },
+
set startEditingListener(startEditingListener)
{
this._startEditingListener = startEditingListener;
@@ -111,11 +121,6 @@ WebInspector.TextViewer.prototype = {
this._gutterPanel.freeCachedElements();
},
- editLine: function(lineRow, callback)
- {
- this._mainPanel.editLine(lineRow, callback);
- },
-
get scrollTop()
{
return this._mainPanel.element.scrollTop;
@@ -395,15 +400,19 @@ WebInspector.TextEditorChunkedPanel.prototype = {
return this._textChunks[this._chunkNumberForLine(lineNumber)];
},
- _findVisibleChunks: function(visibleFrom, visibleTo)
+ _findFirstVisibleChunkNumber: function(visibleFrom)
{
function compareOffsetTops(value, chunk)
{
return value < chunk.offsetTop ? -1 : 1;
}
var insertBefore = insertionIndexForObjectInListSortedByFunction(visibleFrom, this._textChunks, compareOffsetTops);
+ return insertBefore - 1;
+ },
- var from = insertBefore - 1;
+ _findVisibleChunks: function(visibleFrom, visibleTo)
+ {
+ var from = this._findFirstVisibleChunkNumber(visibleFrom);
for (var to = from + 1; to < this._textChunks.length; ++to) {
if (this._textChunks[to].offsetTop >= visibleTo)
break;
@@ -411,6 +420,26 @@ WebInspector.TextEditorChunkedPanel.prototype = {
return { start: from, end: to };
},
+ _findFirstVisibleLineNumber: function(visibleFrom)
+ {
+ var chunk = this._textChunks[this._findFirstVisibleChunkNumber(visibleFrom)];
+ if (!chunk.expanded)
+ return chunk.startLine;
+
+ var lineNumbers = [];
+ for (var i = 0; i < chunk.linesCount; ++i) {
+ lineNumbers.push(chunk.startLine + i);
+ }
+
+ function compareLineRowOffsetTops(value, lineNumber)
+ {
+ var lineRow = chunk.getExpandedLineRow(lineNumber);
+ return value < lineRow.offsetTop ? -1 : 1;
+ }
+ var insertBefore = insertionIndexForObjectInListSortedByFunction(visibleFrom, lineNumbers, compareLineRowOffsetTops);
+ return lineNumbers[insertBefore - 1];
+ },
+
_repaintAll: function()
{
delete this._repaintAllTimer;
@@ -430,6 +459,17 @@ WebInspector.TextEditorChunkedPanel.prototype = {
}
},
+ _expandChunks: function(fromIndex, toIndex)
+ {
+ // First collapse chunks to collect the DOM elements into a cache to reuse them later.
+ for (var i = 0; i < fromIndex; ++i)
+ this._textChunks[i].expanded = false;
+ for (var i = toIndex; i < this._textChunks.length; ++i)
+ this._textChunks[i].expanded = false;
+ for (var i = fromIndex; i < toIndex; ++i)
+ this._textChunks[i].expanded = true;
+ },
+
_totalHeight: function(firstElement, lastElement)
{
lastElement = (lastElement || firstElement).nextElementSibling;
@@ -484,12 +524,6 @@ WebInspector.TextEditorGutterPanel.prototype = {
return new WebInspector.TextEditorGutterChunk(this, startLine, endLine);
},
- _expandChunks: function(fromIndex, toIndex)
- {
- for (var i = 0; i < this._textChunks.length; ++i)
- this._textChunks[i].expanded = (fromIndex <= i && i < toIndex);
- },
-
textChanged: function(oldRange, newRange)
{
if (!this._textChunks) {
@@ -689,10 +723,6 @@ WebInspector.TextEditorMainPanel = function(textModel, url, syncScrollListener,
this.element.addEventListener("scroll", this._scroll.bind(this), false);
- // FIXME: Remove old live editing functionality and Preferences.sourceEditorEnabled flag.
- if (!Preferences.sourceEditorEnabled)
- this._container.addEventListener("keydown", this._handleKeyDown.bind(this), false);
-
// In WebKit the DOMNodeRemoved event is fired AFTER the node is removed, thus it should be
// attached to all DOM nodes that we want to track. Instead, we attach the DOMNodeRemoved
// listeners only on the line rows, and use DOMSubtreeModified to track node removals inside
@@ -714,10 +744,6 @@ WebInspector.TextEditorMainPanel.prototype = {
set readOnly(readOnly)
{
- // FIXME: Remove the Preferences.sourceEditorEnabled flag.
- if (!Preferences.sourceEditorEnabled)
- return;
-
this.beginDomUpdates();
this._readOnly = readOnly;
if (this._readOnly)
@@ -727,6 +753,11 @@ WebInspector.TextEditorMainPanel.prototype = {
this.endDomUpdates();
},
+ get readOnly()
+ {
+ return this._readOnly;
+ },
+
markAndRevealRange: function(range)
{
if (this._rangeToMark) {
@@ -768,58 +799,8 @@ WebInspector.TextEditorMainPanel.prototype = {
this._cachedRows = [];
},
- _handleKeyDown: function()
- {
- if (this._editingLine || event.metaKey || event.shiftKey || event.ctrlKey || event.altKey)
- return;
-
- var scrollValue = 0;
- if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Up.code)
- scrollValue = -1;
- else if (event.keyCode == WebInspector.KeyboardShortcut.Keys.Down.code)
- scrollValue = 1;
-
- if (scrollValue) {
- event.preventDefault();
- event.stopPropagation();
- this.element.scrollByLines(scrollValue);
- return;
- }
-
- scrollValue = 0;
- if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Left.code)
- scrollValue = -40;
- else if (event.keyCode == WebInspector.KeyboardShortcut.Keys.Right.code)
- scrollValue = 40;
-
- if (scrollValue) {
- event.preventDefault();
- event.stopPropagation();
- this.element.scrollLeft += scrollValue;
- }
- },
-
- editLine: function(lineRow, callback)
- {
- var oldContent = lineRow.innerHTML;
- function finishEditing(committed, e, newContent)
- {
- if (committed)
- callback(newContent);
- lineRow.innerHTML = oldContent;
- delete this._editingLine;
- }
- this._editingLine = WebInspector.startEditing(lineRow, {
- context: null,
- commitHandler: finishEditing.bind(this, true),
- cancelHandler: finishEditing.bind(this, false),
- multiline: true
- });
- },
-
_buildChunks: function()
{
- this._highlighter.reset();
for (var i = 0; i < this._textModel.linesCount; ++i)
this._textModel.removeAttribute(i, "highlight");
@@ -842,8 +823,8 @@ WebInspector.TextEditorMainPanel.prototype = {
this._highlighter.highlight(lastVisibleLine);
delete this._muteHighlightListener;
- for (var i = 0; i < this._textChunks.length; ++i)
- this._textChunks[i].expanded = (fromIndex <= i && i < toIndex);
+ this._restorePaintLinesOperationsCredit();
+ WebInspector.TextEditorChunkedPanel.prototype._expandChunks.call(this, fromIndex, toIndex);
this._restoreSelection(selection);
},
@@ -852,64 +833,118 @@ WebInspector.TextEditorMainPanel.prototype = {
{
if (this._muteHighlightListener)
return;
+ this._restorePaintLinesOperationsCredit();
this._paintLines(fromLine, toLine, true /*restoreSelection*/);
},
- _markSkippedPaintLines: function(startLine, endLine)
+ _schedulePaintLines: function(startLine, endLine)
{
- if (!this._skippedPaintLines)
- this._skippedPaintLines = [ { startLine: startLine, endLine: endLine } ];
- else {
- for (var i = 0; i < this._skippedPaintLines.length; ++i) {
- var chunk = this._skippedPaintLines[i];
+ if (startLine >= endLine)
+ return;
+
+ if (!this._scheduledPaintLines) {
+ this._scheduledPaintLines = [ { startLine: startLine, endLine: endLine } ];
+ this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 10);
+ } else {
+ for (var i = 0; i < this._scheduledPaintLines.length; ++i) {
+ var chunk = this._scheduledPaintLines[i];
if (chunk.startLine <= endLine && chunk.endLine >= startLine) {
chunk.startLine = Math.min(chunk.startLine, startLine);
chunk.endLine = Math.max(chunk.endLine, endLine);
return;
}
+ if (chunk.startLine > endLine) {
+ this._scheduledPaintLines.splice(i, 0, { startLine: startLine, endLine: endLine });
+ return;
+ }
}
- this._skippedPaintLines.push({ startLine: startLine, endLine: endLine });
+ this._scheduledPaintLines.push({ startLine: startLine, endLine: endLine });
}
},
- _paintSkippedLines: function()
+ _paintScheduledLines: function(skipRestoreSelection)
{
- if (!this._skippedPaintLines || this._dirtyLines)
+ if (this._paintScheduledLinesTimer)
+ clearTimeout(this._paintScheduledLinesTimer);
+ delete this._paintScheduledLinesTimer;
+
+ if (!this._scheduledPaintLines)
+ return;
+
+ // Reschedule the timer if we can not paint the lines yet, or the user is scrolling.
+ if (this._dirtyLines || this._repaintAllTimer) {
+ this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 50);
return;
- for (var i = 0; i < this._skippedPaintLines.length; ++i) {
- var chunk = this._skippedPaintLines[i];
- this._paintLines(chunk.startLine, chunk.endLine);
}
- delete this._skippedPaintLines;
+
+ var scheduledPaintLines = this._scheduledPaintLines;
+ delete this._scheduledPaintLines;
+
+ this._restorePaintLinesOperationsCredit();
+ this._paintLineChunks(scheduledPaintLines, !skipRestoreSelection);
+ },
+
+ _restorePaintLinesOperationsCredit: function()
+ {
+ this._paintLinesOperationsCredit = 250;
},
_paintLines: function(fromLine, toLine, restoreSelection)
{
- if (this._dirtyLines) {
- this._markSkippedPaintLines(fromLine, toLine);
- return;
- }
+ this._paintLineChunks([ { startLine: fromLine, endLine: toLine } ], restoreSelection);
+ },
+
+ _paintLineChunks: function(lineChunks, restoreSelection)
+ {
+ // First, paint visible lines, so that in case of long lines we should start highlighting
+ // the visible area immediately, instead of waiting for the lines above the visible area.
+ var visibleFrom = this.element.scrollTop;
+ var firstVisibleLineNumber = this._findFirstVisibleLineNumber(visibleFrom);
+ var chunk;
var selection;
- var chunk = this.chunkForLine(fromLine);
- for (var i = fromLine; i < toLine; ++i) {
- if (i >= chunk.startLine + chunk.linesCount)
- chunk = this.chunkForLine(i);
- var lineRow = chunk.getExpandedLineRow(i);
- if (!lineRow)
+ var invisibleLineRows = [];
+ for (var i = 0; i < lineChunks.length; ++i) {
+ var lineChunk = lineChunks[i];
+ if (this._dirtyLines || this._scheduledPaintLines) {
+ this._schedulePaintLines(lineChunk.startLine, lineChunk.endLine);
continue;
+ }
+ for (var lineNumber = lineChunk.startLine; lineNumber < lineChunk.endLine; ++lineNumber) {
+ if (!chunk || lineNumber < chunk.startLine || lineNumber >= chunk.startLine + chunk.linesCount)
+ chunk = this.chunkForLine(lineNumber);
+ var lineRow = chunk.getExpandedLineRow(lineNumber);
+ if (!lineRow)
+ continue;
+ if (lineNumber < firstVisibleLineNumber) {
+ invisibleLineRows.push(lineRow);
+ continue;
+ }
+ if (restoreSelection && !selection)
+ selection = this._getSelection();
+ this._paintLine(lineRow);
+ if (this._paintLinesOperationsCredit < 0) {
+ this._schedulePaintLines(lineNumber + 1, lineChunk.endLine);
+ break;
+ }
+ }
+ }
+
+ for (var i = 0; i < invisibleLineRows.length; ++i) {
if (restoreSelection && !selection)
selection = this._getSelection();
- this._paintLine(lineRow, i);
+ this._paintLine(invisibleLineRows[i]);
}
+
if (restoreSelection)
this._restoreSelection(selection);
},
- _paintLine: function(lineRow, lineNumber)
+ _paintLine: function(lineRow)
{
- if (this._dirtyLines) {
- this._markSkippedPaintLines(lineNumber, lineNumber + 1);
+ var lineNumber = lineRow.lineNumber;
+ if (this._dirtyLines || this._scheduledPaintLines || this._paintLinesOperationsCredit < 0) {
+ this._schedulePaintLines(lineNumber, lineNumber + 1);
return;
}
@@ -944,13 +979,17 @@ WebInspector.TextEditorMainPanel.prototype = {
if (plainTextStart !== -1) {
this._appendTextNode(lineRow, line.substring(plainTextStart, j));
plainTextStart = -1;
+ --this._paintLinesOperationsCredit;
}
this._appendSpan(lineRow, line.substring(j, j + attribute.length), attribute.tokenType);
j += attribute.length;
+ --this._paintLinesOperationsCredit;
}
}
- if (plainTextStart !== -1)
+ if (plainTextStart !== -1) {
this._appendTextNode(lineRow, line.substring(plainTextStart, line.length));
+ --this._paintLinesOperationsCredit;
+ }
if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
this._markedRangeElement = highlightSearchResult(lineRow, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
if (lineRow.decorationsElement)
@@ -1141,12 +1180,37 @@ WebInspector.TextEditorMainPanel.prototype = {
if (this._readOnly)
return;
- var lineNumber = lineRow.lineNumber;
+ if (target === lineRow && e.type === "DOMNodeInserted") {
+ // Ensure that the newly inserted line row has no lineNumber.
+ delete lineRow.lineNumber;
+ }
+
+ var startLine = 0;
+ for (var row = lineRow; row; row = row.previousSibling) {
+ if (typeof row.lineNumber === "number") {
+ startLine = row.lineNumber;
+ break;
+ }
+ }
+
+ var endLine = startLine + 1;
+ for (var row = lineRow.nextSibling; row; row = row.nextSibling) {
+ if (typeof row.lineNumber === "number") {
+ endLine = row.lineNumber;
+ break;
+ }
+ }
+
+ if (target === lineRow && e.type === "DOMNodeRemoved") {
+ // Now this will no longer be valid.
+ delete lineRow.lineNumber;
+ }
+
if (this._dirtyLines) {
- this._dirtyLines.start = Math.min(this._dirtyLines.start, lineNumber);
- this._dirtyLines.end = Math.max(this._dirtyLines.end, lineNumber + 1);
+ this._dirtyLines.start = Math.min(this._dirtyLines.start, startLine);
+ this._dirtyLines.end = Math.max(this._dirtyLines.end, endLine);
} else {
- this._dirtyLines = { start: lineNumber, end: lineNumber + 1 };
+ this._dirtyLines = { start: startLine, end: endLine };
setTimeout(this._applyDomUpdates.bind(this), 0);
// Remove marked ranges, if any.
this.markAndRevealRange(null);
@@ -1227,7 +1291,7 @@ WebInspector.TextEditorMainPanel.prototype = {
this._removeDecorationsInRange(oldRange);
this._updateChunksForRanges(oldRange, newRange);
this._updateHighlightsForRange(newRange);
- this._paintSkippedLines();
+ this._paintScheduledLines(true);
this.endDomUpdates();
this._restoreSelection(selection);
@@ -1348,7 +1412,8 @@ WebInspector.TextEditorMainPanel.prototype = {
var chunk = this._textChunks[result.end - 1];
var lastVisibleLine = chunk.startLine + chunk.linesCount;
- lastVisibleLine = Math.max(lastVisibleLine, range.endLine);
+ lastVisibleLine = Math.max(lastVisibleLine, range.endLine + 1);
+ lastVisibleLine = Math.min(lastVisibleLine, this._textModel.linesCount);
var updated = this._highlighter.updateHighlight(range.startLine, lastVisibleLine);
if (!updated) {
@@ -1479,7 +1544,7 @@ WebInspector.TextEditorMainChunk.prototype = {
if (this.linesCount === 1) {
if (expanded)
- this._textViewer._paintLine(this.element, this.startLine);
+ this._textViewer._paintLine(this.element);
return;
}
@@ -1492,9 +1557,9 @@ WebInspector.TextEditorMainChunk.prototype = {
var lineRow = this._createRow(i);
parentElement.insertBefore(lineRow, this.element);
this._expandedLineRows.push(lineRow);
- this._textViewer._paintLine(lineRow, i);
}
parentElement.removeChild(this.element);
+ this._textViewer._paintLines(this.startLine, this.startLine + this.linesCount);
} else {
var elementInserted = false;
for (var i = 0; i < this._expandedLineRows.length; ++i) {
diff --git a/Source/WebCore/inspector/front-end/TimelineAgent.js b/Source/WebCore/inspector/front-end/TimelineAgent.js
index 97b8e42..5c5ca41 100644
--- a/Source/WebCore/inspector/front-end/TimelineAgent.js
+++ b/Source/WebCore/inspector/front-end/TimelineAgent.js
@@ -34,25 +34,30 @@ WebInspector.TimelineAgent = function() {
// Must be kept in sync with TimelineItem.h
WebInspector.TimelineAgent.RecordType = {
- EventDispatch : 0,
- Layout : 1,
- RecalculateStyles : 2,
- Paint : 3,
- ParseHTML : 4,
- TimerInstall : 5,
- TimerRemove : 6,
- TimerFire : 7,
- XHRReadyStateChange : 8,
- XHRLoad : 9,
- EvaluateScript : 10,
- MarkTimeline : 11,
- ResourceSendRequest : 12,
- ResourceReceiveResponse : 13,
- ResourceFinish : 14,
- FunctionCall : 15,
- ResourceReceiveData: 16,
- GCEvent : 17,
- MarkDOMContentEventType : 18,
- MarkLoadEventType : 19,
- ScheduleResourceRequest : 20
+ EventDispatch: "EventDispatch",
+ Layout: "Layout",
+ RecalculateStyles: "RecalculateStyles",
+ Paint: "Paint",
+ ParseHTML: "ParseHTML",
+
+ TimerInstall: "TimerInstall",
+ TimerRemove: "TimerRemove",
+ TimerFire: "TimerFire",
+
+ XHRReadyStateChange: "XHRReadyStateChange",
+ XHRLoad: "XHRLoad",
+ EvaluateScript: "EvaluateScript",
+
+ MarkTimeline: "MarkTimeline",
+ MarkLoad: "MarkLoad",
+ MarkDOMContent: "MarkDOMContent",
+
+ ScheduleResourceRequest: "ScheduleResourceRequest",
+ ResourceSendRequest: "ResourceSendRequest",
+ ResourceReceiveResponse: "ResourceReceiveResponse",
+ ResourceReceivedData: "ResourceReceivedData",
+ ResourceFinish: "ResourceFinish",
+
+ FunctionCall: "FunctionCall",
+ GCEvent: "GCEvent"
};
diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js
index 62c5de0..2f30876 100644
--- a/Source/WebCore/inspector/front-end/TimelinePanel.js
+++ b/Source/WebCore/inspector/front-end/TimelinePanel.js
@@ -147,7 +147,7 @@ WebInspector.TimelinePanel.prototype = {
get statusBarItems()
{
- return [this.toggleFilterButton.element, this.toggleTimelineButton.element, this.clearButton.element, this._overviewPane.statusBarFilters];
+ return [this.toggleFilterButton.element, this.toggleTimelineButton.element, this.garbageCollectButton.element, this.clearButton.element, this._overviewPane.statusBarFilters];
},
get categories()
@@ -188,10 +188,10 @@ WebInspector.TimelinePanel.prototype = {
recordStyles[recordTypes.ResourceReceiveResponse] = { title: WebInspector.UIString("Receive Response"), category: this.categories.loading };
recordStyles[recordTypes.ResourceFinish] = { title: WebInspector.UIString("Finish Loading"), category: this.categories.loading };
recordStyles[recordTypes.FunctionCall] = { title: WebInspector.UIString("Function Call"), category: this.categories.scripting };
- recordStyles[recordTypes.ResourceReceiveData] = { title: WebInspector.UIString("Receive Data"), category: this.categories.loading };
+ recordStyles[recordTypes.ResourceReceivedData] = { title: WebInspector.UIString("Receive Data"), category: this.categories.loading };
recordStyles[recordTypes.GCEvent] = { title: WebInspector.UIString("GC Event"), category: this.categories.scripting };
- recordStyles[recordTypes.MarkDOMContentEventType] = { title: WebInspector.UIString("DOMContent event"), category: this.categories.scripting };
- recordStyles[recordTypes.MarkLoadEventType] = { title: WebInspector.UIString("Load event"), category: this.categories.scripting };
+ recordStyles[recordTypes.MarkDOMContent] = { title: WebInspector.UIString("DOMContent event"), category: this.categories.scripting };
+ recordStyles[recordTypes.MarkLoad] = { title: WebInspector.UIString("Load event"), category: this.categories.scripting };
recordStyles[recordTypes.ScheduleResourceRequest] = { title: WebInspector.UIString("Schedule Request"), category: this.categories.loading };
this._recordStylesArray = recordStyles;
}
@@ -209,6 +209,9 @@ WebInspector.TimelinePanel.prototype = {
this.toggleFilterButton = new WebInspector.StatusBarButton(this._hideShortRecordsTitleText, "timeline-filter-status-bar-item");
this.toggleFilterButton.addEventListener("click", this._toggleFilterButtonClicked.bind(this), false);
+ this.garbageCollectButton = new WebInspector.StatusBarButton(WebInspector.UIString("Collect Garbage"), "garbage-collect-status-bar-item");
+ this.garbageCollectButton.addEventListener("click", this._garbageCollectButtonClicked.bind(this), false);
+
this.recordsCounter = document.createElement("span");
this.recordsCounter.className = "timeline-records-counter";
},
@@ -247,9 +250,9 @@ WebInspector.TimelinePanel.prototype = {
eventDividerPadding.className = "resources-event-divider-padding";
eventDividerPadding.title = record.title;
- if (record.type === recordTypes.MarkDOMContentEventType)
+ if (record.type === recordTypes.MarkDOMContent)
eventDivider.className += " resources-blue-divider";
- else if (record.type === recordTypes.MarkLoadEventType)
+ else if (record.type === recordTypes.MarkLoad)
eventDivider.className += " resources-red-divider";
else if (record.type === recordTypes.MarkTimeline) {
eventDivider.className += " resources-orange-divider";
@@ -284,6 +287,11 @@ WebInspector.TimelinePanel.prototype = {
this.toggleFilterButton.element.title = this._calculator._showShortEvents ? this._hideShortRecordsTitleText : this._showShortRecordsTitleText;
this._scheduleRefresh(true);
},
+
+ _garbageCollectButtonClicked: function()
+ {
+ ProfilerAgent.collectGarbage();
+ },
_timelineProfilerWasStarted: function()
{
@@ -317,7 +325,7 @@ WebInspector.TimelinePanel.prototype = {
var parentRecord;
if (record.type === recordTypes.ResourceReceiveResponse ||
record.type === recordTypes.ResourceFinish ||
- record.type === recordTypes.ResourceReceiveData)
+ record.type === recordTypes.ResourceReceivedData)
parentRecord = this._sendRequestRecords[record.data.identifier];
else if (record.type === recordTypes.TimerFire)
parentRecord = this._timerRecords[record.data.timerId];
@@ -330,7 +338,7 @@ WebInspector.TimelinePanel.prototype = {
{
var connectedToOldRecord = false;
var recordTypes = WebInspector.TimelineAgent.RecordType;
- if (record.type === recordTypes.MarkDOMContentEventType || record.type === recordTypes.MarkLoadEventType)
+ if (record.type === recordTypes.MarkDOMContent || record.type === recordTypes.MarkLoad)
parentRecord = null; // No bar entry for load events.
else if (parentRecord === this._rootRecord) {
var newParentRecord = this._findParentRecord(record);
@@ -352,7 +360,7 @@ WebInspector.TimelinePanel.prototype = {
var formattedRecord = new WebInspector.TimelinePanel.FormattedRecord(record, parentRecord, this);
- if (record.type === recordTypes.MarkDOMContentEventType || record.type === recordTypes.MarkLoadEventType) {
+ if (record.type === recordTypes.MarkDOMContent || record.type === recordTypes.MarkLoad) {
this._markTimelineRecords.push(formattedRecord);
return;
}
@@ -649,17 +657,17 @@ WebInspector.TimelineDispatcher = function(timelinePanel)
}
WebInspector.TimelineDispatcher.prototype = {
- timelineProfilerWasStarted: function()
+ started: function()
{
this._timelinePanel._timelineProfilerWasStarted();
},
- timelineProfilerWasStopped: function()
+ stopped: function()
{
this._timelinePanel._timelineProfilerWasStopped();
},
- addRecordToTimeline: function(record)
+ eventRecorded: function(record)
{
this._timelinePanel._addRecordToTimeline(record);
}
@@ -853,7 +861,6 @@ WebInspector.TimelinePanel.FormattedRecord = function(record, parentRecord, pane
{
var recordTypes = WebInspector.TimelineAgent.RecordType;
var style = panel._recordStyles[record.type];
-
this.parent = parentRecord;
if (parentRecord)
parentRecord.children.push(this);
@@ -884,7 +891,7 @@ WebInspector.TimelinePanel.FormattedRecord = function(record, parentRecord, pane
if (sendRequestRecord.parent !== panel._rootRecord && sendRequestRecord.parent.type === recordTypes.ScheduleResourceRequest)
sendRequestRecord.parent.details = this._getRecordDetails(sendRequestRecord, panel._sendRequestRecords);
}
- } else if (record.type === recordTypes.ResourceReceiveData) {
+ } else if (record.type === recordTypes.ResourceReceivedData) {
var sendRequestRecord = panel._sendRequestRecords[record.data.identifier];
if (sendRequestRecord) // False for main resource.
record.data.url = sendRequestRecord.data.url;
@@ -968,7 +975,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = {
case recordTypes.ScheduleResourceRequest:
case recordTypes.ResourceSendRequest:
case recordTypes.ResourceReceiveResponse:
- case recordTypes.ResourceReceiveData:
+ case recordTypes.ResourceReceivedData:
case recordTypes.ResourceFinish:
contentHelper._appendLinkRow(WebInspector.UIString("Resource"), this.data.url);
if (this.data.requestMethod)
@@ -977,8 +984,6 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = {
contentHelper._appendTextRow(WebInspector.UIString("Status Code"), this.data.statusCode);
if (this.data.mimeType)
contentHelper._appendTextRow(WebInspector.UIString("MIME Type"), this.data.mimeType);
- if (typeof this.data.expectedContentLength === "number" && this.data.expectedContentLength !== -1)
- contentHelper._appendTextRow(WebInspector.UIString("Expected Content Length"), this.data.expectedContentLength);
break;
case recordTypes.EvaluateScript:
if (this.data && this.data.url)
@@ -1035,7 +1040,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = {
case WebInspector.TimelineAgent.RecordType.XHRLoad:
case WebInspector.TimelineAgent.RecordType.ScheduleResourceRequest:
case WebInspector.TimelineAgent.RecordType.ResourceSendRequest:
- case WebInspector.TimelineAgent.RecordType.ResourceReceiveData:
+ case WebInspector.TimelineAgent.RecordType.ResourceReceivedData:
case WebInspector.TimelineAgent.RecordType.ResourceReceiveResponse:
case WebInspector.TimelineAgent.RecordType.ResourceFinish:
return WebInspector.displayNameForURL(record.data.url);
diff --git a/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js b/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
index bb3460d..23247fc 100644
--- a/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
@@ -103,7 +103,7 @@ WebInspector.WatchExpressionsSection.prototype = {
// last property, and then call the superclass's updateProperties()
// method to get all the properties refreshed at once.
properties.push(property);
-
+
if (properties.length == propertyCount) {
this.updateProperties(properties, WebInspector.WatchExpressionTreeElement, WebInspector.WatchExpressionsSection.CompareProperties);
@@ -120,7 +120,7 @@ WebInspector.WatchExpressionsSection.prototype = {
}
// TODO: pass exact injected script id.
- RuntimeAgent.releaseObjectGroup(0, this._watchObjectGroupId)
+ RuntimeAgent.releaseObjectGroup(this._watchObjectGroupId)
var properties = [];
// Count the properties, so we known when to call this.updateProperties()
diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc
index 91d72d8..0777a19 100644
--- a/Source/WebCore/inspector/front-end/WebKit.qrc
+++ b/Source/WebCore/inspector/front-end/WebKit.qrc
@@ -32,6 +32,7 @@
<file>DataGrid.js</file>
<file>DebuggerModel.js</file>
<file>DebuggerPresentationModel.js</file>
+ <file>SourceFile.js</file>
<file>DOMAgent.js</file>
<file>DOMStorage.js</file>
<file>DOMStorageItemsView.js</file>
@@ -77,6 +78,7 @@
<file>Resource.js</file>
<file>ResourceCategory.js</file>
<file>ResourceCookiesView.js</file>
+ <file>ResourceJSONView.js</file>
<file>ResourceHeadersView.js</file>
<file>ResourceTimingView.js</file>
<file>ResourceTreeModel.js</file>
@@ -174,6 +176,7 @@
<file>Images/focusButtonGlyph.png</file>
<file>Images/forward.png</file>
<file>Images/frame.png</file>
+ <file>Images/garbageCollectButtonGlyph.png</file>
<file>Images/gearButtonGlyph.png</file>
<file>Images/glossyHeader.png</file>
<file>Images/glossyHeaderPressed.png</file>
@@ -285,6 +288,5 @@
<file>Images/warningMediumIcon.png</file>
<file>Images/warningOrangeDot.png</file>
<file>Images/warningsErrors.png</file>
- <file alias="DebuggerScript.js">../../bindings/v8/DebuggerScript.js</file>
</qresource>
</RCC>
diff --git a/Source/WebCore/inspector/front-end/WorkersSidebarPane.js b/Source/WebCore/inspector/front-end/WorkersSidebarPane.js
index efdb936..e70db44 100644
--- a/Source/WebCore/inspector/front-end/WorkersSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/WorkersSidebarPane.js
@@ -74,9 +74,9 @@ WebInspector.WorkersSidebarPane.prototype = {
setInstrumentation: function(enabled)
{
- InspectorAgent.removeAllScriptsToEvaluateOnLoad();
+ PageAgent.removeAllScriptsToEvaluateOnLoad();
if (enabled)
- InspectorAgent.addScriptToEvaluateOnLoad("(" + InjectedFakeWorker + ")");
+ PageAgent.addScriptToEvaluateOnLoad("(" + InjectedFakeWorker + ")");
},
reset: function()
diff --git a/Source/WebCore/inspector/front-end/heapProfiler.css b/Source/WebCore/inspector/front-end/heapProfiler.css
index add02a1..ceeafca 100644
--- a/Source/WebCore/inspector/front-end/heapProfiler.css
+++ b/Source/WebCore/inspector/front-end/heapProfiler.css
@@ -207,6 +207,18 @@
position: static;
}
+.detailed-heapshot-view .console-formatted-string {
+ white-space: nowrap;
+}
+
+.detailed-heapshot-view .data-grid tr.selected * {
+ color: inherit;
+}
+
+.detailed-heapshot-view .data-grid:focus tr.selected * {
+ color: white;
+}
+
.detailed-heapshot-view .delimiter {
height: 24px;
background-color: #d6dde5;
@@ -228,8 +240,15 @@
}
.detailed-heapshot-view .retaining-paths-view .title > span {
+ display: inline-block;
+ padding-top: 3px;
vertical-align: middle;
margin-left: 4px;
+ margin-right: 8px;
+}
+
+.detailed-heapshot-view .retaining-paths-to-windows {
+
}
.heapshot-help-status-bar-item .glyph {
diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css
index a7bd3b3..0311f22 100644
--- a/Source/WebCore/inspector/front-end/inspector.css
+++ b/Source/WebCore/inspector/front-end/inspector.css
@@ -872,6 +872,7 @@ body.platform-linux .monospace, body.platform-linux .source-code {
.console-formatted-string, .console-formatted-regexp {
color: rgb(196, 26, 22);
+ white-space: pre-wrap;
}
.console-formatted-null, .console-formatted-undefined {
@@ -1022,6 +1023,14 @@ body.platform-linux .monospace, body.platform-linux .source-code {
bottom: 0;
}
+#elements-content.nowrap {
+ white-space: nowrap;
+}
+
+#elements-content > ol {
+ display: inline-block;
+}
+
#elements-sidebar {
position: absolute;
top: 0;
@@ -3926,6 +3935,10 @@ body.inactive li.selected .bubble.search-matches {
background-color: rgb(66, 129, 235) !important;
}
+.garbage-collect-status-bar-item .glyph {
+ -webkit-mask-image: url(Images/garbageCollectButtonGlyph.png);
+}
+
.timeline-records-counter, .storage-application-cache-status, .storage-application-cache-connectivity {
font-size: 11px;
text-shadow: white 0 1px 0;
@@ -4442,3 +4455,7 @@ a.worker-item:hover {
font-weight: bold;
z-index: 10000;
}
+
+.resource-view.json {
+ padding: 5px;
+}
diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html
index d6c810e..9ba1dca 100644
--- a/Source/WebCore/inspector/front-end/inspector.html
+++ b/Source/WebCore/inspector/front-end/inspector.html
@@ -122,6 +122,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<script type="text/javascript" src="ResourceHeadersView.js"></script>
<script type="text/javascript" src="ResourceCookiesView.js"></script>
<script type="text/javascript" src="ResourceTimingView.js"></script>
+ <script type="text/javascript" src="ResourceJSONView.js"></script>
<script type="text/javascript" src="NetworkItemView.js"></script>
<script type="text/javascript" src="ScriptFormatter.js"></script>
<script type="text/javascript" src="DOMSyntaxHighlighter.js"></script>
@@ -146,6 +147,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<script type="text/javascript" src="DetailedHeapshotView.js"></script>
<script type="text/javascript" src="DebuggerModel.js"></script>
<script type="text/javascript" src="DebuggerPresentationModel.js"></script>
+ <script type="text/javascript" src="SourceFile.js"></script>
<script type="text/javascript" src="DOMAgent.js"></script>
<script type="text/javascript" src="TimelineAgent.js"></script>
<script type="text/javascript" src="TimelinePanel.js"></script>
diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js
index b4c3fda..59171db 100644
--- a/Source/WebCore/inspector/front-end/inspector.js
+++ b/Source/WebCore/inspector/front-end/inspector.js
@@ -141,7 +141,7 @@ var WebInspector = {
resetFocusElement: function()
{
this.currentFocusElement = null;
- this._previousFocusElement = null;
+ this._previousFocusElement = null;
},
get currentPanel()
@@ -182,17 +182,6 @@ var WebInspector = {
return pane;
},
- createXHRBreakpointsSidebarPane: function()
- {
- var pane = new WebInspector.XHRBreakpointsSidebarPane();
- function breakpointAdded(event)
- {
- pane.addBreakpointItem(new WebInspector.BreakpointItem(event.data));
- }
- WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.XHRBreakpointAdded, breakpointAdded);
- return pane;
- },
-
_createPanels: function()
{
var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(',');
@@ -206,16 +195,8 @@ var WebInspector = {
this.panels.scripts = new WebInspector.ScriptsPanel();
if (hiddenPanels.indexOf("timeline") === -1)
this.panels.timeline = new WebInspector.TimelinePanel();
- if (hiddenPanels.indexOf("profiles") === -1) {
+ if (hiddenPanels.indexOf("profiles") === -1)
this.panels.profiles = new WebInspector.ProfilesPanel();
- this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType());
- if (Preferences.heapProfilerPresent) {
- if (!Preferences.detailedHeapProfiles)
- this.panels.profiles.registerProfileType(new WebInspector.HeapSnapshotProfileType());
- else
- this.panels.profiles.registerProfileType(new WebInspector.DetailedHeapshotProfileType());
- }
- }
if (hiddenPanels.indexOf("audits") === -1)
this.panels.audits = new WebInspector.AuditsPanel();
if (hiddenPanels.indexOf("console") === -1)
@@ -247,7 +228,7 @@ var WebInspector = {
dockToggleButton.title = WebInspector.UIString("Dock to main window.");
}
- // This may be called before onLoadedDone, hence the bulk of inspector objects may
+ // This may be called before onLoadedDone, hence the bulk of inspector objects may
// not be created yet.
if (WebInspector.searchController)
WebInspector.searchController.updateSearchLabel();
@@ -347,9 +328,9 @@ var WebInspector = {
this._highlightedDOMNodeId = nodeId;
if (nodeId)
- InspectorAgent.highlightDOMNode(nodeId);
+ DOMAgent.highlightDOMNode(nodeId);
else
- InspectorAgent.hideDOMNodeHighlight();
+ DOMAgent.hideDOMNodeHighlight();
},
highlightDOMNodeForTwoSeconds: function(nodeId)
@@ -458,11 +439,12 @@ WebInspector.doLoadedDone = function()
this.drawer = new WebInspector.Drawer();
this.console = new WebInspector.ConsoleView(this.drawer);
this.drawer.visibleView = this.console;
+ this.networkManager = new WebInspector.NetworkManager();
this.resourceTreeModel = new WebInspector.ResourceTreeModel();
- this.networkManager = new WebInspector.NetworkManager(this.resourceTreeModel);
this.domAgent = new WebInspector.DOMAgent();
InspectorBackend.registerDomainDispatcher("Inspector", this);
+ InspectorBackend.registerDomainDispatcher("Page", this);
this.resourceCategories = {
documents: new WebInspector.ResourceCategory("documents", WebInspector.UIString("Documents"), "rgb(47,102,236)"),
@@ -522,25 +504,16 @@ WebInspector.doLoadedDone = function()
this.extensionServer.initExtensions();
- function onPopulateScriptObjects()
- {
- if (!WebInspector.currentPanel)
- WebInspector.showPanel(WebInspector.settings.lastActivePanel);
- }
- InspectorAgent.populateScriptObjects(onPopulateScriptObjects);
-
- if (Preferences.debuggerAlwaysEnabled || WebInspector.settings.debuggerEnabled)
- this.debuggerModel.enableDebugger();
- if (Preferences.profilerAlwaysEnabled || WebInspector.settings.profilerEnabled)
- InspectorAgent.enableProfiler();
if (WebInspector.settings.monitoringXHREnabled)
ConsoleAgent.setMonitoringXHREnabled(true);
+ ConsoleAgent.enable(this.console.setConsoleMessageExpiredCount.bind(this.console));
- ConsoleAgent.setConsoleMessagesEnabled(true);
+ WebInspector.showPanel(WebInspector.settings.lastActivePanel);
- function propertyNamesCallback(names)
+ function propertyNamesCallback(error, names)
{
- WebInspector.cssNameCompletions = new WebInspector.CSSCompletions(names);
+ if (!error)
+ WebInspector.cssNameCompletions = new WebInspector.CSSCompletions(names);
}
// As a DOMAgent method, this needs to happen after the frontend has loaded and the agent is available.
CSSAgent.getSupportedCSSProperties(propertyNamesCallback);
@@ -702,7 +675,7 @@ WebInspector.openResource = function(resourceURL, inResourcesPanel)
WebInspector.panels.resources.showResource(resource);
WebInspector.showPanel("resources");
} else
- InspectorAgent.openInInspectedWindow(resource ? resource.url : resourceURL);
+ PageAgent.openInInspectedWindow(resource ? resource.url : resourceURL);
}
WebInspector._registerShortcuts = function()
@@ -826,13 +799,13 @@ WebInspector.documentKeyDown = function(event)
case "U+0052": // R key
if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) {
- InspectorAgent.reloadPage(event.shiftKey);
+ PageAgent.reloadPage(event.shiftKey);
event.preventDefault();
}
break;
case "F5":
if (!isMac)
- InspectorAgent.reloadPage(event.ctrlKey || event.shiftKey);
+ PageAgent.reloadPage(event.ctrlKey || event.shiftKey);
break;
}
}
@@ -1013,6 +986,12 @@ WebInspector.showPanel = function(panel)
this.currentPanel = this.panels[panel];
}
+WebInspector.startUserInitiatedDebugging = function()
+{
+ this.currentPanel = this.panels.scripts;
+ WebInspector.debuggerModel.enableDebugger();
+}
+
WebInspector.domContentEventFired = function(time)
{
this.panels.audits.mainResourceDOMContentTime = time;
@@ -1070,6 +1049,18 @@ WebInspector.inspectedURLChanged = function(url)
this.extensionServer.notifyInspectedURLChanged();
}
+WebInspector.didCreateWorker = function()
+{
+ var workersPane = WebInspector.panels.scripts.sidebarPanes.workers;
+ workersPane.addWorker.apply(workersPane, arguments);
+}
+
+WebInspector.didDestroyWorker = function()
+{
+ var workersPane = WebInspector.panels.scripts.sidebarPanes.workers;
+ workersPane.removeWorker.apply(workersPane, arguments);
+}
+
WebInspector.log = function(message, messageLevel)
{
// remember 'this' for setInterval() callback
@@ -1185,13 +1176,16 @@ WebInspector.drawLoadingPieChart = function(canvas, percent) {
g.fill();
}
-WebInspector.inspect = function(objectId, hints)
+WebInspector.inspect = function(payload, hints)
{
- var object = WebInspector.RemoteObject.fromPayload(objectId);
+ var object = WebInspector.RemoteObject.fromPayload(payload);
if (object.type === "node") {
// Request node from backend and focus it.
- object.pushNodeToFrontend(WebInspector.updateFocusedNode.bind(WebInspector));
- } else if (hints.databaseId) {
+ object.pushNodeToFrontend(WebInspector.updateFocusedNode.bind(WebInspector), object.release.bind(object));
+ return;
+ }
+
+ if (hints.databaseId) {
WebInspector.currentPanel = WebInspector.panels.resources;
WebInspector.panels.resources.selectDatabase(hints.databaseId);
} else if (hints.domStorageId) {
@@ -1199,7 +1193,7 @@ WebInspector.inspect = function(objectId, hints)
WebInspector.panels.resources.selectDOMStorage(hints.domStorageId);
}
- RuntimeAgent.releaseObject(objectId);
+ object.release();
}
WebInspector.updateFocusedNode = function(nodeId)
@@ -1416,6 +1410,8 @@ WebInspector.addMainEventListeners = function(doc)
WebInspector.frontendReused = function()
{
this.networkManager.frontendReused();
+ this.resourceTreeModel.frontendReused();
+ WebInspector.panels.network.clear();
this.reset();
}
@@ -1541,7 +1537,7 @@ WebInspector.startEditing = function(element, config)
var isMetaOrCtrl = WebInspector.isMac() ?
event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey :
event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
- if (isEnterKey(event) && (!config.multiline || isMetaOrCtrl))
+ if (isEnterKey(event) && (event.isMetaOrCtrlForTest || !config.multiline || isMetaOrCtrl))
return "commit";
else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code)
return "cancel";
diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js
index 31a5f0c..fbfdfbb 100644
--- a/Source/WebCore/inspector/front-end/utilities.js
+++ b/Source/WebCore/inspector/front-end/utilities.js
@@ -156,19 +156,7 @@ Node.prototype.rangeBoundaryForOffset = function(offset)
Element.prototype.removeStyleClass = function(className)
{
- // Test for the simple case first.
- if (this.className === className) {
- this.className = "";
- return;
- }
-
- var index = this.className.indexOf(className);
- if (index === -1)
- return;
-
- this.className = this.className.split(" ").filter(function(s) {
- return s && s !== className;
- }).join(" ");
+ this.classList.remove(className);
}
Element.prototype.removeMatchingStyleClasses = function(classNameRegex)
@@ -180,23 +168,12 @@ Element.prototype.removeMatchingStyleClasses = function(classNameRegex)
Element.prototype.addStyleClass = function(className)
{
- if (className && !this.hasStyleClass(className))
- this.className += (this.className.length ? " " + className : className);
+ this.classList.add(className);
}
Element.prototype.hasStyleClass = function(className)
{
- if (!className)
- return false;
- // Test for the simple case
- if (this.className === className)
- return true;
-
- var index = this.className.indexOf(className);
- if (index === -1)
- return false;
- var toTest = " " + this.className + " ";
- return toTest.indexOf(" " + className + " ", index) !== -1;
+ return this.classList.contains(className);
}
Element.prototype.positionAt = function(x, y)
@@ -380,7 +357,6 @@ Node.prototype.isAncestor = function(node)
Node.prototype.isDescendant = isDescendantNode;
Node.prototype.traverseNextNode = traverseNextNode;
Node.prototype.traversePreviousNode = traversePreviousNode;
-Node.prototype.onlyTextChild = onlyTextChild;
String.prototype.hasSubstring = function(string, caseInsensitive)
{
@@ -616,19 +592,6 @@ function traversePreviousNode(stayWithin)
return this.parentNode;
}
-function onlyTextChild()
-{
- if (!this)
- return null;
-
- var firstChild = this.firstChild;
- if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE)
- return null;
-
- var sibling = firstChild.nextSibling;
- return sibling ? null : firstChild;
-}
-
function appropriateSelectorForNode(node, justSelector)
{
if (!node)
@@ -822,31 +785,44 @@ Array.convert = function(list)
return Array.prototype.slice.call(list);
}
-function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction)
+function binarySearch(object, array, comparator)
{
var first = 0;
- var last = aList.length - 1;
- var floor = Math.floor;
- var mid, c;
+ var last = array.length - 1;
while (first <= last) {
- mid = floor((first + last) / 2);
- c = aFunction(anObject, aList[mid]);
-
+ var mid = (first + last) >> 1;
+ var c = comparator(object, array[mid]);
if (c > 0)
first = mid + 1;
else if (c < 0)
last = mid - 1;
- else {
- // Return the first occurance of an item in the list.
- while (mid > 0 && aFunction(anObject, aList[mid - 1]) === 0)
- mid--;
- first = mid;
- break;
- }
+ else
+ return mid;
}
- return first;
+ // Return the nearest lesser index, "-1" means "0, "-2" means "1", etc.
+ return -(first + 1);
+}
+
+Object.defineProperty(Array.prototype, "binaryIndexOf", { value: function(value, comparator)
+{
+ var result = binarySearch(value, this, comparator);
+ return result >= 0 ? result : -1;
+}});
+
+function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction)
+{
+ var index = binarySearch(anObject, aList, aFunction);
+ if (index < 0)
+ // See binarySearch implementation.
+ return -index - 1;
+ else {
+ // Return the first occurance of an item in the list.
+ while (index > 0 && aFunction(anObject, aList[index - 1]) === 0)
+ index--;
+ return index;
+ }
}
String.sprintf = function(format)
diff --git a/Source/WebCore/inspector/generate-inspector-idl b/Source/WebCore/inspector/generate-inspector-idl
new file mode 100755
index 0000000..f2f0e35
--- /dev/null
+++ b/Source/WebCore/inspector/generate-inspector-idl
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+# Copyright (c) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os.path
+import sys
+
+program_name = os.path.basename(__file__)
+if len(sys.argv) < 4 or sys.argv[1] != "-o":
+ sys.stderr.write("Usage: %s -o OUTPUT_FILE INPUT_FILE\n" % program_name)
+ exit(1)
+
+output_path = sys.argv[2]
+input_path = sys.argv[3]
+
+input_file = open(input_path, "r")
+json_string = input_file.read()
+json_string = json_string.replace(": true", ": True")
+json_string = json_string.replace(": false", ": false")
+json_api = eval(json_string)
+
+output_file = open(output_path, "w")
+output_file.write("""/*
+ * Copyright (C) 2011 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module core {""")
+
+type_traits = {
+ "string": "String",
+ "integer": "int",
+ "number": "double",
+ "boolean": "boolean",
+ "array": "Array",
+ "object": "Object"
+}
+
+macro_traits = {
+ "Database": "DATABASE",
+ "DOMStorage": "DOM_STORAGE",
+ "ApplicationCache": "OFFLINE_WEB_APPLICATIONS",
+ "Debugger": "JAVASCRIPT_DEBUGGER",
+ "BrowserDebugger": "JAVASCRIPT_DEBUGGER",
+ "Profiler": "JAVASCRIPT_DEBUGGER"
+}
+
+def param_type(param):
+ if "type" in param:
+ return type_traits[param["type"]];
+ if "$ref" in param:
+ return "Object"
+
+for domain in json_api:
+ domain_name = domain["domain"]
+ if domain_name in macro_traits:
+ output_file.write("\n#if defined(ENABLE_%s) && ENABLE_%s" % (macro_traits[domain_name], macro_traits[domain_name]))
+ output_file.write("\n interface [Conditional=INSPECTOR] %s {" % domain_name)
+ if "commands" in domain:
+ for command in domain["commands"]:
+ params = [];
+ if ("parameters" in command):
+ for in_param in command["parameters"]:
+ params.append("in %s %s" % (param_type(in_param), in_param["name"]))
+ if ("returns" in command):
+ for out_param in command["returns"]:
+ params.append("out %s %s" % (param_type(out_param), out_param["name"]))
+ output_file.write("\n void %s(%s);" % (command["name"], ", ".join(params)))
+ if "events" in domain:
+ for event in domain["events"]:
+ params = [];
+ if ("parameters" in event):
+ for in_param in event["parameters"]:
+ params.append("out %s %s" % (param_type(in_param), in_param["name"]))
+ output_file.write("\n [event] void %s(%s);" % (event["name"], ", ".join(params)))
+ output_file.write("\n };")
+ if domain["domain"] in macro_traits:
+ output_file.write("\n#endif // ENABLE_%s" % macro_traits[domain["domain"]])
+output_file.write("\n}\n")
+output_file.close()
diff --git a/Source/WebCore/inspector/xxd.pl b/Source/WebCore/inspector/xxd.pl
index 42cf4a2..5ee08a5 100644
--- a/Source/WebCore/inspector/xxd.pl
+++ b/Source/WebCore/inspector/xxd.pl
@@ -1,45 +1,45 @@
-#! /usr/bin/perl
-
-# Copyright (C) 2010 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# # Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# # Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# # Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-$varname = shift;
-$fname = shift;
-$output = shift;
-
-open($input, '<', $fname) or die "Can't open file for read: $fname $!";
-$/ = undef;
-$text = <$input>;
-close($input);
-
-$text = join(', ', map('0x' . unpack("H*", $_), split(undef, $text)));
-
-open($output, '>', $output) or die "Can't open file for write: $output $!";
-print $output "unsigned char $varname\[\] = {\n$text\n};\n";
-close($output);
+#! /usr/bin/perl
+
+# Copyright (C) 2010-2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# # Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# # Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# # Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+$varname = shift;
+$fname = shift;
+$output = shift;
+
+open($input, '<', $fname) or die "Can't open file for read: $fname $!";
+$/ = undef;
+$text = <$input>;
+close($input);
+
+$text = join(', ', map('0x' . unpack("H*", $_), split(undef, $text)));
+
+open($output, '>', $output) or die "Can't open file for write: $output $!";
+print $output "const unsigned char $varname\[\] = {\n$text\n};\n";
+close($output);