-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Added a var for Viewer. #1894
Added a var for Viewer. #1894
Conversation
@@ -29,6 +29,9 @@ import {userNotificationManagerFor} from './user-notification'; | |||
/** @private {string} */ | |||
const TAG_ = 'UrlReplacements'; | |||
|
|||
/** @private {string} */ | |||
const VIEWPORT_ORIGIN_PARAM_ = 'origin'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be "VIEWER", not a "VIEWPORT"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
ptal. The test failures seem unrelated. Can't reproduce on my machine. Not sure what is going wrong. |
Provides an identifier for the viewer that contains the AMP document. Empty string is provided when the document is loaded directly in the browser or if the id is not found. | ||
For instance: | ||
```html | ||
<amp-pixel src="https://foo.com/pixel?title=VIEWER"></amp-pixel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: title=VIEWER
-> viewer=VIEWER
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Not sure why @dvoytenko 's commit got involved here. Will try to fix it but this happened in someone else's PR as well today. |
@@ -157,6 +164,9 @@ export class Viewer { | |||
/** @private {?string} */ | |||
this.messagingOrigin_ = null; | |||
|
|||
/** @private {?string} */ | |||
this.viewerOrigin_ = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove. The definition below is the correct one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Looking good - just a couple more comments. |
This var is returns the hostname found in the 'origin' param of the viewer or the referrer. Fixes ampproject#1493 Review feedback, lint fixes. Review feedback.
LGTM. Is this ready to be merged? |
Yes sir
|
This var is returns the hostname found in the 'origin' param of the
viewer or the referrer.
There are a couple of open issues in this PR. Comments and suggestions welcome.
Fixes #1493