Skip to content

amp-consent fullscreen warning#26467

Merged
micajuine-ho merged 15 commits intoampproject:masterfrom
micajuine-ho:fullscreen_warning
Feb 27, 2020
Merged

amp-consent fullscreen warning#26467
micajuine-ho merged 15 commits intoampproject:masterfrom
micajuine-ho:fullscreen_warning

Conversation

@micajuine-ho
Copy link
Copy Markdown
Contributor

@micajuine-ho micajuine-ho commented Jan 24, 2020

Task 4 of #26432

  • Adds a developer warning when an unsuccessful enter-fullscreen message is sent from iframe to parent window
  • Created generic message API for parent to send messages (such as error logging) to iframe
  • Changes to manual test to emulate new behavior
  • Refactor unit tests

@lannka
Copy link
Copy Markdown
Contributor

lannka commented Jan 24, 2020

I'm not sure we're collecting dev warnings. Is that something we want to know about in our reporting?

@micajuine-ho
Copy link
Copy Markdown
Contributor Author

I'm not sure we're collecting dev warnings. Is that something we want to know about in our reporting?

I don't think so, but I'll wait til @zhouyx is back for confirmation

@zhouyx
Copy link
Copy Markdown
Contributor

zhouyx commented Jan 27, 2020

Discussed offline. AMP doesn't want to collect this error message.
We want to send the error message back to CMP iframe so that they can address the error.
We also want to report developer warnings, so publishers can reach out to CMPs to fix the error. (Will rephrase the error message to inform this is an error on CMP side).

@lannka
Copy link
Copy Markdown
Contributor

lannka commented Jan 27, 2020

SGTM

Comment on lines +685 to +687
const error = 'Could not enter fullscreen';
dev().warn(TAG, error);
this.sendIframeMessage_('Error', error);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should there be two different errors sent to the iframe: 1 for if the frame isn't visible & another for if the iframe has not received user interaction first? @zhouyx

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That would be great. Or you could use one message that covers both, for example "Could not enter fullscreen, fullscreen is only supported when the iframe is visible and after user interaction" : )

Comment on lines +685 to +687
const error = 'Could not enter fullscreen';
dev().warn(TAG, error);
this.sendIframeMessage_('Error', error);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That would be great. Or you could use one message that covers both, for example "Could not enter fullscreen, fullscreen is only supported when the iframe is visible and after user interaction" : )

@micajuine-ho micajuine-ho requested a review from zhouyx February 11, 2020 23:30
Copy link
Copy Markdown
Contributor

@zhouyx zhouyx left a comment

Choose a reason for hiding this comment

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

Let's write down the API format before we make change to the PR. Thanks

'Could not enter fullscreen. Fullscreen is only supported ' +
'when the iframe is visible and after user interaction.';

export const messageType = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: /** @enum {string} */

const iframeWindow = this.ui_.contentWindow;
if (iframeWindow) {
// No sensitive information sent, so safe to use '*'
iframeWindow./*OK*/ postMessage(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry I know we agree to send back the status and the error message, but I realize the format doesn't scale well.
Imagine we want to expand the feature to work with following request.

{
  'type': 'consent-response'
  'action': 'accept'
  'info': '.............'
}

It would be difficult for CMPs to categorize response based on the message info. Instead I think the following items are also required.

  1. echo back the request type
  2. echo back the request action
  3. request status
  4. errorMessage if there's any

@micajuine-ho
Copy link
Copy Markdown
Contributor Author

Should I use this API to send back responses from the consent-response iframe request? Or save it for a different PR?

@zhouyx
Copy link
Copy Markdown
Contributor

zhouyx commented Feb 27, 2020

Let's save it : )

@micajuine-ho micajuine-ho merged commit daea9bf into ampproject:master Feb 27, 2020
robinvanopstal added a commit to jungvonmatt/amphtml that referenced this pull request Mar 2, 2020
* master:
  Launch `amp-next-page` v2 & clean up experiment (ampproject#27035)
  ✨Implement Display Locking on amp-accordion (ampproject#25867)
  📖<amp-next-page> documentation and validation (ampproject#26841)
  Improve visibility event tests (ampproject#26847)
  amp-geo: Fall back to API for country (ampproject#26407)
  ✨ Add customization options to <amp-story-quiz> (ampproject#26714)
  navigation: Minor test improvements (ampproject#26926)
  ♻️ Alias video.fullscreen action for symmetry with interface names (ampproject#27017)
  ✨ Implements `amp-analytics` support for `amp-next-page` (ampproject#26451)
  ✨ amp-video-iframe integration: global jwplayer() singleton by default (ampproject#26969)
  Fix unit tests broken by ampproject#26687 (ampproject#27000)
  Filter redirect info from emails (ampproject#27012)
  📖 Make amp-bind doc valid, fix amp-form stories filter (ampproject#27003)
  url-replacements: Minor test improvement (ampproject#26930)
  viewport: Minor test improvement (ampproject#26931)
  amp-consent fullscreen warning (ampproject#26467)
  dep-check: USE CAPS FOR IMPORTANCE (ampproject#26993)
  fix img url (ampproject#26987)

# Conflicts:
#	extensions/amp-next-page/amp-next-page.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants