Open Bug 1603727 Opened 5 years ago Updated 2 years ago

Multiple SOURCE tabs created for inline script

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(Not tracked)

People

(Reporter: Honza, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached image image.png (deleted) —

STR:

  1. Open http://janodvarko.cz/firebug/tests/601/Issue601.htm
  2. Create BP on line 35 in issue601.htm
  3. Click the POST button on the page -> BP hits
  4. Select onclick frame in the Calls stack and then postRequest frame - repeat a few times.
  5. New SOURCE tabs are created -> BUG

Honza

@Jason, can you please look at this, thanks!

Marking as P2 (perhaps P1) since it's quite annoying.

Honza

Blocks: dbg-frontend
Priority: -- → P2
Flags: needinfo?(jlaster)

When a scope is selected updateTabList is called with url being null - so updateTabList assumes that a new tab must be created: https://searchfox.org/mozilla-central/rev/174f1195ec740e8f17223b48018f7e14e6d4e40e/devtools/client/debugger/src/reducers/tabs.js#237
Removing the existence check fixes the issue, though I'm assuming the check is there for a reason so it might break something else:

    diff --git a/devtools/client/debugger/src/reducers/tabs.js b/devtools/client/debugger/src/reducers/tabs.js
    index f119fc4d6b3d..d2b6df8e4fe5 100644
    --- a/devtools/client/debugger/src/reducers/tabs.js
    +++ b/devtools/client/debugger/src/reducers/tabs.js
    @@ -234,9 +234,7 @@ function updateTabList(
       let { tabs } = state;
       // Set currentIndex to -1 for URL-less tabs so that they aren't
       // filtered by isSimilarTab
    -  const currentIndex = url
    -    ? tabs.findIndex(tab => isSimilarTab(tab, url, isOriginal))
    -    : -1;
    +  const currentIndex = tabs.findIndex(tab => isSimilarTab(tab, url, isOriginal));
     
       if (currentIndex === -1) {
         const newTab = {

Sources with url: null and different actors seem to be emitted by newQueuedSources:

    {
      "type": "generated",
      "data": {
        "thread": "server0.conn3.child1/thread20",
        "source": {
          "actor": "server0.conn3.child1/source1712",
          "extensionName": null,
          "url": null,
          "isBlackBoxed": false,
          "sourceMapURL": null,
          "introductionUrl": null,
          "introductionType": "debugger eval"
        }
      }
    }

Stacktrace:

    newQueuedSources (newSources.js#226)
    thunk (thunk.js#29)
    bindActionCreator (redux.js#520)
    dispatchNewSources (source-queue.js#20)
    invokeFunc (lodash.js#10333)
    leadingEdge (lodash.js#10343)
    debounced (lodash.js#10410)
    queue (source-queue.js#31)
    newSource (events.js#135)
    _emit (event-emitter.js#226)
    emit (event-emitter.js#172)
    emit (event-emitter.js#324)
    onPacket (Front.js#252)
    onPacket (debugger-client.js#498)
    send (local-transport.js#68)
    makeInfallible (ThreadSafeDevToolsUtils.js#111)
    makeInfallible (ThreadSafeDevToolsUtils.js#111)

I can submit a patch if the fix seems resonable.

Flags: needinfo?(jlaster)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: