File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,39 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/
52
52
it MUST be used only for WebExtension related functionality.
53
53
</section>
54
54
55
+ <section>
56
+ For backwards compatibility with older versions of web extensions, a UA MAY
57
+ alias individual properties of {{browser}} to <code> chrome</code> . {{browser}}
58
+ and <code> chrome</code> SHOULD NOT be direct aliases. Instead, individual
59
+ subproperties SHOULD be what is alaised. Any modification of a property of
60
+ {{browser}} SHOULD be reflected on <code> chrome</code> , and vice versa.
61
+
62
+ <div class="example" id="example-1">
63
+ Here's an example of the expected alias behavior
64
+ <pre><code class="lang-js">
65
+ // As `chrome` and `browser` are not direct aliases,
66
+ // modifying one top level values will not change the other
67
+
68
+ globalThis.browser.FAKE = true
69
+
70
+ console.log(globalThis.chrome.FAKE);
71
+ // undefined
72
+
73
+ // Individual properies are aliased, so updating a known property
74
+ // directly changes the existing property on the other
75
+ globalThis.browser.runtime.FAKE = 123
76
+
77
+ console.log(globalThis.chrome.runtime.FAKE);
78
+ // 123
79
+ </code></pre>
80
+
81
+ </div>
82
+
83
+
84
+ </section>
85
+
86
+ /e
87
+
55
88
56
89
<pre class="idl">
57
90
partial interface Window {
You can’t perform that action at this time.
0 commit comments