Closed Bug 1261860 Opened 8 years ago Closed 8 years ago

NS_ERROR_FAILURE when accessing nsIURI.hostPort in debugger/utils.js :: SourceUtils.trimUrl :: line 318

Categories

(DevTools :: Debugger, defect)

defect
Not set
normal

Tracking

(firefox48 fixed)

RESOLVED FIXED
Firefox 48
Tracking Status
firefox48 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

Details

Attachments

(1 file)

We can't debug most devtools codebase in packaged builds because of this exception.
You get many of these exception while opening the browser toolbox and opening devtools.
It fails with jar: URLs like this one:
jar:file:///mnt/desktop/gecko/firefox/browser/features/loop@mozilla.org.xpi!/bootstrap.js
Attached patch patch v1Splinter Review
I imagine that's a somewhat recent regression.
Feel free to link to the related bug.
Attachment #8737814 - Flags: review?(jlong)
There's no regression that I can think of. That code hasn't been touched in a long time (although I haven't checked with `git blame`. What do you mean packaged builds? Maybe we just haven't tried that for a long time?
I mean the package we distribute. Like nightly builds. It is slightly different from local builds run via ./mach run. Files are actually packaged into a jar file and ends up possibly having different behavior url.

But the exception I'm hitting is related to some other resources. It isn't directly related to devtools, but Loop. The addon files is in a jar and end up crashing the debugger badly, we loss more resources than just the offenring addon ones.
Ah. I believe Loop has their own workflow for developing it as a normal page, so they haven't hit this. And other addons must not be packaged in a way this hits this either?

I say this because this code has not been touched for a long time, so it's not a new issue. Definitely worth fixing though.
Comment on attachment 8737814 [details] [diff] [review]
patch v1

Review of attachment 8737814 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for fixing this! I had a question before I r+ it

::: devtools/client/debugger/utils.js
@@ +316,5 @@
>      // Prepend the hostname and port number.
>      if (aSeq == 4) {
> +      let host;
> +      try {
> +        // Bug 1261860: jar: URLs throw when accessing hostPost

type: `hostPort`

@@ +323,2 @@
>        if (host) {
>          return this.trimUrl(aUrl, host + "/" + aLabel, aSeq + 1);

Won't `host` be undefined here and print out "undefined"?
(In reply to James Long (:jlongster) from comment #7)
> @@ +323,2 @@
> >        if (host) {
> >          return this.trimUrl(aUrl, host + "/" + aLabel, aSeq + 1);
> 
> Won't `host` be undefined here and print out "undefined"?

There is the `if (host)` one line before?
You're exactly right, I missed that :) I was trying to figure out how those URLs are treated now. But I'll take your word that it looks fine in the source pane.
Comment on attachment 8737814 [details] [diff] [review]
patch v1

Review of attachment 8737814 [details] [diff] [review]:
-----------------------------------------------------------------

Don't forget to assign this bug to yourself
Attachment #8737814 - Flags: review?(jlong) → review+
Assignee: nobody → poirot.alex
https://hg.mozilla.org/integration/fx-team/rev/4d29405a6615cdcc207dacd4d8b7e8f89ac3af28
Bug 1261860 - Prevent exception in debugger UI when processing script with jar: URLs. r=jlongster
https://hg.mozilla.org/mozilla-central/rev/4d29405a6615
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: