Closed Bug 1664881 Opened 4 years ago Closed 3 years ago

"WebDriver:GetCurrentURL" has to retrieve the visible URL via the currentWindowGlobal

Categories

(Remote Protocol :: Marionette, task, P3)

Default
task

Tracking

(Fission Milestone:M7a, firefox88 fixed)

RESOLVED FIXED
88 Branch
Fission Milestone M7a
Tracking Status
firefox88 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Blocks 1 open bug)

Details

(Keywords: memory-footprint, Whiteboard: [marionette-fission-reserve])

Attachments

(1 file)

The currentWindowGlobal only syncs the documentURI at the moment, but not the visible URL. As such to get the current URL for the content process a call to the framescript or actor needs to be done. The workaround was added by bug 1663641.

This should be reverted to directly access the currentWindowGlobal.visibleURL once bug 1663757 has been done.

Severity: -- → S3
Priority: -- → P3
Blocks: 1664968
Fission Milestone: --- → M7
Blocks: 1532589
Whiteboard: [marionette-fission-mvp]

Adding some AWSY logs that might be relevant in response to https://bugzilla.mozilla.org/show_bug.cgi?id=1534582#c16

With modifications to make AWSY work with Marionette JSWindowActors, run

 ./mach awsy-test --gecko-log=- -vv --setpref marionette.actors.enabled=true`

After a few page loads (it varies how many) , we get:

AbortError: Actor 'MarionetteFrame' destroyed before query 'MarionetteFrameParent:getCurrentUrl' was resolved

Here's a successful page load:

1:24.31 INFO switching to tab
1602682113766	Marionette	DEBUG	2 <- [1,87,null,{"value":null}]
1602682113766	Marionette	DEBUG	2 -> [0,88,"WebDriver:SetTimeouts",{"script":30000}]
1602682113767	Marionette	DEBUG	2 <- [1,88,null,{"value":null}]
1602682113767	Marionette	DEBUG	2 -> [0,89,"WebDriver:GetWindowHandles",{}]
1602682113767	Marionette	DEBUG	2 <- [1,89,null,["9","38","40","42","44","46"]]
1602682113768	Marionette	DEBUG	2 -> [0,90,"WebDriver:GetWindowHandles",{}]
1602682113768	Marionette	DEBUG	2 <- [1,90,null,["9","38","40","42","44","46"]]
 1:24.31 INFO switched to tab
1602682113768	Marionette	DEBUG	2 -> [0,91,"WebDriver:SwitchToWindow",{"handle":"46","focus":true}]
1602682113769	Marionette	DEBUG	2 <- [1,91,null,{"value":null}]
1602682113769	Marionette	DEBUG	2 -> [0,92,"Marionette:GetContext",{}]
1602682113769	Marionette	DEBUG	2 <- [1,92,null,{"value":"chrome"}]
1602682113769	Marionette	DEBUG	2 -> [0,93,"Marionette:SetContext",{"value":"content"}}
 1:24.31 INFO loading http://localhost:8006/page_load_test/tp5n/msn.com/www.msn.com/index.html
1602682113771	Marionette	DEBUG	2 <- [1,93,null,{"value":null}]
1602682113772	Marionette	DEBUG	2 -> [0,94,"WebDriver:Navigate",{"url":"http://localhost:8006/page_load_test/tp5n/msn.com/www.msn.com/index.html"}]
1602682113950	Marionette	TRACE	[46] Frame script loaded
1602682113952	Marionette	TRACE	Detected remoteness change. New browsing context: 46
1602682113956	Marionette	TRACE	[46] Child actor created for window id 35
1602682113956	Marionette	TRACE	[46] Parent actor created
1602682113962	Marionette	TRACE	calling getCurrentURL
1602682113963	Marionette	TRACE	MarionetteFrameChild.getCurrentURL(): browsing context id 46
1602682113963	Marionette	TRACE	this.contentWindow.location.href about:blank
1602682113963	Marionette	TRACE	returned from getCurrentURL
1602682113964	Marionette	TRACE	Received message pagehide for about:blank
1602682113967	Marionette	TRACE	[46] Child actor created for window id 17179869185
1602682113970	Marionette	TRACE	Received message beforeunload for about:blank
1602682113971	Marionette	TRACE	[46] Parent actor created
1602682113972	Marionette	TRACE	Received message DOMContentLoaded for about:blank
1602682113974	Marionette	TRACE	Received message pagehide for about:blank
JavaScript error: http://localhost:8006/page_load_test/tp5n/msn.com/www.msn.com/index.html, line 13: SyntaxError: expected expression, got ':'
1602682114076	Marionette	TRACE	Received message DOMContentLoaded for http://localhost:8006/page_load_test/tp5n/msn.com/www.msn.com/index.html
1602682114077	Marionette	TRACE	[46] Child actor created for window id 17179869186
1602682114078	Marionette	TRACE	[46] Parent actor created
 1:24.63 INFO loaded!
1602682114093	Marionette	TRACE	Received message pageshow for http://localhost:8006/page_load_test/tp5n/msn.com/www.msn.com/index.html
1602682114094	Marionette	DEBUG	2 <- [1,94,null,{"value":null}]
1602682114095	Marionette	DEBUG	2 -> [0,95,"Marionette:SetContext",{"value":"chrome"}]
1602682114095	Marionette	DEBUG	2 <- [1,95,null,{"value":null}]
1602682114102	Marionette	DEBUG	2 -> [0,96,"WebDriver:GetWindowHandles",{}]
1602682114102	Marionette	DEBUG	2 <- [1,96,null,["9","38","40","42","44","46"]]
1602682124111	Marionette	DEBUG	2 -> [0,97,"WebDriver:PerformActions",{"actions":[{"type":"key","id":"keyboard_id","actions":[{"type":"keyDown","value":""},{"type":"keyUp","value":""}]}]}]
1602682124117	Marionette	DEBUG	2 <- [1,97,null,{"value":null}]
1602682124119	Marionette	DEBUG	2 -> [0,98,"WebDriver:ReleaseActions",{}]
1602682124120	Marionette	DEBUG	2 <- [1,98,null,{"value":null}]
1602682124121	Marionette	DEBUG	2 -> [0,99,"WebDriver:GetWindowHandles",{}]
1602682124122	Marionette	DEBUG	2 <- [1,99,null,["9","38","40","42","44","46"]]
1602682124123	Marionette	DEBUG	2 -> [0,100,"WebDriver:GetTimeouts",{}]
1602682124124	Marionette	DEBUG	2 <- [1,100,null,{"implicit":0,"pageLoad":300000,"script":30000}]
1602682124125	Marionette	DEBUG	2 -> [0,101,"WebDriver:SetTimeouts",{"script":60000}]
1602682124126	Marionette	DEBUG	2 <- [1,101,null,{"value":null}]
1602682124128	Marionette	DEBUG	2 -> [0,102,"WebDriver:ExecuteScript",{"script":"gBrowser.loadOneTab(\"about:blank\", {\n                inBackground: false,\n    ...            });","newSandbox":true,"args":[],"filename":"testing/awsy/awsy/awsy_test_case.py","sandbox":"default","line":329}

Here's a broken page load:

 1:34.68 INFO switching to tab
 1:34.68 INFO switched to tab
 1:34.68 INFO loading http://localhost:8007/page_load_test/tp5n/yahoo.co.jp/www.yahoo.co.jp/index.html
1602682124139	Marionette	DEBUG	2 <- [1,102,null,{"value":null}]
1602682124139	Marionette	DEBUG	2 -> [0,103,"WebDriver:SetTimeouts",{"script":30000}]
1602682124140	Marionette	DEBUG	2 <- [1,103,null,{"value":null}]
1602682124140	Marionette	DEBUG	2 -> [0,104,"WebDriver:GetWindowHandles",{}]
1602682124140	Marionette	DEBUG	2 <- [1,104,null,["9","38","40","42","44","46","48"]]
1602682124140	Marionette	DEBUG	2 -> [0,105,"WebDriver:GetWindowHandles",{}]
1602682124141	Marionette	DEBUG	2 <- [1,105,null,["9","38","40","42","44","46","48"]]
1602682124141	Marionette	DEBUG	2 -> [0,106,"WebDriver:SwitchToWindow",{"handle":"48","focus":true}]
1602682124141	Marionette	DEBUG	2 <- [1,106,null,{"value":null}]
1602682124142	Marionette	DEBUG	2 -> [0,107,"Marionette:GetContext",{}]
1602682124142	Marionette	DEBUG	2 <- [1,107,null,{"value":"chrome"}]
1602682124142	Marionette	DEBUG	2 -> [0,108,"Marionette:SetContext",{"value":"content"}]
1602682124142	Marionette	DEBUG	2 <- [1,108,null,{"value":null}]
1602682124143	Marionette	DEBUG	2 -> [0,109,"WebDriver:Navigate",{"url":"http://localhost:8007/page_load_test/tp5n/yahoo.co.jp/www.yahoo.co.jp/index.html"}]
1602682124241	Marionette	TRACE	[48] Frame script loaded
1602682124245	Marionette	TRACE	Detected remoteness change. New browsing context: 48
1602682124249	Marionette	TRACE	[48] Child actor created for window id 37
1602682124251	Marionette	TRACE	[48] Parent actor created
1602682124257	Marionette	TRACE	calling getCurrentURL
1602682124259	Marionette	DEBUG	2 <- [1,109,{"error":"unknown error","message":"AbortError: Actor 'MarionetteFrame' destroyed before query 'MarionetteFrameParent:getCurrentUrl' was resolved","stacktrace":""},null]
Marionette threw an error: AbortError: Actor 'MarionetteFrame' destroyed before query 'MarionetteFrameParent:getCurrentUrl' was resolved

1602682124259	Marionette	TRACE	MarionetteFrameChild.getCurrentURL(): browsing context id 48
1602682124260	Marionette	TRACE	this.contentWindow.location.href about:blank
1602682124261	Marionette	TRACE	[48] Child actor created for window id 19327352833
1602682124261	Marionette	TRACE	[48] Parent actor created
1602682124262	Marionette	DEBUG	2 -> [0,110,"Marionette:SetContext",{"value":"chrome"}]
1602682124262	Marionette	DEBUG	2 <- [1,110,null,{"value":null}]
1602682124265	Marionette	DEBUG	2 -> [0,111,"Marionette:GetContext",{}]
1602682124265	Marionette	DEBUG	2 <- [1,111,null,{"value":"chrome"}]
1602682124266	Marionette	DEBUG	2 -> [0,112,"Marionette:SetContext",{"value":"chrome"}]
1602682124266	Marionette	DEBUG	2 <- [1,112,null,{"value":null}]
1602682124266	Marionette	DEBUG	2 -> [0,113,"WebDriver:TakeScreenshot",{"full":true,"hash":false,"id":null,"scroll":true}]
1602682124412	Marionette	DEBUG	2 <- [1,113,null,{"value":"iVBORw0KGgoAAAANSUhEUgAACgAAAAdmCAYAAADCLvZfAAAgAElEQVR4nOy9aXQTV9rvm9XrXXedL+fDPXetdL9vd6eTznm76VCSbNn ... AAAAAAAAAAMCQAAgAAAAAAAAAAwJAACAAAAAAAAAAAAEMCIAAAAAAAAAAAAAwJgAAAAAAAAAAAADAkAAIAAAAAAAAAAMBQ5SfzOMAPYeoAAAAASUVORK5CYII="}]
1602682124414	Marionette	DEBUG	2 -> [0,114,"Marionette:SetContext",{"value":"chrome"}]
1602682124414	Marionette	DEBUG	2 <- [1,114,null,{"value":null}]
1602682124414	Marionette	DEBUG	2 -> [0,115,"Marionette:GetContext",{}]
1602682124414	Marionette	DEBUG	2 <- [1,115,null,{"value":"chrome"}]
1602682124415	Marionette	DEBUG	2 -> [0,116,"Marionette:SetContext",{"value":"content"}]
1602682124415	Marionette	DEBUG	2 <- [1,116,null,{"value":null}]
1602682124415	Marionette	DEBUG	2 -> [0,117,"WebDriver:GetPageSource",{}]
1602682124416	Marionette	DEBUG	2 <- [1,117,null,{"value":"<html><head></head><body></body></html>"}]
 1:34.95 TEST_END: ERROR, expected PASS - UnknownException: AbortError: Actor 'MarionetteFrame' destroyed before query 'MarionetteFrameParent:getCurrentUrl' was resolved
Traceback (most recent call last):
  File "/home/maja/dev/mozilla-unified/testing/marionette/harness/marionette_harness/marionette_test/testcases.py", line 196, in run
    testMethod()
  File "/home/maja/dev/mozilla-unified/testing/awsy/awsy/test_memory_usage.py", line 204, in test_open_tabs
    self.open_pages()
  File "/home/maja/dev/mozilla-unified/testing/awsy/awsy/awsy_test_case.py", line 408, in open_pages
    self.open_and_focus()
  File "/home/maja/dev/mozilla-unified/testing/awsy/awsy/awsy_test_case.py", line 358, in open_and_focus
    self.marionette.navigate(page_to_load)
  File "/home/maja/dev/mozilla-unified/testing/marionette/client/marionette_driver/marionette.py", line 1448, in navigate
    {"url": url})
  File "/home/maja/dev/mozilla-unified/testing/marionette/client/marionette_driver/decorators.py", line 26, in _
    return func(*args, **kwargs)
  File "/home/maja/dev/mozilla-unified/testing/marionette/client/marionette_driver/marionette.py", line 603, in _send_message
    self._handle_error(err)
  File "/home/maja/dev/mozilla-unified/testing/marionette/client/marionette_driver/marionette.py", line 623, in _handle_error
    raise errors.lookup(error)(message, stacktrace=stacktrace)

 1:34.95 INFO tearing down!

There doesn't seem to be anything out of the ordinary about the browsing context id used for successful versus unsuccessful page loads. An AWSY run opens a series of documents in new tabs. In the logs pasted above, 46 corresponds to a tab whose document loaded successfully (38-46 listed below all loaded successfully), and the last tab, browsing context id 48, is the tab with the failed load:

1602682124140	Marionette 	DEBUG	2 -> [0,104,"WebDriver:GetWindowHandles",{}]
1602682124140	Marionette	DEBUG	2 <- [1,104,null,["9","38","40","42","44","46","48"]]

Nice to have but is blocked on some core implementation. We should move it into the reserved backlog.

Whiteboard: [marionette-fission-mvp] → [marionette-fission-reserved]
Whiteboard: [marionette-fission-reserved] → [marionette-fission-reserve]
Whiteboard: [marionette-fission-reserve] → [marionette-fission-reserved]
Whiteboard: [marionette-fission-reserved] → [marionette-fission-reserve]
Blocks: 1679782
Blocks: 1683252
Blocks: 1682293
Blocks: 1669174
Blocks: 1669172
No longer blocks: 1669174
Depends on: 1685454

With the patch as landed on bug 1685454 we should actually be fine. It's not clear when a proper platform implementation will be available.

No longer blocks: 1669172
Whiteboard: [marionette-fission-reserve] → [marionette-fission-reserve
Whiteboard: [marionette-fission-reserve

Not blocking M7 (starting Beta experiment). Punting to M7a (increasing Beta experiment and adding Linux users in Beta).

Fission Milestone: M7 → M7a

Thanks to Nika we now have a BrowsingContext.currentURI property, which can be used to retrieve the visible URL from the content process.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Whiteboard: [marionette-fission-reserve]
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5b32fd7d93c1
[marionette] Use BrowsingContext.currentURI to retrieve currently visible URL. r=marionette-reviewers,jdescottes
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch

== Change summary for alert #29275 (as of Mon, 15 Mar 2021 07:31:05 GMT) ==

Improvements:

Ratio Suite Test Platform Options Absolute values (old vs new)
3% Base Content JS macosx1015-64-shippable-qr 2,480,052.00 -> 2,408,510.00
3% Base Content JS windows10-64-shippable 2,479,322.67 -> 2,411,716.00
3% Base Content JS windows10-64-shippable-qr 2,479,424.00 -> 2,411,669.33
3% Base Content JS windows10-64-shippable-qr 2,479,322.67 -> 2,411,712.00
3% Base Content JS linux1804-64-shippable 2,475,056.00 -> 2,407,959.33
3% Base Content JS linux1804-64-shippable-qr 2,474,986.67 -> 2,408,216.00

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=29275

Regressions: 1699737
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: