mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 941145 - Rename goUrl to get for WebDriver compatibility. r=dburns
This commit is contained in:
parent
9ab8425fc1
commit
9397f67d75
@ -913,12 +913,34 @@ class Marionette(object):
|
||||
return response
|
||||
|
||||
def navigate(self, url):
|
||||
'''
|
||||
Causes the browser to navigate to the specified url.
|
||||
"""Navigate to to given URL.
|
||||
|
||||
This will follow redirects issued by the server. When the
|
||||
method returns is based on the page load strategy that the
|
||||
user has selected.
|
||||
|
||||
Documents that contain a META tag with the "http-equiv"
|
||||
attribute set to "refresh" will return if the timeout is
|
||||
greater than 1 second and the other criteria for determining
|
||||
whether a page is loaded are met. When the refresh period is
|
||||
1 second or less and the page load strategy is "normal" or
|
||||
"conservative", it will wait for the page to complete loading
|
||||
before returning.
|
||||
|
||||
If any modal dialog box, such as those opened on
|
||||
window.onbeforeunload or window.alert, is opened at any point
|
||||
in the page load, it will return immediately.
|
||||
|
||||
If a 401 response is seen by the browser, it will return
|
||||
immediately. That is, if BASIC, DIGEST, NTLM or similar
|
||||
authentication is required, the page load is assumed to be
|
||||
complete. This does not include FORM-based authentication.
|
||||
|
||||
:param url: The url to navigate to.
|
||||
'''
|
||||
response = self._send_message('goUrl', 'ok', url=url)
|
||||
|
||||
"""
|
||||
|
||||
response = self._send_message("get", "ok", url=url)
|
||||
return response
|
||||
|
||||
def timeouts(self, timeout_type, ms):
|
||||
|
@ -130,7 +130,7 @@ function startListeners() {
|
||||
addMessageListenerId("Marionette:singleTap", singleTap);
|
||||
addMessageListenerId("Marionette:actionChain", actionChain);
|
||||
addMessageListenerId("Marionette:multiAction", multiAction);
|
||||
addMessageListenerId("Marionette:goUrl", goUrl);
|
||||
addMessageListenerId("Marionette:get", get);
|
||||
addMessageListenerId("Marionette:getCurrentUrl", getCurrentUrl);
|
||||
addMessageListenerId("Marionette:getTitle", getTitle);
|
||||
addMessageListenerId("Marionette:getPageSource", getPageSource);
|
||||
@ -231,7 +231,7 @@ function deleteSession(msg) {
|
||||
removeMessageListenerId("Marionette:singleTap", singleTap);
|
||||
removeMessageListenerId("Marionette:actionChain", actionChain);
|
||||
removeMessageListenerId("Marionette:multiAction", multiAction);
|
||||
removeMessageListenerId("Marionette:goUrl", goUrl);
|
||||
removeMessageListenerId("Marionette:get", get);
|
||||
removeMessageListenerId("Marionette:getTitle", getTitle);
|
||||
removeMessageListenerId("Marionette:getPageSource", getPageSource);
|
||||
removeMessageListenerId("Marionette:getCurrentUrl", getCurrentUrl);
|
||||
@ -1183,10 +1183,12 @@ function multiAction(msg) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigate to URI. Handles the case where we navigate within an iframe.
|
||||
* All other navigation is handled by the server (in chrome space).
|
||||
* Navigate to the given URL. The operation will be performed on the
|
||||
* current browser context, and handles the case where we navigate
|
||||
* within an iframe. All other navigation is handled by the server
|
||||
* (in chrome space).
|
||||
*/
|
||||
function goUrl(msg) {
|
||||
function get(msg) {
|
||||
let command_id = msg.json.command_id;
|
||||
|
||||
let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
@ -1202,7 +1204,8 @@ function goUrl(msg) {
|
||||
removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
sendOk(command_id);
|
||||
}
|
||||
else if (curFrame.document.readyState == "interactive" && errorRegex.exec(curFrame.document.baseURI)){
|
||||
else if (curFrame.document.readyState == "interactive" &&
|
||||
errorRegex.exec(curFrame.document.baseURI)) {
|
||||
removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
sendError("Error loading page", 13, null, command_id);
|
||||
}
|
||||
@ -1212,12 +1215,13 @@ function goUrl(msg) {
|
||||
}
|
||||
else {
|
||||
removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
sendError("Error loading page, timed out (checkLoad)", 21, null, command_id);
|
||||
sendError("Error loading page, timed out (checkLoad)", 21, null,
|
||||
command_id);
|
||||
}
|
||||
}
|
||||
// Prevent DOMContentLoaded events from frames from invoking this code,
|
||||
// unless the event is coming from the frame associated with the current
|
||||
// window (i.e., someone has used switch_to_frame).
|
||||
// Prevent DOMContentLoaded events from frames from invoking this
|
||||
// code, unless the event is coming from the frame associated with
|
||||
// the current window (i.e. someone has used switch_to_frame).
|
||||
let onDOMContentLoaded = function onDOMContentLoaded(event) {
|
||||
if (!event.originalTarget.defaultView.frameElement ||
|
||||
event.originalTarget.defaultView.frameElement == curFrame.frameElement) {
|
||||
@ -1227,7 +1231,8 @@ function goUrl(msg) {
|
||||
|
||||
function timerFunc() {
|
||||
removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
sendError("Error loading page, timed out (onDOMContentLoaded)", 21, null, command_id);
|
||||
sendError("Error loading page, timed out (onDOMContentLoaded)", 21,
|
||||
null, command_id);
|
||||
}
|
||||
if (msg.json.pageTimeout != null) {
|
||||
checkTimer.initWithCallback(timerFunc, msg.json.pageTimeout, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
|
@ -1040,17 +1040,37 @@ MarionetteServerConnection.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Navigates to given url
|
||||
* Navigate to to given URL.
|
||||
*
|
||||
* @param object aRequest
|
||||
* 'url' member holds the url to navigate to
|
||||
* This will follow redirects issued by the server. When the method
|
||||
* returns is based on the page load strategy that the user has
|
||||
* selected.
|
||||
*
|
||||
* Documents that contain a META tag with the "http-equiv" attribute
|
||||
* set to "refresh" will return if the timeout is greater than 1
|
||||
* second and the other criteria for determining whether a page is
|
||||
* loaded are met. When the refresh period is 1 second or less and
|
||||
* the page load strategy is "normal" or "conservative", it will
|
||||
* wait for the page to complete loading before returning.
|
||||
*
|
||||
* If any modal dialog box, such as those opened on
|
||||
* window.onbeforeunload or window.alert, is opened at any point in
|
||||
* the page load, it will return immediately.
|
||||
*
|
||||
* If a 401 response is seen by the browser, it will return
|
||||
* immediately. That is, if BASIC, DIGEST, NTLM or similar
|
||||
* authentication is required, the page load is assumed to be
|
||||
* complete. This does not include FORM-based authentication.
|
||||
*
|
||||
* @param object aRequest where <code>url</code> property holds the
|
||||
* URL to navigate to
|
||||
*/
|
||||
goUrl: function MDA_goUrl(aRequest) {
|
||||
get: function MDA_get(aRequest) {
|
||||
let command_id = this.command_id = this.getCommandId();
|
||||
if (this.context != "chrome") {
|
||||
aRequest.command_id = command_id;
|
||||
aRequest.parameters.pageTimeout = this.pageTimeout;
|
||||
this.sendAsync("goUrl", aRequest.parameters, command_id);
|
||||
this.sendAsync("get", aRequest.parameters, command_id);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1058,6 +1078,7 @@ MarionetteServerConnection.prototype = {
|
||||
let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
let start = new Date().getTime();
|
||||
let end = null;
|
||||
|
||||
function checkLoad() {
|
||||
end = new Date().getTime();
|
||||
let elapse = end - start;
|
||||
@ -1074,7 +1095,7 @@ MarionetteServerConnection.prototype = {
|
||||
sendError("Error loading page", 13, null, command_id);
|
||||
return;
|
||||
}
|
||||
}//end
|
||||
}
|
||||
checkTimer.initWithCallback(checkLoad, 100, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
},
|
||||
|
||||
@ -2402,7 +2423,8 @@ MarionetteServerConnection.prototype.requestTypes = {
|
||||
"getTitle": MarionetteServerConnection.prototype.getTitle,
|
||||
"getWindowType": MarionetteServerConnection.prototype.getWindowType,
|
||||
"getPageSource": MarionetteServerConnection.prototype.getPageSource,
|
||||
"goUrl": MarionetteServerConnection.prototype.goUrl,
|
||||
"get": MarionetteServerConnection.prototype.get,
|
||||
"goUrl": MarionetteServerConnection.prototype.get, // deprecated
|
||||
"getCurrentUrl": MarionetteServerConnection.prototype.getCurrentUrl,
|
||||
"getUrl": MarionetteServerConnection.prototype.getCurrentUrl, // deprecated
|
||||
"goBack": MarionetteServerConnection.prototype.goBack,
|
||||
|
Loading…
Reference in New Issue
Block a user