Closed Bug 1317347 Opened 3 years ago Closed 3 years ago

TypeError: this.docShell is null when opening about:newtab

Categories

(DevTools :: Netmonitor, defect, P2)

defect

Tracking

(firefox53 fixed)

RESOLVED FIXED
Firefox 53
Tracking Status
firefox53 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

Details

Attachments

(1 file)

I don't think that's specific to about:newtab, but sometime you can see tons of these exception in the browser console:
console.error: 
  Handler function threw an exception: TypeError: this.docShell is null
Stack: get_contentWindow@chrome://global/content/bindings/browser.xml:466:1
get_outerWindowID@chrome://global/content/bindings/browser.xml:435:11
matchRequest@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/webconsole/network-monitor.js:87:1
NetworkMonitor.prototype._onRequestHeader@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/webconsole/network-monitor.js:1148:10
NetworkMonitor.prototype.observeActivity<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/webconsole/network-monitor.js:1012:7
exports.makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14
Line: 466, column: 1

Here is a possible STR (note it is racy or it depends on same caches from about:newtab or something)
* open data:text/html,foo
* open webconsole
* open about:newtab in a new tab
* over website previews

> you should see many of these exceptions

If you don't, try closing about:newtab tab, it sometimes forces this exception.
Comment on attachment 8810439 [details]
Bug 1317347 - Fix exception in network monitor for requests coming from iframes added to the hidden window.

https://reviewboard.mozilla.org/r/92768/#review92738

::: devtools/shared/webconsole/network-monitor.js:89
(Diff revision 1)
>  
>    if (filters.outerWindowID) {
>      let topFrame = NetworkHelper.getTopFrameForRequest(channel);
> -    if (topFrame && topFrame.outerWindowID &&
> +    // Bug XXX: Check for docShell as outerWindowID getter may throw on frames
> +    // added to the hidden window.
> +    if (topFrame && topFrame.docShell && topFrame.outerWindowID &&

Doesn't this break the network monitor for every remote browser (where `docShell` is unavailable from the parent)?
Attachment #8810439 - Flags: review?(jryans) → review-
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #2)
> Doesn't this break the network monitor for every remote browser (where
> `docShell` is unavailable from the parent)?

Yes most likely, good catch!
Do you think a try catch is reasonable? It may hide other breakage... But I can't think about any other way?
topFrame is still rooted to a document (topFrame.parentNode and topFrame.ownerDocument are not null).
I haven't found any other check that would help knowing this frame should be ignored.
Comment on attachment 8810439 [details]
Bug 1317347 - Fix exception in network monitor for requests coming from iframes added to the hidden window.

https://reviewboard.mozilla.org/r/92768/#review93376

Thanks, this version seems safe to me!
Attachment #8810439 - Flags: review?(jryans) → review+
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/163281db1563
Fix exception in network monitor for requests coming from iframes added to the hidden window. r=jryans
Assignee: nobody → poirot.alex
Priority: -- → P2
https://hg.mozilla.org/mozilla-central/rev/163281db1563
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 53
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.