New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window never returns the global object #1200

Closed
annevk opened this Issue May 22, 2018 · 9 comments

Comments

Projects
None yet
7 participants
@annevk
Contributor

annevk commented May 22, 2018

It returns the "global this value".

Re: https://tc39.github.io/ecma262/#sec-global-object.

@getify

This comment has been minimized.

Show comment
Hide comment
@getify

getify May 22, 2018

Contributor

I apparently am uninformed on this topic... what's the difference (anything observable to userland code?) between the "global object" itself, and the "global this value"?

Contributor

getify commented May 22, 2018

I apparently am uninformed on this topic... what's the difference (anything observable to userland code?) between the "global object" itself, and the "global this value"?

@annevk

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk May 22, 2018

Contributor

See WindowProxy (global this value) and Window (actual global) in the HTML Standard: https://html.spec.whatwg.org/.

Contributor

annevk commented May 22, 2018

See WindowProxy (global this value) and Window (actual global) in the HTML Standard: https://html.spec.whatwg.org/.

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb May 22, 2018

Member

I think using the "global this value" - specifically, GetThisBinding(), should suffice?

Member

ljharb commented May 22, 2018

I think using the "global this value" - specifically, GetThisBinding(), should suffice?

@domenic

This comment has been minimized.

Show comment
Hide comment
@domenic

domenic May 22, 2018

Member

The sentence in question is

This may include a property whose value is the global object itself; for example, in the HTML document object model the window property of the global object is the global object itself.

Modifying that to say "the global this value" would kind of defeat the purpose of the sentence.

Maybe instead it should be changed to talk about Node.js? Although they might also have a global this value/global object distinction inherited from V8.

Maybe the sentence should just be removed.

Member

domenic commented May 22, 2018

The sentence in question is

This may include a property whose value is the global object itself; for example, in the HTML document object model the window property of the global object is the global object itself.

Modifying that to say "the global this value" would kind of defeat the purpose of the sentence.

Maybe instead it should be changed to talk about Node.js? Although they might also have a global this value/global object distinction inherited from V8.

Maybe the sentence should just be removed.

@allenwb

This comment has been minimized.

Show comment
Hide comment
@allenwb

allenwb May 22, 2018

Member

Another sentence from the ES1 spec bites the dust.

Maybe it could say "...the window property of the global object used to be..."

Member

allenwb commented May 22, 2018

Another sentence from the ES1 spec bites the dust.

Maybe it could say "...the window property of the global object used to be..."

@ryzokuken

This comment has been minimized.

Show comment
Hide comment
@ryzokuken

ryzokuken Jun 17, 2018

Contributor

@domenic @allenwb @ljharb how should this be taken care of?

Maybe instead it should be changed to talk about Node.js? Although they might also have a global this value/global object distinction inherited from V8.

Node behaves somewhat similarly:

// browser
window === this // => true
// node.js
global === this // => true

We could either:

(A) Change it to include what Node does, but IMHO that doesn't solve the original issue (it not correctly specifying the behavior in the browser)
(B) Change global object itself to global this value
(C) Remove the line, although shouldn't that really be the last resort?

Contributor

ryzokuken commented Jun 17, 2018

@domenic @allenwb @ljharb how should this be taken care of?

Maybe instead it should be changed to talk about Node.js? Although they might also have a global this value/global object distinction inherited from V8.

Node behaves somewhat similarly:

// browser
window === this // => true
// node.js
global === this // => true

We could either:

(A) Change it to include what Node does, but IMHO that doesn't solve the original issue (it not correctly specifying the behavior in the browser)
(B) Change global object itself to global this value
(C) Remove the line, although shouldn't that really be the last resort?

@littledan

This comment has been minimized.

Show comment
Hide comment
@littledan

littledan Jun 24, 2018

Member

Just removing the sentence sounds OK to me; it's hard to see how it could be clarified in a way that's helpful.

Member

littledan commented Jun 24, 2018

Just removing the sentence sounds OK to me; it's hard to see how it could be clarified in a way that's helpful.

@ryzokuken

This comment has been minimized.

Show comment
Hide comment
@ryzokuken

ryzokuken Jun 25, 2018

Contributor

@littledan will submit a patch for this later today. Just to make sure: the whole sentence should be removed and not just the example?

diff --git a/spec.html b/spec.html
index 509bff1..cb47027 100644
--- a/spec.html
+++ b/spec.html
@@ -23067,7 +23067,7 @@
     <li>does not have a [[Construct]] internal method; it cannot be used as a constructor with the `new` operator.</li>
     <li>does not have a [[Call]] internal method; it cannot be invoked as a function.</li>
     <li>has a [[Prototype]] internal slot whose value is implementation-dependent.</li>
-    <li>may have host defined properties in addition to the properties defined in this specification. This may include a property whose value is the global object itself; for example, in the HTML document object model the `window` property of the global object is the global object itself.</li>
+    <li>may have host defined properties in addition to the properties defined in this specification.</li>
   </ul>
 
   <emu-clause id="sec-value-properties-of-the-global-object">
Contributor

ryzokuken commented Jun 25, 2018

@littledan will submit a patch for this later today. Just to make sure: the whole sentence should be removed and not just the example?

diff --git a/spec.html b/spec.html
index 509bff1..cb47027 100644
--- a/spec.html
+++ b/spec.html
@@ -23067,7 +23067,7 @@
     <li>does not have a [[Construct]] internal method; it cannot be used as a constructor with the `new` operator.</li>
     <li>does not have a [[Call]] internal method; it cannot be invoked as a function.</li>
     <li>has a [[Prototype]] internal slot whose value is implementation-dependent.</li>
-    <li>may have host defined properties in addition to the properties defined in this specification. This may include a property whose value is the global object itself; for example, in the HTML document object model the `window` property of the global object is the global object itself.</li>
+    <li>may have host defined properties in addition to the properties defined in this specification.</li>
   </ul>
 
   <emu-clause id="sec-value-properties-of-the-global-object">

ryzokuken added a commit to ryzokuken/ecma262 that referenced this issue Jun 25, 2018

Editorial: remove example for global object
Remove the example in the fifth bullet point in the description for the
global object, because it isn't true anymore (window never returns the
global object).

Fixes: tc39#1200
@ryzokuken

This comment has been minimized.

Show comment
Hide comment
@ryzokuken

ryzokuken Jun 25, 2018

Contributor

P.S. I made a PR just removing the example and not the whole sentence, will update if needed.

Contributor

ryzokuken commented Jun 25, 2018

P.S. I made a PR just removing the example and not the whole sentence, will update if needed.

bterlson added a commit that referenced this issue Jun 27, 2018

Editorial: remove example for global object (#1247)
Remove the example in the fifth bullet point in the description for the
global object, because it isn't true anymore (window never returns the
global object).

Fixes: #1200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment