Bug 152471 - WebInspector: Can't open a new tab: Uncaught Exception: TypeError: this.isNewTabWithTypeAllowed is not a function
Summary: WebInspector: Can't open a new tab: Uncaught Exception: TypeError: this.isNew...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-20 21:07 PST by Nikita Vasilyev
Modified: 2015-12-21 22:07 PST (History)
8 users (show)

See Also:


Attachments
[Image] Exception (218.19 KB, image/png)
2015-12-20 21:20 PST, Nikita Vasilyev
no flags Details
Patch (1.48 KB, patch)
2015-12-20 21:46 PST, Nikita Vasilyev
no flags Details | Formatted Diff | Diff
Patch (1.49 KB, patch)
2015-12-20 21:50 PST, Nikita Vasilyev
timothy: review+
Details | Formatted Diff | Diff
Patch (1.70 KB, patch)
2015-12-21 21:08 PST, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2015-12-20 21:07:37 PST
Clicking on "+" icon in the tab bar results in this exception.

Loading completed: true
Uncaught exceptions:
 - TypeError: this.isNewTabWithTypeAllowed is not a function. (In 'this.isNewTabWithTypeAllowed(tabClass.Type)', 'this.isNewTabWithTypeAllowed' is undefined) (at Main.js:494:84)
Comment 1 Nikita Vasilyev 2015-12-20 21:20:50 PST
Created attachment 267732 [details]
[Image] Exception

I no longer understand what's going on — an exception is thrown because this.isNewTabWithTypeAllowed is not a function, yet, hovering over it shows that it is clearly a function.
Comment 2 Nikita Vasilyev 2015-12-20 21:33:15 PST
This happens when WebInspector._updateNewTabButtonState gets called from
listenersForThisEvent[i].listener.call(listenersForThisEvent[i].thisObject, event);

https://github.com/WebKit/webkit/blob/7d256676418078205157678bf382fbdea88bc9bd/Source/WebInspectorUI/UserInterface/Base/Object.js#L155
Comment 3 Nikita Vasilyev 2015-12-20 21:39:41 PST
Stacktrace:

(anonymous function) (Main.js:496)
some
_updateNewTabButtonState (Main.js:494)
dispatch (Object.js:155)
dispatchEventToListeners (Object.js:162)
insertTabBarItem (TabBar.js:181)
addTabBarItem (TabBar.js:85)
addTabForContentView (TabBrowser.js:148)
tabContentViewForRepresentedObject (Main.js:1031)
showRepresentedObject (Main.js:1038)
showConsoleTab (Main.js:856)
_consoleItemWasClicked (DefaultDashboardView.js:145)
_consoleItemWasClicked
_itemWasClicked (DefaultDashboardView.js:125)
(anonymous function) (DefaultDashboardView.js:114)
Comment 4 Nikita Vasilyev 2015-12-20 21:46:47 PST
Created attachment 267734 [details]
Patch
Comment 5 Nikita Vasilyev 2015-12-20 21:50:27 PST
Created attachment 267735 [details]
Patch
Comment 6 Timothy Hatcher 2015-12-21 16:57:44 PST
Comment on attachment 267735 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=267735&action=review

> Source/WebInspectorUI/UserInterface/Base/Main.js:494
> -    let canMakeNewTab = addableTabs.some((tabClass) => this.isNewTabWithTypeAllowed(tabClass.Type));
> +    let canMakeNewTab = addableTabs.some((tabClass) => WebInspector.isNewTabWithTypeAllowed(tabClass.Type));

this should work here but it is a bug in JSC right now that lexical bound this is not working in arrow functions. I'd vote for converting this to a bound anon function instead.
Comment 7 Blaze Burg 2015-12-21 19:24:03 PST
Comment on attachment 267735 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=267735&action=review

>> Source/WebInspectorUI/UserInterface/Base/Main.js:494
>> +    let canMakeNewTab = addableTabs.some((tabClass) => WebInspector.isNewTabWithTypeAllowed(tabClass.Type));
> 
> this should work here but it is a bug in JSC right now that lexical bound this is not working in arrow functions. I'd vote for converting this to a bound anon function instead.

Please add a fixme with the bugzilla for the JSC fix as well.
Comment 8 Nikita Vasilyev 2015-12-21 21:08:33 PST
Created attachment 267779 [details]
Patch
Comment 9 WebKit Commit Bot 2015-12-21 22:07:47 PST
Comment on attachment 267779 [details]
Patch

Clearing flags on attachment: 267779

Committed r194360: <http://trac.webkit.org/changeset/194360>
Comment 10 WebKit Commit Bot 2015-12-21 22:07:51 PST
All reviewed patches have been landed.  Closing bug.