Open Bug 484266 Opened 16 years ago Updated 2 years ago

unknown protocol alerts should not happen when the url is not manually entered in the address bar

Categories

(Core :: Networking, defect, P5)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: sephr, Unassigned)

References

()

Details

(Whiteboard: [necko-would-take])

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.7) Gecko/2009030423 Ubuntu/8.10 (intrepid) Firefox/3.0.7 GTB5 Build Identifier: try..catch statements should suppress unknown protocol alerts. This is essential for detecting if a browser supports a protocol. For example, at the included URL, a script tries to detect if the browser supports a protocol when clicking on a link that uses a possibly-known "eli-testcase:" protocol. If the browser has an association for the protocol, the link works fine. On the other hand, if it doesn't, an error pops up in an alert that says "Firefox doesn't know how to open this address, because the protocol (eli-testcase) isn't associated with any program." This also throws a normal error, which the script detects in a try..catch statement and tries to install the protocol in the browser. Reproducible: Always Steps to Reproduce: 1. Make a function for detecting if a browser doesn't support a protocol. 2. Make the function use a try..catch statement to detect if the browser supports the protocol. 3. Make a link like <a href="foo:bar" onclick="return tryProtocol(this.href, foo_protocol_descriptor_data)"></a> Actual Results: User has protocol already associated: Link works fine Otherwise: User gets an error modal dialog pop up and has to click ok. Then the user is prompted that code.eligrey.com is trying to install a protocol and installs it Expected Results: Same thing, but in the second case, there is no alert modal dialog. The following is the code I'm using and expecting to suppress the alert. JavaScript: var eliTestcaseProtocol = ["eli-testcase","http://code.eligrey.com/testcases/testcase-protocol-handler.php?uri=%s","code.eligrey.com Testcase Viewer"]; function tryProtocol(uri, protocolData) { try { location.href = uri } catch (e) { if ( Object.prototype.toString.call(protocolData) == "[object Array]" ) navigator.registerProtocolHandler.apply(navigator, protocolData) } return false } Link: <a href="eli-testcase:firefox/" onclick="return tryProtocol(this.href, eliTestcaseProtocol)">View Firefox Testcases</a>
Summary: try..catch statements should suppress unknown protocol alerts → unknown protocol alerts should be suppressed in try..catch statements
Actually, it doesn't really make any sense to even give the alert at all. A program can give an alert itself if it wants to after catching the error, so I suggest this functionality be removed. It can't be that hard to remove the unknown protocol alert and only show the alert if the user inputs an URI in the location bar and an invalid protocol error is thrown.
Summary: unknown protocol alerts should be suppressed in try..catch statements → unknown protocol alerts should not happen when the url is progmatically changed
Summary: unknown protocol alerts should not happen when the url is progmatically changed → unknown protocol alerts should not happen when the url is not manually entered in the address bar
Whiteboard: [necko-would-take]
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.