Closed Bug 1271294 Opened 8 years ago Closed 6 years ago

Attempting to navigate to empty string should throw an exception

Categories

(Remote Protocol :: Marionette, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: davehunt, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, pi-marionette-server, Whiteboard: [lang=js])

It is currently possible to call marionette.navigate with an empty string. When doing so, the empty string appears to be added to the current URL. When there is no current URL (fresh browser instance with no first-run) then an empty string loads chrome://browser/content/browser.xul

In [1]: from marionette_driver.marionette import Marionette
In [2]: m = Marionette(bin='/Applications/Firefox.app/Contents/MacOS/firefox-bin', prefs={'browser.startup.homepage_override.mstone': 'ignore'})
In [3]: m.start_session()
In [4]: m.get_url()
Out[4]: u'about:blank'
In [5]: m.navigate('')
In [6]: m.get_url()
Out[6]: u'chrome://browser/content/browser.xul'

It's also possible to pass None as the argument, in which case the string 'null' is appended to the URL. According to :AutomatedTester these two values should throw an exception.
The above code should all be in content scope. So it's interesting that get_url() returns the chrome window URL out of chrome scope!
This is related to the discussion jgraham raised on the WG mailing list the other day: https://lists.w3.org/Archives/Public/public-browser-tools-testing/2016AprJun/0033.html
So far there seems to be consensus we should return an error on strings that are malformed URLs.  It’s not been decided what error we should return yet.
Is there consensus not to treat the empty string as a relative url, where supported by the underlying scheme)? So Go("") would be like Reload() for http[s].
(In reply to James Graham [:jgraham] from comment #4)

> Is there consensus not to treat the empty string as a relative
> url, where supported by the underlying scheme)? So Go("") would be
> like Reload() for http[s].

The final decision from the WG was to not allow navigation to
relative URLs, unfortunately.

However, I believe this bug is still relevant.
Blocks: webdriver
OS: Unspecified → All
Priority: -- → P2
Hardware: Unspecified → All
Version: unspecified → Trunk
Mentor: ato
Keywords: good-first-bug
Whiteboard: [lang=js]
Actually we throw an exception here:

> TEST-UNEXPECTED-ERROR | _a/test_minimized.py TestMinimizedTestCase.test | InvalidArgumentException: Malformed URL:  is not a valid URL.

If that is good enough as what I think, we should close this bug.
You’re right.  Since this bug was filed two years ago, the navigation
algorithm underwent an overhaul and now passes the string URL input
from the client to the URL parser before navigation.  That error is fine.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.