diff options
Diffstat (limited to 'remote/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs')
-rw-r--r-- | remote/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/remote/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs b/remote/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs index 8421445d2c..adf821601d 100644 --- a/remote/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs +++ b/remote/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs @@ -17,6 +17,7 @@ ChromeUtils.defineESModuleGetters(lazy, { "chrome://remote/content/webdriver-bidi/modules/root/browsingContext.sys.mjs", OriginType: "chrome://remote/content/webdriver-bidi/modules/root/browsingContext.sys.mjs", + PollPromise: "chrome://remote/content/shared/Sync.sys.mjs", }); const DOCUMENT_FRAGMENT_NODE = 11; @@ -356,6 +357,29 @@ class BrowsingContextModule extends WindowGlobalBiDiModule { }); } + /** + * Waits until the visibility state of the document has the expected value. + * + * @param {object} options + * @param {number} options.value + * Expected value of the visibility state. + * + * @returns {Promise} + * Promise that resolves when the visibility state has the expected value. + */ + async _awaitVisibilityState(options) { + const { value } = options; + const win = this.messageHandler.window; + + await lazy.PollPromise((resolve, reject) => { + if (win.document.visibilityState === value) { + resolve(); + } else { + reject(); + } + }); + } + _getBaseURL() { return this.messageHandler.window.document.baseURI; } |