Bug 117755 - Web Inspector: Infrequent uncaught exception with debugger popovers breaks inspector
Summary: Web Inspector: Infrequent uncaught exception with debugger popovers breaks in...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
Keywords: InRadar
Depends on:
Reported: 2013-06-18 14:23 PDT by Joseph Pecoraro
Modified: 2013-06-18 15:44 PDT (History)
5 users (show)

See Also:

[PATCH] Proposed Fix (6.38 KB, patch)
2013-06-18 15:23 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2013-06-18 14:23:43 PDT
I've been able to somewhat reliably reproduce an uncaught exception with debugger popovers:

    [Error] TypeError: 'undefined' is not a function (evaluating 'bestFrame.minX()')
	_update (Popover.js, line 228)
	present (Popover.js, line 117)
	_showPopover (SourceCodeTextEditor.js, line 982)
	_showPopoverForUndefined (SourceCodeTextEditor.js, line 1089)
	populate (SourceCodeTextEditor.js, line 952)
	dispatch (InspectorBackend.js, line 209)
	dispatchNextQueuedMessageFromBackend (Main.js, line 290)
	(anonymous function)

I threw in some logging and caught what was happening:

    // Logging: console.log("FRAME", JSON.stringify(bestFrame), typeof bestFrame.minX);
    [Log] FRAME {"origin":{"x":427,"y":235},"size":{"width":83,"height":51}} function (Popover.js, line 229, x3)
    [Log] FRAME {"origin":{"x":427,"y":67},"size":{"width":83,"height":51}} function (Popover.js, line 229, x10)
    [Log] FRAME {"origin":{"x":0,"y":0},"size":{"width":0,"height":0}} undefined (Popover.js, line 229)
    // ERROR

Because WebInspector.Rect.ZERO_RECT was constructed before we replace the WebInspector.Rect.prototype it didn't get the methods we expected it to have!

    js> WebInspector.Rect.ZERO_RECT instanceof WebInspector.Rect
Comment 1 Radar WebKit Bug Importer 2013-06-18 14:24:24 PDT
Comment 2 Joseph Pecoraro 2013-06-18 14:26:52 PDT
Doing a quick search through the code base, ZERO_SIZE and ZERO_RECT were the only 2 objects being initialized before we reassigned the prototype. There were only a few other objects, all safe.

    shell> ack '^WebInsp.*?= new'
    87:WebInspector.Size.ZERO_SIZE = new WebInspector.Size(0, 0);
    178:WebInspector.Rect.ZERO_RECT = new WebInspector.Rect(0, 0, 0, 0);

    235:WebInspector.notifications = new WebInspector.Object;

    56:WebInspector.Popover.AnchorSize = new WebInspector.Size(22, 11);
    57:WebInspector.Popover.ShadowEdgeInsets = new WebInspector.EdgeInsets(WebInspector.Popover.ShadowPadding);
Comment 3 Radar WebKit Bug Importer 2013-06-18 14:27:16 PDT
Comment 4 Joseph Pecoraro 2013-06-18 14:28:10 PDT
Also the only non-WebInspector namespaced object (InspectorBackend) was correct.
Comment 5 Joseph Pecoraro 2013-06-18 15:23:53 PDT
Created attachment 204948 [details]
[PATCH] Proposed Fix
Comment 6 WebKit Commit Bot 2013-06-18 15:44:46 PDT
Comment on attachment 204948 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 204948

Committed r151704: <http://trac.webkit.org/changeset/151704>
Comment 7 WebKit Commit Bot 2013-06-18 15:44:48 PDT
All reviewed patches have been landed.  Closing bug.