diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index ffbf2546a80..ee67359f859 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -222,6 +222,11 @@ impl NavigatorMethods for Navigator { to_frozen_array(&[self.Language()], cx, retval, can_gc) } + /// + fn OnLine(&self) -> bool { + true + } + // https://html.spec.whatwg.org/multipage/#dom-navigator-plugins fn Plugins(&self) -> DomRoot { self.plugins diff --git a/components/script/dom/workernavigator.rs b/components/script/dom/workernavigator.rs index e3a406ed4f8..0b0e90ffd0c 100644 --- a/components/script/dom/workernavigator.rs +++ b/components/script/dom/workernavigator.rs @@ -105,6 +105,11 @@ impl WorkerNavigatorMethods for WorkerNavigator { to_frozen_array(&[self.Language()], cx, retval, can_gc) } + /// + fn OnLine(&self) -> bool { + true + } + // https://w3c.github.io/permissions/#navigator-and-workernavigator-extension fn Permissions(&self) -> DomRoot { self.permissions diff --git a/components/script_bindings/webidls/Navigator.webidl b/components/script_bindings/webidls/Navigator.webidl index 92f37baa95b..6ac6175f3ca 100644 --- a/components/script_bindings/webidls/Navigator.webidl +++ b/components/script_bindings/webidls/Navigator.webidl @@ -9,7 +9,7 @@ interface Navigator { }; Navigator includes NavigatorID; Navigator includes NavigatorLanguage; -//Navigator includes NavigatorOnLine; +Navigator includes NavigatorOnLine; //Navigator includes NavigatorContentUtils; //Navigator includes NavigatorStorageUtils; Navigator includes NavigatorPlugins; @@ -43,6 +43,12 @@ interface mixin NavigatorLanguage { readonly attribute any languages; }; +// https://html.spec.whatwg.org/multipage/#dom-navigator-online +[Exposed=(Window,Worker)] +interface mixin NavigatorOnLine { + readonly attribute boolean onLine; +}; + // https://html.spec.whatwg.org/multipage/#navigatorplugins interface mixin NavigatorPlugins { [SameObject] readonly attribute PluginArray plugins; diff --git a/components/script_bindings/webidls/WorkerNavigator.webidl b/components/script_bindings/webidls/WorkerNavigator.webidl index 33ddfade93d..7e80fe9a009 100644 --- a/components/script_bindings/webidls/WorkerNavigator.webidl +++ b/components/script_bindings/webidls/WorkerNavigator.webidl @@ -7,7 +7,7 @@ interface WorkerNavigator {}; WorkerNavigator includes NavigatorID; WorkerNavigator includes NavigatorLanguage; -//WorkerNavigator includes NavigatorOnLine; +WorkerNavigator includes NavigatorOnLine; WorkerNavigator includes NavigatorConcurrentHardware; // https://w3c.github.io/permissions/#navigator-and-workernavigator-extension diff --git a/tests/wpt/meta/html/browsers/offline/browser-state/navigator_online_online.https.html.ini b/tests/wpt/meta/html/browsers/offline/browser-state/navigator_online_online.https.html.ini deleted file mode 100644 index 19f382bec2f..00000000000 --- a/tests/wpt/meta/html/browsers/offline/browser-state/navigator_online_online.https.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[navigator_online_online.https.html] - [Offline Application Cache - navigator_online_online] - expected: FAIL diff --git a/tests/wpt/meta/html/dom/idlharness.any.js.ini b/tests/wpt/meta/html/dom/idlharness.any.js.ini index 7d0eb9856b2..f17466adc7f 100644 --- a/tests/wpt/meta/html/dom/idlharness.any.js.ini +++ b/tests/wpt/meta/html/dom/idlharness.any.js.ini @@ -185,15 +185,9 @@ [WorkerNavigator interface: member taintEnabled] expected: FAIL - [WorkerNavigator interface: attribute onLine] - expected: FAIL - [WorkerNavigator interface: self.navigator must not have property "taintEnabled"] expected: FAIL - [WorkerNavigator interface: self.navigator must inherit property "onLine" with the proper type] - expected: FAIL - [OffscreenCanvasRenderingContext2D interface: operation getContextAttributes()] expected: FAIL diff --git a/tests/wpt/meta/html/dom/idlharness.https.html.ini b/tests/wpt/meta/html/dom/idlharness.https.html.ini index a60e9fcd4af..29cbc17c7e3 100644 --- a/tests/wpt/meta/html/dom/idlharness.https.html.ini +++ b/tests/wpt/meta/html/dom/idlharness.https.html.ini @@ -695,9 +695,6 @@ [CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "imageSmoothingQuality" with the proper type] expected: FAIL - [Navigator interface: attribute onLine] - expected: FAIL - [OffscreenCanvasRenderingContext2D interface: operation getLineDash()] expected: FAIL @@ -5348,9 +5345,6 @@ [Navigator interface: attribute oscpu] expected: FAIL - [Navigator interface: attribute onLine] - expected: FAIL - [Navigator interface: operation registerProtocolHandler(DOMString, USVString)] expected: FAIL @@ -5366,9 +5360,6 @@ [Navigator interface: window.navigator must inherit property "oscpu" with the proper type] expected: FAIL - [Navigator interface: window.navigator must inherit property "onLine" with the proper type] - expected: FAIL - [Navigator interface: window.navigator must inherit property "registerProtocolHandler(DOMString, USVString)" with the proper type] expected: FAIL diff --git a/tests/wpt/meta/workers/WorkerNavigator.any.js.ini b/tests/wpt/meta/workers/WorkerNavigator.any.js.ini index 9f6e56150ef..02500985497 100644 --- a/tests/wpt/meta/workers/WorkerNavigator.any.js.ini +++ b/tests/wpt/meta/workers/WorkerNavigator.any.js.ini @@ -3,7 +3,3 @@ [WorkerNavigator.any.serviceworker.html] expected: ERROR - -[WorkerNavigator.any.worker.html] - [Testing Navigator properties on workers.] - expected: FAIL