Inspector doesn't give code entered by JavaScript

NEW
Unassigned

Status

()

Firefox
Developer Tools: Inspector
P3
normal
4 years ago
2 years ago

People

(Reporter: Charlie, Unassigned)

Tracking

33 Branch
x86_64
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
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.
(Reporter)

Comment 1

4 years ago
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

*************************
(Reporter)

Comment 2

4 years ago
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)

Updated

3 years ago
OS: Linux → All
filter on CLIMBING SHOES
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Ever confirmed: true
Priority: -- → P3
See Also: → bug 1277348
You need to log in before you can comment on or make changes to this bug.