Closed Bug 930647 Opened 11 years ago Closed 5 years ago

Console doesn't report missing scripts if referenced by file: URLs

Categories

(DevTools :: Console, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: jimb, Unassigned)

Details

When I load a page via a file: URL, if that page references a script that doesn't exist, I don't get any error in the console.

To reproduce, create a .html file like this:

<head>
  <script src="mootz.js"></script>
</head>
<body>
  Hi!
</body>

assuming there is no file named "mootz.js" in the same directory. Then, visit the file via a 'file:' url, open the web console, and hit reload. I, at least, get a complaint about not having specified a character set, but no mention that it couldn't load "mootz.js".
Thanks for the report Jim!

Jonas, we use an nsIWebProgressListener to track file URI loads in the web console, in onStateChange if the request is an imgIRequest or an nsIChannel, then we check the URI scheme (if it's "file"). [1] This works well but we are not notified when a file is not found.

What kind of listener/observer do we need to use for tracking file:// load failures? Thanks!

[1] See CPL__checkFileActivity() in https://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/webconsole/utils.js#2528
Flags: needinfo?(jonas)
Priority: -- → P3
Sorry, I don't know. I suggest asking someone on the network team.
Flags: needinfo?(jonas)
Product: Firefox → DevTools

This looks fixed, I tried the STR from Comment 0 and got the following warning in the console:

Loading failed for the <script> with source “file:///Users/nchevobbe/Desktop/mootz.js”. test-file.html:2:1
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.