summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/inspector/front-end
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/inspector/front-end')
-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
218 files changed, 3545 insertions, 2397 deletions
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)