From 25cf447901b0398a774d89b9c18e063e573e035b Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Wed, 6 Jul 2022 19:34:32 +0000 Subject: [PATCH] Bug 1770477 - [bidi] Return the innerWindowId as realm id for script.evaluate r=webdriver-reviewers,jgraham,whimboo Depends on D149413 Differential Revision: https://phabricator.services.mozilla.com/D150245 --- remote/webdriver-bidi/modules/root/script.jsm | 8 +++++++- .../webdriver/tests/bidi/script/evaluate/evaluate.py.ini | 3 --- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/remote/webdriver-bidi/modules/root/script.jsm b/remote/webdriver-bidi/modules/root/script.jsm index 438b3c4ce5ac..c09fd8839d84 100644 --- a/remote/webdriver-bidi/modules/root/script.jsm +++ b/remote/webdriver-bidi/modules/root/script.jsm @@ -249,10 +249,16 @@ class ScriptModule extends Module { ); } + if (!context.currentWindowGlobal) { + throw new lazy.error.NoSuchFrameError( + `No window found for BrowsingContext with id ${contextId}` + ); + } + // TODO: Return an actual realm once we have proper realm support. // See Bug 1766240. return { - realm: null, + realm: String(context.currentWindowGlobal.innerWindowId), origin: null, type: RealmType.Window, context, diff --git a/testing/web-platform/meta/webdriver/tests/bidi/script/evaluate/evaluate.py.ini b/testing/web-platform/meta/webdriver/tests/bidi/script/evaluate/evaluate.py.ini index a34f227e635f..647c59261793 100644 --- a/testing/web-platform/meta/webdriver/tests/bidi/script/evaluate/evaluate.py.ini +++ b/testing/web-platform/meta/webdriver/tests/bidi/script/evaluate/evaluate.py.ini @@ -10,6 +10,3 @@ [test_rejected_promise_with_await_promise_false] expected: FAIL - - [test_rejected_promise_with_await_promise_true] - expected: FAIL