Skip to content

Commit

Permalink
fix(playbuzz): parent url and host fix (ampproject#13430)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaibo authored and RanAbram committed Mar 12, 2018
1 parent 7fb319e commit 659cb48
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions extensions/amp-playbuzz/0.1/amp-playbuzz.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import * as events from '../../../src/event-helper';
import * as utils from './utils';
import {CSS} from '../../../build/amp-playbuzz-0.1.css.js';
import {Layout, isLayoutSizeDefined} from '../../../src/layout';
import {Services} from '../../../src/services';
import {
assertAbsoluteHttpOrHttpsUrl,
parseUrl,
Expand All @@ -52,7 +53,6 @@ import {isExperimentOn} from '../../../src/experiments';
import {logo, showMoreArrow} from './images';
import {removeElement} from '../../../src/dom';
import {user} from '../../../src/log';

/** @const */
const EXPERIMENT = 'amp-playbuzz';

Expand Down Expand Up @@ -255,15 +255,16 @@ class AmpPlaybuzz extends AMP.BaseElement {
*
*/
generateEmbedSourceUrl_() {
const winUrl = this.win.location;
const canonicalUrl = Services.documentInfoForDoc(this.element).canonicalUrl;
const parsedPageUrl = parseUrl(canonicalUrl);
const params = {
itemUrl: this.iframeSrcUrl_,
relativeUrl: parseUrl(this.iframeSrcUrl_).pathname,
displayItemInfo: this.displayItemInfo_,
displayShareBar: this.displayShareBar_,
displayComments: this.displayComments_,
parentUrl: removeFragment(winUrl.href),
parentHost: winUrl.hostname,
parentUrl: removeFragment(parsedPageUrl.href),
parentHost: parsedPageUrl.host,
};

const embedUrl = utils.composeEmbedUrl(params);
Expand Down

0 comments on commit 659cb48

Please sign in to comment.