Closed Bug 349151 Opened 20 years ago Closed 15 years ago

The simple-uri is incompatible with FF < 2.0, and causes an exception when attempting to createInstance(nsIURI).

Categories

(Core :: Networking, defect)

1.8 Branch
x86
Linux
defect
Not set
major

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: kalle, Unassigned)

References

()

Details

(Whiteboard: [closeme 2010-09-15])

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.5) Gecko/20060731 Ubuntu/dapper-security Firefox/1.5.0.5 Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1 The URL demonstrating the problem is a tutorial which a lot of people use to create URL protocols. The method is no longer functional under FF 2.0, and causes a crash akin to: Error: [Exception... "Component returned failure code: 0x804b000a [nsIURI.spec]" nsresult: "0x804b000a (<unknown>)" location: "JS frame :: file:///home/me/.mozilla/firefox/whatever.default/extensions/lalalala/components/my-service.js :: anonymous :: line 84" data: no] Source File: file:///home/me/.mozilla/firefox/whatever.default/extensions/lalalala/components/my-service.js Line: 84 Reproducible: Always Steps to Reproduce: 1. Create an extension based on the tutorial. 2. Install and restart. 3. Try. Actual Results: Exception as mentioned in details. Expected Results: The JS code should handle the protocol URI.
Component: General → Networking
Product: Firefox → Core
QA Contact: general → networking
Version: unspecified → 1.8 Branch
How does the spec look that you are trying to set?
I'm not sure what you mean by spec, but the project itself is Open Source, with an SVN repository at http://svn.enrogue.com/zealotry/ The file in which an exception is thrown is http://svn.enrogue.com/zealotry/components/zealotry-service.js The line # is #84, and the function in question goes: --- 82 newURI: function(spec, charset, baseURI) 83 { 84 var uri = Components.classes[kSIMPLEURI_CONTRACTID].createInstance(nsIURI); 85 uri.spec = spec; 86 return uri; 87 }, --- The constants used in that are: const kSIMPLEURI_CONTRACTID = "@mozilla.org/network/simple-uri;1"; const nsIURI = Components.interfaces.nsIURI; (found in the same file) If you want to actually try the XPI, go to http://zealotry.enrogue.com/ and install the stable or dev version, and then (after restarting) go to e.g. zealotry:foo@mv -- a blank window will appear, and the JS console will have the exception. In the FF < 2.0 versions, the same URL will open 3 panes (left, center, right) which all point to the login screen for Skotos. Possibly not very useful, but who knows. Hope that was what you were asking about. :)
85 uri.spec = spec; what is |spec| (the variable on the RHS) equal to when this fails?
Ah, THAT'S what you're asking for. Sorry about that. :) I added a dump("spec=" + spec + "\n"); at #85 and got the following on the console: ---- spec=zealotry:kalle@cm spec=zealotry:kalle@cm spec=zealotry:kalle@cm spec=my-world.js spec=zealotry:kalle@cm ---- Which is mighty odd as I only typed in the URL once. What's also mighty odd is the "my-world.js" deal, which is a file I have in the code itself. Sounds like there's some bug that FF 1.5 accepts but FF 2.0 trips over. If so, it's mine to fix. I'll look into it.
After I wrapped the code in a try/catch case, the following is the dumped output. Weird as heck! --- spec=zealotry:kalle@cm spec=zealotry:kalle@cm spec=zealotry:kalle@cm spec=my-world.js spec=init.js spec=jslib.js spec=filesystem.js spec=file.js spec=utils.js spec=md5.js spec=connection-xpcom.js spec=network.js spec=client.js spec=macro.js spec=zealotry.js spec=zealotry:kalle@cm spec=zealotry:kalle@cm spec=zealotry:kalle@cm spec=zealotry:kalle@cm --- The exact samed code when executed in FF 1.5 shows this: --- spec=zealotry:kalle@mv spec=zealotry:kalle@mv --- That is followed by the standard jslib output that begins with: --- Welcome to jslib version 0.1.50 Global Constants: JS_LIBRARY jslib --- I'll dig more.
I failed to mention... by catching the exception, the issue seems to have moved on, so I suppose it's safe to say that closing this bug is okay. Though I'm still clueless as to why the behavior changed in FF 2.0, and the code is still completely malfunctional .. the function that should "pick up from there" (onMainLoad()) claims to be undefined. This all works fine under 1.5, so I can only presume some underlying issue made changing how it worked necessary.
> spec=my-world.js What is the third argument of newURI in cases like this?
Code: dump("spec=" + spec + ";baseURI=" + baseURI + "\n"); Gives: --- spec=zealotry:kalle@cm;baseURI=null spec=zealotry:kalle@cm;baseURI=null spec=zealotry:kalle@cm;baseURI=null newChannel([xpconnect wrapped nsIURI]) spec=my-world.js;baseURI=[xpconnect wrapped nsIURI] spec=init.js;baseURI=[xpconnect wrapped nsIURI] spec=jslib.js;baseURI=[xpconnect wrapped nsIURI] spec=filesystem.js;baseURI=[xpconnect wrapped nsIURI] spec=file.js;baseURI=[xpconnect wrapped nsIURI] spec=utils.js;baseURI=[xpconnect wrapped nsIURI] spec=md5.js;baseURI=[xpconnect wrapped nsIURI] spec=connection-xpcom.js;baseURI=[xpconnect wrapped nsIURI] spec=network.js;baseURI=[xpconnect wrapped nsIURI] spec=client.js;baseURI=[xpconnect wrapped nsIURI] spec=macro.js;baseURI=[xpconnect wrapped nsIURI] spec=zealotry.js;baseURI=[xpconnect wrapped nsIURI] ---
so is the bug that the protocol handler gets called despite the URI_NORELATIVE flag?
The bug is that the code crashes on FF 2, and works fine on FF < 2.
s/crashes/throws exception/
... Calling setSpec with something like "my-world.js" is _supposed_ to throw an exception, because that's not a valid URI. That newURI is called with such a string is (in itself) not a bug when a base URI is also provided. Therefore I can only assume that the bug is that newURI is called at all, and presumably the URI_NORELATIVE flag is supposed to prevent that.
Fair enough. All I know is that FF < 2 works, and FF = 2 doesn't, and the code is the same. ;)
hm, it doesn't seem to be related to the URI_NORELATIVE flag, that was ignored in older releases as well... guess I need to try the actual XPI.
Do you still see this problem using the most recent versions of all components? If you do not, please close the bug with resolution set to WORKSFORME. If you do, please comment in the bug.
Whiteboard: [closeme 2010-09-15]
Closing since now after whiteboard closeme date and no reply to last comment. Please reopen/comment with further info, if you still see this issue with Firefox 3.6.13 or later in safe mode: http://support.mozilla.com/kb/Safe+Mode If you wish, you can also try to reproduce in Firefox 4 Beta 8 or later: http://www.mozilla.com/en-US/firefox/all-beta.html
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.