Bug 941136 - getUrl not matching webdriver command getCurrentUrl. r=dburns

This commit is contained in:
Andreas Tolfsen 2014-01-21 13:31:31 -05:00
parent 3a75aac6e3
commit 7c1599c82c
3 changed files with 30 additions and 12 deletions

View File

@ -870,10 +870,20 @@ class Marionette(object):
return response
def get_url(self):
'''
Returns the url of the active page in the browser.
'''
response = self._send_message('getUrl', 'value')
"""Get a string representing the current URL.
On Desktop this returns a string representation of the URL of
the current top level browsing context. This is equivalent to
document.location.href.
When in the context of the chrome, this returns the canonical
URL of the current resource.
:returns: string representation of URL
"""
response = self._send_message("getCurrentUrl", "value")
return response
def get_window_type(self):

View File

@ -131,7 +131,7 @@ function startListeners() {
addMessageListenerId("Marionette:actionChain", actionChain);
addMessageListenerId("Marionette:multiAction", multiAction);
addMessageListenerId("Marionette:goUrl", goUrl);
addMessageListenerId("Marionette:getUrl", getUrl);
addMessageListenerId("Marionette:getCurrentUrl", getCurrentUrl);
addMessageListenerId("Marionette:getTitle", getTitle);
addMessageListenerId("Marionette:getPageSource", getPageSource);
addMessageListenerId("Marionette:goBack", goBack);
@ -234,7 +234,7 @@ function deleteSession(msg) {
removeMessageListenerId("Marionette:goUrl", goUrl);
removeMessageListenerId("Marionette:getTitle", getTitle);
removeMessageListenerId("Marionette:getPageSource", getPageSource);
removeMessageListenerId("Marionette:getUrl", getUrl);
removeMessageListenerId("Marionette:getCurrentUrl", getCurrentUrl);
removeMessageListenerId("Marionette:goBack", goBack);
removeMessageListenerId("Marionette:goForward", goForward);
removeMessageListenerId("Marionette:refresh", refresh);
@ -1237,9 +1237,9 @@ function goUrl(msg) {
}
/**
* Get the current URI
* Get URL of the top level browsing context.
*/
function getUrl(msg) {
function getCurrentUrl(msg) {
sendResponse({value: curFrame.location.href}, msg.json.command_id);
}

View File

@ -1079,15 +1079,22 @@ MarionetteServerConnection.prototype = {
},
/**
* Gets current url
* Get a string representing the current URL.
*
* On Desktop this returns a string representation of the URL of the
* current top level browsing context. This is equivalent to
* document.location.href.
*
* When in the context of the chrome, this returns the canonical URL
* of the current resource.
*/
getUrl: function MDA_getUrl() {
getCurrentUrl: function MDA_getCurrentUrl() {
this.command_id = this.getCommandId();
if (this.context == "chrome") {
this.sendResponse(this.getCurrentWindow().location.href, this.command_id);
}
else {
this.sendAsync("getUrl", {}, this.command_id);
this.sendAsync("getCurrentUrl", {}, this.command_id);
}
},
@ -2375,7 +2382,8 @@ MarionetteServerConnection.prototype.requestTypes = {
"getWindowType": MarionetteServerConnection.prototype.getWindowType,
"getPageSource": MarionetteServerConnection.prototype.getPageSource,
"goUrl": MarionetteServerConnection.prototype.goUrl,
"getUrl": MarionetteServerConnection.prototype.getUrl,
"getCurrentUrl": MarionetteServerConnection.prototype.getCurrentUrl,
"getUrl": MarionetteServerConnection.prototype.getCurrentUrl, // deprecated
"goBack": MarionetteServerConnection.prototype.goBack,
"goForward": MarionetteServerConnection.prototype.goForward,
"refresh": MarionetteServerConnection.prototype.refresh,