Skip to content

Commit

Permalink
Disable ampCors for analytics remote config XHR in a backward compati…
Browse files Browse the repository at this point in the history
…ble way (ampproject#13009)

* Disable ampCors for analytics remote config XHR in a backward compatible way.

* Fix test
  • Loading branch information
lannka authored and protonate committed Mar 15, 2018
1 parent 0d13643 commit 0addd29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion extensions/amp-analytics/0.1/amp-analytics.js
Expand Up @@ -437,7 +437,9 @@ export class AmpAnalytics extends AMP.BaseElement {
assertHttpsUrl(remoteConfigUrl, this.element);
const TAG = this.getName_();
dev().fine(TAG, 'Fetching remote config', remoteConfigUrl);
const fetchConfig = {};
const fetchConfig = {
requireAmpResponseSourceOrigin: false,
};
if (this.element.hasAttribute('data-credentials')) {
fetchConfig.credentials = this.element.getAttribute('data-credentials');
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-analytics/0.1/test/test-amp-analytics.js
Expand Up @@ -81,7 +81,7 @@ describes.realWin('amp-analytics', {
resetServiceForTesting(win, 'xhr');
registerServiceBuilder(win, 'xhr', function() {
return {fetchJson: (url, init) => {
expect(init.requireAmpResponseSourceOrigin).to.be.undefined;
expect(init.requireAmpResponseSourceOrigin).to.be.false;
if (configWithCredentials) {
expect(init.credentials).to.equal('include');
} else {
Expand Down

0 comments on commit 0addd29

Please sign in to comment.