Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alanorozco committed Jun 29, 2018
1 parent 26514a0 commit 23d0a86
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion extensions/amp-iframe/0.1/amp-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
import {LayoutPriority} from '../../../src/layout';
import {Services} from '../../../src/services';
import {base64EncodeFromBytes} from '../../../src/utils/base64.js';
import {closestBySelector, removeElement} from '../../../src/dom';
import {createCustomEvent, getData} from '../../../src/event-helper';
import {dev, user} from '../../../src/log';
import {endsWith} from '../../../src/string';
Expand All @@ -35,6 +34,7 @@ import {isExperimentOn} from '../../../src/experiments';
import {isLayoutSizeDefined} from '../../../src/layout';
import {moveLayoutRect} from '../../../src/layout-rect';
import {parseJson} from '../../../src/json';
import {removeElement} from '../../../src/dom';
import {removeFragment} from '../../../src/url';
import {setStyle} from '../../../src/style';
import {urls} from '../../../src/config';
Expand Down
10 changes: 6 additions & 4 deletions extensions/amp-video-iframe/0.1/amp-video-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,12 @@ class AmpVideoIframe extends AMP.BaseElement {
const src = urlService.assertHttpsUrl(element.getAttribute('src'), element);

if (urlService.getSourceOrigin(src) === urlService.getWinOrigin(this.win)) {
this.user().warn('%s: Origin of the video-iframe and the page are the ' +
'same, which allows for same-origin behavior. However in AMP cache, ' +
'origins won\'t match. Please ensure you do not rely on any ' +
'same-origin privileges.', element);
this.user().warn(TAG,
'Origins of document inside amp-video-iframe and the host are the ' +
'same, which allows for same-origin behavior. However in AMP ' +
'cache, origins won\'t match. Please ensure you do not rely on any ' +
'same-origin privileges.',
element);
}

return src;
Expand Down
4 changes: 2 additions & 2 deletions src/iframe-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,11 @@ export function isAdLike(element) {
* @private
*/
export function disableScrollingOnIframe(iframe) {
addAttributesToElement(iframe, {scrolling: "no"});
addAttributesToElement(iframe, dict({'scrolling': 'no'}));

// This shouldn't work, but it does on Firefox.
// https://stackoverflow.com/a/15494969
setStyle(iframe, {overflow: 'hidden'});
setStyle(iframe, 'overflow', 'hidden');

return iframe;
}
3 changes: 2 additions & 1 deletion src/service/video-manager-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,8 @@ class VideoEntry {
const {element} = this.video;
const ratio = element.getIntersectionChangeEntry().intersectionRatio;
this.isVisible_ =
(!isFiniteNumber(ratio) ? 0 : ratio) >= MIN_VISIBILITY_RATIO_FOR_AUTOPLAY;
(!isFiniteNumber(ratio) ? 0 : ratio) >=
MIN_VISIBILITY_RATIO_FOR_AUTOPLAY;
}

if (this.isVisible_ != wasVisible) {
Expand Down
8 changes: 4 additions & 4 deletions src/video-iframe-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import {tryParseJson} from '../src/json';

/** @fileoverview Entry point for documents inside an <amp-video-iframe>. */

if (!getMode(self).test) {
adopt(self);
}

/**
* @typedef {{
* on: function(string, function()),
Expand Down Expand Up @@ -336,3 +332,7 @@ export function adopt(global) {
// Execute callbacks created before adoption.
callbacks.forEach(callbacks.push);
}

if (!getMode(self).test) {
adopt(self);
}

0 comments on commit 23d0a86

Please sign in to comment.