Open Bug 1096031 Opened 10 years ago Updated 2 years ago

Inspector doesn't give code entered by JavaScript

Categories

(DevTools :: Inspector, defect, P3)

33 Branch
x86_64
All
defect

Tracking

(Not tracked)

People

(Reporter: c_bouthoorn, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0
Build ID: 20141013200257

Steps to reproduce:

Make an HTML file which looks like this

<!DOCTYPE HTML>
<head>
 <script src="./code.js"></script>
</head>
<body>
 <input type="button" onclick="javascript:show();" value="show();">
</body>

And a JavaScript file that looks like this

function show() {
 document.write("<p>This text is loaded</p>");
}

Open the Inspector using F12


Actual results:

The page loads smoothly, the Inspector gives the code.
When you press the button the text "This text is loaded" is shown, the inspector gives no code and the title changed to "Connecting..."


Expected results:

The text would be shown, the inspector would give the code and the title would be empty.
While the title is "Connecting...", you can close the Inspector, but can't re-open using F12.
When run in Terminal, Firefox gives the following error:


*************************
A coding exception was thrown in a Promise resolution callback.
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Full message: TypeError: inspector is undefined
Full stack: CM_inspectNode/<@chrome://browser/content/nsContextMenu.js:494:7
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:866:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:745:7

*************************
When you stop the page from loading by pressing the X at the right side of the navigation bar, the following error gets thrown:

*************************
A coding exception was thrown in a Promise resolution callback.
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Full message: TypeError: this.doc is undefined
Full stack: Toolbox.prototype.loadTool@resource://gre/modules/commonjs/toolkit/loader.js -> resource:///modules/devtools/framework/toolbox.js:811:9
Toolbox.prototype.loadTool/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource:///modules/devtools/framework/toolbox.js:806:16
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:866:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:745:7

*************************
This is because you technically opened a new document by using document.write after the document had finished loading. Using document.write after the document finishes loading is a bad idea.

In any case, the fact that the inspector doesn't show anything is probably a bug that's related to the fact that we end up with a spinner in the tab... After hitting stop/esc the page is inspectable just fine...

Boris, what's going on here? Neither chrome nor ie11 do what we do here. Is there a bug on file on the "document" load never finishing?
Component: Untriaged → Developer Tools: Inspector
Flags: needinfo?(bzbarsky)
> Is there a bug on file on the "document" load never finishing?

Yes, mostly marked invalid, since the load in fact hasn't finished.  For example, the document hasn't fired onload; it will do that when document.close() is called.

If inspector can't handle a document that hasn't fired onload yet, that needs to be fixed in inspector...
Flags: needinfo?(bzbarsky)
OS: Linux → All
filter on CLIMBING SHOES
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Ever confirmed: true
Priority: -- → P3
See Also: → 1277348
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.