Skip to content
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

Tidy up the window.postMessage algorithm further #1586

Merged
merged 5 commits into from
Jul 27, 2016

Conversation

domenic
Copy link
Member

@domenic domenic commented Jul 21, 2016

  • Makes the origin-checking logic clearer by consolidating the logic
    that determines targetOrigin in one place.
  • Since an environment settings object's origin is its responsible
    document's origin, we can just use the former phrase.
  • Since the default action concept is not supposed to exist (Spec still talks about "default actions" for events #805), we
    don't need to say there's no default action.
  • Save "this Window object" as targetWindow, since it isn't really
    meaningful once we've returned from the method and started running
    steps in parallel.
  • Consistently use camelCase variables, since that seems to be the way
    things are heading these days.

* Makes the origin-checking logic clearer by consolidating the logic
  that determines targetOrigin in one place.
* Since an environment settings object's origin is its responsible
  document's origin, we can just use the former phrase.
* Since the default action concept is not supposed to exist (#805), we
  don't need to say there's no default action.
* Save "this Window object" as targetWindow, since it isn't really
  meaningful once we've returned from the method and started running
  steps in parallel.
* Consistently use camelCase variables, since that seems to be the way
  things are heading these days.
@domenic domenic added the clarification Standard could be clearer label Jul 21, 2016
window, in same-origin cases. See discussion at
https://github.com/whatwg/html/issues/1542#issuecomment-233502636 -->

<li><p>If <var>targetOrigin</var> is a single U+002F SOLIDUS character (/), set
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then*

@annevk annevk assigned domenic and unassigned annevk Jul 24, 2016
@domenic domenic assigned annevk and unassigned domenic Jul 27, 2016
@domenic
Copy link
Member Author

domenic commented Jul 27, 2016

Went ahead and did a bunch of consistification/tidying of the other two postMessages. Best to review the output probably.

New commit message proposal:

Tidy up the various postMessage algorithms

For window.postMessage in particular:
* Makes the origin-checking logic clearer by consolidating the logic
  that determines targetOrigin in one place.
* Since an environment settings object's origin is its responsible
  document's origin, we can just use the former phrase.
* Save "this Window object" as targetWindow, since it isn't really
  meaningful once we've returned from the method and started running
  steps in parallel.

In general:

* Since the default action concept is not supposed to exist (#805), we
  don't need to say there's no default action.
* Consistently use camelCase variables, since that seems to be the way
  things are heading these days.
* Use "this Window/MessagePort/BroadcastChannel object" more
  consistently, and specify arguments in the <dfn>.
* Other miscellaneous consistification.

<var>transfer</var>)</code></dfn> method on a <code>Window</code> object, the user agent must
follow these steps:</p>
<p>The <dfn><code data-x="dom-window-postMessage">postMessage(<var>message</var>,
<var>targetOrigin</var>, <var>transfer</var>)</code></dfn> method on a <code>Window</code> object
Copy link
Member

@annevk annevk Jul 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object, when invoked,*

@annevk
Copy link
Member

annevk commented Jul 27, 2016

LGTM % modulo nits.

@domenic domenic merged commit ee103bb into master Jul 27, 2016
@domenic domenic deleted the more-window-postmessage-cleaning branch July 27, 2016 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer
Development

Successfully merging this pull request may close these issues.

2 participants