Changeset 195835 in webkit


Ignore:
Timestamp:
Jan 29, 2016 12:35:30 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Duplicate tab-types being saved to setting, causing duplicate tabs to be opened
https://bugs.webkit.org/show_bug.cgi?id=153659
<rdar://problem/24413157>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-01-29
Reviewed by Brian Burg.

  • UserInterface/Base/Main.js:

(WebInspector.contentLoaded):
(WebInspector._rememberOpenTabs):
De-duplicate the setting when building the list of tabs for existing
cases where the setting has duplicates and de-duplicate storing into
the setting, which was causing the issue to begin with.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r195819 r195835  
     12016-01-29  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Duplicate tab-types being saved to setting, causing duplicate tabs to be opened
     4        https://bugs.webkit.org/show_bug.cgi?id=153659
     5        <rdar://problem/24413157>
     6
     7        Reviewed by Brian Burg.
     8
     9        * UserInterface/Base/Main.js:
     10        (WebInspector.contentLoaded):
     11        (WebInspector._rememberOpenTabs):
     12        De-duplicate the setting when building the list of tabs for existing
     13        cases where the setting has duplicates and de-duplicate storing into
     14        the setting, which was causing the issue to begin with.
     15
    1162016-01-29  Devin Rousso  <dcrousso+webkit@gmail.com>
    217
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r194572 r195835  
    391391    this._pendingOpenTabs = [];
    392392
     393    // Previously we may have stored duplicates in this setting. Avoid creating duplicate tabs.
    393394    let openTabTypes = this._openTabsSetting.value;
     395    let seenTabTypes = new Set;
    394396
    395397    for (let i = 0; i < openTabTypes.length; ++i) {
    396398        let tabType = openTabTypes[i];
     399
     400        if (seenTabTypes.has(tabType))
     401            continue;
     402        seenTabTypes.add(tabType);
     403
    397404        if (!this.isTabTypeAllowed(tabType)) {
    398405            this._pendingOpenTabs.push({tabType, index: i});
     
    468475WebInspector._rememberOpenTabs = function()
    469476{
     477    let seenTabTypes = new Set;
    470478    let openTabs = [];
    471479
     
    478486        console.assert(tabContentView.type, "Tab type can't be null, undefined, or empty string", tabContentView.type, tabContentView);
    479487        openTabs.push(tabContentView.type);
     488        seenTabTypes.add(tabContentView.type);
    480489    }
    481490
    482491    // Keep currently unsupported tabs in the setting at their previous index.
    483     for (let {tabType, index} of this._pendingOpenTabs)
     492    for (let {tabType, index} of this._pendingOpenTabs) {
     493        if (seenTabTypes.has(tabType))
     494            continue;
    484495        openTabs.insertAtIndex(tabType, index);
     496        seenTabTypes.add(tabType);
     497    }
    485498
    486499    this._openTabsSetting.value = openTabs;
Note: See TracChangeset for help on using the changeset viewer.