Restart-less add-ons' scripts do not show up in browser debugger.

VERIFIED FIXED in Firefox 23

Status

P2
normal
VERIFIED FIXED
6 years ago
4 months ago

People

(Reporter: Optimizer, Assigned: past)

Tracking

(Blocks: 1 bug)

unspecified
Firefox 25
x86_64
Windows 7

Firefox Tracking Flags

(firefox22 wontfix, firefox23 verified, firefox24 verified, firefox25 verified)

Details

(Whiteboard: [chrome-debug])

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

6 years ago
Using latest nightly:
1. Install this addon for example : https://addons.mozilla.org/en-US/firefox/addon/ui-enhancer/
2. Open up Browser debugger .
3. None of the script show up. Atleast the bootstrap.js should show up.
(Reporter)

Comment 1

6 years ago
None of its scripts*
Whiteboard: [chrome-debug]
Priority: -- → P2
I have a fix for this.
Assignee: ejpbruel → past
Status: NEW → ASSIGNED
(Reporter)

Comment 3

5 years ago
(In reply to Panos Astithas [:past] from comment #2)
> I have a fix for this.

http://ragemaker.net/images/Happy/happy%20crying.png
Created attachment 771284 [details] [diff] [review]
Properly parse jar: URLs from add-ons

uri.hostPort was throwing for jar: URLs. With this patch I can now step through the code of the add-on in comment 0.
Attachment #771284 - Flags: review?(vporof)
Blocks: 890269
Comment on attachment 771284 [details] [diff] [review]
Properly parse jar: URLs from add-ons

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

::: browser/devtools/debugger/debugger-panes.js
@@ +1068,5 @@
>      }
>  
> +    let { scheme, directory, fileName } = uri;
> +    let hostPort;
> +    // Add-on SDK jar: URLs may cause this to throw.

!!

Any clue why? I don't particularly care, but it'd be nice to explain it here if you know.

@@ +1072,5 @@
> +    // Add-on SDK jar: URLs may cause this to throw.
> +    try {
> +      hostPort = uri.hostPort;
> +    } catch (e) {
> +      dumpn(e);

Could you also add the Cu.report error with an explicit message extravaganza here please?
Attachment #771284 - Flags: review?(vporof) → review+
Created attachment 772013 [details] [diff] [review]
Properly parse jar: URLs from add-ons

(In reply to Victor Porof [:vp] from comment #5)
> > +    // Add-on SDK jar: URLs may cause this to throw.
> 
> !!
> 
> Any clue why? I don't particularly care, but it'd be nice to explain it here
> if you know.

I dug a little deeper and this is apparently by design:
http://mxr.mozilla.org/mozilla-central/source/modules/libjar/nsJARURI.cpp#376

> @@ +1072,5 @@
> > +    // Add-on SDK jar: URLs may cause this to throw.
> > +    try {
> > +      hostPort = uri.hostPort;
> > +    } catch (e) {
> > +      dumpn(e);
> 
> Could you also add the Cu.report error with an explicit message extravaganza
> here please?

Armed with this newfound knowledge I modified the code to avoid the exception instead of catch it.
Attachment #772013 - Flags: review?(vporof)
Comment on attachment 772013 [details] [diff] [review]
Properly parse jar: URLs from add-ons

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

This is the last time I'm being surprised by things not working by design.
Attachment #772013 - Flags: review?(vporof) → review+
Whiteboard: [chrome-debug] → [chrome-debug][land-in-fx-team]
(Reporter)

Comment 8

5 years ago
Can this be uplifted to Aurora (if not beta) ?
(In reply to Girish Sharma [:Optimizer] from comment #8)
> Can this be uplifted to Aurora (if not beta) ?

Yes, I'll ask for approval after the patch lands.
Attachment #771284 - Attachment is obsolete: true
https://hg.mozilla.org/integration/fx-team/rev/18d601eff8b6
Whiteboard: [chrome-debug][land-in-fx-team] → [chrome-debug][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/18d601eff8b6
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Whiteboard: [chrome-debug][fixed-in-fx-team] → [chrome-debug]
Target Milestone: --- → Firefox 25
Comment on attachment 772013 [details] [diff] [review]
Properly parse jar: URLs from add-ons

[Approval Request Comment]
Bug caused by (feature/regressing bug #): probably bug 812083
User impact if declined: add-on developers won't be able to debug their add-ons using the debugger
Testing completed (on m-c, etc.): fx-team and m-c
Risk to taking this patch (and alternatives if risky): minor risk, this is a tiny patch to a feature targeting developers
String or IDL/UUID changes made by this patch: none
Attachment #772013 - Flags: approval-mozilla-aurora?
Comment on attachment 772013 [details] [diff] [review]
Properly parse jar: URLs from add-ons

[Approval Request Comment]
Bug caused by (feature/regressing bug #): probably bug 812083
User impact if declined: add-on developers won't be able to debug their add-ons using the debugger
Testing completed (on m-c, etc.): fx-team and m-c
Risk to taking this patch (and alternatives if risky): minor risk, this is a tiny patch to a feature targeting developers
String or IDL/UUID changes made by this patch: none
Attachment #772013 - Flags: approval-mozilla-beta?
Comment on attachment 772013 [details] [diff] [review]
Properly parse jar: URLs from add-ons

low risk enough to land in aurora & will help developers.Approving on aurora
Attachment #772013 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
https://hg.mozilla.org/releases/mozilla-aurora/rev/d78e01f88bbe
status-firefox22: --- → wontfix
status-firefox23: --- → affected
status-firefox24: --- → fixed
status-firefox25: --- → fixed
Attachment #772013 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment on attachment 772013 [details] [diff] [review]
Properly parse jar: URLs from add-ons

nsIURI in general does not make any garantees about the host/hostPort getters succeeding, so it's not just JAR URIs that can cause this to throw. E.g. data: URIs (nsSimpleURI) will have similar behavior.

A more robust check would be to check instanceof nsIStandardURL, rather than checking "scheme".
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #16)
> nsIURI in general does not make any garantees about the host/hostPort
> getters succeeding, so it's not just JAR URIs that can cause this to throw.
> E.g. data: URIs (nsSimpleURI) will have similar behavior.
> 
> A more robust check would be to check instanceof nsIStandardURL, rather than
> checking "scheme".

Good point, filed bug 892368 for this.
Keywords: verifyme

Comment 19

5 years ago
How can I get the add-on scrips displayed in the debugger? I don't get them with the steps in comment 0, so I suppose there are details missing there.

Tried on Firefox 23 beta 9: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0.
Flags: needinfo?(past)
(Reporter)

Comment 20

5 years ago
I think the issue you are facing is that there are two bootstrap.js files, i.e. you have two restartless addons, and thus the browser debugger only shows one due to bug 890269 .
Which add-on did you install Ioana? The one mentioned in comment 0 or another one? This one (Location Bar Enhancer) appears fine for me. Look for a pref.js or a helper.js file.
Flags: needinfo?(past)

Comment 22

5 years ago
(In reply to Panos Astithas [:past] from comment #21)
> Which add-on did you install Ioana? The one mentioned in comment 0 or
> another one? This one (Location Bar Enhancer) appears fine for me. Look for
> a pref.js or a helper.js file.

That's the one I installed (the only add-on I have on this profile) and I see no scripts. Am I missing something in the steps? This is what I do:

1. Launch Firefox.
2. Install the Location Bar Enhancer add-on.
3. Press Ctrl+Shift+S.
(In reply to Ioana Budnar, QA [:ioana] from comment #22)
> 3. Press Ctrl+Shift+S.

That starts the content debugger. You need to launch the Browser Debugger from the Web Developer menu. Check the Enable Remote Debugging and Enable Chrome Debugging options first in the toolbox options panel.

Comment 24

5 years ago
Thanks for the help, guys :) I did reproduce the issue on Firefox 22 and verified it on 23:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0 (20130725195523)

bootstrap.js, helper.js and pref.js appear in the Firefox 23 debugger.
status-firefox23: fixed → verified
QA Contact: ioana.budnar

Comment 25

5 years ago
Verified as fixed on Firefox 24 and 25:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Status: RESOLVED → VERIFIED
status-firefox24: fixed → verified
status-firefox25: fixed → verified
Keywords: verifyme

Updated

4 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.