From 04a89290500ec1a993be511376ed53e0853fcd69 Mon Sep 17 00:00:00 2001 From: Raghu Simha Date: Mon, 30 Mar 2020 18:09:47 -0400 Subject: [PATCH] Fix all JS files with Prettier v2 --- 3p/3d-gltf/index.js | 14 +- 3p/3d-gltf/viewer.js | 6 +- 3p/3p.js | 4 +- 3p/ampcontext.js | 10 +- 3p/beopinion.js | 10 +- 3p/bodymovinanimation.js | 4 +- 3p/embedly.js | 6 +- 3p/environment.js | 23 +- 3p/facebook.js | 4 +- 3p/github.js | 4 +- 3p/iframe-messaging-client.js | 6 +- 3p/iframe-transport-client.js | 4 +- 3p/integration.js | 4 +- 3p/mathml.js | 6 +- 3p/messaging.js | 4 +- 3p/recaptcha.js | 14 +- 3p/reddit.js | 2 +- 3p/twitter.js | 12 +- 3p/viqeoplayer.js | 4 +- 3p/yotpo.js | 4 +- ads/_ping_.js | 8 +- ads/adform.js | 2 +- ads/adgeneration.js | 2 +- ads/adocean.js | 14 +- ads/adplugg.js | 6 +- ads/ads.extern.js | 2 +- ads/adservsolutions.js | 2 +- ads/adstyle.js | 4 +- ads/adunity.js | 4 +- ads/alp/handler.js | 2 +- ads/amoad.js | 2 +- ads/appnexus.js | 8 +- ads/appvador.js | 2 +- ads/baidu.js | 6 +- ads/bidtellect.js | 2 +- ads/blade.js | 2 +- ads/bringhub.js | 2 +- ads/capirs.js | 4 +- ads/colombia.js | 4 +- ads/conative.js | 4 +- ads/connatix.js | 2 +- ads/dable.js | 4 +- ads/fluct.js | 2 +- ads/fusion.js | 4 +- .../a4a/line-delimited-response-handler.js | 8 +- .../test/test-content-recommendation.js | 20 +- .../test-line-delimited-response-handler.js | 12 +- ads/google/a4a/test/test-utils.js | 371 ++-- ads/google/a4a/traffic-experiments.js | 6 +- ads/google/a4a/utils.js | 26 +- ads/google/imaVideo.js | 12 +- ads/google/utils.js | 24 +- ads/gumgum.js | 6 +- ads/idealmedia.js | 4 +- ads/imedia.js | 6 +- ads/imonomy.js | 2 +- ads/inabox/frame-overlay-helper.js | 4 +- ads/inabox/frame-overlay-manager.js | 2 +- ads/inabox/inabox-host.js | 4 +- ads/inabox/inabox-messaging-host.js | 6 +- ads/inmobi.js | 2 +- ads/insticator.js | 4 +- ads/ix.js | 2 +- ads/kargo.js | 4 +- ads/kiosked.js | 4 +- ads/kixer.js | 10 +- ads/lentainform.js | 4 +- ads/loka.js | 2 +- ads/mads.js | 2 +- ads/medianet.js | 8 +- ads/medyanet.js | 2 +- ads/mgid.js | 4 +- ads/nativery.js | 2 +- ads/nativo.js | 16 +- ads/navegg.js | 6 +- ads/netletix.js | 2 +- ads/onnetwork.js | 2 +- ads/openx.js | 10 +- ads/opinary.js | 5 +- ads/pubmine.js | 2 +- ads/readmo.js | 2 +- ads/relap.js | 12 +- ads/runative.js | 2 +- ads/spotx.js | 2 +- ads/springAds.js | 8 +- ads/ssp.js | 6 +- ads/svknative.js | 2 +- ads/swoop.js | 4 +- ads/taboola.js | 6 +- ads/uas.js | 6 +- ads/uzou.js | 4 +- ads/vmfive.js | 4 +- ads/widespace.js | 2 +- ads/wpmedia.js | 2 +- ads/xlift.js | 4 +- ads/yieldpro.js | 4 +- ads/zedo.js | 2 +- ads/zucks.js | 2 +- babel.config.js | 8 +- .../index.js | 4 +- .../babel-plugin-const-transformer/index.js | 2 +- .../index.js | 2 +- .../index.js | 2 +- .../index.js | 4 +- .../index.js | 2 +- .../index.js | 8 +- .../index.js | 2 +- .../index.js | 10 +- .../index.js | 6 +- .../index.js | 4 +- .../index.js | 4 +- .../index.js | 10 +- .../index.js | 4 +- .../index.js | 2 +- .../index.js | 2 +- .../index.js | 2 +- .../index.js | 2 +- .../index.js | 2 +- .../babel-plugins/log-module-metadata.js | 2 +- build-system/common/check-package-manager.js | 12 +- build-system/common/ctrlcHandler.js | 4 +- build-system/common/git.js | 8 +- build-system/common/utils.js | 2 +- build-system/compile/build.conf.js | 8 +- build-system/compile/bundles.config.js | 12 +- .../compile/check-for-unknown-deps.js | 4 +- build-system/compile/closure-compile.js | 2 +- build-system/compile/compile-wrappers.js | 2 +- build-system/compile/compile.js | 30 +- build-system/compile/log-messages.js | 2 +- build-system/compile/post-closure-babel.js | 6 +- build-system/compile/single-pass.js | 92 +- build-system/compile/typescript.js | 4 +- build-system/eslint-rules/await-expect.js | 4 +- .../eslint-rules/closure-type-primitives.js | 10 +- build-system/eslint-rules/dict-string-keys.js | 8 +- build-system/eslint-rules/html-template.js | 2 +- build-system/eslint-rules/index.js | 6 +- build-system/eslint-rules/is-experiment-on.js | 4 +- .../eslint-rules/json-configuration.js | 12 +- .../eslint-rules/no-array-destructuring.js | 4 +- .../no-arrow-on-register-functions.js | 6 +- .../eslint-rules/no-deep-destructuring.js | 4 +- .../no-destructure-assignment-params.js | 4 +- .../eslint-rules/no-duplicate-import.js | 4 +- .../eslint-rules/no-duplicate-name-typedef.js | 4 +- .../eslint-rules/no-es2015-number-props.js | 4 +- .../eslint-rules/no-export-side-effect.js | 10 +- .../eslint-rules/no-for-of-statement.js | 4 +- build-system/eslint-rules/no-global.js | 4 +- build-system/eslint-rules/no-import-rename.js | 2 +- build-system/eslint-rules/no-import.js | 4 +- build-system/eslint-rules/no-is-amp-alt.js | 4 +- build-system/eslint-rules/no-log-array.js | 6 +- .../eslint-rules/no-mixed-interpolation.js | 6 +- .../eslint-rules/no-module-exports.js | 2 +- build-system/eslint-rules/no-rest.js | 6 +- build-system/eslint-rules/no-spread.js | 6 +- build-system/eslint-rules/no-style-display.js | 8 +- .../eslint-rules/no-style-property-setting.js | 4 +- .../eslint-rules/no-unload-listener.js | 8 +- build-system/eslint-rules/preact.js | 2 +- .../eslint-rules/prefer-deferred-promise.js | 4 +- .../eslint-rules/prefer-destructuring.js | 12 +- .../eslint-rules/prefer-spread-props.js | 4 +- .../prefer-unnested-spread-objects.js | 2 +- .../eslint-rules/private-prop-names.js | 8 +- build-system/eslint-rules/query-selector.js | 10 +- .../eslint-rules/split-single-pass-comment.js | 6 +- build-system/eslint-rules/todo-format.js | 6 +- .../eslint-rules/unused-private-field.js | 10 +- build-system/eslint-rules/vsync.js | 4 +- .../eslint-rules/window-property-name.js | 6 +- build-system/externs/amp.extern.js | 60 +- build-system/externs/dompurify.extern.js | 2 +- build-system/externs/preact.extern.js | 8 +- build-system/pr-check/build-targets.js | 46 +- build-system/pr-check/remote-tests.js | 2 +- build-system/pr-check/utils.js | 2 +- build-system/server/amp4test.js | 14 +- .../server/app-index/amphtml-helpers.js | 8 +- build-system/server/app-index/api/api.js | 2 +- build-system/server/app-index/file-list.js | 6 +- build-system/server/app-index/form.js | 8 +- build-system/server/app-index/html.js | 2 +- build-system/server/app-index/template.js | 5 +- build-system/server/app-index/url.js | 2 +- build-system/server/app-index/util/listing.js | 2 +- build-system/server/app-utils.js | 2 +- build-system/server/app.js | 34 +- build-system/server/lazy-build.js | 2 +- build-system/server/recaptcha-router.js | 6 +- build-system/server/routes/a4a-envelopes.js | 22 +- build-system/server/routes/list.js | 16 +- build-system/server/routes/test.js | 2 +- build-system/server/test-server.js | 22 +- build-system/server/variable-substitution.js | 2 +- build-system/tasks/bundle-size/index.js | 2 +- build-system/tasks/caches-json.js | 2 +- build-system/tasks/check-exact-versions.js | 2 +- build-system/tasks/check-links.js | 8 +- build-system/tasks/check-owners.js | 4 +- build-system/tasks/check-types.js | 6 +- build-system/tasks/compile-jison.js | 4 +- build-system/tasks/create-golden-css/index.js | 2 +- build-system/tasks/css.js | 8 +- build-system/tasks/csvify-size/index.js | 32 +- build-system/tasks/csvify-size/test.js | 4 +- build-system/tasks/dep-check.js | 54 +- build-system/tasks/dev-dashboard-tests.js | 6 +- build-system/tasks/dist.js | 14 +- build-system/tasks/e2e/amp-driver.js | 12 +- build-system/tasks/e2e/controller-promise.js | 6 +- build-system/tasks/e2e/describes-e2e.js | 36 +- build-system/tasks/e2e/driver/query-xpath.js | 2 +- build-system/tasks/e2e/expect.js | 16 +- build-system/tasks/e2e/index.js | 12 +- build-system/tasks/e2e/network-logger.js | 4 +- .../tasks/e2e/puppeteer-controller.js | 18 +- build-system/tasks/e2e/repl.js | 4 +- .../e2e/selenium-webdriver-controller.js | 39 +- .../tasks/extension-generator/index.js | 6 +- build-system/tasks/extension-helpers.js | 16 +- build-system/tasks/firebase.js | 4 +- build-system/tasks/get-zindex/index.js | 12 +- build-system/tasks/get-zindex/test.js | 6 +- build-system/tasks/helpers.js | 22 +- build-system/tasks/jsify-css.js | 4 +- build-system/tasks/karma.conf.js | 2 +- build-system/tasks/lint.js | 12 +- build-system/tasks/mocha-ci-reporter.js | 8 +- .../tasks/performance/cache-documents.js | 2 +- .../tasks/performance/compile-scripts.js | 2 +- build-system/tasks/performance/helpers.js | 6 +- .../tasks/performance/measure-documents.js | 20 +- .../tasks/performance/print-report.js | 10 +- .../tasks/performance/rewrite-script-tags.js | 2 +- build-system/tasks/performance/run-tests.js | 2 +- build-system/tasks/performance/stats.js | 14 +- build-system/tasks/performance/test-suite.js | 2 +- build-system/tasks/pr-check.js | 2 +- build-system/tasks/pr-deploy-bot-utils.js | 4 +- build-system/tasks/prepend-global/index.js | 8 +- build-system/tasks/prepend-global/test.js | 6 +- build-system/tasks/presubmit-checks.js | 14 +- build-system/tasks/prettify.js | 10 +- build-system/tasks/process-3p-github-pr.js | 14 +- build-system/tasks/process-github-issues.js | 18 +- build-system/tasks/report-test-status.js | 8 +- .../tasks/runtime-test/helpers-unit.js | 22 +- build-system/tasks/runtime-test/helpers.js | 12 +- .../tasks/runtime-test/runtime-test-base.js | 10 +- build-system/tasks/serve.js | 2 +- build-system/tasks/server-tests.js | 12 +- build-system/tasks/size.js | 22 +- build-system/tasks/todos.js | 14 +- build-system/tasks/update-packages.js | 2 +- build-system/tasks/vendor-configs.js | 4 +- build-system/tasks/visual-diff/helpers.js | 10 +- build-system/tasks/visual-diff/index.js | 18 +- builtins/amp-img.js | 2 +- builtins/amp-layout.js | 2 +- builtins/amp-pixel.js | 6 +- extensions/amp-3d-gltf/0.1/amp-3d-gltf.js | 14 +- .../amp-3d-gltf/0.1/test/test-amp-3d-gltf.js | 6 +- extensions/amp-3q-player/0.1/amp-3q-player.js | 2 +- .../0.1/test/test-amp-3q-player.js | 2 +- extensions/amp-a4a/0.1/amp-a4a.js | 58 +- extensions/amp-a4a/0.1/amp-ad-network-base.js | 12 +- .../amp-a4a/0.1/amp-ad-template-helper.js | 2 +- extensions/amp-a4a/0.1/amp-ad-utils.js | 2 +- .../amp-a4a/0.1/cryptographic-validator.js | 2 +- extensions/amp-a4a/0.1/friendly-frame-util.js | 4 +- .../amp-a4a/0.1/real-time-config-manager.js | 30 +- .../refresh-intersection-observer-wrapper.js | 2 +- extensions/amp-a4a/0.1/refresh-manager.js | 4 +- extensions/amp-a4a/0.1/signature-verifier.js | 22 +- extensions/amp-a4a/0.1/template-renderer.js | 7 +- extensions/amp-a4a/0.1/template-validator.js | 4 +- extensions/amp-a4a/0.1/test/fetch-mock.js | 2 +- extensions/amp-a4a/0.1/test/test-amp-a4a.js | 60 +- .../0.1/test/test-amp-ad-template-helper.js | 14 +- .../amp-a4a/0.1/test/test-callout-vendors.js | 4 +- .../0.1/test/test-cryptographic-validator.js | 8 +- .../0.1/test/test-friendly-frame-renderer.js | 2 +- .../0.1/test/test-friendly-frame-util.js | 10 +- .../0.1/test/test-name-frame-renderer.js | 2 +- .../0.1/test/test-real-time-config-manager.js | 14 +- extensions/amp-a4a/0.1/test/test-refresh.js | 12 +- .../0.1/test/test-signature-verifier.js | 80 +- .../0.1/test/test-template-renderer.js | 14 +- .../0.1/test/test-template-validator.js | 26 +- .../0.1/amp-access-laterpay.js | 6 +- .../amp-access-laterpay/0.1/laterpay-impl.js | 22 +- .../0.1/test/test-amp-access-laterpay.js | 12 +- .../0.2/amp-access-laterpay.js | 6 +- .../amp-access-laterpay/0.2/laterpay-impl.js | 32 +- .../0.2/test/test-amp-access-laterpay.js | 12 +- .../amp-access-poool/0.1/amp-access-poool.js | 6 +- extensions/amp-access-poool/0.1/poool-impl.js | 12 +- .../0.1/test/test-amp-access-poool.js | 8 +- .../0.1/amp-access-scroll.js | 6 +- .../0.1/read-depth-tracker.js | 6 +- .../amp-access-scroll/0.1/scroll-bar.js | 2 +- .../amp-access-scroll/0.1/scroll-component.js | 6 +- .../amp-access-scroll/0.1/scroll-impl.js | 20 +- .../amp-access-scroll/0.1/scroll-relay.js | 8 +- .../amp-access-scroll/0.1/scroll-sheet.js | 4 +- .../0.1/test/read-depth-tracker.js | 2 +- .../amp-access/0.1/amp-access-client.js | 6 +- .../amp-access/0.1/amp-access-iframe.js | 8 +- .../amp-access/0.1/amp-access-server-jwt.js | 20 +- .../amp-access/0.1/amp-access-server.js | 4 +- .../amp-access/0.1/amp-access-source.js | 22 +- .../amp-access/0.1/amp-access-vendor.js | 4 +- extensions/amp-access/0.1/amp-access.js | 41 +- .../amp-access/0.1/amp-login-done-dialog.js | 4 +- .../amp-access/0.1/iframe-api/iframe-api.js | 8 +- .../amp-access/0.1/iframe-api/messenger.js | 6 +- extensions/amp-access/0.1/jwt.js | 10 +- extensions/amp-access/0.1/login-dialog.js | 18 +- .../amp-access/0.1/test/test-access-expr.js | 2 +- .../0.1/test/test-amp-access-client.js | 14 +- .../0.1/test/test-amp-access-iframe.js | 14 +- .../0.1/test/test-amp-access-other.js | 4 +- .../0.1/test/test-amp-access-server-jwt.js | 70 +- .../0.1/test/test-amp-access-server.js | 23 +- .../0.1/test/test-amp-access-source.js | 21 +- .../0.1/test/test-amp-access-vendor.js | 10 +- .../amp-access/0.1/test/test-amp-access.js | 97 +- .../0.1/test/test-amp-login-done-dialog.js | 36 +- .../amp-access/0.1/test/test-iframe-api.js | 14 +- .../0.1/test/test-iframe-messenger.js | 8 +- extensions/amp-access/0.1/test/test-jwt.js | 18 +- .../amp-access/0.1/test/test-login-dialog.js | 93 +- extensions/amp-accordion/0.1/amp-accordion.js | 22 +- .../test/integration/test-amp-accordion.js | 6 +- .../0.1/test/test-amp-accordion.js | 72 +- .../amp-action-macro/0.1/amp-action-macro.js | 4 +- .../0.1/test/test-amp-action-macro.js | 8 +- extensions/amp-ad-custom/0.1/amp-ad-custom.js | 4 +- .../0.1/test/test-amp-ad-custom.js | 10 +- extensions/amp-ad-exit/0.1/amp-ad-exit.js | 23 +- extensions/amp-ad-exit/0.1/config.js | 2 +- .../0.1/test-e2e/test-amp-ad-exit.js | 4 +- .../0.1/test/filters/test-click-delay.js | 2 +- .../amp-ad-exit/0.1/test/test-amp-ad-exit.js | 12 +- .../0.1/adsense-shared-state.js | 4 +- .../0.1/amp-ad-network-adsense-impl.js | 12 +- .../0.1/responsive-state.js | 20 +- .../test/test-amp-ad-network-adsense-impl.js | 76 +- .../0.1/test/test-responsive-state.js | 4 +- .../0.1/amp-ad-network-adzerk-impl.js | 17 +- .../test/test-amp-ad-network-adzerk-impl.js | 20 +- .../0.1/amp-ad-network-doubleclick-impl.js | 71 +- .../0.1/flexible-ad-slot-utils.js | 6 +- .../0.1/safeframe-host.js | 14 +- .../0.1/sra-utils.js | 42 +- .../test-amp-ad-network-doubleclick-impl.js | 96 +- .../0.1/test/test-doubleclick-fluid.js | 6 +- .../0.1/test/test-doubleclick-rtc.js | 16 +- .../0.1/test/test-doubleclick-safeframe.js | 1908 +++++++++-------- .../0.1/test/test-doubleclick-sra.js | 38 +- .../0.1/test/test-flexible-ad-slot-utils.js | 4 +- .../0.1/amp-ad-network-fake-impl.js | 6 +- .../0.1/test/test-amp-ad-network-fake-impl.js | 2 +- .../0.1/amp-ad-network-oblivki-impl.js | 2 +- .../test/test-amp-ad-network-oblivki-impl.js | 4 +- .../0.1/amp-ad-network-smartads-impl.js | 2 +- .../test/test-amp-ad-network-smartads-impl.js | 4 +- extensions/amp-ad/0.1/amp-ad-3p-impl.js | 10 +- extensions/amp-ad/0.1/amp-ad-custom.js | 6 +- extensions/amp-ad/0.1/amp-ad-ui.js | 2 +- .../0.1/amp-ad-xorigin-iframe-handler.js | 24 +- extensions/amp-ad/0.1/amp-ad.js | 10 +- .../amp-ad/0.1/test/test-amp-ad-3p-impl.js | 20 +- .../amp-ad/0.1/test/test-amp-ad-custom.js | 6 +- extensions/amp-ad/0.1/test/test-amp-ad-ui.js | 26 +- .../test-amp-ad-xorigin-iframe-handler.js | 60 +- extensions/amp-ad/0.1/test/test-amp-ad.js | 48 +- .../amp-ad/0.1/test/test-concurrent-load.js | 8 +- .../amp-addthis/0.1/addthis-utils/classify.js | 18 +- .../amp-addthis/0.1/addthis-utils/cuid.js | 8 +- .../amp-addthis/0.1/addthis-utils/eng.js | 4 +- .../amp-addthis/0.1/addthis-utils/fragment.js | 20 +- ...overloaded-with-json-for-anonymous-mode.js | 2 +- .../amp-addthis/0.1/addthis-utils/meta.js | 6 +- .../addthis-utils/monitors/click-monitor.js | 2 +- .../amp-addthis/0.1/addthis-utils/pixel.js | 22 +- .../amp-addthis/0.1/addthis-utils/pjson.js | 4 +- .../amp-addthis/0.1/addthis-utils/rot13.js | 6 +- extensions/amp-addthis/0.1/amp-addthis.js | 8 +- extensions/amp-addthis/0.1/config-manager.js | 8 +- .../0.1/post-message-dispatcher.js | 2 +- .../amp-addthis/0.1/test/test-amp-addthis.js | 20 +- extensions/amp-analytics/0.1/amp-analytics.js | 37 +- .../amp-analytics/0.1/analytics-group.js | 2 +- .../amp-analytics/0.1/analytics-root.js | 26 +- extensions/amp-analytics/0.1/config.js | 30 +- extensions/amp-analytics/0.1/cookie-writer.js | 4 +- extensions/amp-analytics/0.1/events.js | 60 +- .../amp-analytics/0.1/iframe-transport.js | 6 +- .../amp-analytics/0.1/linker-manager.js | 16 +- extensions/amp-analytics/0.1/linker.js | 4 +- extensions/amp-analytics/0.1/requests.js | 24 +- .../amp-analytics/0.1/resource-timing.js | 14 +- .../amp-analytics/0.1/scroll-manager.js | 4 +- .../0.1/test-e2e/test-iframe-transport.js | 2 +- .../0.1/test/test-amp-analytics.js | 82 +- .../0.1/test/test-analytics-group.js | 32 +- .../0.1/test/test-analytics-root.js | 18 +- .../amp-analytics/0.1/test/test-config-new.js | 50 +- .../0.1/test/test-cookie-writer.js | 4 +- .../amp-analytics/0.1/test/test-events.js | 110 +- .../0.1/test/test-iframe-transport-client.js | 8 +- .../test-iframe-transport-message-queue.js | 2 +- .../0.1/test/test-iframe-transport.js | 4 +- .../0.1/test/test-instrumentation.js | 6 +- .../0.1/test/test-linker-manager.js | 14 +- .../amp-analytics/0.1/test/test-linker.js | 4 +- .../amp-analytics/0.1/test/test-opacity.js | 2 +- .../amp-analytics/0.1/test/test-requests.js | 58 +- .../0.1/test/test-resource-timing.js | 16 +- .../0.1/test/test-scroll-manager.js | 2 +- .../amp-analytics/0.1/test/test-transport.js | 2 +- .../amp-analytics/0.1/test/test-variables.js | 4 +- .../0.1/test/test-vendors-new.js | 18 +- .../amp-analytics/0.1/test/test-vendors.js | 12 +- .../test/test-visibility-manager-for-mapp.js | 6 +- .../0.1/test/test-visibility-manager.js | 70 +- .../0.1/test/test-visibility-model.js | 10 +- .../amp-analytics/0.1/transport-serializer.js | 6 +- extensions/amp-analytics/0.1/transport.js | 2 +- extensions/amp-analytics/0.1/variables.js | 20 +- .../amp-analytics/0.1/visibility-manager.js | 8 +- .../amp-analytics/0.1/visibility-model.js | 2 +- extensions/amp-anim/0.1/amp-anim.js | 2 +- extensions/amp-anim/0.1/test/test-amp-anim.js | 2 +- extensions/amp-animation/0.1/amp-animation.js | 12 +- .../amp-animation/0.1/parsers/css-expr-ast.js | 4 +- .../0.1/parsers/keyframes-extractor.js | 4 +- .../runners/native-web-animation-runner.js | 16 +- .../runners/scrolltimeline-worklet-runner.js | 6 +- .../0.1/test-e2e/test-amp-animation.js | 2 +- .../0.1/test/test-amp-animation.js | 88 +- .../amp-animation/0.1/test/test-css-expr.js | 146 +- .../0.1/test/test-keyframes-extractor.js | 2 +- .../0.1/test/test-web-animations.js | 120 +- .../amp-animation/0.1/web-animations.js | 18 +- .../0.1/amp-apester-media.js | 18 +- .../0.1/monetization/companion/display.js | 6 +- .../0.1/monetization/consent-util.js | 8 +- .../0.1/monetization/index.js | 2 +- .../0.1/test/test-amp-apester-media-utils.js | 2 +- .../0.1/test/test-amp-apester-media.js | 12 +- .../0.1/test/test-amp-apester-monetization.js | 8 +- extensions/amp-apester-media/0.1/utils.js | 22 +- .../amp-app-banner/0.1/amp-app-banner.js | 20 +- .../0.1/test/test-amp-app-banner.js | 66 +- extensions/amp-audio/0.1/amp-audio.js | 4 +- .../amp-audio/0.1/test/test-amp-audio.js | 30 +- extensions/amp-auto-ads/0.1/ad-strategy.js | 4 +- extensions/amp-auto-ads/0.1/ad-tracker.js | 38 +- extensions/amp-auto-ads/0.1/amp-auto-ads.js | 8 +- extensions/amp-auto-ads/0.1/placement.js | 18 +- .../0.1/test/test-ad-network-config.js | 2 +- .../amp-auto-ads/0.1/test/test-ad-strategy.js | 16 +- .../amp-auto-ads/0.1/test/test-ad-tracker.js | 27 +- .../0.1/test/test-adsense-network-config.js | 2 +- .../0.1/test/test-amp-auto-ads.js | 62 +- .../0.1/test/test-anchor-ad-strategy.js | 21 +- .../0.1/test/test-denakop-network-config.js | 2 +- .../test/test-doubleclick-network-config.js | 2 +- .../amp-auto-ads/0.1/test/test-placement.js | 28 +- .../amp-auto-ads/0.1/test/test-utils.js | 8 +- .../0.1/amp-auto-lightbox.js | 18 +- .../0.1/test/test-amp-auto-lightbox.js | 163 +- .../amp-autocomplete/0.1/amp-autocomplete.js | 32 +- .../test-e2e/test-amp-autocomplete-inline.js | 2 +- .../0.1/test-e2e/test-amp-autocomplete.js | 2 +- .../test/test-amp-autocomplete-bindings.js | 6 +- .../0.1/test/test-amp-autocomplete-init.js | 40 +- .../0.1/test/test-amp-autocomplete.js | 6 +- .../0.1/amp-base-carousel.js | 62 +- .../amp-base-carousel/0.1/auto-advance.js | 2 +- .../0.1/carousel-accessibility.js | 6 +- extensions/amp-base-carousel/0.1/carousel.js | 10 +- .../0.1/child-layout-manager.js | 16 +- .../0.1/responsive-attributes.js | 6 +- .../0.1/test-e2e/test-arrows-non-looping.js | 2 +- .../0.1/test-e2e/test-arrows.js | 2 +- .../0.1/test-e2e/test-autoadvance.js | 2 +- .../0.1/test-e2e/test-carousel.js | 24 +- .../0.1/test-e2e/test-grouping.js | 4 +- .../0.1/test-e2e/test-hidden-controls.js | 2 +- .../0.1/test-e2e/test-initial-slide.js | 2 +- .../test-e2e/test-mixed-lengths-no-snap.js | 2 +- .../0.1/test-e2e/test-mixed-lengths.js | 2 +- .../0.1/test-e2e/test-non-looping.js | 2 +- .../0.1/test-e2e/test-responsive.js | 2 +- .../0.1/test-e2e/test-rtl.js | 2 +- .../0.1/test-e2e/test-vertical.js | 2 +- .../0.1/test/test-carousel.js | 6 +- .../0.1/test/test-child-layout-manager.js | 10 +- extensions/amp-beopinion/0.1/amp-beopinion.js | 4 +- .../0.1/test/test-amp-beopinion.js | 6 +- extensions/amp-bind/0.1/amp-bind.js | 2 +- extensions/amp-bind/0.1/amp-state.js | 14 +- extensions/amp-bind/0.1/bind-evaluator.js | 10 +- extensions/amp-bind/0.1/bind-expression.js | 14 +- extensions/amp-bind/0.1/bind-impl.js | 100 +- .../0.1/test/integration/test-bind-impl.js | 16 +- .../amp-bind/0.1/test/test-amp-state.js | 16 +- .../0.1/amp-bodymovin-animation.js | 6 +- .../test-amp-bodymovin-animation.js | 10 +- .../amp-brid-player/0.1/amp-brid-player.js | 2 +- .../0.1/test/test-amp-brid-player.js | 14 +- .../amp-brightcove/0.1/amp-brightcove.js | 4 +- .../0.1/test/test-amp-brightcove.js | 22 +- .../0.1/amp-byside-content.js | 8 +- .../0.1/test/test-amp-byside-content.js | 22 +- .../0.1/amp-call-tracking.js | 8 +- .../0.1/test/test-amp-call-tracking.js | 10 +- extensions/amp-carousel/0.1/amp-carousel.js | 2 +- extensions/amp-carousel/0.1/base-carousel.js | 2 +- extensions/amp-carousel/0.1/base-slides.js | 2 +- .../amp-carousel/0.1/scrollable-carousel.js | 18 +- extensions/amp-carousel/0.1/slidescroll.js | 10 +- .../0.1/test-e2e/test-hidden-controls.js | 2 +- .../0.1/test-e2e/test-slidescroll-autoplay.js | 8 +- .../amp-carousel/0.1/test/test-base-slide.js | 2 +- .../0.1/test/test-scrollable-carousel.js | 12 +- .../amp-carousel/0.1/test/test-slidescroll.js | 82 +- extensions/amp-carousel/0.2/amp-carousel.js | 18 +- .../amp-carousel/0.2/test/test-type-slides.js | 2 +- .../0.1/amp-connatix-player.js | 4 +- .../0.1/test/test-amp-connatix-player.js | 2 +- extensions/amp-consent/0.1/amp-consent.js | 32 +- extensions/amp-consent/0.1/consent-config.js | 4 +- .../amp-consent/0.1/consent-policy-manager.js | 8 +- .../amp-consent/0.1/consent-state-manager.js | 18 +- extensions/amp-consent/0.1/consent-ui.js | 6 +- .../test-e2e/test-amp-consent-client-side.js | 2 +- ...st-amp-consent-server-side-expire-cache.js | 2 +- .../test-e2e/test-amp-consent-server-side.js | 2 +- .../amp-consent/0.1/test/test-amp-consent.js | 18 +- .../0.1/test/test-consent-config.js | 10 +- .../0.1/test/test-consent-policy-manager.js | 82 +- .../0.1/test/test-consent-state-manager.js | 124 +- .../amp-consent/0.1/test/test-consent-ui.js | 50 +- .../0.1/amp-crypto-polyfill.js | 2 +- .../amp-dailymotion/0.1/amp-dailymotion.js | 4 +- .../0.1/test/test-amp-dailymotion.js | 2 +- .../0.1/amp-date-countdown.js | 2 +- .../0.1/test/test-amp-date-countdown.js | 2 +- .../amp-date-display/0.1/amp-date-display.js | 2 +- .../0.1/test/test-amp-date-display.js | 2 +- .../amp-date-display/0.2/amp-date-display.js | 4 +- .../0.2/test/test-amp-date-display.js | 2 +- .../0.2/test/test-date-display.js | 2 +- .../amp-date-picker/0.1/amp-date-picker.js | 49 +- .../amp-date-picker/0.1/date-picker-common.js | 6 +- .../amp-date-picker/0.1/date-range-picker.js | 20 +- extensions/amp-date-picker/0.1/dates-list.js | 6 +- .../amp-date-picker/0.1/defaultPhrases.js | 8 +- extensions/amp-date-picker/0.1/react-utils.js | 12 +- .../amp-date-picker/0.1/single-date-picker.js | 20 +- .../0.1/test-e2e/test-blocked-dates.js | 2 +- ...est-integration-amp-date-picker-actions.js | 33 +- .../test-integration-dates-attributes.js | 9 +- .../test-integration-maximum-nights.js | 9 +- .../0.1/test/test-amp-date-picker-bind.js | 2 +- .../0.1/test/test-amp-date-picker-state.js | 2 +- .../0.1/test/test-amp-date-picker.js | 4 +- .../0.1/test/test-dates-list.js | 2 +- .../0.1/test/test-wrapper-maximum-nights.js | 2 +- .../0.1/wrappers/maximum-nights.js | 8 +- .../0.1/amp-delight-player.js | 10 +- .../0.1/test/test-amp-delight-player.js | 6 +- .../0.1/amp-dynamic-css-classes.js | 6 +- .../0.1/test/test-runtime-classes.js | 2 +- .../0.1/amp-embedly-card-impl.js | 2 +- .../amp-embedly-card/0.1/amp-embedly-card.js | 2 +- .../0.1/test/test-amp-embedly-card.js | 22 +- .../amp-experiment/0.1/amp-experiment.js | 10 +- .../0.1/test/test-amp-experiment.js | 10 +- .../amp-experiment/0.1/test/test-variant.js | 16 +- extensions/amp-experiment/0.1/variant.js | 16 +- .../amp-experiment/1.0/amp-experiment.js | 14 +- .../amp-experiment/1.0/apply-experiment.js | 8 +- .../attribute-mutation-default-class.js | 2 +- .../attribute-mutation-default-style.js | 2 +- .../attribute-mutation-default-url.js | 2 +- .../1.0/mutation/character-data-mutation.js | 2 +- .../1.0/test/test-amp-experiment.js | 14 +- .../1.0/test/test-apply-experiment.js | 6 +- .../1.0/test/test-attribute-mutation.js | 8 +- .../1.0/test/test-character-data-mutation.js | 4 +- .../1.0/test/test-mutation-record.js | 2 +- .../amp-experiment/1.0/test/test-mutation.js | 2 +- .../amp-experiment/1.0/test/test-variant.js | 11 +- extensions/amp-experiment/1.0/variant.js | 16 +- .../0.1/amp-facebook-comments.js | 4 +- .../0.1/amp-facebook-like.js | 4 +- .../0.1/amp-facebook-page.js | 4 +- extensions/amp-facebook/0.1/amp-facebook.js | 4 +- .../0.1/test/test-amp-facebook.js | 6 +- extensions/amp-fit-text/0.1/amp-fit-text.js | 4 +- .../0.1/test-e2e/test-amp-fit-text.js | 2 +- .../0.1/test/test-amp-fit-text.js | 8 +- extensions/amp-font/0.1/amp-font.js | 4 +- extensions/amp-font/0.1/fontloader.js | 6 +- extensions/amp-font/0.1/test/test-amp-font.js | 6 +- .../amp-font/0.1/test/test-fontloader.js | 4 +- extensions/amp-form/0.1/amp-form-textarea.js | 18 +- extensions/amp-form/0.1/amp-form.js | 84 +- extensions/amp-form/0.1/form-proxy.js | 8 +- extensions/amp-form/0.1/form-validators.js | 6 +- extensions/amp-form/0.1/form-verifiers.js | 14 +- extensions/amp-form/0.1/test-e2e/test-ssr.js | 4 +- .../test-integration-form-verifiers.js | 15 +- .../test/integration/test-integration-form.js | 12 +- .../0.1/test/test-amp-form-textarea.js | 4 +- extensions/amp-form/0.1/test/test-amp-form.js | 144 +- .../amp-form/0.1/test/test-form-dirtiness.js | 4 +- .../amp-form/0.1/test/test-form-proxy.js | 2 +- .../amp-form/0.1/test/test-form-validators.js | 12 +- .../amp-form/0.1/test/test-form-verifiers.js | 2 +- .../0.1/test/test-validation-bubble.js | 2 +- .../0.1/amp-fx-collection.js | 6 +- .../0.1/providers/fx-provider.js | 6 +- .../integration/test-amp-fx-fade-in-scroll.js | 10 +- .../test/integration/test-amp-fx-fade-in.js | 10 +- .../test/integration/test-amp-fx-fly-in.js | 10 +- .../test/integration/test-amp-fx-parallax.js | 10 +- .../0.1/test/test-amp-fx-collection.js | 2 +- .../0.1/test/test-fx-type.js | 21 +- .../0.1/amp-fx-flying-carpet.js | 10 +- .../0.1/test/test-amp-fx-flying-carpet.js | 30 +- extensions/amp-geo/0.1/amp-geo.js | 39 +- extensions/amp-geo/0.1/test/test-amp-geo.js | 42 +- extensions/amp-gfycat/0.1/amp-gfycat.js | 2 +- .../amp-gfycat/0.1/test/test-amp-gfycat.js | 14 +- extensions/amp-gist/0.1/amp-gist.js | 4 +- extensions/amp-gist/0.1/test/test-amp-gist.js | 6 +- .../0.1/amp-google-document-embed.js | 4 +- .../test/test-amp-google-document-embed.js | 8 +- .../0.1/amp-google-vrview-image.js | 2 +- .../0.1/test/test-amp-google-vrview-image.js | 8 +- .../0.1/amp-gwd-animation-impl.js | 2 +- .../0.1/amp-gwd-animation.js | 4 +- .../0.1/test/test-amp-gwd-animation.js | 8 +- extensions/amp-hulu/0.1/amp-hulu.js | 2 +- extensions/amp-hulu/0.1/test/test-amp-hulu.js | 6 +- extensions/amp-iframe/0.1/amp-iframe.js | 17 +- .../amp-iframe/0.1/test/test-amp-iframe.js | 94 +- extensions/amp-ima-video/0.1/amp-ima-video.js | 8 +- .../0.1/test/test-amp-ima-video.js | 20 +- .../0.1/amp-image-lightbox.js | 36 +- .../integration/test-amp-image-lightbox.js | 4 +- .../0.1/test/test-amp-image-lightbox.js | 20 +- .../amp-image-slider/0.1/amp-image-slider.js | 8 +- .../test/integration/test-amp-image-slider.js | 13 +- .../amp-image-viewer/0.1/amp-image-viewer.js | 16 +- extensions/amp-imgur/0.1/amp-imgur.js | 2 +- .../amp-imgur/0.1/test/test-amp-imgur.js | 10 +- .../0.1/amp-inline-gallery-thumbnails.js | 8 +- .../0.1/amp-inline-gallery.js | 22 +- extensions/amp-inputmask/0.1/amp-inputmask.js | 8 +- .../0.1/inputmask-custom-alias.js | 6 +- .../0.1/inputmask-payment-card-alias.js | 8 +- extensions/amp-inputmask/0.1/mask-impl.js | 6 +- .../test-integration-amp-inputmask-date.js | 7 +- .../test-integration-amp-inputmask.js | 9 +- .../amp-inputmask/0.1/test/test-mask-impl.js | 4 +- extensions/amp-inputmask/0.1/text-mask.js | 6 +- extensions/amp-instagram/0.1/amp-instagram.js | 2 +- .../0.1/test/test-amp-instagram.js | 12 +- .../0.1/amp-install-serviceworker.js | 16 +- .../test/test-amp-install-serviceworker.js | 20 +- extensions/amp-izlesene/0.1/amp-izlesene.js | 2 +- .../0.1/test/test-amp-izlesene.js | 6 +- extensions/amp-jwplayer/0.1/amp-jwplayer.js | 2 +- .../0.1/test/test-amp-jwplayer.js | 10 +- .../0.1/amp-kaltura-player.js | 4 +- .../0.1/test/test-amp-kaltura-player.js | 14 +- .../0.1/amp-lightbox-gallery.js | 54 +- .../0.1/lightbox-controls.js | 6 +- .../0.1/service/lightbox-manager-impl.js | 12 +- .../0.1/swipe-to-dismiss.js | 2 +- .../0.1/test-e2e/test-open-close.js | 2 +- .../integration/test-amp-lightbox-gallery.js | 6 +- .../0.1/test/test-amp-lightbox-gallery.js | 6 +- extensions/amp-lightbox/0.1/amp-lightbox.js | 18 +- .../0.1/test-e2e/test-amp-lightbox.js | 2 +- .../0.1/amp-link-rewriter.js | 6 +- .../amp-link-rewriter/0.1/config-options.js | 2 +- .../amp-link-rewriter/0.1/link-rewriter.js | 12 +- extensions/amp-link-rewriter/0.1/scope.js | 4 +- .../0.1/test/test-amp-link-rewriter.js | 2 +- extensions/amp-list/0.1/amp-list.js | 58 +- .../0.1/test-e2e/test-load-more-auto.js | 2 +- .../0.1/test-e2e/test-load-more-manual.js | 2 +- extensions/amp-list/0.1/test-e2e/test-ssr.js | 8 +- .../0.1/test/integration/test-amp-list.js | 8 +- .../0.1/test/test-amp-list-container.js | 2 +- .../0.1/test/test-amp-list-load-more.js | 2 +- extensions/amp-list/0.1/test/test-amp-list.js | 169 +- extensions/amp-live-list/0.1/amp-live-list.js | 24 +- .../amp-live-list/0.1/live-list-manager.js | 10 +- extensions/amp-live-list/0.1/poller.js | 2 +- .../0.1/test/test-amp-live-list.js | 2 +- .../0.1/test/test-live-list-manager.js | 40 +- extensions/amp-loader/0.1/amp-loader.js | 4 +- extensions/amp-mathml/0.1/amp-mathml.js | 4 +- extensions/amp-mega-menu/0.1/amp-mega-menu.js | 12 +- .../0.1/test/test-amp-mega-menu.js | 2 +- extensions/amp-megaphone/0.1/amp-megaphone.js | 2 +- .../0.1/test/test-amp-megaphone.js | 2 +- .../0.1/amp-minute-media-player.js | 4 +- .../0.1/test/test-amp-minute-media-player.js | 2 +- extensions/amp-mowplayer/0.1/amp-mowplayer.js | 2 +- .../0.1/test/test-amp-mowplayer.js | 8 +- extensions/amp-mraid/0.1/amp-mraid.js | 2 +- extensions/amp-mustache/0.1/amp-mustache.js | 5 +- .../0.1/test/test-amp-mustache.js | 6 +- extensions/amp-mustache/0.2/amp-mustache.js | 9 +- .../0.2/test/test-amp-mustache.js | 6 +- .../amp-nested-menu/0.1/amp-nested-menu.js | 10 +- .../0.1/test/test-amp-nested-menu.js | 4 +- extensions/amp-next-page/0.1/amp-next-page.js | 22 +- extensions/amp-next-page/0.1/config.js | 6 +- .../amp-next-page/0.1/next-page-service.js | 20 +- .../0.1/test/test-amp-next-page.js | 32 +- .../amp-next-page/0.1/test/test-config.js | 2 +- extensions/amp-next-page/1.0/amp-next-page.js | 2 +- extensions/amp-next-page/1.0/page.js | 4 +- extensions/amp-next-page/1.0/service.js | 62 +- .../1.0/test/test-amp-next-page.js | 32 +- .../amp-next-page/1.0/visibility-observer.js | 4 +- .../0.1/amp-nexxtv-player.js | 4 +- .../0.1/test/test-amp-nexxtv-player.js | 2 +- extensions/amp-o2-player/0.1/amp-o2-player.js | 2 +- .../0.1/test/test-amp-o2-player.js | 2 +- .../0.1/amp-ooyala-player.js | 4 +- .../0.1/test/test-amp-ooyala.js | 6 +- .../0.1/amp-orientation-observer.js | 13 +- .../0.1/test/test-amp-orientation-observer.js | 2 +- extensions/amp-pan-zoom/0.1/amp-pan-zoom.js | 27 +- .../0.1/test/integration/test-amp-pan-zoom.js | 4 +- .../0.1/test/test-amp-pan-zoom.js | 22 +- extensions/amp-pinterest/0.1/amp-pinterest.js | 4 +- extensions/amp-pinterest/0.1/pin-widget.js | 4 +- extensions/amp-pinterest/0.1/save-button.js | 2 +- .../0.1/test/test-amp-pinterest.js | 10 +- extensions/amp-playbuzz/0.1/amp-playbuzz.js | 8 +- .../0.1/test/test-amp-playbuzz.js | 20 +- extensions/amp-playbuzz/0.1/utils.js | 6 +- .../0.1/amp-position-observer.js | 6 +- .../test-e2e/test-scrollbound-animation.js | 2 +- .../0.1/test-e2e/test-target-id.js | 4 +- .../0.1/test/test-amp-position-observer.js | 2 +- .../amp-powr-player/0.1/amp-powr-player.js | 4 +- .../0.1/test/test-amp-powr-player.js | 18 +- .../amp-reach-player/0.1/amp-reach-player.js | 2 +- .../0.1/test/test-amp-reach-player.js | 6 +- .../0.1/amp-recaptcha-input.js | 4 +- .../0.1/amp-recaptcha-service.js | 12 +- .../0.1/test/test-amp-recaptcha-input.js | 14 +- .../0.1/test/test-amp-recaptcha-service.js | 6 +- .../0.1/amp-redbull-player.js | 4 +- .../0.1/test/test-amp-redbull.js | 2 +- extensions/amp-reddit/0.1/amp-reddit.js | 4 +- .../amp-reddit/0.1/test/test-amp-reddit.js | 2 +- .../amp-riddle-quiz/0.1/amp-riddle-quiz.js | 2 +- .../0.1/test/test-amp-riddle-quiz.js | 2 +- extensions/amp-script/0.1/amp-script.js | 42 +- .../0.1/test-e2e/test-amp-script.js | 2 +- .../0.1/test/integration/test-amp-script.js | 20 +- .../0.1/test/unit/test-amp-script.js | 6 +- .../test/unit/test-user-activation-tracker.js | 8 +- .../amp-script/0.1/user-activation-tracker.js | 4 +- extensions/amp-selector/0.1/amp-selector.js | 22 +- .../0.1/test-e2e/test-amp-selector-tabs.js | 2 +- .../0.1/test/test-amp-selector.js | 62 +- .../0.1/amp-share-tracking.js | 18 +- .../0.1/test/test-amp-share-tracking.js | 26 +- extensions/amp-sidebar/0.1/amp-sidebar.js | 30 +- .../0.1/test-e2e/test-amp-sidebar.js | 2 +- .../0.1/test/integration/test-amp-sidebar.js | 4 +- .../amp-sidebar/0.1/test/test-amp-sidebar.js | 68 +- .../amp-sidebar/0.1/test/test-toolbar.js | 54 +- extensions/amp-sidebar/0.2/amp-sidebar.js | 30 +- .../0.2/test-e2e/test-amp-sidebar.js | 2 +- .../0.2/test/integration/test-amp-sidebar.js | 4 +- .../amp-sidebar/0.2/test/test-amp-sidebar.js | 66 +- .../amp-sidebar/0.2/test/test-toolbar.js | 56 +- .../0.1/affiliate-link-resolver.js | 14 +- extensions/amp-skimlinks/0.1/amp-skimlinks.js | 8 +- .../link-rewriter/link-replacement-cache.js | 4 +- .../link-rewriter/link-rewriter-manager.js | 4 +- .../0.1/link-rewriter/link-rewriter.js | 17 +- extensions/amp-skimlinks/0.1/skim-options.js | 2 +- extensions/amp-skimlinks/0.1/test/helpers.js | 2 +- .../0.1/test/test-affiliate-link-resolver.js | 8 +- .../0.1/test/test-amp-skimlinks.js | 2 +- .../0.1/test/test-link-rewriter.js | 12 +- .../0.1/test/test-skim-options.js | 2 +- .../amp-skimlinks/0.1/test/test-tracking.js | 2 +- .../amp-skimlinks/0.1/test/test-waypoint.js | 2 +- extensions/amp-skimlinks/0.1/tracking.js | 2 +- extensions/amp-slides/0.1/amp-slides.js | 2 +- .../amp-smartlinks/0.1/amp-smartlinks.js | 14 +- extensions/amp-smartlinks/0.1/linkmate.js | 10 +- .../0.1/test/test-amp-smartlinks.js | 4 +- .../amp-smartlinks/0.1/test/test-linkmate.js | 4 +- .../amp-social-share/0.1/amp-social-share.js | 6 +- .../0.1/test/test-amp-social-share.js | 58 +- .../amp-social-share/0.2/amp-social-share.js | 6 +- .../amp-soundcloud/0.1/amp-soundcloud.js | 2 +- .../0.1/test/test-amp-soundcloud.js | 16 +- .../0.1/amp-springboard-player.js | 2 +- .../0.1/test/test-amp-springboard-player.js | 12 +- .../amp-standalone/0.1/amp-standalone.js | 4 +- .../0.1/test/test-amp-standalone.js | 2 +- extensions/amp-sticky-ad/1.0/amp-sticky-ad.js | 6 +- .../1.0/test/test-amp-sticky-ad.js | 52 +- .../0.1/amp-story-auto-ads.js | 60 +- .../0.1/story-ad-localization.js | 2 +- .../amp-story-auto-ads/0.1/story-ad-page.js | 14 +- .../test-amp-story-auto-ads-fullbleed.js | 2 +- .../0.1/test-e2e/test-amp-story-auto-ads.js | 4 +- .../amp-story-auto-ads/0.1/test/story-mock.js | 6 +- .../0.1/test/test-amp-story-auto-ads.js | 4 +- .../0.1/test/test-story-ad-analytics.js | 324 +-- .../0.1/test/test-story-ad-config.js | 2 +- .../0.1/test/test-story-ad-localization.js | 2 +- .../0.1/test/test-story-ad-page.js | 2 +- .../0.1/amp-story-education.js | 14 +- .../0.1/test/test-amp-story-education.js | 8 +- extensions/amp-story/0.1/amp-story-bookend.js | 28 +- extensions/amp-story/0.1/amp-story-consent.js | 4 +- .../amp-story/0.1/amp-story-grid-layer.js | 4 +- .../amp-story/0.1/amp-story-info-dialog.js | 10 +- extensions/amp-story/0.1/amp-story-page.js | 26 +- .../amp-story/0.1/amp-story-render-service.js | 2 +- .../0.1/amp-story-request-service.js | 4 +- .../amp-story/0.1/amp-story-share-menu.js | 6 +- extensions/amp-story/0.1/amp-story-share.js | 22 +- .../amp-story/0.1/amp-story-store-service.js | 2 +- .../amp-story/0.1/amp-story-system-layer.js | 16 +- .../0.1/amp-story-viewport-warning-layer.js | 4 +- extensions/amp-story/0.1/amp-story.js | 90 +- extensions/amp-story/0.1/analytics.js | 4 +- .../amp-story/0.1/animation-presets-utils.js | 2 +- extensions/amp-story/0.1/animation.js | 30 +- extensions/amp-story/0.1/development-ui.js | 2 +- extensions/amp-story/0.1/jsonld.js | 2 +- extensions/amp-story/0.1/logging.js | 26 +- extensions/amp-story/0.1/media-pool.js | 27 +- extensions/amp-story/0.1/navigation-state.js | 4 +- extensions/amp-story/0.1/page-advancement.js | 28 +- extensions/amp-story/0.1/page-element.js | 4 +- .../amp-story/0.1/pagination-buttons.js | 2 +- extensions/amp-story/0.1/related-articles.js | 6 +- extensions/amp-story/0.1/simple-template.js | 19 +- extensions/amp-story/0.1/sources.js | 8 +- .../0.1/test/test-amp-story-consent.js | 8 +- .../0.1/test/test-amp-story-cta-layer.js | 2 +- .../amp-story/0.1/test/test-amp-story-hint.js | 6 +- .../0.1/test/test-amp-story-info-dialog.js | 8 +- .../test/test-amp-story-request-service.js | 6 +- .../0.1/test/test-amp-story-share-menu.js | 8 +- .../0.1/test/test-amp-story-store-service.js | 6 +- .../0.1/test/test-amp-story-system-layer.js | 8 +- .../amp-story/0.1/test/test-amp-story.js | 19 +- .../amp-story/0.1/test/test-analytics.js | 2 +- .../0.1/test/test-full-bleed-animations.js | 14 +- .../0.1/test/test-loading-spinner.js | 2 +- .../amp-story/0.1/test/test-media-pool.js | 22 +- .../amp-story/0.1/test/test-media-tasks.js | 10 +- .../0.1/test/test-navigation-state.js | 32 +- extensions/amp-story/0.1/utils.js | 2 +- extensions/amp-story/1.0/amp-story-access.js | 18 +- .../amp-story/1.0/amp-story-affiliate-link.js | 4 +- extensions/amp-story/1.0/amp-story-consent.js | 11 +- .../1.0/amp-story-draggable-drawer.js | 10 +- .../1.0/amp-story-embedded-component.js | 26 +- .../amp-story/1.0/amp-story-grid-layer.js | 4 +- extensions/amp-story/1.0/amp-story-hint.js | 10 +- .../amp-story/1.0/amp-story-info-dialog.js | 10 +- .../1.0/amp-story-media-query-service.js | 8 +- .../1.0/amp-story-page-attachment.js | 4 +- extensions/amp-story/1.0/amp-story-page.js | 76 +- extensions/amp-story/1.0/amp-story-quiz.js | 44 +- .../amp-story/1.0/amp-story-render-service.js | 2 +- .../1.0/amp-story-request-service.js | 6 +- .../amp-story/1.0/amp-story-share-menu.js | 14 +- extensions/amp-story/1.0/amp-story-share.js | 26 +- .../amp-story/1.0/amp-story-store-service.js | 6 +- .../amp-story/1.0/amp-story-system-layer.js | 28 +- .../1.0/amp-story-viewer-messaging-handler.js | 10 +- .../1.0/amp-story-viewport-warning-layer.js | 6 +- extensions/amp-story/1.0/amp-story.js | 130 +- .../amp-story/1.0/animation-presets-utils.js | 2 +- extensions/amp-story/1.0/animation.js | 34 +- .../1.0/bookend/amp-story-bookend.js | 28 +- .../1.0/bookend/components/article.js | 4 +- .../1.0/bookend/components/cta-link.js | 4 +- .../1.0/bookend/components/landscape.js | 4 +- .../1.0/bookend/components/portrait.js | 4 +- .../1.0/bookend/components/text-box.js | 6 +- extensions/amp-story/1.0/development-ui.js | 2 +- extensions/amp-story/1.0/jsonld.js | 2 +- .../amp-story/1.0/live-story-manager.js | 4 +- extensions/amp-story/1.0/logging.js | 26 +- .../1.0/media-performance-metrics-service.js | 8 +- extensions/amp-story/1.0/media-pool.js | 27 +- extensions/amp-story/1.0/page-advancement.js | 22 +- .../amp-story/1.0/pagination-buttons.js | 10 +- extensions/amp-story/1.0/progress-bar.js | 17 +- extensions/amp-story/1.0/semantic-render.js | 12 +- extensions/amp-story/1.0/simple-template.js | 4 +- extensions/amp-story/1.0/sources.js | 8 +- extensions/amp-story/1.0/story-analytics.js | 6 +- .../1.0/test-e2e/test-amp-story-bookend.js | 2 +- .../1.0/test-e2e/test-amp-story-share-menu.js | 2 +- .../test-amp-story-affiliate-link.js | 9 +- .../1.0/test/test-amp-story-access.js | 10 +- .../1.0/test/test-amp-story-bookend.js | 8 +- .../1.0/test/test-amp-story-consent.js | 8 +- .../1.0/test/test-amp-story-cta-layer.js | 8 +- .../test/test-amp-story-embedded-component.js | 16 +- .../1.0/test/test-amp-story-grid-layer.js | 12 +- .../amp-story/1.0/test/test-amp-story-hint.js | 8 +- .../1.0/test/test-amp-story-info-dialog.js | 8 +- .../test-amp-story-media-query-service.js | 6 +- .../amp-story/1.0/test/test-amp-story-page.js | 48 +- .../amp-story/1.0/test/test-amp-story-quiz.js | 10 +- .../test/test-amp-story-request-service.js | 2 +- .../1.0/test/test-amp-story-share-menu.js | 8 +- .../1.0/test/test-amp-story-store-service.js | 6 +- .../1.0/test/test-amp-story-system-layer.js | 8 +- ...test-amp-story-viewer-messaging-handler.js | 2 +- .../amp-story/1.0/test/test-amp-story.js | 39 +- .../amp-story/1.0/test/test-analytics.js | 2 +- .../1.0/test/test-full-bleed-animations.js | 10 +- .../1.0/test/test-live-story-manager.js | 6 +- .../1.0/test/test-loading-spinner.js | 2 +- .../test-media-performance-metrics-service.js | 4 +- .../amp-story/1.0/test/test-media-pool.js | 26 +- .../amp-story/1.0/test/test-media-tasks.js | 12 +- .../1.0/test/test-variable-service.js | 2 +- extensions/amp-story/1.0/utils.js | 4 +- extensions/amp-story/1.0/variable-service.js | 8 +- .../0.1/amp-stream-gallery.js | 50 +- .../0.1/test/test-amp-stream-gallery.js | 30 +- .../0.1/amp-subscriptions-google.js | 33 +- .../test-e2e/test-amp-subscriptions-google.js | 2 +- .../0.1/test/test-amp-subscriptions-google.js | 8 +- extensions/amp-subscriptions/0.1/actions.js | 6 +- .../0.1/amp-subscriptions.js | 52 +- .../amp-subscriptions/0.1/crypto-handler.js | 8 +- .../0.1/local-subscription-platform-base.js | 8 +- .../0.1/local-subscription-platform-iframe.js | 10 +- .../0.1/local-subscription-platform-remote.js | 10 +- .../local-subscription-platform-renderer.js | 6 +- .../amp-subscriptions/0.1/platform-store.js | 16 +- .../0.1/test/test-actions.js | 4 +- .../0.1/test/test-amp-subscriptions.js | 12 +- .../0.1/test/test-analytics.js | 2 +- .../0.1/test/test-crypto-handler.js | 4 +- .../amp-subscriptions/0.1/test/test-dialog.js | 2 +- .../0.1/test/test-doc-impl.js | 2 +- .../test/test-local-subscription-rendering.js | 10 +- ...est-local-subscriptions-iframe-platform.js | 2 +- .../0.1/test/test-local-subscriptions.js | 2 +- .../0.1/test/test-platform-store.js | 58 +- .../0.1/test/test-renderer.js | 8 +- .../0.1/test/test-service-adapter.js | 2 +- .../0.1/test/test-url-builder.js | 2 +- .../0.1/test/test-viewer-platform.js | 2 +- .../0.1/test/test-viewer-tracker.js | 4 +- .../amp-subscriptions/0.1/url-builder.js | 8 +- .../0.1/viewer-subscription-platform.js | 6 +- .../amp-subscriptions/0.1/viewer-tracker.js | 10 +- extensions/amp-timeago/0.1/amp-timeago.js | 2 +- .../amp-timeago/0.1/test/test-amp-timeago.js | 6 +- extensions/amp-timeago/0.2/amp-timeago.js | 2 +- .../amp-timeago/0.2/test/test-amp-timeago.js | 6 +- extensions/amp-timeago/0.2/timeago.js | 2 +- .../0.1/amp-truncate-text.js | 21 +- .../0.1/test/test-amp-truncate-text.js | 6 +- .../0.1/test/test-binary-search.js | 32 +- .../amp-truncate-text/0.1/truncate-text.js | 8 +- extensions/amp-twitter/0.1/amp-twitter.js | 4 +- .../amp-twitter/0.1/test/test-amp-twitter.js | 2 +- .../0.1/amp-user-notification.js | 34 +- .../0.1/test/test-amp-user-notification.js | 62 +- .../0.1/amp-video-docking.js | 40 +- .../amp-video-docking/0.1/breakpoints.js | 2 +- extensions/amp-video-docking/0.1/controls.js | 16 +- extensions/amp-video-docking/0.1/math.js | 4 +- .../0.1/test/test-amp-video-docking.js | 26 +- .../0.1/test/test-breakpoints.js | 10 +- .../amp-video-docking/0.1/viewport-rect.js | 2 +- .../amp-video-iframe/0.1/amp-video-iframe.js | 4 +- .../0.1/test/test-amp-video-iframe.js | 15 +- extensions/amp-video/0.1/amp-video.js | 14 +- .../amp-video/0.1/test-e2e/test-amp-video.js | 2 +- .../amp-video/0.1/test/test-amp-video.js | 64 +- .../0.1/amp-viewer-assistance.js | 29 +- .../0.1/test/test-amp-viewer-assistance.js | 6 +- .../0.1/amp-viewer-gpay-button.js | 2 +- .../0.1/test/test-amp-viewer-gpay-button.js | 2 +- .../0.1/amp-viewer-gpay-inline.js | 2 +- .../0.1/test/test-amp-viewer-gpay-inline.js | 2 +- .../0.1/amp-viewer-integration.js | 8 +- .../0.1/examples/amp-viewer-host.js | 4 +- .../amp-viewer-integration/0.1/findtext.js | 2 +- .../0.1/keyboard-handler.js | 2 +- .../0.1/messaging/messaging.js | 14 +- .../test-amp-viewer-integration.js | 22 +- .../test-amp-webview-viewer-integration.js | 6 +- .../integration/test-messaging-handshake.js | 22 +- .../test-viewer-initiated-handshake.js | 4 +- .../0.1/test/test-findtext.js | 6 +- .../0.1/test/test-focus-handler.js | 6 +- .../0.1/test/test-highlight-handler.js | 10 +- .../0.1/test/test-keyboard-handler.js | 6 +- .../0.1/test/test-touch-handler.js | 12 +- .../0.1/touch-handler.js | 2 +- .../0.1/viewer-for-testing.js | 6 +- ...-initiated-handshake-viewer-for-testing.js | 4 +- .../0.1/webview-viewer-for-testing.js | 6 +- extensions/amp-vimeo/0.1/amp-vimeo.js | 10 +- .../amp-vimeo/0.1/test/test-amp-vimeo.js | 2 +- extensions/amp-vine/0.1/amp-vine.js | 2 +- extensions/amp-vine/0.1/test/test-amp-vine.js | 6 +- .../amp-viqeo-player/0.1/amp-viqeo-player.js | 7 +- .../0.1/test/test-amp-viqeo-player.js | 16 +- extensions/amp-viz-vega/0.1/amp-viz-vega.js | 10 +- extensions/amp-vk/0.1/amp-vk.js | 10 +- extensions/amp-vk/0.1/test/test-amp-vk.js | 2 +- .../amp-web-push/0.1/amp-web-push-config.js | 6 +- .../0.1/amp-web-push-helper-frame.js | 8 +- .../0.1/amp-web-push-permission-dialog.js | 8 +- extensions/amp-web-push/0.1/amp-web-push.js | 2 +- .../0.1/amp-web-push.service-worker.js | 10 +- .../0.1/test/test-web-push-config.js | 4 +- .../test/test-web-push-permission-dialog.js | 2 +- .../0.1/test/test-web-push-service.js | 30 +- .../amp-web-push/0.1/web-push-service.js | 22 +- .../amp-web-push/0.1/window-messenger.js | 4 +- .../0.1/amp-wistia-player.js | 2 +- .../0.1/test/test-amp-wistia-player.js | 4 +- extensions/amp-yotpo/0.1/amp-yotpo.js | 6 +- .../amp-yotpo/0.1/test/test-amp-yotpo.js | 4 +- extensions/amp-youtube/0.1/amp-youtube.js | 4 +- .../amp-youtube/0.1/test/test-amp-youtube.js | 14 +- gulpfile.js | 4 +- src/3p-frame.js | 2 +- src/ad-cid.js | 6 +- src/amp-story-player-impl.js | 12 +- src/amp-story-player-manager.js | 4 +- src/analytics.js | 2 +- src/animation.js | 2 +- src/auto-lightbox.js | 2 +- src/base-element.js | 6 +- src/batched-json.js | 10 +- src/chunk.js | 2 +- src/consent.js | 6 +- src/custom-element.js | 24 +- src/document-fetcher.js | 10 +- src/document-ready.js | 4 +- src/document-submit.js | 14 +- src/dom.js | 12 +- src/element-service.js | 4 +- src/error.js | 18 +- src/event-helper-listen.js | 2 +- src/event-helper.js | 6 +- src/examiner/examiner.js | 2 +- src/exponential-backoff.js | 2 +- src/extension-analytics.js | 4 +- src/focus-history.js | 4 +- src/form-data-wrapper.js | 10 +- src/form.js | 4 +- src/format.js | 2 +- src/friendly-iframe-embed.js | 26 +- src/gesture.js | 2 +- src/get-html.js | 4 +- src/iframe-helper.js | 16 +- src/iframe-video.js | 2 +- src/impression.js | 18 +- src/inabox/inabox-resources.js | 6 +- src/inabox/inabox-viewport.js | 35 +- src/ini-load.js | 10 +- src/input.js | 10 +- src/intersection-observer-polyfill.js | 2 +- src/loader.js | 2 +- src/localized-strings.js | 2 +- src/log.js | 12 +- src/mediasession-helper.js | 2 +- src/modal.js | 28 +- src/motion.js | 2 +- src/multidoc-manager.js | 38 +- src/polyfills/custom-elements.js | 32 +- src/polyfills/domtokenlist.js | 2 +- src/polyfills/fetch.js | 6 +- src/polyfills/object-values.js | 2 +- src/preact/base-element.js | 6 +- src/preact/slot.js | 14 +- src/purifier/purifier.js | 14 +- src/render-delaying-services.js | 6 +- src/runtime.js | 14 +- src/sanitizer.js | 10 +- src/service.js | 8 +- src/service/action-impl.js | 38 +- src/service/ampdoc-impl.js | 6 +- src/service/batched-xhr-impl.js | 6 +- src/service/cache-cid-api.js | 12 +- src/service/cid-api.js | 8 +- src/service/cid-impl.js | 34 +- src/service/crypto-impl.js | 12 +- src/service/custom-element-registry.js | 2 +- src/service/document-info-impl.js | 2 +- src/service/extensions-impl.js | 12 +- src/service/fixed-layer.js | 18 +- src/service/hidden-observer-impl.js | 2 +- src/service/history-impl.js | 24 +- src/service/ie-media-bug.js | 2 +- src/service/jank-meter.js | 4 +- src/service/localization.js | 4 +- src/service/mutator-impl.js | 8 +- src/service/navigation.js | 19 +- src/service/origin-experiments-impl.js | 10 +- src/service/owners-impl.js | 14 +- src/service/performance-impl.js | 10 +- .../position-observer-worker.js | 7 +- src/service/resource.js | 4 +- src/service/resources-impl.js | 45 +- src/service/standard-actions-impl.js | 10 +- src/service/storage-impl.js | 26 +- src/service/template-impl.js | 20 +- src/service/timer-impl.js | 4 +- src/service/url-expander/expander.js | 28 +- src/service/url-replacements-impl.js | 69 +- src/service/variable-source.js | 10 +- src/service/video-manager-impl.js | 30 +- src/service/viewer-impl.js | 23 +- src/service/viewport/viewport-impl.js | 18 +- src/service/vsync-impl.js | 10 +- src/service/xhr-impl.js | 15 +- src/shadow-embed.js | 12 +- src/size-list.js | 2 +- src/srcset.js | 2 +- src/ssr-template-helper.js | 2 +- src/standalone.js | 2 +- src/string.js | 4 +- src/style-installer.js | 4 +- src/transition.js | 18 +- src/url-rewrite.js | 2 +- src/utils/base64.js | 4 +- src/utils/dom-ancestor-visitor.js | 6 +- src/utils/dom-writer.js | 2 +- src/utils/math.js | 2 +- src/utils/object.js | 2 +- src/utils/promise.js | 10 +- src/utils/rate-limit.js | 4 +- src/utils/video.js | 2 +- src/utils/xhr-utils.js | 16 +- src/video-iframe-integration.js | 16 +- src/video-interface.js | 2 +- src/web-worker/amp-worker.js | 4 +- src/web-worker/web-worker.js | 4 +- test/_init_tests.js | 44 +- test/e2e/test-adchoices.js | 2 +- test/e2e/test-amp-bind-brightcove.js | 2 +- test/e2e/test-amp-bind-email.js | 2 +- test/e2e/test-amp-bind-form.js | 4 +- test/e2e/test-amp-bind-iframe.js | 2 +- test/e2e/test-amp-bind-live-list.js | 2 +- test/e2e/test-amp-bind-state.js | 2 +- test/e2e/test-amp-bind-video.js | 2 +- test/e2e/test-amp-bind-youtube.js | 2 +- test/e2e/test-controller-promise.js | 42 +- test/e2e/test-expect.js | 28 +- test/integration/test-3p-nameframe.js | 16 +- test/integration/test-actions.js | 24 +- test/integration/test-amp-ad-3p.js | 14 +- test/integration/test-amp-ad-doubleclick.js | 20 +- test/integration/test-amp-ad-type-custom.js | 2 +- test/integration/test-amp-analytics.js | 56 +- test/integration/test-amp-bind.js | 30 +- test/integration/test-amp-carousel.js | 17 +- test/integration/test-amp-img.js | 18 +- test/integration/test-amp-pixel.js | 20 +- test/integration/test-amp-recaptcha-input.js | 32 +- test/integration/test-amp-skimlinks.js | 23 +- test/integration/test-amp-story-analytics.js | 12 +- test/integration/test-amphtml-ads.js | 36 +- test/integration/test-boilerplates.js | 4 +- test/integration/test-configuration.js | 4 +- test/integration/test-errors.js | 6 +- test/integration/test-extensions-loading.js | 4 +- test/integration/test-position-observer.js | 6 +- test/integration/test-released.js | 16 +- test/integration/test-shadow-amp.js | 2 +- test/integration/test-toggle-display.js | 4 +- test/integration/test-user-error-reporting.js | 8 +- test/integration/test-video-manager.js | 22 +- test/integration/test-video-players-helper.js | 163 +- test/integration/test-video-players.js | 20 +- test/integration/test-visibility-states.js | 15 +- test/unit/3p/test-3p-frame.js | 14 +- test/unit/3p/test-3p-messaging.js | 22 +- test/unit/3p/test-ampcontext-integration.js | 2 +- test/unit/3p/test-iframe-messaging-client.js | 2 +- test/unit/3p/test-recaptcha.js | 4 +- test/unit/ads/test-adplugg.js | 12 +- test/unit/ads/test-csa.js | 8 +- test/unit/ads/test-pubmine.js | 2 +- test/unit/ads/test-ssp.js | 2 +- .../test-inabox-frame-overlay-manager.js | 2 +- test/unit/inabox/test-inabox-host.js | 6 +- .../unit/inabox/test-inabox-messaging-host.js | 2 +- test/unit/inabox/test-inabox-mutator.js | 4 +- test/unit/inabox/test-inabox-resources.js | 4 +- test/unit/inabox/test-inabox-viewport.js | 22 +- test/unit/inabox/test-position-observer.js | 4 +- test/unit/inabox/test-utils.js | 2 +- test/unit/test-3p-environment.js | 6 +- test/unit/test-3p.js | 12 +- test/unit/test-action.js | 70 +- test/unit/test-activity.js | 16 +- test/unit/test-ad-cid.js | 12 +- test/unit/test-ad-helper.js | 16 +- test/unit/test-ads-config.js | 2 +- test/unit/test-alp-handler.js | 2 +- test/unit/test-amp-context.js | 2 +- test/unit/test-amp-img.js | 56 +- test/unit/test-amp-inabox.js | 2 +- test/unit/test-amp-pixel.js | 20 +- test/unit/test-amp-story-player.js | 2 +- test/unit/test-ampdoc.js | 28 +- test/unit/test-analytics.js | 2 +- test/unit/test-animation.js | 28 +- test/unit/test-base-element.js | 4 +- test/unit/test-batched-xhr.js | 50 +- test/unit/test-cache-cid-api.js | 10 +- test/unit/test-chunk.js | 56 +- test/unit/test-cid-api.js | 32 +- test/unit/test-cid.js | 80 +- test/unit/test-consent.js | 2 +- test/unit/test-cookies.js | 2 +- test/unit/test-crypto.js | 26 +- test/unit/test-custom-element-registry.js | 10 +- test/unit/test-custom-element.js | 111 +- test/unit/test-describes.js | 8 +- test/unit/test-document-info.js | 24 +- test/unit/test-document-ready.js | 8 +- test/unit/test-document-submit.js | 6 +- test/unit/test-dom.js | 66 +- test/unit/test-element-service.js | 88 +- test/unit/test-error.js | 8 +- test/unit/test-event-helper.js | 28 +- test/unit/test-experiments.js | 12 +- test/unit/test-extension-analytics.js | 36 +- test/unit/test-extensions.js | 72 +- test/unit/test-fixed-layer.js | 32 +- test/unit/test-font-stylesheet-timeout.js | 4 +- test/unit/test-form-data-wrapper.js | 4 +- test/unit/test-form.js | 8 +- test/unit/test-friendly-iframe-embed.js | 87 +- test/unit/test-gesture-recognizers.js | 71 +- test/unit/test-gesture.js | 44 +- test/unit/test-hidden-observer.js | 6 +- test/unit/test-history.js | 118 +- test/unit/test-ie-media-bug.js | 14 +- test/unit/test-iframe-helper.js | 26 +- test/unit/test-iframe-stub.js | 6 +- test/unit/test-impression.js | 28 +- test/unit/test-ini-load.js | 2 +- test/unit/test-input.js | 92 +- test/unit/test-integration.js | 6 +- .../test-intersection-observer-polyfill.js | 10 +- test/unit/test-intersection-observer.js | 14 +- test/unit/test-jank-meter.js | 2 +- test/unit/test-json.js | 2 +- test/unit/test-layout-delay-meter.js | 2 +- test/unit/test-layout.js | 30 +- test/unit/test-localization.js | 8 +- test/unit/test-log.js | 30 +- test/unit/test-mediasession-helper.js | 2 +- test/unit/test-modal.js | 2 +- test/unit/test-mustache.js | 2 +- test/unit/test-mutator.js | 170 +- test/unit/test-navigation.js | 30 +- test/unit/test-notification-ui-manager.js | 12 +- test/unit/test-origin-experiments.js | 20 +- test/unit/test-owners.js | 10 +- test/unit/test-pass.js | 11 +- test/unit/test-performance.js | 95 +- test/unit/test-polyfill-array-includes.js | 2 +- .../unit/test-polyfill-domtokenlist-toggle.js | 4 +- test/unit/test-polyfill-math-sign.js | 2 +- test/unit/test-position-observer.js | 12 +- test/unit/test-preconnect.js | 24 +- test/unit/test-pull-to-refresh.js | 5 +- test/unit/test-purifier.js | 9 +- test/unit/test-render-delaying-services.js | 8 +- test/unit/test-resource.js | 295 +-- test/unit/test-resources.js | 20 +- test/unit/test-runtime.js | 132 +- test/unit/test-sanitizer.js | 2 +- test/unit/test-service.js | 50 +- test/unit/test-shadow-embed.js | 10 +- test/unit/test-size-list.js | 4 +- test/unit/test-ssr-template-helper.js | 8 +- test/unit/test-standard-actions.js | 64 +- test/unit/test-static-template.js | 12 +- test/unit/test-storage.js | 88 +- test/unit/test-style-installer.js | 64 +- test/unit/test-task-queue.js | 2 +- test/unit/test-template.js | 26 +- test/unit/test-timer.js | 46 +- test/unit/test-transition.js | 6 +- test/unit/test-types.js | 4 +- test/unit/test-url-replacements.js | 288 +-- test/unit/test-validator-integration.js | 4 +- test/unit/test-variable-source.js | 22 +- ...test-video-analytics-percentage-tracker.js | 8 +- test/unit/test-video-iframe-integration.js | 12 +- test/unit/test-video-rotate-to-fullscreen.js | 2 +- test/unit/test-video-session-manager.js | 2 +- test/unit/test-viewer-cid-api.js | 4 +- test/unit/test-viewer.js | 116 +- test/unit/test-viewport-binding.js | 8 +- test/unit/test-viewport.js | 123 +- test/unit/test-vsync.js | 54 +- test/unit/test-web-components.js | 2 +- test/unit/test-xhr-document-fetcher.js | 26 +- test/unit/test-xhr-fetch-polyfill.js | 28 +- test/unit/test-xhr.js | 114 +- test/unit/test-yield.js | 20 +- test/unit/url-expander/test-expander.js | 22 +- test/unit/utils/test-array.js | 14 +- test/unit/utils/test-base64.js | 6 +- test/unit/utils/test-bytes.js | 8 +- test/unit/utils/test-detached-dom-stream.js | 2 +- test/unit/utils/test-document-visibility.js | 2 +- test/unit/utils/test-dom-ancestor-visitor.js | 10 +- test/unit/utils/test-dom-fingerprint.js | 2 +- test/unit/utils/test-dom-transform-stream.js | 2 +- test/unit/utils/test-dom-writer.js | 20 +- test/unit/utils/test-priority-queue.js | 4 +- test/unit/utils/test-promise.js | 16 +- test/unit/utils/test-signals.js | 12 +- test/unit/utils/test-xhr-utils.js | 18 +- test/unit/web-worker/test-amp-worker.js | 6 +- testing/amp-performance-extension/measure.js | 18 +- testing/describes.js | 58 +- testing/fake-dom.js | 38 +- testing/iframe.js | 50 +- testing/test-helper.js | 32 +- testing/yield.js | 2 +- tools/experiments/experiments.js | 18 +- 1367 files changed, 10472 insertions(+), 11381 deletions(-) diff --git a/3p/3d-gltf/index.js b/3p/3d-gltf/index.js index 9ddf8f3db762..623ba1b83c0f 100644 --- a/3p/3d-gltf/index.js +++ b/3p/3d-gltf/index.js @@ -22,8 +22,8 @@ import {user} from '../../src/log'; import GltfViewer from './viewer'; -const seq = (taskA, taskB) => cb => taskA(() => taskB(cb)); -const parallel = (taskA, taskB) => cb => { +const seq = (taskA, taskB) => (cb) => taskA(() => taskB(cb)); +const parallel = (taskA, taskB) => (cb) => { let n = 0; const finish = () => { n++; @@ -36,8 +36,8 @@ const parallel = (taskA, taskB) => cb => { }; const loadThree = (global, cb) => { - const loadScriptCb = url => cb => loadScript(global, url, cb); - const loadThreeExample = examplePath => + const loadScriptCb = (url) => (cb) => loadScript(global, url, cb); + const loadThreeExample = (examplePath) => loadScriptCb( 'https://cdn.jsdelivr.net/npm/three@0.91/examples/js/' + examplePath ); @@ -62,7 +62,7 @@ export function gltfViewer(global) { onload: () => { nonSensitiveDataPostMessage('loaded'); }, - onprogress: e => { + onprogress: (e) => { if (!e.lengthComputable) { return; } @@ -74,7 +74,7 @@ export function gltfViewer(global) { }) ); }, - onerror: err => { + onerror: (err) => { user().error('3DGLTF', err); nonSensitiveDataPostMessage( 'error', @@ -84,7 +84,7 @@ export function gltfViewer(global) { ); }, }); - listenParent(global, 'action', msg => { + listenParent(global, 'action', (msg) => { viewer.actions[msg['action']](msg['args']); }); nonSensitiveDataPostMessage('ready'); diff --git a/3p/3d-gltf/viewer.js b/3p/3d-gltf/viewer.js index 83bc1a065e2e..1ee91bde01f9 100644 --- a/3p/3d-gltf/viewer.js +++ b/3p/3d-gltf/viewer.js @@ -128,7 +128,7 @@ export default class GltfViewer { let oldW = null; let oldH = null; /** @param {JsonObject} box */ - const setSize = box => { + const setSize = (box) => { const w = box['width']; const h = box['height']; if (oldW === w && oldH === h) { @@ -250,9 +250,9 @@ export default class GltfViewer { loader.load( this.options_['src'], /** @param {{scene: !THREE.Scene}} gltfData */ - gltfData => { + (gltfData) => { this.setupCameraForObject_(gltfData.scene); - gltfData.scene.children.slice().forEach(child => { + gltfData.scene.children.slice().forEach((child) => { this.model_.add(child); }); diff --git a/3p/3p.js b/3p/3p.js index 7385178b7fea..0611bbd1099a 100644 --- a/3p/3p.js +++ b/3p/3p.js @@ -197,7 +197,7 @@ export function computeInMasterFrame(global, taskId, work, cb) { if (!global.context.isMaster) { return; // Only do work in master. } - work(result => { + work((result) => { for (let i = 0; i < cbs.length; i++) { cbs[i].call(null, result); } @@ -254,7 +254,7 @@ export function validateData(data, mandatoryFields, opt_optionalFields) { */ function validateExactlyOne(data, alternativeFields) { userAssert( - alternativeFields.filter(field => data[field]).length === 1, + alternativeFields.filter((field) => data[field]).length === 1, '%s must contain exactly one of attributes: %s.', data.type, alternativeFields.join(', ') diff --git a/3p/ampcontext.js b/3p/ampcontext.js index b9065b2bb23b..254596ff8443 100644 --- a/3p/ampcontext.js +++ b/3p/ampcontext.js @@ -129,7 +129,7 @@ export class AbstractAmpContext { this.client_.makeRequest( MessageType.SEND_EMBED_STATE, MessageType.EMBED_STATE, - data => { + (data) => { this.hidden = data['pageHidden']; this.dispatchVisibilityChangeEvent_(); } @@ -155,7 +155,7 @@ export class AbstractAmpContext { * every time we receive a page visibility message. */ onPageVisibilityChange(callback) { - return this.client_.registerCallback(MessageType.EMBED_STATE, data => { + return this.client_.registerCallback(MessageType.EMBED_STATE, (data) => { callback({hidden: data['pageHidden']}); }); } @@ -171,7 +171,7 @@ export class AbstractAmpContext { return this.client_.makeRequest( MessageType.SEND_INTERSECTIONS, MessageType.INTERSECTION, - intersection => { + (intersection) => { callback(intersection['changes']); } ); @@ -230,7 +230,7 @@ export class AbstractAmpContext { * request succeeds. */ onResizeSuccess(callback) { - this.client_.registerCallback(MessageType.EMBED_SIZE_CHANGED, obj => { + this.client_.registerCallback(MessageType.EMBED_SIZE_CHANGED, (obj) => { callback(obj['requestedHeight'], obj['requestedWidth']); }); } @@ -243,7 +243,7 @@ export class AbstractAmpContext { * request is denied. */ onResizeDenied(callback) { - this.client_.registerCallback(MessageType.EMBED_SIZE_DENIED, obj => { + this.client_.registerCallback(MessageType.EMBED_SIZE_DENIED, (obj) => { callback(obj['requestedHeight'], obj['requestedWidth']); }); } diff --git a/3p/beopinion.js b/3p/beopinion.js index d0e4a9a8e3cc..709770bef82e 100644 --- a/3p/beopinion.js +++ b/3p/beopinion.js @@ -25,7 +25,7 @@ import {setStyles} from '../src/style'; * @param {!Window} global */ function getBeOpinion(global) { - loadScript(global, 'https://widget.beopinion.com/sdk.js', function() {}); + loadScript(global, 'https://widget.beopinion.com/sdk.js', function () {}); } /** @@ -87,20 +87,20 @@ function createContainer(global, data) { */ function getBeOpinionAsyncInit(global, accountId) { const {context} = global; - return function() { - context.onResizeDenied(function(requestedHeight, requestedWidth) { + return function () { + context.onResizeDenied(function (requestedHeight, requestedWidth) { context.requestResize(requestedWidth, requestedHeight); }); global.BeOpinionSDK.init({ account: accountId, - onContentReceive: function(hasContent) { + onContentReceive: function (hasContent) { if (hasContent) { context.renderStart(); } else { context.noContentAvailable(); } }, - onHeightChange: function(newHeight) { + onHeightChange: function (newHeight) { const c = global.document.getElementById('c'); const boundingClientRect = c./*REVIEW*/ getBoundingClientRect(); context.requestResize(boundingClientRect.width, newHeight); diff --git a/3p/bodymovinanimation.js b/3p/bodymovinanimation.js index 55a58ce55321..21e3e538fadd 100644 --- a/3p/bodymovinanimation.js +++ b/3p/bodymovinanimation.js @@ -38,7 +38,7 @@ function getBodymovinAnimationSdk(global, renderer, cb) { renderer === 'svg' ? 'https://cdnjs.cloudflare.com/ajax/libs/bodymovin/4.13.0/bodymovin_light.min.js' : 'https://cdnjs.cloudflare.com/ajax/libs/bodymovin/4.13.0/bodymovin.min.js'; - loadScript(global, scriptToLoad, function() { + loadScript(global, scriptToLoad, function () { cb(global.bodymovin); }); } @@ -83,7 +83,7 @@ export function bodymovinanimation(global) { const shouldLoop = dataLoop != 'false'; const loop = !isNaN(dataLoop) ? dataLoop : shouldLoop; const renderer = dataReceived['renderer']; - getBodymovinAnimationSdk(global, renderer, function(bodymovin) { + getBodymovinAnimationSdk(global, renderer, function (bodymovin) { animationHandler = bodymovin.loadAnimation({ container: animatingContainer, renderer, diff --git a/3p/embedly.js b/3p/embedly.js index e10ec86a0b76..f4ee6d4c3930 100644 --- a/3p/embedly.js +++ b/3p/embedly.js @@ -64,7 +64,7 @@ export const CardOptions = { * @visibleForTesting */ function getEmbedly(global, callback) { - loadScript(global, EMBEDLY_SDK_URL, function() { + loadScript(global, EMBEDLY_SDK_URL, function () { callback(); }); } @@ -98,7 +98,7 @@ export function embedly(global, data) { container.appendChild(card); - getEmbedly(global, function() { + getEmbedly(global, function () { // Given by the parent frame. delete data.width; delete data.height; @@ -106,7 +106,7 @@ export function embedly(global, data) { global.window['embedly']('card', card); // Use embedly SDK to listen to resize event from loaded card - global.window['embedly']('on', RESIZE_EVENT_NAME, function(iframe) { + global.window['embedly']('on', RESIZE_EVENT_NAME, function (iframe) { context.requestResize( iframe./*OK*/ width, parseInt(iframe./*OK*/ height, 10) + /* margin */ 5 diff --git a/3p/environment.js b/3p/environment.js index 0db6b8dd6338..38ab1ad99403 100644 --- a/3p/environment.js +++ b/3p/environment.js @@ -73,8 +73,8 @@ function manageWin_(win) { function instrumentDocWrite(parent, win) { const doc = win.document; const {close} = doc; - doc.close = function() { - parent.ampManageWin = function(win) { + doc.close = function () { + parent.ampManageWin = function (win) { manageWin(win); }; if (!parent.ampSeen) { @@ -93,7 +93,7 @@ function instrumentDocWrite(parent, win) { */ function instrumentSrcdoc(parent, iframe) { let srcdoc = iframe.getAttribute('srcdoc'); - parent.ampManageWin = function(win) { + parent.ampManageWin = function (win) { manageWin(win); }; srcdoc += ''; @@ -159,7 +159,7 @@ function installObserver(win) { if (!window.MutationObserver) { return; } - const observer = new MutationObserver(function(mutations) { + const observer = new MutationObserver(function (mutations) { for (let i = 0; i < mutations.length; i++) { maybeInstrumentsNodes(win, mutations[i].addedNodes); } @@ -177,14 +177,14 @@ function installObserver(win) { function instrumentEntryPoints(win) { // Change setTimeout to respect a minimum timeout. const {setTimeout} = win; - win.setTimeout = function(fn, time) { + win.setTimeout = function (fn, time) { time = minTime(time); arguments[1] = time; return setTimeout.apply(this, arguments); }; // Implement setInterval in terms of setTimeout to make // it respect the same rules - win.setInterval = function(fn) { + win.setInterval = function (fn) { const id = intervalId++; const args = Array.prototype.slice.call(arguments); /** @@ -195,7 +195,8 @@ function instrumentEntryPoints(win) { next(); if (typeof fn == 'string') { // Handle rare and dangerous string arg case. - return (0, win.eval /*NOT OK but whatcha gonna do.*/).call(win, fn); // lgtm [js/useless-expression] + return (0, win.eval) /*NOT OK but whatcha gonna do.*/ + .call(win, fn); // lgtm [js/useless-expression] } else { return fn.apply(this, arguments); } @@ -211,7 +212,7 @@ function instrumentEntryPoints(win) { return id; }; const {clearInterval} = win; - win.clearInterval = function(id) { + win.clearInterval = function (id) { clearInterval(id); win.clearTimeout(intervals[id]); delete intervals[id]; @@ -235,11 +236,11 @@ function blockSyncPopups(win) { } try { win.alert = maybeThrow; - win.prompt = function() { + win.prompt = function () { maybeThrow(); return ''; }; - win.confirm = function() { + win.confirm = function () { maybeThrow(); return false; }; @@ -269,7 +270,7 @@ function minTime(time) { * Installs embed state listener. */ export function installEmbedStateListener() { - listenParent(window, 'embed-state', function(data) { + listenParent(window, 'embed-state', function (data) { inViewport = data['inViewport']; }); } diff --git a/3p/facebook.js b/3p/facebook.js index 067d5b0d0c37..834c16a011ab 100644 --- a/3p/facebook.js +++ b/3p/facebook.js @@ -228,12 +228,12 @@ export function facebook(global, data) { getFacebookSdk( global, - FB => { + (FB) => { // Dimensions are given by the parent frame. delete data.width; delete data.height; - FB.Event.subscribe('xfbml.resize', event => { + FB.Event.subscribe('xfbml.resize', (event) => { context.updateDimensions( parseInt(event.width, 10), parseInt(event.height, 10) + /* margins */ 20 diff --git a/3p/github.js b/3p/github.js index b07cec8462e6..fc646ccf40d4 100644 --- a/3p/github.js +++ b/3p/github.js @@ -29,7 +29,7 @@ import {writeScript} from './3p'; * @param {function()} cb */ function getGistJs(global, scriptSource, cb) { - writeScript(global, scriptSource, function() { + writeScript(global, scriptSource, function () { cb(); }); } @@ -52,7 +52,7 @@ export function github(global, data) { gistUrl += '?file=' + encodeURIComponent(data.file); } - getGistJs(global, gistUrl, function() { + getGistJs(global, gistUrl, function () { // Dimensions are given by the parent frame. delete data.width; delete data.height; diff --git a/3p/iframe-messaging-client.js b/3p/iframe-messaging-client.js index 55ca06186719..d81aa23b5976 100644 --- a/3p/iframe-messaging-client.js +++ b/3p/iframe-messaging-client.js @@ -62,7 +62,7 @@ export class IframeMessagingClient { getData(requestType, payload, callback) { const responseType = requestType + CONSTANTS.responseTypeSuffix; const messageId = this.nextMessageId_++; - const unlisten = this.registerCallback(responseType, result => { + const unlisten = this.registerCallback(responseType, (result) => { if (result[CONSTANTS.messageIdFieldName] === messageId) { unlisten(); callback(result[CONSTANTS.contentFieldName]); @@ -100,7 +100,7 @@ export class IframeMessagingClient { * @return {*} TODO(#23582): Specify return type */ requestOnce(requestType, responseType, callback) { - const unlisten = this.registerCallback(responseType, event => { + const unlisten = this.registerCallback(responseType, (event) => { unlisten(); callback(event); }); @@ -191,7 +191,7 @@ export class IframeMessagingClient { * @private */ setupEventListener_() { - listen(this.win_, 'message', event => { + listen(this.win_, 'message', (event) => { // If we have set a host window, strictly check that it's from it. if (this.hostWindow_ && event.source != this.hostWindow_) { return; diff --git a/3p/iframe-transport-client.js b/3p/iframe-transport-client.js index 3fca0d886f44..c45b9d588b21 100644 --- a/3p/iframe-transport-client.js +++ b/3p/iframe-transport-client.js @@ -62,7 +62,7 @@ export class IframeTransportClient { this.iframeMessagingClient_.makeRequest( MessageType.SEND_IFRAME_TRANSPORT_EVENTS, MessageType.IFRAME_TRANSPORT_EVENTS, - eventData => { + (eventData) => { const events = /** * @type @@ -77,7 +77,7 @@ export class IframeTransportClient { events.length, 'Received empty events list in ' + this.win_.location.href ); - events.forEach(event => { + events.forEach((event) => { try { devAssert( event.creativeId, diff --git a/3p/integration.js b/3p/integration.js index ccf2ac35fdb2..2e79a74c0bc9 100644 --- a/3p/integration.js +++ b/3p/integration.js @@ -638,7 +638,7 @@ export function draw3p(win, data, configCallback) { win.context.tagName ); if (configCallback) { - configCallback(data, data => { + configCallback(data, (data) => { userAssert(data, 'Expected configuration to be passed as first argument'); run(type, win, data); }); @@ -659,7 +659,7 @@ export function draw3p(win, data, configCallback) { * @param {!Array=} opt_allowedEmbeddingOrigins List of domain suffixes * that are allowed to embed this frame. */ -window.draw3p = function( +window.draw3p = function ( opt_configCallback, opt_allowed3pTypes, opt_allowedEmbeddingOrigins diff --git a/3p/mathml.js b/3p/mathml.js index ffe0d42133a8..25e1c590cec7 100644 --- a/3p/mathml.js +++ b/3p/mathml.js @@ -29,7 +29,7 @@ import {writeScript} from './3p'; * @param {function(*)} cb */ function getMathmlJs(global, scriptSource, cb) { - writeScript(global, scriptSource, function() { + writeScript(global, scriptSource, function () { cb(global.MathJax); }); } @@ -48,7 +48,7 @@ export function mathml(global, data) { getMathmlJs( global, 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML', - mathjax => { + (mathjax) => { // Dimensions are given by the parent frame. delete data.width; delete data.height; @@ -60,7 +60,7 @@ export function mathml(global, data) { mathjax.Hub.Config({ showMathMenu: false, }); - mathjax.Hub.Queue(function() { + mathjax.Hub.Queue(function () { const rendered = document.getElementById('MathJax-Element-1-Frame'); // Remove built in mathjax margins. let display = document.getElementsByClassName('MJXc-display'); diff --git a/3p/messaging.js b/3p/messaging.js index c7f3434da479..bf732de87b6b 100644 --- a/3p/messaging.js +++ b/3p/messaging.js @@ -54,7 +54,7 @@ export function listenParent(win, type, callback) { }; listeners.push(listener); startListening(win); - return function() { + return function () { const index = listeners.indexOf(listener); if (index > -1) { listeners.splice(index, 1); @@ -72,7 +72,7 @@ function startListening(win) { return; } win.AMP_LISTENING = true; - win.addEventListener('message', function(event) { + win.addEventListener('message', function (event) { // Cheap operations first, so we don't parse JSON unless we have to. const eventData = getData(event); if ( diff --git a/3p/recaptcha.js b/3p/recaptcha.js index 60e34a85ae45..f552e4e99888 100644 --- a/3p/recaptcha.js +++ b/3p/recaptcha.js @@ -104,15 +104,15 @@ export function initRecaptcha(recaptchaApiBaseUrl = RECAPTCHA_API_URL) { loadScript( win, recaptchaApiUrl, - function() { + function () { const {grecaptcha} = win; - grecaptcha.ready(function() { + grecaptcha.ready(function () { initializeIframeMessagingClient(win, grecaptcha, dataObject); iframeMessagingClient./*OK*/ sendMessage('amp-recaptcha-ready'); }); }, - function() { + function () { dev().error(TAG + ' Failed to load recaptcha api script'); } ); @@ -155,7 +155,7 @@ function actionTypeHandler(win, grecaptcha, data) { // .then() promise pollyfilled by recaptcha api script executePromise./*OK*/ then( - function(token) { + function (token) { iframeMessagingClient./*OK*/ sendMessage( 'amp-recaptcha-token', dict({ @@ -164,7 +164,7 @@ function actionTypeHandler(win, grecaptcha, data) { }) ); }, - function(err) { + function (err) { let message = 'There was an error running ' + 'execute() on the reCAPTCHA script.'; @@ -182,7 +182,7 @@ function actionTypeHandler(win, grecaptcha, data) { } ); }) - .catch(error => { + .catch((error) => { dev().error(TAG, '%s', error.message); }); } @@ -210,7 +210,7 @@ export function doesOriginDomainMatchIframeSrc(win, data) { return ampToolboxCacheUrl .createCurlsSubdomain(data.origin) - .then(curlsSubdomain => { + .then((curlsSubdomain) => { return compareCurlsDomain(win, curlsSubdomain, data.origin); }); } diff --git a/3p/reddit.js b/3p/reddit.js index c1f4d81e8b2e..c4ac95658153 100644 --- a/3p/reddit.js +++ b/3p/reddit.js @@ -83,7 +83,7 @@ export function reddit(global, data) { getContainerScript(global, scriptSource); - global.addEventListener('resize', event => { + global.addEventListener('resize', (event) => { global.context.updateDimensions( event.target.outerWidth, event.target.outerHeight diff --git a/3p/twitter.js b/3p/twitter.js index fcfb7e4ecd54..59357add44eb 100644 --- a/3p/twitter.js +++ b/3p/twitter.js @@ -59,7 +59,7 @@ export function twitter(global, data) { justifyContent: 'center', }); global.document.getElementById('c').appendChild(tweet); - getTwttr(global, function(twttr) { + getTwttr(global, function (twttr) { // Dimensions are given by the parent frame. delete data.width; delete data.height; @@ -67,22 +67,22 @@ export function twitter(global, data) { if (data.tweetid) { twttr.widgets .createTweet(cleanupTweetId_(data.tweetid), tweet, data) - ./*OK*/ then(el => tweetCreated(twttr, el)); + ./*OK*/ then((el) => tweetCreated(twttr, el)); } else if (data.momentid) { twttr.widgets .createMoment(data.momentid, tweet, data) - ./*OK*/ then(el => tweetCreated(twttr, el)); + ./*OK*/ then((el) => tweetCreated(twttr, el)); } else if (data.timelineSourceType) { // Extract properties starting with 'timeline'. const timelineData = Object.keys(data) - .filter(prop => startsWith(prop, 'timeline')) + .filter((prop) => startsWith(prop, 'timeline')) .reduce((newData, prop) => { newData[stripPrefixCamelCase(prop, 'timeline')] = data[prop]; return newData; }, {}); twttr.widgets .createTimeline(timelineData, tweet, data) - ./*OK*/ then(el => tweetCreated(twttr, el)); + ./*OK*/ then((el) => tweetCreated(twttr, el)); } }); @@ -98,7 +98,7 @@ export function twitter(global, data) { } resize(el); - twttr.events.bind('resize', event => { + twttr.events.bind('resize', (event) => { // To be safe, make sure the resize event was triggered for the widget we // created below. if (el === event.target) { diff --git a/3p/viqeoplayer.js b/3p/viqeoplayer.js index 28211c050192..a04f8a1cbed2 100644 --- a/3p/viqeoplayer.js +++ b/3p/viqeoplayer.js @@ -27,7 +27,7 @@ function viqeoPlayerInitLoaded(global, VIQEO) { const data = getData(global.context); let viqeoPlayerInstance; VIQEO['setConfig']({url: sourceUrl, amp: {pageViewId, canonicalUrl}}); - VIQEO['subscribeTracking'](params => { + VIQEO['subscribeTracking']((params) => { viqeoPlayerInstance = params['player']; }, 'Player:added'); VIQEO['subscribeTracking'](() => { @@ -117,6 +117,6 @@ export function viqeoplayer(global) { ? 'https://cdn.viqeo.tv/js/vq_starter.js' : 'https://static.viqeo.tv/js/vq_player_init.js?branch=dev1'); - global['onViqeoLoad'] = VIQEO => viqeoPlayerInitLoaded(global, VIQEO); + global['onViqeoLoad'] = (VIQEO) => viqeoPlayerInitLoaded(global, VIQEO); loadScript(global, scriptPlayerInit); } diff --git a/3p/yotpo.js b/3p/yotpo.js index ab52046da932..83a91c6a37ad 100644 --- a/3p/yotpo.js +++ b/3p/yotpo.js @@ -28,10 +28,10 @@ function getContainerScript(global, scriptSource, cb) { delete global.Yotpo.widgets['testimonials']; const yotpoWidget = typeof global.yotpo === 'undefined' ? undefined : global.yotpo; - yotpoWidget.on('CssReady', function() { + yotpoWidget.on('CssReady', function () { cb(yotpoWidget, 'cssLoaded'); }); - yotpoWidget.on('BatchReady', function() { + yotpoWidget.on('BatchReady', function () { cb(yotpoWidget, 'batchLoaded'); }); }); diff --git a/ads/_ping_.js b/ads/_ping_.js index 61f82bea4184..879800894414 100644 --- a/ads/_ping_.js +++ b/ads/_ping_.js @@ -71,8 +71,8 @@ export function _ping_(global, data) { global.context.renderStart(); } if (data.enableIo) { - global.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + global.context.observeIntersection(function (changes) { + changes.forEach(function (c) { dev().info( 'AMP-AD', 'Intersection: (WxH)' + @@ -83,10 +83,10 @@ export function _ping_(global, data) { global.ping.lastIO = changes[changes.length - 1]; }); } - global.context.getHtml('a', ['href'], function(html) { + global.context.getHtml('a', ['href'], function (html) { dev().info('GET-HTML', html); }); - global.context.getConsentState(function(consentState) { + global.context.getConsentState(function (consentState) { dev().info('GET-CONSENT-STATE', consentState); }); if (global.context.consentSharedData) { diff --git a/ads/adform.js b/ads/adform.js index 84ff0799791c..7617b2d089b6 100644 --- a/ads/adform.js +++ b/ads/adform.js @@ -39,7 +39,7 @@ export function adform(global, data) { // Custom ad url using "data-src" attribute if (src) { validateSrcPrefix( - Object.keys(hosts).map(type => hosts[type]), + Object.keys(hosts).map((type) => hosts[type]), src ); url = src; diff --git a/ads/adgeneration.js b/ads/adgeneration.js index 418db5efaef6..ef30d56be465 100644 --- a/ads/adgeneration.js +++ b/ads/adgeneration.js @@ -53,7 +53,7 @@ export function adgeneration(global, data) { function encodeQueryValue(str) { return str .split('&') - .map(v => { + .map((v) => { const key = v.split('=')[0], val = v.split('=')[1]; return encodeURIComponent(key) + '=' + encodeURIComponent(val); diff --git a/ads/adocean.js b/ads/adocean.js index bb0bb884089c..bee294ab084a 100644 --- a/ads/adocean.js +++ b/ads/adocean.js @@ -147,17 +147,17 @@ function appendPlacement(mode, global, data) { if (global.ado) { if (mode == 'sync') { - runSync(global, function() { + runSync(global, function () { global['ado']['placement'](config); }); - runSync(global, function() { + runSync(global, function () { if (!config['_hasAd']) { window.context.noContentAvailable(); } }); } else { - global['ado']['onAd'](data['aoId'], function(isAd) { + global['ado']['onAd'](data['aoId'], function (isAd) { if (!isAd) { window.context.noContentAvailable(); } @@ -204,10 +204,10 @@ function requestCodes(masterId, data, global, callback) { computeInMasterFrame( global, 'ao-master-exec', - done => { - executeMaster(masterId, data, global, codes => done(codes)); + (done) => { + executeMaster(masterId, data, global, (codes) => done(codes)); }, - codes => { + (codes) => { const creative = codes[slaveId]; if (codes[slaveId + '_second_phase']) { creative['code'] += '\n' + codes[slaveId + '_second_phase']['code']; @@ -342,7 +342,7 @@ export function adocean(global, data) { ado['features']['passback'] = false; } - requestCodes(masterId, data, global, codes => { + requestCodes(masterId, data, global, (codes) => { executeSlave(data['aoId'], codes, global); }); } else { diff --git a/ads/adplugg.js b/ads/adplugg.js index 7e179e2647fe..2db95918f381 100644 --- a/ads/adplugg.js +++ b/ads/adplugg.js @@ -50,10 +50,10 @@ export function adplugg(global, data) { const {AdPlugg} = global; // Register event listeners (via async wrapper). - AdPlugg.push(function() { + AdPlugg.push(function () { const {AdPlugg} = global; // Register the renderStart event listener. - AdPlugg.on(adTag, 'adplugg:renderStart', function(event) { + AdPlugg.on(adTag, 'adplugg:renderStart', function (event) { // Create the opt_data object. const optData = {}; if (hasOwn(event, 'width')) { @@ -66,7 +66,7 @@ export function adplugg(global, data) { }); // Register the noContentAvailable event listener. - AdPlugg.on(adTag, 'adplugg:noContentAvailable', function() { + AdPlugg.on(adTag, 'adplugg:noContentAvailable', function () { global.context.noContentAvailable(); }); }); diff --git a/ads/ads.extern.js b/ads/ads.extern.js index 91d270ded2e3..f8b55b24926c 100644 --- a/ads/ads.extern.js +++ b/ads/ads.extern.js @@ -408,7 +408,7 @@ data.epl_e; * @param {!Window} global * @param {!Object} data */ -window.EzoicAmpAd = function(global, data) {}; +window.EzoicAmpAd = function (global, data) {}; window.EzoicAmpAd.prototype.createAd; // flite.js diff --git a/ads/adservsolutions.js b/ads/adservsolutions.js index 5a5a1e1c9c64..2b504e9f435a 100644 --- a/ads/adservsolutions.js +++ b/ads/adservsolutions.js @@ -24,7 +24,7 @@ export function adservsolutions(global, data) { validateData(data, [], ['client', 'zid']); global['ABNS'] = global['ABNS'] || - function() { + function () { (global['ABNSl'] = global['ABNSl'] || []).push(arguments); }; global['ABNSh'] = data.client; diff --git a/ads/adstyle.js b/ads/adstyle.js index 9ecdc8ac56b9..6c76568471db 100644 --- a/ads/adstyle.js +++ b/ads/adstyle.js @@ -35,8 +35,8 @@ export function adstyle(global, data) { const url = 'https://widgets.ad.style/amp.js'; - window.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + window.context.observeIntersection(function (changes) { + changes.forEach(function (c) { window['intersectionRect' + data.widget] = c.intersectionRect; window['boundingClientRect' + data.widget] = c.boundingClientRect; }); diff --git a/ads/adunity.js b/ads/adunity.js index 67c33461b348..10d7f0a5d7f5 100644 --- a/ads/adunity.js +++ b/ads/adunity.js @@ -84,8 +84,8 @@ export function adunity(global, data) { let libAd = false; //execute tag only if in view - const inViewCb = global.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + const inViewCb = global.context.observeIntersection(function (changes) { + changes.forEach(function (c) { if (!libAd && c.intersectionRect.height > data['height'] / 2) { libAd = true; inViewCb(); diff --git a/ads/alp/handler.js b/ads/alp/handler.js index b20018397b8c..74c93ea08245 100644 --- a/ads/alp/handler.js +++ b/ads/alp/handler.js @@ -114,7 +114,7 @@ export function handleClick(e, opt_viewerNavigate) { * }|undefined} A URL on the AMP Cache. */ function getLinkInfo(e) { - const a = closest(dev().assertElement(e.target), element => { + const a = closest(dev().assertElement(e.target), (element) => { return element.tagName == 'A' && element.href; }); if (!a) { diff --git a/ads/amoad.js b/ads/amoad.js index e6b5e0f7c52f..d0447724c15f 100644 --- a/ads/amoad.js +++ b/ads/amoad.js @@ -36,7 +36,7 @@ export function amoad(global, data) { global.amoadOption = {ampData: data}; const d = global.document.createElement('div'); - Object.keys(attrs).forEach(k => { + Object.keys(attrs).forEach((k) => { d.setAttribute(k, attrs[k]); }); global.document.getElementById('c').appendChild(d); diff --git a/ads/appnexus.js b/ads/appnexus.js index b3224e47c97f..3a91559a4758 100644 --- a/ads/appnexus.js +++ b/ads/appnexus.js @@ -74,7 +74,7 @@ function appnexusAst(global, data) { context.master.adUnitTargetIds = context.master.adUnitTargetIds || []; context.master.adUnitTargetIds = data.adUnits.map( - adUnit => adUnit.targetId + (adUnit) => adUnit.targetId ); apntag.anq.push(() => { @@ -86,7 +86,7 @@ function appnexusAst(global, data) { }); } - data.adUnits.forEach(adUnit => { + data.adUnits.forEach((adUnit) => { apntag.defineTag(adUnit); }); }); @@ -119,12 +119,12 @@ function appnexusAst(global, data) { } if (!context.isMaster && data.adUnits) { - const newAddUnits = data.adUnits.filter(adUnit => { + const newAddUnits = data.adUnits.filter((adUnit) => { return context.master.adUnitTargetIds.indexOf(adUnit.targetId) === -1; }); if (newAddUnits.length) { apntag.anq.push(() => { - newAddUnits.forEach(adUnit => { + newAddUnits.forEach((adUnit) => { apntag.defineTag(adUnit); context.master.adUnitTargetIds.push(adUnit.targetId); }); diff --git a/ads/appvador.js b/ads/appvador.js index 271f3abbddff..50c2dab325a6 100644 --- a/ads/appvador.js +++ b/ads/appvador.js @@ -42,7 +42,7 @@ export function appvador(global, data) { (data.options ? ',' + data.options : '') + '}).load();'; - const cb = function() { + const cb = function () { const apvLoadScript = global.document.createElement('script'); apvLoadScript.text = apvScript; container.appendChild(apvLoadScript); diff --git a/ads/baidu.js b/ads/baidu.js index eecd54059af5..09cddba9cac9 100644 --- a/ads/baidu.js +++ b/ads/baidu.js @@ -23,11 +23,7 @@ import {loadScript, validateData} from '../3p/3p'; export function baidu(global, data) { validateData(data, ['cproid']); - const id = - '_' + - Math.random() - .toString(36) - .slice(2); + const id = '_' + Math.random().toString(36).slice(2); const container = global.document.createElement('div'); container.id = id; global.document.getElementById('c').appendChild(container); diff --git a/ads/bidtellect.js b/ads/bidtellect.js index 7950bbc485ec..959d23f0d52a 100644 --- a/ads/bidtellect.js +++ b/ads/bidtellect.js @@ -45,7 +45,7 @@ export function bidtellect(global, data) { if (data.height) { params += '&h=' + encodeURIComponent(data.height); } - optionalParams.forEach(function(param) { + optionalParams.forEach(function (param) { if (data[param]) { params += '&' + param + '=' + encodeURIComponent(data[param]); } diff --git a/ads/blade.js b/ads/blade.js index 4d18de643022..5286a352f53b 100644 --- a/ads/blade.js +++ b/ads/blade.js @@ -51,7 +51,7 @@ export function blade(global, data) { const ctx = global.context; const bladeOnLoad = `_bladeOnLoad-${containerId}`; - global[bladeOnLoad] = function(error, player) { + global[bladeOnLoad] = function (error, player) { if (error) { global.context.noContentAvailable(); return; diff --git a/ads/bringhub.js b/ads/bringhub.js index 2a206aa85f66..0284f51e40a2 100644 --- a/ads/bringhub.js +++ b/ads/bringhub.js @@ -31,7 +31,7 @@ export function bringhub(global, data) { writeScript( global, `https://static.bh-cdn.com/msf/amp-loader.js?v=${Date.now()}`, - function() { + function () { loadScript( global, `https://static.bh-cdn.com/msf/amp-widget.js?v=${global._bringhub.hash}` diff --git a/ads/capirs.js b/ads/capirs.js index 4987dc63e883..864f5703f6da 100644 --- a/ads/capirs.js +++ b/ads/capirs.js @@ -50,7 +50,7 @@ export function capirs(global, data) { }, }, block: { - draw: feed => { + draw: (feed) => { const banner = feed['banners']['graph'][0]; global.context.renderStart({ @@ -61,7 +61,7 @@ export function capirs(global, data) { const reportId = 'capirs-' + banner['banner_id']; global.context.reportRenderedEntityIdentifier(reportId); }, - unexist: function() { + unexist: function () { global.context.noContentAvailable(); }, }, diff --git a/ads/colombia.js b/ads/colombia.js index df7a3b32b487..7c8725e61315 100644 --- a/ads/colombia.js +++ b/ads/colombia.js @@ -36,8 +36,8 @@ export function colombia(global, data) { clmbdivid: data.clmb_divid, }); // install observation on entering/leaving the view - global.context.observeIntersection(function(newrequest) { - newrequest.forEach(function(d) { + global.context.observeIntersection(function (newrequest) { + newrequest.forEach(function (d) { if (d.intersectionRect.height > 0) { global._colombia.push({ visible: true, diff --git a/ads/conative.js b/ads/conative.js index 6abc4b39b393..1f0980a12076 100644 --- a/ads/conative.js +++ b/ads/conative.js @@ -33,8 +33,8 @@ export function conative(global, data) { window.dmConativeData.preview = window.dmConativeData.preview || data.preview; window.dmConativeData.visibility = window.dmConativeData.visibility || 0; - window.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + window.context.observeIntersection(function (changes) { + changes.forEach(function (c) { window.dmConativeData.visibility = parseInt( (c.intersectionRect.height / c.boundingClientRect.height) * 100, 10 diff --git a/ads/connatix.js b/ads/connatix.js index a80fc25b6e6e..6d9fbb453b8b 100644 --- a/ads/connatix.js +++ b/ads/connatix.js @@ -38,7 +38,7 @@ export function connatix(global, data) { window.addEventListener( 'connatix_no_content', - function() { + function () { window.context.noContentAvailable(); }, false diff --git a/ads/dable.js b/ads/dable.js index 413c5b00be8a..764e68c9e6b3 100644 --- a/ads/dable.js +++ b/ads/dable.js @@ -26,7 +26,7 @@ export function dable(global, data) { global.dable = global.dable || - function() { + function () { (global.dable.q = global.dable.q || []).push(arguments); }; global.dable( @@ -55,7 +55,7 @@ export function dable(global, data) { } // call render widget - global.dable('renderWidget', slot.id, itemId, opts, function(hasAd) { + global.dable('renderWidget', slot.id, itemId, opts, function (hasAd) { if (hasAd) { global.context.renderStart(); } else { diff --git a/ads/fluct.js b/ads/fluct.js index 45863b78cc8a..5eaa306f679f 100644 --- a/ads/fluct.js +++ b/ads/fluct.js @@ -27,7 +27,7 @@ export function fluct(global, data) { writeScript( global, `https://cdn-fluct.sh.adingo.jp/f.js?G=${encodeURIComponent(data['g'])}`, - function() { + function () { adingoFluct.showAd(data['u']); } ); diff --git a/ads/fusion.js b/ads/fusion.js index 3c2bda914f72..e4b06476ba68 100644 --- a/ads/fusion.js +++ b/ads/fusion.js @@ -26,7 +26,7 @@ function queryParametersToObject(input) { } return input .split('&') - .filter(_ => _) + .filter((_) => _) .reduce((obj, val) => { const kv = val.split('='); return Object.assign(obj, {[kv[0]]: kv[1] || true}); @@ -56,7 +56,7 @@ export function fusion(global, data) { () => { global.Fusion.apply(container, global.Fusion.loadAds(data, parameters)); - global.Fusion.on.warning.run(ev => { + global.Fusion.on.warning.run((ev) => { if (ev.msg === 'Space not present in response.') { global.context.noContentAvailable(); } diff --git a/ads/google/a4a/line-delimited-response-handler.js b/ads/google/a4a/line-delimited-response-handler.js index 4d83a4975cf5..a7d2938a1c36 100644 --- a/ads/google/a4a/line-delimited-response-handler.js +++ b/ads/google/a4a/line-delimited-response-handler.js @@ -44,7 +44,7 @@ export function lineDelimitedStreamer(win, response, lineCallback) { } } if (!response.body || !win.TextDecoder) { - response.text().then(text => streamer(text, true)); + response.text().then((text) => streamer(text, true)); return; } @@ -74,10 +74,10 @@ export function lineDelimitedStreamer(win, response, lineCallback) { */ export function metaJsonCreativeGrouper(callback) { let first; - return function(line, done) { + return function (line, done) { if (first) { - const metadata = - /** @type {!Object} */ (tryParseJson(first) || {}); + const metadata = /** @type {!Object} */ (tryParseJson(first) || + {}); const lowerCasedMetadata = Object.keys(metadata).reduce((newObj, key) => { newObj[key.toLowerCase()] = metadata[key]; return newObj; diff --git a/ads/google/a4a/shared/test/test-content-recommendation.js b/ads/google/a4a/shared/test/test-content-recommendation.js index 22594acdf895..6058e6d7f268 100644 --- a/ads/google/a4a/shared/test/test-content-recommendation.js +++ b/ads/google/a4a/shared/test/test-content-recommendation.js @@ -20,8 +20,8 @@ import { getPubControlConfig, } from '../content-recommendation.js'; -describe('getAutoConfig', function() { - it('should use image_stacked on wide slots', function() { +describe('getAutoConfig', function () { + it('should use image_stacked on wide slots', function () { const runTest = (availableWidth, expectedWidth, expectedHeight) => { expect( getAutoConfig(availableWidth, /* isMobile= */ false) @@ -60,7 +60,7 @@ describe('getAutoConfig', function() { ); }); - it('should use mobile_banner_image_sidebyside on narrow slots on mobile', function() { + it('should use mobile_banner_image_sidebyside on narrow slots on mobile', function () { const runTest = (availableWidth, expectedWidth, expectedHeight) => { expect(getAutoConfig(availableWidth, /* isMobile= */ true)).to.deep.equal( { @@ -109,7 +109,7 @@ describe('getAutoConfig', function() { ); }); - it('should use image_sidebyside on narrow slots on desktop', function() { + it('should use image_sidebyside on narrow slots on desktop', function () { const runTest = (availableWidth, expectedWidth, expectedHeight) => { expect( getAutoConfig(availableWidth, /* isMobile= */ false) @@ -164,8 +164,8 @@ describe('getAutoConfig', function() { }); }); -describe('getPubControlConfig', function() { - it('should use setting when only one provided', function() { +describe('getPubControlConfig', function () { + it('should use setting when only one provided', function () { const rawPubControlParams = { numberOfColumns: '4', numberOfRows: '2', @@ -209,7 +209,7 @@ describe('getPubControlConfig', function() { ); }); - it('should use different settings for mobile and desktop when two provided', function() { + it('should use different settings for mobile and desktop when two provided', function () { const rawPubControlParams = { numberOfColumns: '1,4', numberOfRows: '3,2', @@ -279,7 +279,7 @@ describe('getPubControlConfig', function() { ); }); - it('should return different sizes for different layouts', function() { + it('should return different sizes for different layouts', function () { // sanity check that when publisher provides different layouts we use // apply different coefficients and get different ad slot sizes. const runTest = (layout, expectedHeight) => { @@ -303,7 +303,7 @@ describe('getPubControlConfig', function() { runTest('text_card', /* expectedHeight= */ 184); }); - it('should reject invalid pub params', function() { + it('should reject invalid pub params', function () { const runTest = (pubControlParams, expectedErrorRegex) => { const coreConfig = getPubControlConfig(100, pubControlParams); expect(coreConfig.validationError).to.match(expectedErrorRegex); @@ -357,7 +357,7 @@ describe('getPubControlConfig', function() { ); }); - it('limits number of columns if publisher chose too many', function() { + it('limits number of columns if publisher chose too many', function () { const rawPubControlParams = { numberOfColumns: '5', // want 5 columns. numberOfRows: '2', diff --git a/ads/google/a4a/test/test-line-delimited-response-handler.js b/ads/google/a4a/test/test-line-delimited-response-handler.js index 6bc653c90d73..9327181a8d3a 100644 --- a/ads/google/a4a/test/test-line-delimited-response-handler.js +++ b/ads/google/a4a/test/test-line-delimited-response-handler.js @@ -30,7 +30,7 @@ describe('#line-delimited-response-handler', () => { */ function generateResponseFormat() { let slotDataString = ''; - slotData.forEach(slot => { + slotData.forEach((slot) => { // TODO: escape creative returns const creative = slot.creative .replace(/\\/g, '\\\\') @@ -45,7 +45,7 @@ describe('#line-delimited-response-handler', () => { // Streamed response calls chunk handlers after returning so need to // wait on chunks. let chunkResolver; - const chunkPromise = new Promise(resolver => (chunkResolver = resolver)); + const chunkPromise = new Promise((resolver) => (chunkResolver = resolver)); const chunkHandlerWrapper = (creative, metaData) => { chunkHandlerStub(creative, metaData); if (chunkHandlerStub.callCount == slotData.length) { @@ -67,20 +67,20 @@ describe('#line-delimited-response-handler', () => { // Could have duplicate responses so need to iterate and get counts. // TODO: can't use objects as keys :( const calls = {}; - slotData.forEach(slot => { - const normalizedHeaderNames = Object.keys(slot.headers).map(s => [ + slotData.forEach((slot) => { + const normalizedHeaderNames = Object.keys(slot.headers).map((s) => [ s.toLowerCase(), s, ]); slot.normalizedHeaders = {}; normalizedHeaderNames.forEach( - namePair => + (namePair) => (slot.normalizedHeaders[namePair[0]] = slot.headers[namePair[1]]) ); const key = slot.creative + JSON.stringify(slot.normalizedHeaders); calls[key] ? calls[key]++ : (calls[key] = 1); }); - slotData.forEach(slot => { + slotData.forEach((slot) => { expect( chunkHandlerStub.withArgs(slot.creative, slot.normalizedHeaders) .callCount diff --git a/ads/google/a4a/test/test-utils.js b/ads/google/a4a/test/test-utils.js index 76bde3c5535f..3fe90f757808 100644 --- a/ads/google/a4a/test/test-utils.js +++ b/ads/google/a4a/test/test-utils.js @@ -133,7 +133,7 @@ describe('Google A4A utils', () => { }; it('should extract correct config from header', () => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); let url; const headers = { @@ -175,7 +175,7 @@ describe('Google A4A utils', () => { url = ['https://foo.com?hello=world', 'https://bar.com?a=b']; const config = extractAmpAnalyticsConfig(a4a, headers); expect(config).to.deep.equal(builtConfig); - headers.has = function(name) { + headers.has = function (name) { expect(name).to.equal('X-AmpAnalytics'); return false; }; @@ -188,7 +188,7 @@ describe('Google A4A utils', () => { .stub(Services, 'documentInfoForDoc') .returns({pageViewId: 777}); const mockElement = { - getAttribute: function(name) { + getAttribute: function (name) { switch (name) { case EXPERIMENT_ATTRIBUTE: return '00000001,00000002'; @@ -217,7 +217,7 @@ describe('Google A4A utils', () => { expect(newConfig.triggers.continuousVisibleRenderStart.request).to.equal( 'renderStartCsi' ); - const getRegExps = metricName => [ + const getRegExps = (metricName) => [ /^https:\/\/csi\.gstatic\.com\/csi\?/, /(\?|&)s=a4a(&|$)/, /(\?|&)c=[0-9]+(&|$)/, @@ -229,13 +229,13 @@ describe('Google A4A utils', () => { /(\?|&)rls=\$internalRuntimeVersion\$(&|$)/, /(\?|&)adt.0=fake-type(&|$)/, ]; - getRegExps('visibilityCsi').forEach(regExp => { + getRegExps('visibilityCsi').forEach((regExp) => { expect(newConfig.requests.visibilityCsi).to.match(regExp); }); - getRegExps('iniLoadCsiFriendly').forEach(regExp => { + getRegExps('iniLoadCsiFriendly').forEach((regExp) => { expect(newConfig.requests.iniLoadCsi).to.match(regExp); }); - getRegExps('renderStartCsiFriendly').forEach(regExp => { + getRegExps('renderStartCsiFriendly').forEach((regExp) => { expect(newConfig.requests.renderStartCsi).to.match(regExp); }); newConfig = addCsiSignalsToAmpAnalyticsConfig( @@ -247,10 +247,10 @@ describe('Google A4A utils', () => { /* lifecycle time events; not relevant here */ -1, -1 ); - getRegExps('iniLoadCsiCrossDomain').forEach(regExp => { + getRegExps('iniLoadCsiCrossDomain').forEach((regExp) => { expect(newConfig.requests.iniLoadCsi).to.match(regExp); }); - getRegExps('renderStartCsiCrossDomain').forEach(regExp => { + getRegExps('renderStartCsiCrossDomain').forEach((regExp) => { expect(newConfig.requests.renderStartCsi).to.match(regExp); }); }); @@ -307,10 +307,10 @@ describe('Google A4A utils', () => { }); describe('#googleAdUrl', () => { - it('should set ad position', function() { + it('should set ad position', function () { // When ran locally, this test tends to exceed 2000ms timeout. this.timeout(5000); - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = window; @@ -322,7 +322,7 @@ describe('Google A4A utils', () => { const impl = new MockA4AImpl(elem); noopMethods(impl, fixture.ampdoc, window.sandbox); return fixture.addElement(elem).then(() => { - return googleAdUrl(impl, '', 0, [], []).then(url1 => { + return googleAdUrl(impl, '', 0, [], []).then((url1) => { expect(url1).to.match(/ady=11/); expect(url1).to.match(/adx=12/); }); @@ -330,8 +330,8 @@ describe('Google A4A utils', () => { }); }); - it('should include scroll position', function() { - return createIframePromise().then(fixture => { + it('should include scroll position', function () { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = window; @@ -353,17 +353,17 @@ describe('Google A4A utils', () => { const viewportStub = window.sandbox.stub(Services, 'viewportForDoc'); viewportStub.returns({getRect, getSize, getScrollTop, getScrollLeft}); return fixture.addElement(elem).then(() => { - return googleAdUrl(impl, '', 0, {}, []).then(url1 => { + return googleAdUrl(impl, '', 0, {}, []).then((url1) => { expect(url1).to.match(/scr_x=12&scr_y=34/); }); }); }); }); - it('should include all experiment ids', function() { + it('should include all experiment ids', function () { // When ran locally, this test tends to exceed 2000ms timeout. this.timeout(5000); - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = window; @@ -376,7 +376,7 @@ describe('Google A4A utils', () => { const impl = new MockA4AImpl(elem); noopMethods(impl, fixture.ampdoc, window.sandbox); return fixture.addElement(elem).then(() => { - return googleAdUrl(impl, '', 0, {}, ['789', '098']).then(url1 => { + return googleAdUrl(impl, '', 0, {}, ['789', '098']).then((url1) => { expect(url1).to.match(/eid=123%2C456%2C789%2C098/); }); }); @@ -384,7 +384,7 @@ describe('Google A4A utils', () => { }); it('should include debug_experiment_id if local mode w/ deid hash', () => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = fixture.win; @@ -398,7 +398,7 @@ describe('Google A4A utils', () => { impl.win.AMP_CONFIG = {type: 'production'}; impl.win.location.hash = 'foo,deid=123456,654321,bar'; return fixture.addElement(elem).then(() => { - return googleAdUrl(impl, '', 0, [], []).then(url1 => { + return googleAdUrl(impl, '', 0, [], []).then((url1) => { expect(url1).to.match(/[&?]debug_experiment_id=123456%2C654321/); }); }); @@ -406,7 +406,7 @@ describe('Google A4A utils', () => { }); it('should include GA cid/hid', () => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = fixture.win; @@ -419,7 +419,7 @@ describe('Google A4A utils', () => { noopMethods(impl, fixture.ampdoc, window.sandbox); impl.win.gaGlobal = {cid: 'foo', hid: 'bar'}; return fixture.addElement(elem).then(() => { - return googleAdUrl(impl, '', 0, [], []).then(url => { + return googleAdUrl(impl, '', 0, [], []).then((url) => { expect(url).to.match(/[&?]ga_cid=foo[&$]/); expect(url).to.match(/[&?]ga_hid=bar[&$]/); }); @@ -428,7 +428,7 @@ describe('Google A4A utils', () => { }); it('should have correct bc value when everything supported', () => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = fixture.win; @@ -457,7 +457,7 @@ describe('Google A4A utils', () => { }); it('should have correct bc value when sandbox not supported', () => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = fixture.win; @@ -484,7 +484,7 @@ describe('Google A4A utils', () => { }); it('should not include bc when nothing supported', () => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = fixture.win; @@ -514,7 +514,7 @@ describe('Google A4A utils', () => { }); it('should handle referrer url promise timeout', () => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = fixture.win; @@ -547,7 +547,7 @@ describe('Google A4A utils', () => { }); it('should include domLoading time', () => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const {doc} = fixture; doc.win = fixture.win; @@ -555,7 +555,7 @@ describe('Google A4A utils', () => { const impl = new MockA4AImpl(elem); noopMethods(impl, fixture.ampdoc, window.sandbox); return fixture.addElement(elem).then(() => { - return googleAdUrl(impl, '', Date.now(), [], []).then(url => { + return googleAdUrl(impl, '', Date.now(), [], []).then((url) => { expect(url).to.match(/[&?]bdt=[1-9][0-9]*[&$]/); }); }); @@ -605,7 +605,7 @@ describe('Google A4A utils', () => { }); }); - describes.realWin('#getEnclosingContainerTypes', {}, env => { + describes.realWin('#getEnclosingContainerTypes', {}, (env) => { it('should return empty if no containers', () => { expect( getEnclosingContainerTypes(env.win.document.createElement('amp-ad')) @@ -613,7 +613,7 @@ describe('Google A4A utils', () => { ).to.equal(0); }); - Object.keys(ValidAdContainerTypes).forEach(container => { + Object.keys(ValidAdContainerTypes).forEach((container) => { it(`should return container: ${container}`, () => { const containerElem = env.win.document.createElement(container); env.win.document.body.appendChild(containerElem); @@ -627,7 +627,7 @@ describe('Google A4A utils', () => { it('should include ALL containers', () => { let prevContainer; - Object.keys(ValidAdContainerTypes).forEach(container => { + Object.keys(ValidAdContainerTypes).forEach((container) => { const containerElem = env.win.document.createElement(container); (prevContainer || env.win.document.body).appendChild(containerElem); prevContainer = containerElem; @@ -635,7 +635,7 @@ describe('Google A4A utils', () => { const ampAdElem = env.win.document.createElement('amp-ad'); prevContainer.appendChild(ampAdElem); const ValidAdContainerTypeValues = Object.keys(ValidAdContainerTypes).map( - function(key) { + function (key) { return ValidAdContainerTypes[key]; } ); @@ -645,7 +645,7 @@ describe('Google A4A utils', () => { }); }); - describes.fakeWin('#getIdentityTokenRequestUrl', {}, env => { + describes.fakeWin('#getIdentityTokenRequestUrl', {}, (env) => { let doc; let fakeWin; beforeEach(() => { @@ -698,170 +698,181 @@ describe('Google A4A utils', () => { }); }); - describes.fakeWin('#getIdentityToken', {amp: true, mockFetch: true}, env => { - beforeEach(() => { - installXhrService(env.win); - const documentInfoStub = env.sandbox.stub(Services, 'documentInfoForDoc'); - documentInfoStub - .withArgs(env.ampdoc) - .returns({canonicalUrl: 'http://f.blah.com?some_site'}); - }); + describes.fakeWin( + '#getIdentityToken', + {amp: true, mockFetch: true}, + (env) => { + beforeEach(() => { + installXhrService(env.win); + const documentInfoStub = env.sandbox.stub( + Services, + 'documentInfoForDoc' + ); + documentInfoStub + .withArgs(env.ampdoc) + .returns({canonicalUrl: 'http://f.blah.com?some_site'}); + }); - afterEach(() => { - // Verify fetch mocks are all consumed. - expect(env.fetchMock.done()).to.be.true; - }); + afterEach(() => { + // Verify fetch mocks are all consumed. + expect(env.fetchMock.done()).to.be.true; + }); - const getUrl = domain => { - domain = domain || 'google.com'; - return ( - `https:\/\/adservice\.${domain}\/adsid\/integrator\.json\?` + - 'domain=f.blah.com' - ); - }; + const getUrl = (domain) => { + domain = domain || 'google.com'; + return ( + `https:\/\/adservice\.${domain}\/adsid\/integrator\.json\?` + + 'domain=f.blah.com' + ); + }; - it('should ignore response if required fields are missing', () => { - env.expectFetch(getUrl(), JSON.stringify({newToken: 'abc'})); - return getIdentityToken(env.win, env.ampdoc).then(result => { - expect(result.token).to.not.be.ok; - expect(result.jar).to.not.be.ok; - expect(result.pucrd).to.not.be.ok; - expect(result.freshLifetimeSecs).to.not.be.ok; - expect(result.validLifetimeSecs).to.not.be.ok; - expect(result.fetchTimeMs).to.be.at.least(0); + it('should ignore response if required fields are missing', () => { + env.expectFetch(getUrl(), JSON.stringify({newToken: 'abc'})); + return getIdentityToken(env.win, env.ampdoc).then((result) => { + expect(result.token).to.not.be.ok; + expect(result.jar).to.not.be.ok; + expect(result.pucrd).to.not.be.ok; + expect(result.freshLifetimeSecs).to.not.be.ok; + expect(result.validLifetimeSecs).to.not.be.ok; + expect(result.fetchTimeMs).to.be.at.least(0); + }); }); - }); - it('should fetch full token as expected', () => { - env.expectFetch( - getUrl(), - JSON.stringify({ - newToken: 'abc', - '1p_jar': 'some_jar', - pucrd: 'some_pucrd', - freshLifetimeSecs: '1234', - validLifetimeSecs: '5678', - }) - ); - return getIdentityToken(env.win, env.ampdoc).then(result => { - expect(result.token).to.equal('abc'); - expect(result.jar).to.equal('some_jar'); - expect(result.pucrd).to.equal('some_pucrd'); - expect(result.freshLifetimeSecs).to.equal(1234); - expect(result.validLifetimeSecs).to.equal(5678); - expect(result.fetchTimeMs).to.be.at.least(0); + it('should fetch full token as expected', () => { + env.expectFetch( + getUrl(), + JSON.stringify({ + newToken: 'abc', + '1p_jar': 'some_jar', + pucrd: 'some_pucrd', + freshLifetimeSecs: '1234', + validLifetimeSecs: '5678', + }) + ); + return getIdentityToken(env.win, env.ampdoc).then((result) => { + expect(result.token).to.equal('abc'); + expect(result.jar).to.equal('some_jar'); + expect(result.pucrd).to.equal('some_pucrd'); + expect(result.freshLifetimeSecs).to.equal(1234); + expect(result.validLifetimeSecs).to.equal(5678); + expect(result.fetchTimeMs).to.be.at.least(0); + }); }); - }); - it('should redirect as expected', () => { - env.expectFetch(getUrl(), JSON.stringify({altDomain: '.google.fr'})); - env.expectFetch( - getUrl('google.fr'), - JSON.stringify({ - newToken: 'abc', - freshLifetimeSecs: '1234', - validLifetimeSecs: '5678', - }) - ); - return getIdentityToken(env.win, env.ampdoc, '').then(result => { - expect(result.token).to.equal('abc'); - expect(result.jar).to.equal(''); - expect(result.pucrd).to.equal(''); - expect(result.freshLifetimeSecs).to.equal(1234); - expect(result.validLifetimeSecs).to.equal(5678); - expect(result.fetchTimeMs).to.be.at.least(0); + it('should redirect as expected', () => { + env.expectFetch(getUrl(), JSON.stringify({altDomain: '.google.fr'})); + env.expectFetch( + getUrl('google.fr'), + JSON.stringify({ + newToken: 'abc', + freshLifetimeSecs: '1234', + validLifetimeSecs: '5678', + }) + ); + return getIdentityToken(env.win, env.ampdoc, '').then((result) => { + expect(result.token).to.equal('abc'); + expect(result.jar).to.equal(''); + expect(result.pucrd).to.equal(''); + expect(result.freshLifetimeSecs).to.equal(1234); + expect(result.validLifetimeSecs).to.equal(5678); + expect(result.fetchTimeMs).to.be.at.least(0); + }); }); - }); - it('should stop after 1 redirect', () => { - env.expectFetch(getUrl(), JSON.stringify({altDomain: '.google.fr'})); - env.expectFetch( - getUrl('google.fr'), - JSON.stringify({altDomain: '.google.com'}) - ); - return getIdentityToken(env.win, env.ampdoc).then(result => { - expect(result.token).to.not.be.ok; - expect(result.jar).to.not.be.ok; - expect(result.pucrd).to.not.be.ok; - expect(result.fetchTimeMs).to.be.at.least(0); + it('should stop after 1 redirect', () => { + env.expectFetch(getUrl(), JSON.stringify({altDomain: '.google.fr'})); + env.expectFetch( + getUrl('google.fr'), + JSON.stringify({altDomain: '.google.com'}) + ); + return getIdentityToken(env.win, env.ampdoc).then((result) => { + expect(result.token).to.not.be.ok; + expect(result.jar).to.not.be.ok; + expect(result.pucrd).to.not.be.ok; + expect(result.fetchTimeMs).to.be.at.least(0); + }); }); - }); - it('should use previous execution', () => { - const ident = { - newToken: 'foo', - freshLifetimeSecs: '1234', - validLifetimeSecs: '5678', - }; - env.win['goog_identity_prom'] = Promise.resolve(ident); - return getIdentityToken(env.win, env.ampdoc).then(result => - expect(result).to.jsonEqual(ident) - ); - }); - - it('should handle fetch error', () => { - env.sandbox - .stub(Services, 'xhrFor') - .returns({fetchJson: () => Promise.reject('some network failure')}); - return getIdentityToken(env.win, env.ampdoc).then(result => - expect(result).to.jsonEqual({}) - ); - }); - - it('should fetch if SUFFICIENT consent', () => { - env.expectFetch( - getUrl(), - JSON.stringify({ - newToken: 'abc', - '1p_jar': 'some_jar', - pucrd: 'some_pucrd', + it('should use previous execution', () => { + const ident = { + newToken: 'foo', freshLifetimeSecs: '1234', validLifetimeSecs: '5678', - }) - ); - env.sandbox.stub(Services, 'consentPolicyServiceForDocOrNull').returns( - Promise.resolve({ - whenPolicyResolved: () => CONSENT_POLICY_STATE.SUFFICIENT, - }) - ); - return getIdentityToken(env.win, env.ampdoc, 'default').then(result => - expect(result.token).to.equal('abc') - ); - }); + }; + env.win['goog_identity_prom'] = Promise.resolve(ident); + return getIdentityToken(env.win, env.ampdoc).then((result) => + expect(result).to.jsonEqual(ident) + ); + }); - it.configure() - .skipFirefox() - .run('should not fetch if INSUFFICIENT consent', () => { - env.sandbox.stub(Services, 'consentPolicyServiceForDocOrNull').returns( - Promise.resolve({ - whenPolicyResolved: () => CONSENT_POLICY_STATE.INSUFFICIENT, - }) + it('should handle fetch error', () => { + env.sandbox + .stub(Services, 'xhrFor') + .returns({fetchJson: () => Promise.reject('some network failure')}); + return getIdentityToken(env.win, env.ampdoc).then((result) => + expect(result).to.jsonEqual({}) ); - return expect( - getIdentityToken(env.win, env.ampdoc, 'default') - ).to.eventually.jsonEqual({}); }); - it.configure() - .skipFirefox() - .run('should not fetch if UNKNOWN consent', () => { + it('should fetch if SUFFICIENT consent', () => { + env.expectFetch( + getUrl(), + JSON.stringify({ + newToken: 'abc', + '1p_jar': 'some_jar', + pucrd: 'some_pucrd', + freshLifetimeSecs: '1234', + validLifetimeSecs: '5678', + }) + ); env.sandbox.stub(Services, 'consentPolicyServiceForDocOrNull').returns( Promise.resolve({ - whenPolicyResolved: () => CONSENT_POLICY_STATE.UNKNOWN, + whenPolicyResolved: () => CONSENT_POLICY_STATE.SUFFICIENT, }) ); - return expect( - getIdentityToken(env.win, env.ampdoc, 'default') - ).to.eventually.jsonEqual({}); + return getIdentityToken(env.win, env.ampdoc, 'default').then((result) => + expect(result.token).to.equal('abc') + ); }); - }); + + it.configure() + .skipFirefox() + .run('should not fetch if INSUFFICIENT consent', () => { + env.sandbox + .stub(Services, 'consentPolicyServiceForDocOrNull') + .returns( + Promise.resolve({ + whenPolicyResolved: () => CONSENT_POLICY_STATE.INSUFFICIENT, + }) + ); + return expect( + getIdentityToken(env.win, env.ampdoc, 'default') + ).to.eventually.jsonEqual({}); + }); + + it.configure() + .skipFirefox() + .run('should not fetch if UNKNOWN consent', () => { + env.sandbox + .stub(Services, 'consentPolicyServiceForDocOrNull') + .returns( + Promise.resolve({ + whenPolicyResolved: () => CONSENT_POLICY_STATE.UNKNOWN, + }) + ); + return expect( + getIdentityToken(env.win, env.ampdoc, 'default') + ).to.eventually.jsonEqual({}); + }); + } + ); describe('variables for amp-analytics', () => { let a4a; let ampdoc; beforeEach(() => { - return createIframePromise().then(fixture => { + return createIframePromise().then((fixture) => { setupForAdTesting(fixture); const element = createElementWithAttributes(fixture.doc, 'amp-a4a', { 'width': '200', @@ -935,12 +946,12 @@ describe('Google A4A utils', () => { {in: 'foo.com?lj=fl', out: 'foo.com'}, {in: 'hello.com', out: 'hello.com'}, {in: '', out: ''}, - ].forEach(test => + ].forEach((test) => it(test.in, () => expect(extractHost(test.in)).to.equal(test.out)) ); }); - describes.realWin('#getCorrelator', {}, env => { + describes.realWin('#getCorrelator', {}, (env) => { let win; beforeEach(() => { @@ -976,7 +987,7 @@ describe('Google A4A utils', () => { }); }); -describes.realWin('#groupAmpAdsByType', {amp: true}, env => { +describes.realWin('#groupAmpAdsByType', {amp: true}, (env) => { let doc, win, ampdoc; beforeEach(() => { win = env.win; @@ -1001,11 +1012,11 @@ describes.realWin('#groupAmpAdsByType', {amp: true}, env => { .stub(IniLoad, 'getMeasuredResources') .callsFake((doc, win, fn) => Promise.resolve(resources.filter(fn))); return groupAmpAdsByType(ampdoc, 'doubleclick', () => 'foo').then( - result => { + (result) => { expect(Object.keys(result).length).to.equal(1); expect(result['foo']).to.be.ok; expect(result['foo'].length).to.equal(1); - return result['foo'][0].then(baseElement => + return result['foo'][0].then((baseElement) => expect(baseElement.element.getAttribute('type')).to.equal( 'doubleclick' ) @@ -1030,11 +1041,11 @@ describes.realWin('#groupAmpAdsByType', {amp: true}, env => { env.sandbox .stub(IniLoad, 'getMeasuredResources') .callsFake((doc, win, fn) => Promise.resolve(resources.filter(fn))); - return groupAmpAdsByType(win, 'doubleclick', () => 'foo').then(result => { + return groupAmpAdsByType(win, 'doubleclick', () => 'foo').then((result) => { expect(Object.keys(result).length).to.equal(1); expect(result['foo']).to.be.ok; expect(result['foo'].length).to.equal(1); - return result['foo'][0].then(baseElement => + return result['foo'][0].then((baseElement) => expect(baseElement.element.getAttribute('type')).to.equal('doubleclick') ); }); @@ -1061,9 +1072,9 @@ describes.realWin('#groupAmpAdsByType', {amp: true}, env => { env.sandbox .stub(IniLoad, 'getMeasuredResources') .callsFake((doc, win, fn) => Promise.resolve(resources.filter(fn))); - return groupAmpAdsByType(win, 'doubleclick', element => + return groupAmpAdsByType(win, 'doubleclick', (element) => element.getAttribute('foo') - ).then(result => { + ).then((result) => { expect(Object.keys(result).length).to.equal(2); expect(result['bar']).to.be.ok; expect(result['bar'].length).to.equal(2); @@ -1071,8 +1082,8 @@ describes.realWin('#groupAmpAdsByType', {amp: true}, env => { expect(result['hello'].length).to.equal(1); return Promise.all( result['bar'].concat(result['hello']) - ).then(baseElements => - baseElements.forEach(baseElement => + ).then((baseElements) => + baseElements.forEach((baseElement) => expect(baseElement.element.getAttribute('type')).to.equal( 'doubleclick' ) diff --git a/ads/google/a4a/traffic-experiments.js b/ads/google/a4a/traffic-experiments.js index 3bd5155317c6..b02cb727def6 100644 --- a/ads/google/a4a/traffic-experiments.js +++ b/ads/google/a4a/traffic-experiments.js @@ -71,7 +71,7 @@ export function extractUrlExperimentId(win, element) { let arg; let match; expKeys.forEach( - key => + (key) => (arg = arg || ((match = new RegExp(`(?:^|,)${key}:(-?\\d+)`).exec(expParam)) && @@ -112,7 +112,7 @@ export function parseExperimentIds(idString) { */ export function isInExperiment(element, id) { return parseExperimentIds(element.getAttribute(EXPERIMENT_ATTRIBUTE)).some( - x => { + (x) => { return x === id; } ); @@ -140,7 +140,7 @@ export function isInManualExperiment(element) { * @return {boolean} Whether all list elements are valid experiment IDs. */ export function validateExperimentIds(idList) { - return idList.every(id => { + return idList.every((id) => { return !isNaN(parseInt(id, 10)); }); } diff --git a/ads/google/a4a/utils.js b/ads/google/a4a/utils.js index f0936823a779..36a0924b7f50 100644 --- a/ads/google/a4a/utils.js +++ b/ads/google/a4a/utils.js @@ -215,10 +215,10 @@ export function groupAmpAdsByType(ampdoc, type, groupFn) { // TODO(keithwrightbos): what about slots that become measured due to removal // of display none (e.g. user resizes viewport and media selector makes // visible). - const ampAdSelector = r => + const ampAdSelector = (r) => r.element./*OK*/ querySelector(`amp-ad[type=${type}]`); return ( - getMeasuredResources(ampdoc, ampdoc.win, r => { + getMeasuredResources(ampdoc, ampdoc.win, (r) => { const isAmpAdType = r.element.tagName == 'AMP-AD' && r.element.getAttribute('type') == type; if (isAmpAdType) { @@ -231,9 +231,9 @@ export function groupAmpAdsByType(ampdoc, type, groupFn) { }) // Need to wait on any contained element resolution followed by build // of child ad. - .then(resources => + .then((resources) => Promise.all( - resources.map(resource => { + resources.map((resource) => { if (resource.element.tagName == 'AMP-AD') { return resource.element; } @@ -246,7 +246,7 @@ export function groupAmpAdsByType(ampdoc, type, groupFn) { ) ) // Group by networkId. - .then(elements => + .then((elements) => elements.reduce((result, element) => { const groupId = groupFn(element); (result[groupId] || (result[groupId] = [])).push(element.getImpl()); @@ -276,7 +276,7 @@ export function googlePageParameters(a4a, startTime) { return Promise.all([ getOrCreateAdCid(ampDoc, 'AMP_ECID_GOOGLE', '_ga'), referrerPromise, - ]).then(promiseResults => { + ]).then((promiseResults) => { const clientId = promiseResults[0]; const referrer = promiseResults[1]; const {pageViewId, canonicalUrl} = Services.documentInfoForDoc(ampDoc); @@ -343,7 +343,7 @@ export function googleAdUrl( ) { // TODO: Maybe add checks in case these promises fail. const blockLevelParameters = googleBlockParameters(a4a, opt_experimentIds); - return googlePageParameters(a4a, startTime).then(pageLevelParameters => { + return googlePageParameters(a4a, startTime).then((pageLevelParameters) => { Object.assign(parameters, blockLevelParameters, pageLevelParameters); return truncAndTimeUrl(baseUrl, parameters, startTime); }); @@ -703,7 +703,7 @@ export function extractAmpAnalyticsConfig(a4a, responseHeaders) { * @see parseExperimentIds, validateExperimentIds */ export function mergeExperimentIds(newIds, currentIdString) { - const newIdString = newIds.filter(newId => Number(newId)).join(','); + const newIdString = newIds.filter((newId) => Number(newId)).join(','); currentIdString = currentIdString || ''; return ( currentIdString + (currentIdString && newIdString ? ',' : '') + newIdString @@ -868,7 +868,7 @@ export function getIdentityToken(win, ampDoc, consentPolicyId) { (consentPolicyId ? getConsentPolicyState(ampDoc.getHeadNode(), consentPolicyId) : Promise.resolve(CONSENT_POLICY_STATE.UNKNOWN_NOT_REQUIRED) - ).then(consentState => + ).then((consentState) => consentState == CONSENT_POLICY_STATE.INSUFFICIENT || consentState == CONSENT_POLICY_STATE.UNKNOWN ? /** @type {!IdentityToken} */ ({}) @@ -900,8 +900,8 @@ function executeIdentityTokenFetch( ampCors: false, credentials: 'include', }) - .then(res => res.json()) - .then(obj => { + .then((res) => res.json()) + .then((obj) => { const token = obj['newToken']; const jar = obj['1p_jar'] || ''; const pucrd = obj['pucrd'] || ''; @@ -938,7 +938,7 @@ function executeIdentityTokenFetch( // returning empty return {fetchTimeMs}; }) - .catch(unusedErr => { + .catch((unusedErr) => { // TODO log? return {}; }); @@ -982,7 +982,7 @@ export function isCdnProxy(win) { export function setNameframeExperimentConfigs(headers, nameframeConfig) { const nameframeExperimentHeader = headers.get('amp-nameframe-exp'); if (nameframeExperimentHeader) { - nameframeExperimentHeader.split(';').forEach(config => { + nameframeExperimentHeader.split(';').forEach((config) => { if (config == 'instantLoad' || config == 'writeInBody') { nameframeConfig[config] = true; } diff --git a/ads/google/imaVideo.js b/ads/google/imaVideo.js index 41ea09637176..31637382cd7c 100644 --- a/ads/google/imaVideo.js +++ b/ads/google/imaVideo.js @@ -440,7 +440,7 @@ export function imaVideo(global, data) { } if (data.childElements) { const children = JSON.parse(data.childElements); - children.forEach(child => { + children.forEach((child) => { videoPlayer.appendChild(htmlToElement(child)); }); } @@ -510,7 +510,7 @@ export function imaVideo(global, data) { 'mozfullscreenchange', 'webkitfullscreenchange', ]; - fullScreenEvents.forEach(fsEvent => { + fullScreenEvents.forEach((fsEvent) => { global.document.addEventListener( fsEvent, onFullscreenChange.bind(null, global), @@ -1328,7 +1328,7 @@ export function showAdControls() { const isSkippable = currentAd ? currentAd.getSkipTimeOffset() !== -1 : false; const miniControls = hasMobileStyles && isSkippable; // hide non-ad controls - [timeDiv, progressBarWrapperDiv].forEach(button => { + [timeDiv, progressBarWrapperDiv].forEach((button) => { setStyle(button, 'display', 'none'); }); // set ad control styles @@ -1337,7 +1337,7 @@ export function showAdControls() { 'justify-content': 'flex-end', 'padding': '10px', }); - [fullscreenDiv, playPauseDiv, muteUnmuteDiv].forEach(button => { + [fullscreenDiv, playPauseDiv, muteUnmuteDiv].forEach((button) => { setStyles(button, {'height': miniControls ? '18px' : '22px'}); }); setStyles(muteUnmuteDiv, {'margin-right': '10px'}); @@ -1362,12 +1362,12 @@ export function resetControlsAfterAd() { 'height': '100px', 'padding': '60px 10px 10px', }); - [fullscreenDiv, playPauseDiv, muteUnmuteDiv].forEach(button => { + [fullscreenDiv, playPauseDiv, muteUnmuteDiv].forEach((button) => { setStyles(button, {'height': '30px'}); }); setStyles(muteUnmuteDiv, {'margin-right': '20px'}); // show non-ad controls - [timeDiv, progressBarWrapperDiv].forEach(button => { + [timeDiv, progressBarWrapperDiv].forEach((button) => { setStyle(button, 'display', 'block'); }); } diff --git a/ads/google/utils.js b/ads/google/utils.js index 5c6c561f6368..a549860b42f9 100644 --- a/ads/google/utils.js +++ b/ads/google/utils.js @@ -86,12 +86,12 @@ export function getMultiSizeDimensions( !validateDimensions( width, height, - w => isNaN(w) || w <= 0, - h => isNaN(h) || h <= 0, - badParams => + (w) => isNaN(w) || w <= 0, + (h) => isNaN(h) || h <= 0, + (badParams) => badParams .map( - badParam => + (badParam) => `Invalid ${badParam.dim} of ${badParam.val} ` + 'given for secondary size.' ) @@ -107,12 +107,12 @@ export function getMultiSizeDimensions( !validateDimensions( width, height, - w => w > primaryWidth, - h => h > primaryHeight, - badParams => + (w) => w > primaryWidth, + (h) => h > primaryHeight, + (badParams) => badParams .map( - badParam => + (badParam) => `Secondary ${badParam.dim} ${badParam.val} ` + `can't be larger than the primary ${badParam.dim}.` ) @@ -134,12 +134,12 @@ export function getMultiSizeDimensions( !validateDimensions( width, height, - w => w < minWidth, - h => h < minHeight, - badParams => + (w) => w < minWidth, + (h) => h < minHeight, + (badParams) => badParams .map( - badParam => + (badParam) => `Secondary ${badParam.dim} ${badParam.val} is ` + `smaller than 2/3rds of the primary ${badParam.dim}.` ) diff --git a/ads/gumgum.js b/ads/gumgum.js index bf106176e650..0f870284221c 100644 --- a/ads/gumgum.js +++ b/ads/gumgum.js @@ -33,8 +33,8 @@ export function gumgum(global, data) { const {max} = Math, slotId = parseInt(data.slot, 10), - onLoad = function(type) { - return function(evt) { + onLoad = function (type) { + return function (evt) { const ad = {width: 0, height: 0, ...(evt.ad || {})}, identifier = ['GUMGUM', type, evt.id].join('_'); ctx.reportRenderedEntityIdentifier(identifier); @@ -44,7 +44,7 @@ export function gumgum(global, data) { }); }; }, - noFill = function() { + noFill = function () { ctx.noContentAvailable(); }; diff --git a/ads/idealmedia.js b/ads/idealmedia.js index 3ea624bfc896..fe765c916901 100644 --- a/ads/idealmedia.js +++ b/ads/idealmedia.js @@ -48,8 +48,8 @@ export function idealmedia(global, data) { '00000' + Math.round(Math.random() * 100000).toString(16) ).slice(-5); - global.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + global.context.observeIntersection(function (changes) { + changes.forEach(function (c) { window['intersectionRect' + data.widget + '_' + global.uniqId] = c.intersectionRect; window['boundingClientRect' + data.widget + '_' + global.uniqId] = diff --git a/ads/imedia.js b/ads/imedia.js index 8da74128d79e..6c422e9bcc0e 100644 --- a/ads/imedia.js +++ b/ads/imedia.js @@ -39,7 +39,7 @@ export function imedia(global, data) { computeInMasterFrame( global, 'imedia-load', - done => { + (done) => { loadScript(global, 'https://i.imedia.cz/js/im3.js', () => { if (global.im != null) { mW.im = global.im; @@ -47,7 +47,7 @@ export function imedia(global, data) { // send request to get all ads mW.im.getAds(positions, { - AMPcallback: ads => { + AMPcallback: (ads) => { mW.ads = ads; done(null); }, @@ -56,7 +56,7 @@ export function imedia(global, data) { }); }, () => { - mW.inPagePositions = mW.inPagePositions.filter(inPagePostion => { + mW.inPagePositions = mW.inPagePositions.filter((inPagePostion) => { let used = true; positions.filter((position, index) => { // match right element and zone to write advert from adserver diff --git a/ads/imonomy.js b/ads/imonomy.js index c92969e029bf..0f1575bd8a7a 100644 --- a/ads/imonomy.js +++ b/ads/imonomy.js @@ -40,7 +40,7 @@ export function imonomy(global, data) { const timer = setTimeout(() => { callDoubleclick(EVENT_TIMEOUT); }, data.timeout); - const callDoubleclick = function(code) { + const callDoubleclick = function (code) { if (calledDoubleclick) { return; } diff --git a/ads/inabox/frame-overlay-helper.js b/ads/inabox/frame-overlay-helper.js index 3f3eadb1f8f6..5b5734f84101 100644 --- a/ads/inabox/frame-overlay-helper.js +++ b/ads/inabox/frame-overlay-helper.js @@ -36,7 +36,7 @@ const CENTER_TRANSITION_END_WAIT_TIME_MS = 50; * @param {function(!LayoutRectDef, !LayoutRectDef)} onFinish * @private */ -const expandFrameImpl = function(win, iframe, onFinish) { +const expandFrameImpl = function (win, iframe, onFinish) { restrictedVsync( win, { @@ -86,7 +86,7 @@ const expandFrameImpl = function(win, iframe, onFinish) { * @param {function(!LayoutRectDef)} onMeasure * @private */ -const collapseFrameImpl = function(win, iframe, onFinish, onMeasure) { +const collapseFrameImpl = function (win, iframe, onFinish, onMeasure) { restrictedVsync(win, { mutate() { collapseFrameUnderVsyncMutate(iframe); diff --git a/ads/inabox/frame-overlay-manager.js b/ads/inabox/frame-overlay-manager.js index 4dec775d123a..d1f12a35c278 100644 --- a/ads/inabox/frame-overlay-manager.js +++ b/ads/inabox/frame-overlay-manager.js @@ -93,7 +93,7 @@ export class FrameOverlayManager { callback(this.collapsedRect_); } }, - collapsedRect => { + (collapsedRect) => { this.collapsedRect_ = collapsedRect; if (this.viewportChangedSinceExpand_) { diff --git a/ads/inabox/inabox-host.js b/ads/inabox/inabox-host.js index eb9462333546..07e0c1faf202 100644 --- a/ads/inabox/inabox-host.js +++ b/ads/inabox/inabox-host.js @@ -69,7 +69,7 @@ export class InaboxHost { win.AMP[INABOX_UNREGISTER_IFRAME] = host.unregisterIframe.bind(host); } const queuedMsgs = win[PENDING_MESSAGES]; - const processMessageFn = /** @type {function(Event)} */ (evt => { + const processMessageFn = /** @type {function(Event)} */ ((evt) => { try { host.processMessage(evt); } catch (err) { @@ -78,7 +78,7 @@ export class InaboxHost { }); if (queuedMsgs) { if (Array.isArray(queuedMsgs)) { - queuedMsgs.forEach(message => { + queuedMsgs.forEach((message) => { // Pending messages are added by external scripts. // Validate their data types to avoid client errors. if (!validateMessage(message)) { diff --git a/ads/inabox/inabox-messaging-host.js b/ads/inabox/inabox-messaging-host.js index 2dbb78646811..a78a8783f7c0 100644 --- a/ads/inabox/inabox-messaging-host.js +++ b/ads/inabox/inabox-messaging-host.js @@ -184,7 +184,7 @@ export class InaboxMessagingHost { devAssert(this.iframeMap_[request.sentinel]); this.iframeMap_[request.sentinel].observeUnregisterFn = this.iframeMap_[request.sentinel].observeUnregisterFn || - this.positionObserver_.observe(iframe, data => + this.positionObserver_.observe(iframe, (data) => this.sendPosition_(request, source, /** @type {?JsonObject} */ (data)) ); return true; @@ -220,7 +220,7 @@ export class InaboxMessagingHost { * 2. Disable zoom and scroll on parent doc */ handleEnterFullOverlay_(iframe, request, source, origin) { - this.frameOverlayManager_.expandFrame(iframe, boxRect => { + this.frameOverlayManager_.expandFrame(iframe, (boxRect) => { source./*OK*/ postMessage( serializeMessage( MessageType.FULL_OVERLAY_FRAME_RESPONSE, @@ -245,7 +245,7 @@ export class InaboxMessagingHost { * @return {boolean} */ handleCancelFullOverlay_(iframe, request, source, origin) { - this.frameOverlayManager_.collapseFrame(iframe, boxRect => { + this.frameOverlayManager_.collapseFrame(iframe, (boxRect) => { source./*OK*/ postMessage( serializeMessage( MessageType.CANCEL_FULL_OVERLAY_FRAME_RESPONSE, diff --git a/ads/inmobi.js b/ads/inmobi.js index 77f4e9d64c23..2e21f2a1b532 100644 --- a/ads/inmobi.js +++ b/ads/inmobi.js @@ -28,7 +28,7 @@ export function inmobi(global, data) { siteid: data.siteid, slot: data.slotid, manual: true, - onError: code => { + onError: (code) => { if (code == 'nfr') { global.context.noContentAvailable(); setStyle(document.getElementById('my-ad-slot'), 'display', 'none'); diff --git a/ads/insticator.js b/ads/insticator.js index 3925e8155912..44e2aaa2a621 100644 --- a/ads/insticator.js +++ b/ads/insticator.js @@ -66,7 +66,7 @@ function createAdsAndEmbed(siteId, embedId) { 'Insticator' in a || (a.Insticator = { ad: { - loadAd: function(b) { + loadAd: function (b) { a.Insticator.ad.q.push(b); }, q: [], @@ -76,7 +76,7 @@ function createAdsAndEmbed(siteId, embedId) { version: '4.0', q: [], amp: null, // this will get set to window.context which is the AMP API so we can access from our ads code - load: function(t, o) { + load: function (t, o) { a.Insticator.amp = window.context; // set the Insticator object property amp to window.context which is the AMP API so we can access from our ads code a.Insticator.q.push({t, o}); }, diff --git a/ads/ix.js b/ads/ix.js index 1089899dfaf7..333698576cc0 100644 --- a/ads/ix.js +++ b/ads/ix.js @@ -42,7 +42,7 @@ export function ix(global, data) { callDoubleclick(EVENT_TIMEOUT); }, data.ixTimeout); - const callDoubleclick = function(code) { + const callDoubleclick = function (code) { if (calledDoubleclick) { return; } diff --git a/ads/kargo.js b/ads/kargo.js index 75a7226f6f87..a060211cf51c 100644 --- a/ads/kargo.js +++ b/ads/kargo.js @@ -43,7 +43,7 @@ export function kargo(global, data) { computeInMasterFrame( global, 'kargo-load', - function(done) { + function (done) { // load AdTag in Master window loadScript(this, kargoScriptUrl, () => { let success = false; @@ -54,7 +54,7 @@ export function kargo(global, data) { done(success); }); }, - success => { + (success) => { if (success) { const w = options.source_window; diff --git a/ads/kiosked.js b/ads/kiosked.js index 235df8a09fab..b32d1e22a672 100644 --- a/ads/kiosked.js +++ b/ads/kiosked.js @@ -29,7 +29,7 @@ export function kiosked(global, data) { } window.addEventListener( 'kioskedAdRender', - function() { + function () { global.context.renderStart(); }, false @@ -37,7 +37,7 @@ export function kiosked(global, data) { window.addEventListener( 'kioskedAdNoFill', - function() { + function () { global.context.noContentAvailable(); }, false diff --git a/ads/kixer.js b/ads/kixer.js index 3ef34177e954..1ef06244594f 100644 --- a/ads/kixer.js +++ b/ads/kixer.js @@ -41,7 +41,7 @@ export function kixer(global, data) { d.id = '__kx_ad_' + data.adslot; global.document.getElementById('c').appendChild(d); - const kxload = function() { + const kxload = function () { d.removeEventListener('load', kxload, false); if (d.childNodes.length > 0) { global.context.renderStart(); @@ -51,7 +51,7 @@ export function kixer(global, data) { }; d.addEventListener('load', kxload, false); // Listen for the kixer load event - const kxviewCheck = function(intersectionEntry) { + const kxviewCheck = function (intersectionEntry) { inView = intersectionEntry.intersectionRatio > 0.5; // Half of the unit is in the viewport if (inView) { if (!viewed && viewTimer == null) { @@ -67,7 +67,7 @@ export function kixer(global, data) { } }; - const kxviewFire = function() { + const kxviewFire = function () { if (inView) { // if the ad is still in the viewport if (typeof __kx_viewability.process_locked === 'function') { @@ -77,8 +77,8 @@ export function kixer(global, data) { } }; - global.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + global.context.observeIntersection(function (changes) { + changes.forEach(function (c) { kxviewCheck(c); }); }); diff --git a/ads/lentainform.js b/ads/lentainform.js index 4a7a4d1d78fb..45a64455a81e 100644 --- a/ads/lentainform.js +++ b/ads/lentainform.js @@ -41,8 +41,8 @@ export function lentainform(global, data) { '00000' + Math.round(Math.random() * 100000).toString(16) ).slice(-5); - global.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + global.context.observeIntersection(function (changes) { + changes.forEach(function (c) { window['intersectionRect' + data.widget + '_' + global.uniqId] = c.intersectionRect; window['boundingClientRect' + data.widget + '_' + global.uniqId] = diff --git a/ads/loka.js b/ads/loka.js index f7ab8aee3186..57eedba1baba 100644 --- a/ads/loka.js +++ b/ads/loka.js @@ -26,7 +26,7 @@ export function loka(global, data) { global.lokaParams = data; const container = global.document.querySelector('#c'); - container.addEventListener('lokaUnitLoaded', e => { + container.addEventListener('lokaUnitLoaded', (e) => { if (e.detail.isReady) { global.context.renderStart(); } else { diff --git a/ads/mads.js b/ads/mads.js index 7c53787bd0e8..d4ecb0e004b4 100644 --- a/ads/mads.js +++ b/ads/mads.js @@ -23,7 +23,7 @@ import {validateData, writeScript} from '../3p/3p'; export function mads(global, data) { validateData(data, ['adrequest'], []); - writeScript(global, 'https://eu2.madsone.com/js/tags.js', function() { + writeScript(global, 'https://eu2.madsone.com/js/tags.js', function () { window.MADSAdrequest.adrequest(JSON.parse(data.adrequest)); }); } diff --git a/ads/medianet.js b/ads/medianet.js index 19206f93ee2c..c4e4815908a8 100644 --- a/ads/medianet.js +++ b/ads/medianet.js @@ -66,10 +66,10 @@ export function medianet(global, data) { */ function getCallbacksObject() { return { - renderStartCb: opt_data => { + renderStartCb: (opt_data) => { global.context.renderStart(opt_data); }, - reportRenderedEntityIdentifierCb: ampId => { + reportRenderedEntityIdentifierCb: (ampId) => { global.context.reportRenderedEntityIdentifier(ampId); }, noContentAvailableCb: () => { @@ -165,7 +165,7 @@ function loadHBTag(global, data, publisherUrl, referrerUrl) { global.advBidxc = global.context.master.advBidxc; if (global.advBidxc && typeof global.advBidxc.renderAmpAd === 'function') { - global.addEventListener('message', event => { + global.addEventListener('message', (event) => { global.advBidxc.renderAmpAd(event, global); }); } @@ -201,7 +201,7 @@ function loadHBTag(global, data, publisherUrl, referrerUrl) { computeInMasterFrame( global, 'medianet-hb-load', - done => { + (done) => { /*eslint "google-camelcase/google-camelcase": 0*/ global.advBidxc_requrl = publisherUrl; global.advBidxc_refurl = referrerUrl; diff --git a/ads/medyanet.js b/ads/medyanet.js index e17dd6c0c7a7..ca485ad1ebdd 100644 --- a/ads/medyanet.js +++ b/ads/medyanet.js @@ -49,7 +49,7 @@ function medyanetAds(global, data) { border: '0 none transparent', position: 'relative', }); - f.onload = function() { + f.onload = function () { window.context.renderStart(); }; f.src = `https://app.medyanetads.com/amp/medyanetads.html?bidderData=${global.domain}&adunit=${global.adunit}&size=${global.size}`; diff --git a/ads/mgid.js b/ads/mgid.js index 54e679e363df..2c817af60770 100644 --- a/ads/mgid.js +++ b/ads/mgid.js @@ -48,8 +48,8 @@ export function mgid(global, data) { '00000' + Math.round(Math.random() * 100000).toString(16) ).slice(-5); - global.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + global.context.observeIntersection(function (changes) { + changes.forEach(function (c) { window['intersectionRect' + data.widget + '_' + global.uniqId] = c.intersectionRect; window['boundingClientRect' + data.widget + '_' + global.uniqId] = diff --git a/ads/nativery.js b/ads/nativery.js index 1b40a80c2746..57f6960273df 100644 --- a/ads/nativery.js +++ b/ads/nativery.js @@ -34,7 +34,7 @@ export function nativery(global, data) { }; // must add listener for resize - global.addEventListener('amp-widgetCreated', function(e) { + global.addEventListener('amp-widgetCreated', function (e) { if (e && e.detail) { global.context.requestResize(undefined, e.detail.height); } diff --git a/ads/nativo.js b/ads/nativo.js index 6ebd8ceb3c14..badb0e07785b 100644 --- a/ads/nativo.js +++ b/ads/nativo.js @@ -21,7 +21,7 @@ import {loadScript} from '../3p/3p'; */ export function nativo(global, data) { let ntvAd; - (function(ntvAd, global, data) { + (function (ntvAd, global, data) { global.history.replaceState( null, '', @@ -63,7 +63,7 @@ export function nativo(global, data) { */ function loadAdWhenViewed() { const g = global; - global.context.observeIntersection(function(positions) { + global.context.observeIntersection(function (positions) { const coordinates = getLastPositionCoordinates(positions); if ( typeof coordinates.rootBounds != 'undefined' && @@ -82,7 +82,7 @@ export function nativo(global, data) { */ function loadAdWhenTimedout() { const g = global; - setTimeout(function() { + setTimeout(function () { g.PostRelease.Start(); delayedAdLoad = true; }, parseInt(data.delayByTime, 10)); @@ -115,15 +115,15 @@ export function nativo(global, data) { global.PostRelease.checkIsAdVisible(); } // Public - ntvAd.getPercentageOfadViewed = function() { + ntvAd.getPercentageOfadViewed = function () { return percentageOfadViewed; }; - ntvAd.getScriptURL = function() { + ntvAd.getScriptURL = function () { return 'https://s.ntv.io/serve/load.js'; }; // Configuration setup is based on the parameters/attributes associated with // the amp-ad node - ntvAd.setupAd = function() { + ntvAd.setupAd = function () { global._prx = [['cfg.Amp']]; global._prx.push(['cfg.RequestUrl', data['requestUrl'] || loc.href]); for (const key in data) { @@ -144,13 +144,13 @@ export function nativo(global, data) { }; // Used to Delay Start and Initalize Tracking. This is a callback AMP will // use once script is loaded - ntvAd.Start = function() { + ntvAd.Start = function () { if (isDelayedTimeStart(data)) { loadAdWhenTimedout(); } else if (isDelayedViewStart(data)) { loadAdWhenViewed(); } - global.PostRelease.checkAmpViewability = function() { + global.PostRelease.checkAmpViewability = function () { return ntvAd.getPercentageOfadViewed(); }; // ADD TRACKING HANDLER TO OBSERVER diff --git a/ads/navegg.js b/ads/navegg.js index 5c7fc5252934..b9c84a94b05f 100644 --- a/ads/navegg.js +++ b/ads/navegg.js @@ -25,15 +25,15 @@ export function navegg(global, data) { validateData(data, ['acc']); const {acc} = data; let seg, - nvg = function() {}; + nvg = function () {}; delete data.acc; - nvg.prototype.getProfile = function() {}; + nvg.prototype.getProfile = function () {}; data.targeting = data.targeting || {}; loadScript(global, 'https://tag.navdmp.com/amp.1.0.0.min.js', () => { nvg = global[`nvg${acc}`] = new global['AMPNavegg']({ acc, }); - nvg.getProfile(nvgTargeting => { + nvg.getProfile((nvgTargeting) => { for (seg in nvgTargeting) { data.targeting[seg] = nvgTargeting[seg]; } diff --git a/ads/netletix.js b/ads/netletix.js index 635b636101fc..c8e6e72d756a 100644 --- a/ads/netletix.js +++ b/ads/netletix.js @@ -65,7 +65,7 @@ export function netletix(global, data) { data.ampSlotIndex ); - window.addEventListener('message', event => { + window.addEventListener('message', (event) => { if ( event.data.type && startsWith(dev().assertString(event.data.type), 'nx-') diff --git a/ads/onnetwork.js b/ads/onnetwork.js index ceb3d82c127c..24f8b00448c5 100644 --- a/ads/onnetwork.js +++ b/ads/onnetwork.js @@ -37,7 +37,7 @@ export function onnetwork(global, data) { // Custom movie url using "data-src" attribute if (src) { validateSrcPrefix( - Object.keys(hosts).map(type => hosts[type]), + Object.keys(hosts).map((type) => hosts[type]), src ); url = src; diff --git a/ads/openx.js b/ads/openx.js index 28d5b89f2dde..6576c1e70110 100644 --- a/ads/openx.js +++ b/ads/openx.js @@ -52,7 +52,7 @@ export function openx(global, data) { // conversion rules are explained in openx.md. if (data.dfpSlot) { // Anything starting with 'dfp' gets promoted. - openxData.forEach(openxKey => { + openxData.forEach((openxKey) => { if (openxKey in dfpData && openxKey !== 'dfp') { if (startsWith(openxKey, 'dfp')) { // Remove 'dfp' prefix, lowercase the first letter. @@ -156,10 +156,10 @@ function advanceImplementation(global, jssdk, dfpData, data) { */ function setCustomVars(oxRequest, customVars) { const customVarKeys = Object.keys(customVars); - customVarKeys.forEach(customVarKey => { + customVarKeys.forEach((customVarKey) => { const customVarValue = customVars[customVarKey]; if (Array.isArray(customVarValue)) { - customVarValue.forEach(value => { + customVarValue.forEach((value) => { oxRequest.addVariable(customVarKey, value); }); } else { @@ -174,11 +174,11 @@ function setCustomVars(oxRequest, customVars) { */ function filterCustomVar(customVars) { const filterPattern = /^[A-Za-z0-9._]{1,20}$/; - const filteredKeys = Object.keys(customVars).filter(key => + const filteredKeys = Object.keys(customVars).filter((key) => filterPattern.test(key) ); const filteredCustomVar = {}; - filteredKeys.forEach(key => { + filteredKeys.forEach((key) => { filteredCustomVar[key.toLowerCase()] = customVars[key]; }); return filteredCustomVar; diff --git a/ads/opinary.js b/ads/opinary.js index e8931b92b213..ec157b913236 100644 --- a/ads/opinary.js +++ b/ads/opinary.js @@ -32,10 +32,7 @@ export function opinary(global, data) { div2.setAttribute('id', 'opinaryAMP'); // append divs to page - global.document - .getElementById('c') - .appendChild(div) - .appendChild(div2); + global.document.getElementById('c').appendChild(div).appendChild(div2); if (!document.querySelector("link[rel='canonical']")) { const link = document.createElement('link'); diff --git a/ads/pubmine.js b/ads/pubmine.js index d5c1c4d29cd2..f7d04896c05f 100644 --- a/ads/pubmine.js +++ b/ads/pubmine.js @@ -87,7 +87,7 @@ export function pubmine(global, data) { initMasterFrame(data, global); } const master = isMaster ? global : global.context.master; - master['__ATA']['cmd']['push'](function() { + master['__ATA']['cmd']['push'](function () { master['__ATA']['insertStyles'](global); master['__ATA']['initSlot'](slotId, slotConfig); }); diff --git a/ads/readmo.js b/ads/readmo.js index 348362cc68a5..513408798114 100644 --- a/ads/readmo.js +++ b/ads/readmo.js @@ -30,7 +30,7 @@ export function readmo(global, data) { global.publisherUrl = data.url; - Object.keys(data).forEach(property => { + Object.keys(data).forEach((property) => { config[property] = data[property]; }); diff --git a/ads/relap.js b/ads/relap.js index 83fbd2ac1f56..8fa8a5d60ccc 100644 --- a/ads/relap.js +++ b/ads/relap.js @@ -26,23 +26,23 @@ export function relap(global, data) { const urlParam = data['url'] || window.context.canonicalUrl; if (data['version'] === 'v7') { - window.onRelapAPIReady = function(relapAPI) { + window.onRelapAPIReady = function (relapAPI) { relapAPI['init']({ token: data['token'], url: urlParam, }); }; - window.onRelapAPIInit = function(relapAPI) { + window.onRelapAPIInit = function (relapAPI) { relapAPI['addWidget']({ cfgId: data['anchorid'], anchorEl: global.document.getElementById('c'), position: 'append', events: { - onReady: function() { + onReady: function () { window.context.renderStart(); }, - onNoContent: function() { + onNoContent: function () { window.context.noContentAvailable(); }, }, @@ -51,11 +51,11 @@ export function relap(global, data) { loadScript(global, 'https://relap.io/v7/relap.js'); } else { - window.relapV6WidgetReady = function() { + window.relapV6WidgetReady = function () { window.context.renderStart(); }; - window.relapV6WidgetNoSimilarPages = function() { + window.relapV6WidgetNoSimilarPages = function () { window.context.noContentAvailable(); }; diff --git a/ads/runative.js b/ads/runative.js index 7fd7b0eb9787..69e783a073f2 100644 --- a/ads/runative.js +++ b/ads/runative.js @@ -61,7 +61,7 @@ function getInitData(data) { const initKeys = requiredParams.concat(optionsParams); const initParams = {}; - initKeys.forEach(key => { + initKeys.forEach((key) => { if (key in data) { const initKey = key === 'adType' ? 'type' : key; diff --git a/ads/spotx.js b/ads/spotx.js index e09fd3b34ca1..d56ef90d6dd8 100644 --- a/ads/spotx.js +++ b/ads/spotx.js @@ -42,7 +42,7 @@ export function spotx(global, data) { } } - global['spotx_ad_done_function'] = function(spotxAdFound) { + global['spotx_ad_done_function'] = function (spotxAdFound) { if (!spotxAdFound) { global.context.noContentAvailable(); } diff --git a/ads/springAds.js b/ads/springAds.js index a7d2a44acd65..069e1a9548e3 100644 --- a/ads/springAds.js +++ b/ads/springAds.js @@ -21,11 +21,11 @@ import {parseJson} from '../src/json'; * @param context */ -const initSlotList = function(context) { +const initSlotList = function (context) { context.master.availableSlots = context.master.availableSlots || {}; }; -const registerSlot = function(slot) { +const registerSlot = function (slot) { context.master.availableSlots[slot.slotName] = slot; }; @@ -34,7 +34,7 @@ export function springAds(global, data) { computeInMasterFrame( global, 'springAds', - function() { + function () { initSlotList(context); }, () => {} @@ -53,7 +53,7 @@ export function springAds(global, data) { computeInMasterFrame( global, 'springAds', - function() { + function () { registerSlot({ window, document, diff --git a/ads/ssp.js b/ads/ssp.js index 6700e9fd51bc..b2ae308fb646 100644 --- a/ads/ssp.js +++ b/ads/ssp.js @@ -80,7 +80,7 @@ export function ssp(global, data) { computeInMasterFrame( global, 'ssp-load', - done => { + (done) => { loadScript(global, 'https://ssp.imedia.cz/static/js/ssp.js', () => { // This callback is run just once for amp-ad with same type // Script will inject "sssp" object on Window @@ -105,9 +105,9 @@ export function ssp(global, data) { }); }); }, - ads => { + (ads) => { /** @suppress {checkTypes} */ - const adById = keyBy(ads, item => item.id); + const adById = keyBy(ads, (item) => item.id); const ad = adById[position['id']]; if (!ad || ['error', 'empty'].includes(ad.type)) { diff --git a/ads/svknative.js b/ads/svknative.js index a170f58fe098..62e50afb4950 100644 --- a/ads/svknative.js +++ b/ads/svknative.js @@ -31,7 +31,7 @@ export function svknative(global, data) { s.setAttribute('data-key', scriptKey); global.document.getElementById('c').appendChild(s); - (function(w, a) { + (function (w, a) { (w[a] = w[a] || []).push({ 'script_key': scriptKey, 'settings': { diff --git a/ads/swoop.js b/ads/swoop.js index 61fe24d1da54..849eed02011e 100644 --- a/ads/swoop.js +++ b/ads/swoop.js @@ -27,14 +27,14 @@ export function swoop(global, data) { computeInMasterFrame( global, 'swoop-load', - done => { + (done) => { global.swoopIabConfig = data; loadScript(global, 'https://www.swoop-amp.com/amp.js', () => done(global.Swoop != null) ); }, - success => { + (success) => { if (success) { if (!global.context.isMaster) { global.context.master.Swoop.announcePlace(global, data); diff --git a/ads/taboola.js b/ads/taboola.js index 44307c2f5519..4380a328c059 100644 --- a/ads/taboola.js +++ b/ads/taboola.js @@ -41,7 +41,7 @@ export function taboola(global, data) { }; // copy none blacklisted attribute to the 'params' map - Object.keys(data).forEach(k => { + Object.keys(data).forEach((k) => { if (blackList.indexOf(k) === -1) { params[k] = data[k]; } @@ -62,8 +62,8 @@ export function taboola(global, data) { ]); // install observation on entering/leaving the view - global.context.observeIntersection(function(changes) { - changes.forEach(function(c) { + global.context.observeIntersection(function (changes) { + changes.forEach(function (c) { if (c.intersectionRect.height) { global._taboola.push({ visible: true, diff --git a/ads/uas.js b/ads/uas.js index 09476bdaade2..81400f4fec4b 100644 --- a/ads/uas.js +++ b/ads/uas.js @@ -72,7 +72,7 @@ export function uas(global, data) { const uasDivId = 'uas-amp-slot'; global.document.write('
'); loadScript(global, 'https://ads.pubmatic.com/AdServer/js/phoenix.js', () => { - global.Phoenix.EQ.push(function() { + global.Phoenix.EQ.push(function () { global.Phoenix.enableSingleRequestCallMode(); global.Phoenix.setInfo('AMP', 1); // Need to set the AMP flag global.Phoenix.setInfo('ACCID', data.accId); @@ -91,10 +91,10 @@ export function uas(global, data) { uasDivId ); slot.setVisibility(1); - forEachOnObject(data.targetings, function(key, value) { + forEachOnObject(data.targetings, function (key, value) { slot.setTargeting(key, value); }); - forEachOnObject(data.extraParams, function(key, value) { + forEachOnObject(data.extraParams, function (key, value) { slot.setExtraParameters(key, value); }); global.Phoenix.display(uasDivId); diff --git a/ads/uzou.js b/ads/uzou.js index 0fb32c5f81a6..3086c8008147 100644 --- a/ads/uzou.js +++ b/ads/uzou.js @@ -51,7 +51,7 @@ export function uzou(global, data) { ), referer: widgetParams['referer'] || global.context.referrer, }; - ['adServerHost', 'akamaiHost', 'iframeSrcPath'].forEach(function(elem) { + ['adServerHost', 'akamaiHost', 'iframeSrcPath'].forEach(function (elem) { if (widgetParams[elem]) { uzouInjector[elem] = widgetParams[elem]; } @@ -69,7 +69,7 @@ export function uzou(global, data) { * @return {*} TODO(#23582): Specify return type */ function fixedEncodeURIComponent(str) { - return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { return '%' + c.charCodeAt(0).toString(16); }); } diff --git a/ads/vmfive.js b/ads/vmfive.js index 463d8df78e2a..b230b00f3d1c 100644 --- a/ads/vmfive.js +++ b/ads/vmfive.js @@ -43,7 +43,7 @@ function parallelDownloadScriptsAndExecuteInOrder(win) { [ 'https://vawpro.vm5apis.com/man.js', 'https://man.vm5apis.com/dist/adn-web-sdk.js', - ].forEach(function(src) { + ].forEach(function (src) { const script = document.createElement('script'); script.src = src; script.async = false; @@ -68,5 +68,5 @@ function createAdUnit(win, placementId, adType) { * @param {string} appKey */ function setupSDKReadyCallback(win, appKey) { - win.onVM5AdSDKReady = sdk => sdk.init({appKey}); + win.onVM5AdSDKReady = (sdk) => sdk.init({appKey}); } diff --git a/ads/widespace.js b/ads/widespace.js index 8f8dd709f093..3ceeb6e2ea13 100644 --- a/ads/widespace.js +++ b/ads/widespace.js @@ -25,7 +25,7 @@ export function widespace(global, data) { // Optional demography parameters. let demo = []; - demo = ['Gender', 'Country', 'Region', 'City', 'Postal', 'Yob'].map(d => { + demo = ['Gender', 'Country', 'Region', 'City', 'Postal', 'Yob'].map((d) => { return 'demo' + d; }); diff --git a/ads/wpmedia.js b/ads/wpmedia.js index b6750561be5d..75a4f8630d5a 100644 --- a/ads/wpmedia.js +++ b/ads/wpmedia.js @@ -26,7 +26,7 @@ export function wpmedia(global, data) { // const url = 'http://localhost/wpjslib.js'; const url = 'https://std.wpcdn.pl/wpjslib/wpjslib-amp.js'; - writeScript(global, url, function() { + writeScript(global, url, function () { window.run(data); }); } diff --git a/ads/xlift.js b/ads/xlift.js index c1cafffe7d51..9fd982df6a53 100644 --- a/ads/xlift.js +++ b/ads/xlift.js @@ -28,11 +28,11 @@ export function xlift(global, data) { d.id = '_XL_recommend'; global.document.getElementById('c').appendChild(d); - d.addEventListener('SuccessLoadedXliftAd', function(e) { + d.addEventListener('SuccessLoadedXliftAd', function (e) { e.detail = e.detail || {adSizeInfo: {}}; global.context.renderStart(e.detail.adSizeInfo); }); - d.addEventListener('FailureLoadedXliftAd', function() { + d.addEventListener('FailureLoadedXliftAd', function () { global.context.noContentAvailable(); }); diff --git a/ads/yieldpro.js b/ads/yieldpro.js index b46716bf2ee0..92906fca39e2 100644 --- a/ads/yieldpro.js +++ b/ads/yieldpro.js @@ -47,7 +47,7 @@ export function yieldpro(global, data) { computeInMasterFrame( global, 'yieldpro-request', - done => { + (done) => { let success = false; const masterWin = this; if (!masterWin.showadAMPAdapter) { @@ -64,7 +64,7 @@ export function yieldpro(global, data) { done(true); } }, - success => { + (success) => { if (success) { global.showadAMPAdapter = global.context.master.showadAMPAdapter; global.showadAMPAdapter.registerSlot(data, global); diff --git a/ads/zedo.js b/ads/zedo.js index bb584ecd2387..3a846e02e663 100644 --- a/ads/zedo.js +++ b/ads/zedo.js @@ -31,7 +31,7 @@ export function zedo(global, data) { loadScript(global, 'https://ss3.zedo.com/gecko/tag/Gecko.amp.min.js', () => { const {ZGTag} = global; const charset = data.charset || ''; - const callback = data.callback || function() {}; + const callback = data.callback || function () {}; const geckoTag = new ZGTag( data.superId, data.network, diff --git a/ads/zucks.js b/ads/zucks.js index c5d558461942..57b25b02e8cf 100644 --- a/ads/zucks.js +++ b/ads/zucks.js @@ -23,7 +23,7 @@ import {loadScript, validateData, writeScript} from '../3p/3p'; export function zucks(global, data) { validateData(data, ['frameId']); if (data['adtype'] === 'zoe') { - loadScript(global, 'https://j.zoe.zucks.net/zoe.min.js', function() { + loadScript(global, 'https://j.zoe.zucks.net/zoe.min.js', function () { const frameId = data['frameId']; const elementId = 'zucks-widget-parent'; diff --git a/babel.config.js b/babel.config.js index cc0b2a59dbf5..b089bef30ad1 100644 --- a/babel.config.js +++ b/babel.config.js @@ -33,7 +33,7 @@ const isClosureCompiler = argv._.includes('dist') || argv._.includes('check-types'); const {esm} = argv; -const targets = esm => { +const targets = (esm) => { if (esm) { return {'esmodules': true}; } @@ -45,7 +45,7 @@ const targets = esm => { return {'browsers': ['Last 2 versions']}; }; -const plugins = esm => { +const plugins = (esm) => { const leadingComments = './build-system/babel-plugins/babel-plugin-transform-fix-leading-comments'; const reactConstantElements = @@ -77,7 +77,7 @@ const plugins = esm => { ]; }; -const presets = esm => { +const presets = (esm) => { if (esm) { return [ [ @@ -104,7 +104,7 @@ const presets = esm => { }; // eslint-disable-next-line local/no-module-exports -module.exports = function(api) { +module.exports = function (api) { api.cache(true); // Closure Compiler builds do not use any of the default settings below until its // an esm build. (Both Multipass and Singlepass) diff --git a/build-system/babel-plugins/babel-plugin-amp-mode-transformer/index.js b/build-system/babel-plugins/babel-plugin-amp-mode-transformer/index.js index d6d1aa7d5dac..c9040fea662e 100644 --- a/build-system/babel-plugins/babel-plugin-amp-mode-transformer/index.js +++ b/build-system/babel-plugins/babel-plugin-amp-mode-transformer/index.js @@ -24,7 +24,7 @@ const {resolve, dirname} = require('path'); let shouldResolveDevelopmentMode = true; // This plugin is not executed when AMP is building resources in isForTesting mode. -module.exports = function({types: t}) { +module.exports = function ({types: t}) { let getModeFound = false; return { pre() { @@ -39,7 +39,7 @@ module.exports = function({types: t}) { if (!source.value.endsWith('/mode')) { return; } - specifiers.forEach(specifier => { + specifiers.forEach((specifier) => { if (specifier.imported && specifier.imported.name === 'getMode') { const filepath = resolve( dirname(state.file.opts.filename), diff --git a/build-system/babel-plugins/babel-plugin-const-transformer/index.js b/build-system/babel-plugins/babel-plugin-const-transformer/index.js index 39f1d5cd80ee..de3a48e6c903 100644 --- a/build-system/babel-plugins/babel-plugin-const-transformer/index.js +++ b/build-system/babel-plugins/babel-plugin-const-transformer/index.js @@ -20,7 +20,7 @@ * @param {Object} babelTypes * @return {!Object} */ -module.exports = function({types: t}) { +module.exports = function ({types: t}) { return { visitor: { VariableDeclaration(path) { diff --git a/build-system/babel-plugins/babel-plugin-is_dev-constant-transformer/index.js b/build-system/babel-plugins/babel-plugin-is_dev-constant-transformer/index.js index 986ea75113b2..69eeb10fbb7e 100644 --- a/build-system/babel-plugins/babel-plugin-is_dev-constant-transformer/index.js +++ b/build-system/babel-plugins/babel-plugin-is_dev-constant-transformer/index.js @@ -20,7 +20,7 @@ * @param {Object} babelTypes * @return {!Object} */ -module.exports = function({types: t}) { +module.exports = function ({types: t}) { return { visitor: { VariableDeclarator(path) { diff --git a/build-system/babel-plugins/babel-plugin-is_minified-constant-transformer/index.js b/build-system/babel-plugins/babel-plugin-is_minified-constant-transformer/index.js index 5d0062cfb1f1..0e2beb39bbb1 100644 --- a/build-system/babel-plugins/babel-plugin-is_minified-constant-transformer/index.js +++ b/build-system/babel-plugins/babel-plugin-is_minified-constant-transformer/index.js @@ -20,7 +20,7 @@ * @param {Object} babelTypes * @return {!Object} */ -module.exports = function(babelTypes) { +module.exports = function (babelTypes) { const {types: t} = babelTypes; return { visitor: { diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/index.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/index.js index c36d286d3939..94de6f7c384b 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/index.js @@ -35,7 +35,7 @@ const REMOVABLE = { user: ['fine'], }; -module.exports = function(babel) { +module.exports = function (babel) { const {types: t, template} = babel; /** @@ -44,7 +44,7 @@ module.exports = function(babel) { * @return {boolean} */ function isRemovableMethod(path, names) { - return names.some(name => { + return names.some((name) => { return path.isIdentifier({name}); }); } diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-extension-call/index.js b/build-system/babel-plugins/babel-plugin-transform-amp-extension-call/index.js index 6b300d6e1762..e9a2c98caa38 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-extension-call/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-extension-call/index.js @@ -14,7 +14,7 @@ * limitations under the License. */ -module.exports = function(babel) { +module.exports = function (babel) { const {types: t} = babel; return { name: 'transform-amp-extension-call', diff --git a/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/index.js b/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/index.js index 4b5f9f78a328..0ac66e70a3f1 100644 --- a/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/index.js @@ -17,7 +17,7 @@ // Global typedef map typedefName: typedef comment const TYPEDEFS = new Map(); -const buildTypedefs = t => { +const buildTypedefs = (t) => { const typedefs = []; for (const [typedefName, typedefComment] of TYPEDEFS) { const ast = buildVarDeclAndComment(t, typedefName, typedefComment); @@ -35,7 +35,7 @@ const buildVarDeclAndComment = (t, name, comment) => { return decl; }; -module.exports = function(babel) { +module.exports = function (babel) { const {types: t} = babel; // `shouldWriteToFile` should only be true in the production pipeline. let shouldWriteToFile; @@ -64,7 +64,7 @@ module.exports = function(babel) { // extern would look like. if (shouldEmitTypedefs) { const typedefs = buildTypedefs(t); - typedefs.forEach(typedef => { + typedefs.forEach((typedef) => { path.pushContainer('body', typedef); }); path.stop(); @@ -78,7 +78,7 @@ module.exports = function(babel) { return; } - const typedefComment = node.leadingComments.find(comment => { + const typedefComment = node.leadingComments.find((comment) => { return ( comment.type === 'CommentBlock' && /@typedef/.test(comment.value) ); diff --git a/build-system/babel-plugins/babel-plugin-transform-fix-leading-comments/index.js b/build-system/babel-plugins/babel-plugin-transform-fix-leading-comments/index.js index f4c783014e85..56ca2e1698e9 100644 --- a/build-system/babel-plugins/babel-plugin-transform-fix-leading-comments/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-fix-leading-comments/index.js @@ -17,7 +17,7 @@ // Reassigns the trailing comments of a statement to be leading comment of its // next sibling. This is because JSDoc comments (which should be on the next // statement) get erroneously assigned as trailing comments of this statement. -module.exports = function() { +module.exports = function () { return { visitor: { Statement(path) { diff --git a/build-system/babel-plugins/babel-plugin-transform-function-declarations/index.js b/build-system/babel-plugins/babel-plugin-transform-function-declarations/index.js index 32943ae6d036..e50063e60c97 100644 --- a/build-system/babel-plugins/babel-plugin-transform-function-declarations/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-function-declarations/index.js @@ -33,7 +33,7 @@ const BAIL_OUT_CONDITIONS = { // Since we don't know if exported members are 'new'd, bail out on modification. isExported: (t, path) => path.findParent( - path => + (path) => path.isExportNamedDeclaration() || path.isExportDefaultDeclaration() ), @@ -70,7 +70,7 @@ const BAIL_OUT_CONDITIONS = { const {name} = path.get('id').node; let isNewed = false; path - .findParent(path => path.isProgram()) + .findParent((path) => path.isProgram()) .traverse({ NewExpression(path) { if (t.isIdentifier(path.node.callee, {name})) { @@ -102,7 +102,7 @@ function createVariableDeclaration(t, path) { // Attempt to convert simple single ReturnStatement FunctionDeclarations to ArrowFunctionExpressions. // See BAIL_OUT_CONDITIONS for reasons why FunctionDeclarations would not be modified. -module.exports = function({types: t}) { +module.exports = function ({types: t}) { const DEBUG = false; const REPORT = false; @@ -111,7 +111,7 @@ module.exports = function({types: t}) { pre() { this.bailoutCount = {...BAIL_OUT_CONDITIONS}; Object.keys(this.bailoutCount).forEach( - key => (this.bailoutCount[key] = []) + (key) => (this.bailoutCount[key] = []) ); this.successCount = []; }, @@ -146,7 +146,7 @@ module.exports = function({types: t}) { .log(`Success Count: ${this.successCount.length}`); console /*OK*/ .log('Bail Out Reason Counts'); - Object.keys(this.bailoutCount).forEach(name => + Object.keys(this.bailoutCount).forEach((name) => console /*OK*/ .log(`${name}: ${this.bailoutCount[name].length}`) ); diff --git a/build-system/babel-plugins/babel-plugin-transform-html-template/index.js b/build-system/babel-plugins/babel-plugin-transform-html-template/index.js index 87fd246ee3c6..14b6dff5bd77 100644 --- a/build-system/babel-plugins/babel-plugin-transform-html-template/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-html-template/index.js @@ -44,7 +44,7 @@ function optimizeLiteralOutput(templateLiteral) { }); } -module.exports = function({types: t}) { +module.exports = function ({types: t}) { /** * Determines whether a TaggedTemplateExpression should be handled based on * naming convention: @@ -56,7 +56,7 @@ module.exports = function({types: t}) { * @param {Node} tag * @return {boolean} */ - const isTagOrFactoryByName = tag => + const isTagOrFactoryByName = (tag) => (t.isIdentifier(tag) && staticTemplateTags.has(tag.name)) || (t.isCallExpression(tag) && t.isIdentifier(tag.callee) && @@ -100,7 +100,7 @@ module.exports = function({types: t}) { hoistedIdentifier = path.scope.generateUidIdentifier( 'template' ); - const program = path.findParent(path => path.isProgram()); + const program = path.findParent((path) => path.isProgram()); program.scope.push({ id: t.cloneNode(hoistedIdentifier), diff --git a/build-system/babel-plugins/babel-plugin-transform-inline-configure-component/index.js b/build-system/babel-plugins/babel-plugin-transform-inline-configure-component/index.js index f83761fd9595..ab9e6808bbad 100644 --- a/build-system/babel-plugins/babel-plugin-transform-inline-configure-component/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-inline-configure-component/index.js @@ -135,7 +135,7 @@ const redefineInline = (sourceFilename, opts) => * Replaces `configureComponent()` wrapping calls. * @return {!Object} */ -module.exports = function({types: t}) { +module.exports = function ({types: t}) { function getImportPath(nodes, name) { for (let i = 0; i < nodes.length; i++) { const node = nodes[i]; @@ -161,7 +161,7 @@ module.exports = function({types: t}) { return; } - const program = path.findParent(p => t.isProgram(p)); + const program = path.findParent((p) => t.isProgram(p)); const importPath = getImportPath(program.node.body, importedId.name); if (!importPath) { diff --git a/build-system/babel-plugins/babel-plugin-transform-json-configuration/index.js b/build-system/babel-plugins/babel-plugin-transform-json-configuration/index.js index 502459d00a76..e6188d0f5fa8 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-configuration/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-json-configuration/index.js @@ -14,7 +14,7 @@ * limitations under the License. */ -module.exports = function({template, types: t}) { +module.exports = function ({template, types: t}) { /** * Produces a random number that is guaranteed not to be present in str. * @param {string} str @@ -98,7 +98,7 @@ module.exports = function({template, types: t}) { // must return a function. We want to propagate its argument, so // we return that in the function. if (prop === 'includeJsonLiteral') { - return s => s; + return (s) => s; } // The argument to `includeJsonLiteral`. We'll create a new diff --git a/build-system/babel-plugins/babel-plugin-transform-log-methods/index.js b/build-system/babel-plugins/babel-plugin-transform-log-methods/index.js index a29daa8ee225..b68217ed3104 100644 --- a/build-system/babel-plugins/babel-plugin-transform-log-methods/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-log-methods/index.js @@ -67,9 +67,9 @@ const roughNestedLength = '["xx"]'.length; * @param {string} path * @return {string} */ -const relativeToRoot = path => `${__dirname}/../../../${path}`; +const relativeToRoot = (path) => `${__dirname}/../../../${path}`; -module.exports = function({types: t}) { +module.exports = function ({types: t}) { let messages; let nextMessageId; let messagesPath; @@ -127,7 +127,7 @@ module.exports = function({types: t}) { * @return {../log-module-metadata.LogMethodMetadataDef} */ function getTransformableCalleeMeta({callee}) { - if (assertAliases.some(name => t.isIdentifier(callee, {name}))) { + if (assertAliases.some((name) => t.isIdentifier(callee, {name}))) { return transformableMethods.assert; } // is method().call(). @@ -137,7 +137,9 @@ module.exports = function({types: t}) { // is either dev() or user() object. const singletonCallee = callee.object.callee; if ( - !singletonFunctions.some(name => t.isIdentifier(singletonCallee, {name})) + !singletonFunctions.some((name) => + t.isIdentifier(singletonCallee, {name}) + ) ) { return; } diff --git a/build-system/babel-plugins/babel-plugin-transform-minified-comments/index.js b/build-system/babel-plugins/babel-plugin-transform-minified-comments/index.js index dcbecbb0d110..5d5f86199135 100644 --- a/build-system/babel-plugins/babel-plugin-transform-minified-comments/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-minified-comments/index.js @@ -15,7 +15,7 @@ */ // Ensure comments in minified build output is minimal. -module.exports = function() { +module.exports = function () { return { visitor: { Statement(path) { @@ -31,7 +31,7 @@ module.exports = function() { } node.trailingComments = null; - const formattedComments = (trailingComments || []).map(comment => ({ + const formattedComments = (trailingComments || []).map((comment) => ({ ...comment, value: comment.value.replace(/\n +/g, `\n`), })); diff --git a/build-system/babel-plugins/babel-plugin-transform-parenthesize-expression/index.js b/build-system/babel-plugins/babel-plugin-transform-parenthesize-expression/index.js index 05328c94156f..d03f3be7b33f 100644 --- a/build-system/babel-plugins/babel-plugin-transform-parenthesize-expression/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-parenthesize-expression/index.js @@ -14,7 +14,7 @@ * limitations under the License. */ -module.exports = function(babel) { +module.exports = function (babel) { const {types: t} = babel; return { visitor: { diff --git a/build-system/babel-plugins/babel-plugin-transform-prune-namespace/index.js b/build-system/babel-plugins/babel-plugin-transform-prune-namespace/index.js index caa1fc37aeef..09898d5390a6 100644 --- a/build-system/babel-plugins/babel-plugin-transform-prune-namespace/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-prune-namespace/index.js @@ -14,7 +14,7 @@ * limitations under the License. */ -module.exports = function() { +module.exports = function () { const namespace = '_'; const namespacedVisitor = { diff --git a/build-system/babel-plugins/babel-plugin-transform-simple-array-destructure/index.js b/build-system/babel-plugins/babel-plugin-transform-simple-array-destructure/index.js index 305576f01a3b..51713e14971f 100644 --- a/build-system/babel-plugins/babel-plugin-transform-simple-array-destructure/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-simple-array-destructure/index.js @@ -14,7 +14,7 @@ * limitations under the License. */ -module.exports = function(babel) { +module.exports = function (babel) { const {types: t} = babel; return { diff --git a/build-system/babel-plugins/babel-plugin-transform-simple-object-destructure/index.js b/build-system/babel-plugins/babel-plugin-transform-simple-object-destructure/index.js index 1eed40daea5e..db6f5bd66fbe 100644 --- a/build-system/babel-plugins/babel-plugin-transform-simple-object-destructure/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-simple-object-destructure/index.js @@ -14,7 +14,7 @@ * limitations under the License. */ -module.exports = function(babel) { +module.exports = function (babel) { const {types: t} = babel; function cloneDeepWithoutLoc(node) { diff --git a/build-system/babel-plugins/babel-plugin-transform-version-call/index.js b/build-system/babel-plugins/babel-plugin-transform-version-call/index.js index 3c42979017e4..fab76277db2c 100644 --- a/build-system/babel-plugins/babel-plugin-transform-version-call/index.js +++ b/build-system/babel-plugins/babel-plugin-transform-version-call/index.js @@ -16,7 +16,7 @@ const {VERSION} = require('../../compile/internal-version'); -module.exports = function(babel) { +module.exports = function (babel) { const {types: t} = babel; return { name: 'transform-version-call', diff --git a/build-system/babel-plugins/log-module-metadata.js b/build-system/babel-plugins/log-module-metadata.js index fe454ab00a0a..3683d10d81ea 100644 --- a/build-system/babel-plugins/log-module-metadata.js +++ b/build-system/babel-plugins/log-module-metadata.js @@ -24,7 +24,7 @@ const definitionFile = 'src/log.js'; /** Functions exposed as singleton getters for `Log`. */ const singletonFunctions = ['dev', 'user']; -const assertAliases = singletonFunctions.map(prefix => `${prefix}Assert`); +const assertAliases = singletonFunctions.map((prefix) => `${prefix}Assert`); /** * Known transformable logging methods. diff --git a/build-system/common/check-package-manager.js b/build-system/common/check-package-manager.js index 9b8a9256dfe9..2313a4a4428d 100644 --- a/build-system/common/check-package-manager.js +++ b/build-system/common/check-package-manager.js @@ -103,12 +103,12 @@ function ensureYarn() { // Check the node version and print a warning if it is not the latest LTS. function checkNodeVersion() { const nodeVersion = getStdout('node --version').trim(); - return new Promise(resolve => { + return new Promise((resolve) => { https - .get(nodeDistributionsUrl, res => { + .get(nodeDistributionsUrl, (res) => { res.setEncoding('utf8'); let distributions = ''; - res.on('data', data => { + res.on('data', (data) => { distributions += data; }); res.on('end', () => { @@ -168,7 +168,7 @@ function checkNodeVersion() { function getNodeLatestLtsVersion(distributionsJson) { if (distributionsJson) { // Versions are in descending order, so the first match is the latest lts. - return distributionsJson.find(function(distribution) { + return distributionsJson.find(function (distribution) { return ( distribution.hasOwnProperty('version') && distribution.hasOwnProperty('lts') && @@ -244,7 +244,7 @@ function runGulpChecks() { const defaultGulpPath = getStdout('which gulp', { 'env': {'PATH': getParentShellPath()}, }).trim(); - const wrongGulp = wrongGulpPaths.some(path => + const wrongGulp = wrongGulpPaths.some((path) => defaultGulpPath.startsWith(path) ); if (globalGulp) { @@ -373,7 +373,7 @@ function main() { yellow('to abort and fix...') ); let resolver; - const deferred = new Promise(resolverIn => { + const deferred = new Promise((resolverIn) => { resolver = resolverIn; }); setTimeout(() => { diff --git a/build-system/common/ctrlcHandler.js b/build-system/common/ctrlcHandler.js index fc1a90520e3b..2129f8e9a1c2 100644 --- a/build-system/common/ctrlcHandler.js +++ b/build-system/common/ctrlcHandler.js @@ -31,7 +31,7 @@ const killSuffix = process.platform == 'win32' ? '>NUL' : ''; * @param {string} command * @return {number} */ -exports.createCtrlcHandler = function(command) { +exports.createCtrlcHandler = function (command) { if (!isTravisBuild()) { log( green('Running'), @@ -66,7 +66,7 @@ exports.createCtrlcHandler = function(command) { * * @param {string} handlerProcess */ -exports.exitCtrlcHandler = function(handlerProcess) { +exports.exitCtrlcHandler = function (handlerProcess) { const exitCmd = killCmd + ' ' + handlerProcess + ' ' + killSuffix; exec(exitCmd); }; diff --git a/build-system/common/git.js b/build-system/common/git.js index de9ad2f3da22..bc937c0166a2 100644 --- a/build-system/common/git.js +++ b/build-system/common/git.js @@ -70,9 +70,7 @@ function shortSha(sha) { * @return {!Array} */ function gitDiffNameOnly() { - return getStdout('git diff --name-only') - .trim() - .split('\n'); + return getStdout('git diff --name-only').trim().split('\n'); } /** @@ -82,9 +80,7 @@ function gitDiffNameOnly() { */ function gitDiffNameOnlyMaster() { const masterBaseline = gitMasterBaseline(); - return getStdout(`git diff --name-only ${masterBaseline}`) - .trim() - .split('\n'); + return getStdout(`git diff --name-only ${masterBaseline}`).trim().split('\n'); } /** diff --git a/build-system/common/utils.js b/build-system/common/utils.js index 693c4c7ace09..af3cb7e80354 100644 --- a/build-system/common/utils.js +++ b/build-system/common/utils.js @@ -58,7 +58,7 @@ function logOnSameLine(message) { */ function getFilesChanged(globs) { const allFiles = globby.sync(globs, {dot: true}); - return gitDiffNameOnlyMaster().filter(changedFile => { + return gitDiffNameOnlyMaster().filter((changedFile) => { return fs.existsSync(changedFile) && allFiles.includes(changedFile); }); } diff --git a/build-system/compile/build.conf.js b/build-system/compile/build.conf.js index 53453f53abd2..205816de7ac4 100644 --- a/build-system/compile/build.conf.js +++ b/build-system/compile/build.conf.js @@ -16,7 +16,7 @@ const argv = require('minimist')(process.argv.slice(2)); const experimentsConfig = require('../global-configs/experiments-config.json'); const experimentsConstantBackup = require('../global-configs/experiments-const.json'); -const localPlugin = name => +const localPlugin = (name) => require.resolve(`../babel-plugins/babel-plugin-${name}`); const jsxOpts = { @@ -25,7 +25,7 @@ const jsxOpts = { useSpread: true, }; -const defaultPlugins = isEsmBuild => [ +const defaultPlugins = (isEsmBuild) => [ localPlugin('transform-fix-leading-comments'), '@babel/plugin-transform-react-constant-elements', ['@babel/plugin-transform-react-jsx', jsxOpts], @@ -41,7 +41,7 @@ const defaultPlugins = isEsmBuild => [ getReplacePlugin(isEsmBuild), ]; -const postCompilationPlugins = isEsmBuild => +const postCompilationPlugins = (isEsmBuild) => isEsmBuild ? [ localPlugin('transform-minified-comments'), @@ -103,7 +103,7 @@ function getReplacePlugin(isEsmBuild) { } // default each experiment flag constant to false - Object.keys(experimentsConfig).forEach(experiment => { + Object.keys(experimentsConfig).forEach((experiment) => { const experimentDefine = experimentsConfig[experiment]['defineExperimentConstant']; diff --git a/build-system/compile/bundles.config.js b/build-system/compile/bundles.config.js index 31d0e339f133..92ceee6145d3 100644 --- a/build-system/compile/bundles.config.js +++ b/build-system/compile/bundles.config.js @@ -1216,8 +1216,8 @@ function verifyBundle_(condition, field, message, name, found) { } } -exports.verifyExtensionBundles = function() { - exports.extensionBundles.forEach(bundle => { +exports.verifyExtensionBundles = function () { + exports.extensionBundles.forEach((bundle) => { const bundleString = JSON.stringify(bundle, null, 2); verifyBundle_( 'name' in bundle, @@ -1241,11 +1241,11 @@ exports.verifyExtensionBundles = function() { bundleString ); const duplicates = exports.extensionBundles.filter( - duplicate => duplicate.name === bundle.name + (duplicate) => duplicate.name === bundle.name ); verifyBundle_( duplicates.every( - duplicate => duplicate.latestVersion === bundle.latestVersion + (duplicate) => duplicate.latestVersion === bundle.latestVersion ), 'latestVersion', 'is not the same for all versions of', @@ -1259,9 +1259,9 @@ exports.verifyExtensionBundles = function() { bundle.name, bundleString ); - const validTypes = Object.keys(TYPES).map(x => TYPES[x]); + const validTypes = Object.keys(TYPES).map((x) => TYPES[x]); verifyBundle_( - validTypes.some(validType => validType === bundle.type), + validTypes.some((validType) => validType === bundle.type), 'type', `is not one of ${validTypes.join(',')} in`, bundle.name, diff --git a/build-system/compile/check-for-unknown-deps.js b/build-system/compile/check-for-unknown-deps.js index 3f2e743d1a57..3d2a015fd1d0 100644 --- a/build-system/compile/check-for-unknown-deps.js +++ b/build-system/compile/check-for-unknown-deps.js @@ -26,10 +26,10 @@ const {red, cyan, yellow} = require('ansi-colors'); * * @return {!Stream} */ -exports.checkForUnknownDeps = function() { +exports.checkForUnknownDeps = function () { const regex = /[\w$]+?\$\$module\$[\w$]+/; - return through.obj(function(file, encoding, cb) { + return through.obj(function (file, encoding, cb) { const contents = file.contents.toString(); if (!contents.includes('$$module$')) { // Fast check, since regexes can backtrack like crazy. diff --git a/build-system/compile/closure-compile.js b/build-system/compile/closure-compile.js index 0355d275da80..7b233a44a4a8 100644 --- a/build-system/compile/closure-compile.js +++ b/build-system/compile/closure-compile.js @@ -111,7 +111,7 @@ function gulpClosureCompile(compilerOptions, nailgunPort) { }; const pluginOptions = { platform: ['java'], // Override the binary used by closure compiler - logger: errors => (compilerErrors = errors), // Capture compiler errors + logger: (errors) => (compilerErrors = errors), // Capture compiler errors }; if (compilerOptions.includes('SINGLE_FILE_COMPILATION=true')) { diff --git a/build-system/compile/compile-wrappers.js b/build-system/compile/compile-wrappers.js index 7d7a2574f06d..3f0ae1101476 100644 --- a/build-system/compile/compile-wrappers.js +++ b/build-system/compile/compile-wrappers.js @@ -28,7 +28,7 @@ exports.mainBinary = 's.animation="none";' + 's.WebkitAnimation="none;"},1000);throw e};'; -exports.extension = function( +exports.extension = function ( name, loadPriority, intermediateDeps, diff --git a/build-system/compile/compile.js b/build-system/compile/compile.js index a32af841f1bf..7bb20ca222af 100644 --- a/build-system/compile/compile.js +++ b/build-system/compile/compile.js @@ -52,7 +52,7 @@ const MAX_PARALLEL_CLOSURE_INVOCATIONS = isTravisBuild() // Compiles AMP with the closure compiler. This is intended only for // production use. During development we intend to continue using // babel, as it has much faster incremental compilation. -exports.closureCompile = async function( +exports.closureCompile = async function ( entryModuleFilename, outputDir, outputFilename, @@ -61,7 +61,7 @@ exports.closureCompile = async function( ) { // Rate limit closure compilation to MAX_PARALLEL_CLOSURE_INVOCATIONS // concurrent processes. - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { function start() { inProgress++; compile( @@ -71,12 +71,12 @@ exports.closureCompile = async function( options, timeInfo ).then( - function() { + function () { inProgress--; next(); resolve(); }, - reason => reject(reason) + (reason) => reject(reason) ); } function next() { @@ -170,7 +170,7 @@ function compile( ); } - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { if (!(entryModuleFilenames instanceof Array)) { entryModuleFilenames = [entryModuleFilenames]; } @@ -193,7 +193,7 @@ function compile( // Add needed path for extensions. // Instead of globbing all extensions, this will only add the actual // extension path for much quicker build times. - entryModuleFilenames.forEach(function(filename) { + entryModuleFilenames.forEach(function (filename) { if (!filename.includes('extensions/')) { return; } @@ -216,7 +216,7 @@ function compile( // this works fine. if (options.includeOnlyESMLevelPolyfills) { const polyfills = fs.readdirSync('src/polyfills'); - const polyfillsShadowList = polyfills.filter(p => { + const polyfillsShadowList = polyfills.filter((p) => { // custom-elements polyfill must be included. return p !== 'custom-elements.js'; }); @@ -227,7 +227,7 @@ function compile( 'src/polyfills/custom-elements.js', 'build/fake-polyfills/**/*.js' ); - polyfillsShadowList.forEach(polyfillFile => { + polyfillsShadowList.forEach((polyfillFile) => { srcs.push(`!src/polyfills/${polyfillFile}`); fs.writeFileSync( 'build/fake-polyfills/src/polyfills/' + polyfillFile, @@ -255,7 +255,7 @@ function compile( // Don't include externs. '!**/*.extern.js' ); - unneededFiles.forEach(function(fake) { + unneededFiles.forEach(function (fake) { if (!fs.existsSync(fake)) { fs.writeFileSync( fake, @@ -351,10 +351,10 @@ function compile( } const compilerOptionsArray = []; - Object.keys(compilerOptions).forEach(function(option) { + Object.keys(compilerOptions).forEach(function (option) { const value = compilerOptions[option]; if (value instanceof Array) { - value.forEach(function(item) { + value.forEach(function (item) { compilerOptionsArray.push('--' + option + '=' + item); }); } else { @@ -371,9 +371,9 @@ function compile( .src(srcs, {base: '.'}) .pipe(sourcemaps.init()) .pipe(preClosureBabel()) - .on('error', err => handlePreClosureError(err, outputFilename)) + .on('error', (err) => handlePreClosureError(err, outputFilename)) .pipe(gulpClosureCompile(compilerOptionsArray, checkTypesNailgunPort)) - .on('error', err => handleTypeCheckError(err)) + .on('error', (err) => handleTypeCheckError(err)) .pipe(nop()) .on('end', resolve); } else { @@ -382,11 +382,11 @@ function compile( .src(srcs, {base: '.'}) .pipe(sourcemaps.init()) .pipe(preClosureBabel()) - .on('error', err => + .on('error', (err) => handlePreClosureError(err, outputFilename, options, resolve) ) .pipe(gulpClosureCompile(compilerOptionsArray, distNailgunPort)) - .on('error', err => + .on('error', (err) => handleCompilerError(err, outputFilename, options, resolve) ) .pipe(rename(outputFilename)) diff --git a/build-system/compile/log-messages.js b/build-system/compile/log-messages.js index 5d9c61ac1eb3..2405a45688fe 100644 --- a/build-system/compile/log-messages.js +++ b/build-system/compile/log-messages.js @@ -45,7 +45,7 @@ async function formatExtractedMessages() { return Promise.all( Object.entries(formats).map(async ([path, format]) => { const formatted = {}; - items.forEach(item => (formatted[item.id] = format(item))); + items.forEach((item) => (formatted[item.id] = format(item))); await fs.outputJson(path, formatted); log('Formatted', cyan(path)); }) diff --git a/build-system/compile/post-closure-babel.js b/build-system/compile/post-closure-babel.js index b4d4cb59eb78..27de6fc51dcc 100644 --- a/build-system/compile/post-closure-babel.js +++ b/build-system/compile/post-closure-babel.js @@ -42,7 +42,7 @@ function loadSourceMap(file) { */ function returnMapFirst(map) { let first = true; - return function(file) { + return function (file) { if (first) { first = false; return map; @@ -86,10 +86,10 @@ function terserMinify(code) { * @param {boolean} isEsmBuild * @return {!Promise} */ -exports.postClosureBabel = function(directory, isEsmBuild) { +exports.postClosureBabel = function (directory, isEsmBuild) { const babelPlugins = conf.plugins({isPostCompile: true, isEsmBuild}); - return through.obj(function(file, enc, next) { + return through.obj(function (file, enc, next) { if (path.extname(file.path) === '.map' || babelPlugins.length === 0) { return next(null, file); } diff --git a/build-system/compile/single-pass.js b/build-system/compile/single-pass.js index 0baebf50a647..9483a68a0ba4 100644 --- a/build-system/compile/single-pass.js +++ b/build-system/compile/single-pass.js @@ -47,7 +47,7 @@ const { const {checkForUnknownDeps} = require('./check-for-unknown-deps'); const {preClosureBabel, handlePreClosureError} = require('./pre-closure-babel'); const {TopologicalSort} = require('topological-sort'); -const TYPES_VALUES = Object.keys(TYPES).map(x => TYPES[x]); +const TYPES_VALUES = Object.keys(TYPES).map((x) => TYPES[x]); const wrappers = require('./compile-wrappers'); const {VERSION: internalRuntimeVersion} = require('./internal-version'); @@ -68,7 +68,7 @@ const extensionsInfo = {}; let extensions = extensionBundles .concat(altMainBundles) .filter(unsupportedExtensions) - .map(ext => { + .map((ext) => { const path = buildFullPathFromConfig(ext); if (Array.isArray(path)) { path.forEach((p, index) => { @@ -90,7 +90,7 @@ extensions = [].concat.apply([], extensions); const jsFilesToWrap = []; -exports.getFlags = function(config) { +exports.getFlags = function (config) { config.define.push('SINGLE_FILE_COMPILATION=true'); config.define.push(`VERSION=${internalRuntimeVersion}`); /* eslint "google-camelcase/google-camelcase": 0 */ @@ -133,10 +133,10 @@ exports.getFlags = function(config) { const flagsArray = []; Object.keys(flags) .sort() - .forEach(function(flag) { + .forEach(function (flag) { const val = flags[flag]; if (val instanceof Array) { - val.forEach(function(item) { + val.forEach(function (item) { flagsArray.push('--' + flag, item); }); } else { @@ -148,12 +148,12 @@ exports.getFlags = function(config) { } }); - return exports.getGraph(config.modules, config).then(function(g) { + return exports.getGraph(config.modules, config).then(function (g) { return flagsArray.concat(exports.getBundleFlags(g, flagsArray)); }); }; -exports.getBundleFlags = function(g) { +exports.getBundleFlags = function (g) { const flagsArray = []; // Add all packages (directories with a package.json) to the srcs array. @@ -161,7 +161,7 @@ exports.getBundleFlags = function(g) { // non-relative module names. Object.keys(g.packages) .sort() - .forEach(function(pkg) { + .forEach(function (pkg) { g.bundles[mainBundle].modules.push(pkg); fs.outputFileSync( pkg, @@ -180,11 +180,11 @@ exports.getBundleFlags = function(g) { const indexOfIntermediate = bundleKeys.indexOf('_base_i'); bundleKeys.splice(indexOfIntermediate, 1); bundleKeys.splice(1, 0, '_base_i'); - bundleKeys.forEach(function(originalName) { + bundleKeys.forEach(function (originalName) { const isMain = originalName == mainBundle; // TODO(erwinm): This access will break const bundle = g.bundles[originalName]; - bundle.modules.forEach(function(js) { + bundle.modules.forEach(function (js) { srcs.push(js); }); let name; @@ -268,10 +268,10 @@ exports.getBundleFlags = function(g) { return flagsArray; }; -exports.getGraph = function(entryModules, config) { +exports.getGraph = function (entryModules, config) { let resolve; let reject; - const promise = new Promise(function(res, rej) { + const promise = new Promise(function (res, rej) { resolve = res; reject = rej; }); @@ -297,7 +297,7 @@ exports.getGraph = function(entryModules, config) { packages: {}, }; - TYPES_VALUES.forEach(type => { + TYPES_VALUES.forEach((type) => { graph.bundles[type] = { isBase: true, name: type, @@ -335,7 +335,7 @@ exports.getGraph = function(entryModules, config) { // will not be stable. const depEntries = []; b.pipeline.get('deps').push( - through.obj(function(row, enc, next) { + through.obj(function (row, enc, next) { row.source = null; // Release memory depEntries.push(row); next(); @@ -343,20 +343,20 @@ exports.getGraph = function(entryModules, config) { ); b.bundle() - .on('end', function() { + .on('end', function () { const edges = {}; depEntries - .sort(function(a, b) { + .sort(function (a, b) { return a.id < b.id; }) - .forEach(function(row) { + .forEach(function (row) { const id = unifyPath( exports.maybeAddDotJs(path.relative('.', row.id)) ); topo.addNode(id, id); const deps = Object.keys(row.deps) .sort() - .map(dep => { + .map((dep) => { dep = unifyPath(path.relative('.', row.deps[dep])); if (dep.startsWith('node_modules/')) { const pkgJson = pkgUp.sync({cwd: path.dirname(dep)}); @@ -370,15 +370,15 @@ exports.getGraph = function(entryModules, config) { if (row.entry) { graph.depOf[id] = {}; graph.depOf[id][id] = true; // Self edge. - deps.forEach(function(dep) { + deps.forEach(function (dep) { graph.depOf[id][dep] = true; }); } }); Object.keys(edges) .sort() - .forEach(function(id) { - edges[id].forEach(function(dep) { + .forEach(function (id) { + edges[id].forEach(function (dep) { topo.addEdge(id, dep); }); }); @@ -398,11 +398,11 @@ function setupBundles(graph) { // modules depends on them (transitively). Array.from(graph.sorted) .reverse() - .forEach(function(id) { - graph.deps[id].forEach(function(dep) { + .forEach(function (id) { + graph.deps[id].forEach(function (dep) { Object.keys(graph.depOf) .sort() - .forEach(function(entry) { + .forEach(function (entry) { if (graph.depOf[entry][id]) { graph.depOf[entry][dep] = true; } @@ -411,7 +411,7 @@ function setupBundles(graph) { }); // Create the bundles. - graph.sorted.forEach(function(id) { + graph.sorted.forEach(function (id) { let inBundleCount = 0; // The bundle a module should go into. let dest; @@ -420,7 +420,7 @@ function setupBundles(graph) { // Count in how many bundles a modules wants to be. Object.keys(graph.depOf) .sort() - .forEach(function(entry) { + .forEach(function (entry) { if (graph.depOf[entry][id]) { inBundleCount++; dest = entry; @@ -441,8 +441,8 @@ function setupBundles(graph) { // If a module is in more than 1 bundle, it must go into _base. if (bundleDestCandidates.length > 1) { const first = bundleDestCandidates[0]; - const allTheSame = !bundleDestCandidates.some(c => c != first); - const needsBase = bundleDestCandidates.some(c => c == mainBundle); + const allTheSame = !bundleDestCandidates.some((c) => c != first); + const needsBase = bundleDestCandidates.some((c) => c == mainBundle); dest = mainBundle; // If all requested bundles are the same, then that is the right // place. @@ -468,7 +468,7 @@ function setupBundles(graph) { // Returns the extension bundle config for the given filename or null. function getExtensionBundleConfig(filename) { const basename = path.basename(filename, '.js'); - return extensionBundles.filter(x => x.name == basename)[0]; + return extensionBundles.filter((x) => x.name == basename)[0]; } const knownExtensions = { @@ -479,7 +479,7 @@ const knownExtensions = { json: true, }; -exports.maybeAddDotJs = function(id) { +exports.maybeAddDotJs = function (id) { const extensionMatch = id.match(/\.([a-zA-Z0-9]+)$/); const extension = extensionMatch ? extensionMatch[1].toLowerCase() : null; if (!knownExtensions[extension]) { @@ -503,7 +503,7 @@ function buildFullPathFromConfig(ext) { } if (Array.isArray(ext.version)) { - return ext.version.map(ver => getPath(ver)); + return ext.version.map((ver) => getPath(ver)); } return getPath(ext.version); @@ -521,12 +521,12 @@ function unsupportedExtensions(name) { * @return {boolean} */ function isAltMainBundle(name) { - return altMainBundles.some(altMainBundle => { + return altMainBundles.some((altMainBundle) => { return altMainBundle.name === name; }); } -exports.singlePassCompile = async function(entryModule, options, timeInfo) { +exports.singlePassCompile = async function (entryModule, options, timeInfo) { timeInfo.startTime = Date.now(); return exports .getFlags({ @@ -544,7 +544,7 @@ exports.singlePassCompile = async function(entryModule, options, timeInfo) { .then(thirdPartyConcat) .then(cleanupWeakModuleFiles) .then(copyAliasedExtensions) - .catch(err => { + .catch((err) => { err.showStack = false; // Useless node_modules stack throw err; }); @@ -563,7 +563,7 @@ function wrapMainBinaries() { const suffix = pair[1]; // Cache the v0 file so we can prepend it to alternative binaries. const mainFile = readMagicString('dist/v0.js'); - jsFilesToWrap.forEach(x => { + jsFilesToWrap.forEach((x) => { const path = `dist/${x}.js`; const s = readMagicString(path); if (x === 'v0') { @@ -596,7 +596,7 @@ function wrapMainBinaries() { * TODO This should operate on the gulp stream, not on disk files. */ function intermediateBundleConcat() { - extensionBundles.forEach(extension => { + extensionBundles.forEach((extension) => { const prependContents = [ 'dist/v0/_base_i.js', `dist/v0/${extension.type}.js`, @@ -617,7 +617,7 @@ function intermediateBundleConcat() { * TODO This should operate on the gulp stream, not on disk files. */ function thirdPartyConcat() { - extensionBundles.forEach(extension => { + extensionBundles.forEach((extension) => { const postPrependPaths = extension.postPrepend; if (!Array.isArray(postPrependPaths)) { return; @@ -639,7 +639,7 @@ function postPrepend(extension, prependContents) { } else { targets.push(createFullPath(extension.version)); } - targets.forEach(path => { + targets.forEach((path) => { const bundle = new MagicString.Bundle(); const s = readMagicString(path); const index = s.original.indexOf(SPLIT_MARKER); @@ -661,7 +661,7 @@ function postPrepend(extension, prependContents) { * Copies JS for aliased extensions. (CSS is already dropped in place.) */ function copyAliasedExtensions() { - Object.keys(extensionAliasBundles).forEach(aliasedExtension => { + Object.keys(extensionAliasBundles).forEach((aliasedExtension) => { const {version, aliasedVersion} = extensionAliasBundles[aliasedExtension]; const src = `${aliasedExtension}-${version}.js`; const dest = `${aliasedExtension}-${aliasedVersion}.js`; @@ -683,21 +683,21 @@ function cleanupWeakModuleFiles() { function compile(flagsArray) { log('Minifying single-pass JS with', colors.cyan('closure-compiler') + '...'); // TODO(@cramforce): Run the post processing step - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { gulp .src(srcs, {base: '.'}) .pipe(sourcemaps.init()) .pipe(preClosureBabel()) - .on('error', err => handlePreClosureError(err)) + .on('error', (err) => handlePreClosureError(err)) .pipe(gulpClosureCompile(flagsArray)) - .on('error', err => handleSinglePassCompilerError(err)) + .on('error', (err) => handleSinglePassCompilerError(err)) .pipe(gulpIf(!argv.pseudo_names, checkForUnknownDeps())) .on('error', reject) .pipe(sourcemaps.write('.')) .pipe( gulpIf( /(\/amp-|\/_base)/, - rename(path => (path.dirname += '/v0')) + rename((path) => (path.dirname += '/v0')) ) ) .pipe(gulp.dest('.')) @@ -709,7 +709,7 @@ function compile(flagsArray) { * TODO This should operate on the gulp stream, not on disk files. */ function eliminateIntermediateBundles() { - extensionBundles.forEach(extension => { + extensionBundles.forEach((extension) => { function createFullPath(version) { return `dist/v0/${extension.name}-${version}.js`; } @@ -720,11 +720,11 @@ function eliminateIntermediateBundles() { } else { targets.push(createFullPath(extension.version)); } - targets.forEach(path => { + targets.forEach((path) => { const map = loadSourceMap(path); function returnMapFirst(map) { let first = true; - return function(file) { + return function (file) { if (first) { first = false; return map; diff --git a/build-system/compile/typescript.js b/build-system/compile/typescript.js index cabfd791ddaf..93c7a839cfd9 100644 --- a/build-system/compile/typescript.js +++ b/build-system/compile/typescript.js @@ -31,7 +31,7 @@ const {endBuildStep} = require('../tasks/helpers'); * @param {string} srcFilename * @return {!Promise} */ -exports.transpileTs = function(srcDir, srcFilename) { +exports.transpileTs = function (srcDir, srcFilename) { const startTime = Date.now(); const tsEntry = path.join(srcDir, srcFilename).replace(/\.js$/, '.ts'); const tsConfig = ts.convertCompilerOptionsFromJson( @@ -78,7 +78,7 @@ exports.transpileTs = function(srcDir, srcFilename) { fs.writeFileSync(filePath, contents, {encoding: 'utf-8'}); } ) - .then(emitResult => { + .then((emitResult) => { const diagnostics = ts .getPreEmitDiagnostics(program) .concat(emitResult.diagnostics); diff --git a/build-system/eslint-rules/await-expect.js b/build-system/eslint-rules/await-expect.js index c071c55c85a6..8e2eb02beffe 100644 --- a/build-system/eslint-rules/await-expect.js +++ b/build-system/eslint-rules/await-expect.js @@ -24,7 +24,7 @@ * await expect(actual).to.equal(expected); * @return {!Object} */ -module.exports = function(context) { +module.exports = function (context) { return { CallExpression(node) { const filename = context.getFilename(); @@ -42,7 +42,7 @@ module.exports = function(context) { } const comments = context.getCommentsBefore(callee); - const ok = comments.some(comment => comment.value === 'OK'); + const ok = comments.some((comment) => comment.value === 'OK'); if (ok) { return; } diff --git a/build-system/eslint-rules/closure-type-primitives.js b/build-system/eslint-rules/closure-type-primitives.js index a2db7b104cb5..b9dbc3b88127 100644 --- a/build-system/eslint-rules/closure-type-primitives.js +++ b/build-system/eslint-rules/closure-type-primitives.js @@ -32,18 +32,18 @@ let EslintNodeDef; */ let ClosureCommentDef; -module.exports = function(context) { +module.exports = function (context) { const sourceCode = context.getSourceCode(); return { meta: { fixable: 'code', }, - Program: function() { + Program: function () { const comments = /** @type {!Array} */ (sourceCode.getAllComments()); comments - .map(node => parseClosureComments(context, node)) - .forEach(comment => checkClosureComments(context, comment)); + .map((node) => parseClosureComments(context, node)) + .forEach((comment) => checkClosureComments(context, comment)); }, }; }; @@ -91,7 +91,7 @@ function checkClosureComments(context, closureComment) { } const {parsed, node} = closureComment; - traverse(parsed).forEach(astNode => { + traverse(parsed).forEach((astNode) => { if (!astNode) { return; } diff --git a/build-system/eslint-rules/dict-string-keys.js b/build-system/eslint-rules/dict-string-keys.js index 47cab86a174e..b3322a182e82 100644 --- a/build-system/eslint-rules/dict-string-keys.js +++ b/build-system/eslint-rules/dict-string-keys.js @@ -15,9 +15,9 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { return { - CallExpression: function(node) { + CallExpression: function (node) { if (node.callee.name === 'dict') { if (node.arguments[0]) { const arg1 = node.arguments[0]; @@ -39,7 +39,7 @@ module.exports = function(context) { function checkNode(node, context) { if (node.type === 'ObjectExpression') { - node.properties.forEach(function(prop) { + node.properties.forEach(function (prop) { if (!prop.key.raw && !prop.computed) { context.report({ node, @@ -53,7 +53,7 @@ function checkNode(node, context) { checkNode(prop.value, context); }); } else if (node.type === 'ArrayExpression') { - node.elements.forEach(function(elem) { + node.elements.forEach(function (elem) { checkNode(elem, context); }); } diff --git a/build-system/eslint-rules/html-template.js b/build-system/eslint-rules/html-template.js index 8b4fc6743e4a..c4be545daff2 100644 --- a/build-system/eslint-rules/html-template.js +++ b/build-system/eslint-rules/html-template.js @@ -21,7 +21,7 @@ const { staticTemplateFactoryFns, } = require('../babel-plugins/static-template-metadata'); -module.exports = function(context) { +module.exports = function (context) { function tagCannotBeCalled(node) { const {name} = node.callee; context.report({ diff --git a/build-system/eslint-rules/index.js b/build-system/eslint-rules/index.js index 4d5771cb21f0..9ca35fb4a477 100644 --- a/build-system/eslint-rules/index.js +++ b/build-system/eslint-rules/index.js @@ -21,8 +21,10 @@ const path = require('path'); const rules = {}; const ruleFiles = fs .readdirSync(__dirname) - .filter(ruleFile => !['index.js', '.eslintrc', 'OWNERS'].includes(ruleFile)); -ruleFiles.forEach(function(ruleFile) { + .filter( + (ruleFile) => !['index.js', '.eslintrc', 'OWNERS'].includes(ruleFile) + ); +ruleFiles.forEach(function (ruleFile) { const rule = ruleFile.replace(path.extname(ruleFile), ''); rules[rule] = require(path.join(__dirname, rule)); }); diff --git a/build-system/eslint-rules/is-experiment-on.js b/build-system/eslint-rules/is-experiment-on.js index 3dfb978b408f..76b33c0eea95 100644 --- a/build-system/eslint-rules/is-experiment-on.js +++ b/build-system/eslint-rules/is-experiment-on.js @@ -15,7 +15,7 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { const isExperimentOn = 'CallExpression[callee.name=isExperimentOn]'; const message = 'isExperimentOn must be passed an explicit string'; @@ -28,7 +28,7 @@ module.exports = function(context) { } const comments = context.getCommentsBefore(arg); - const ok = comments.some(comment => comment.value === 'OK'); + const ok = comments.some((comment) => comment.value === 'OK'); if (ok) { return; } diff --git a/build-system/eslint-rules/json-configuration.js b/build-system/eslint-rules/json-configuration.js index 46147e949a0e..5bcda606d2dd 100644 --- a/build-system/eslint-rules/json-configuration.js +++ b/build-system/eslint-rules/json-configuration.js @@ -20,9 +20,9 @@ * validation on its input. */ -module.exports = function(context) { +module.exports = function (context) { const configurationCalls = ['jsonConfiguration', 'jsonLiteral'].map( - name => `CallExpression[callee.name=${name}]` + (name) => `CallExpression[callee.name=${name}]` ); function verifyPath(node) { @@ -53,7 +53,7 @@ module.exports = function(context) { } return { - 'CallExpression[callee.name=jsonConfiguration]': function(node) { + 'CallExpression[callee.name=jsonConfiguration]': function (node) { const args = node.arguments; if ( @@ -71,7 +71,7 @@ module.exports = function(context) { }); }, - [`:matches(${configurationCalls}) * Identifier`]: function(node) { + [`:matches(${configurationCalls}) * Identifier`]: function (node) { const {name, parent} = node; if (name === 'undefined') { return; @@ -115,7 +115,7 @@ module.exports = function(context) { }); }, - 'CallExpression[callee.name=jsonLiteral]': function(node) { + 'CallExpression[callee.name=jsonLiteral]': function (node) { const args = node.arguments; if (args.length === 1 && args[0].type !== 'Identifier') { @@ -129,7 +129,7 @@ module.exports = function(context) { }); }, - 'CallExpression[callee.name=includeJsonLiteral]': function(node) { + 'CallExpression[callee.name=includeJsonLiteral]': function (node) { const args = node.arguments; if (args.length !== 1 || args[0].type !== 'Identifier') { diff --git a/build-system/eslint-rules/no-array-destructuring.js b/build-system/eslint-rules/no-array-destructuring.js index 2faf424d3fa6..0f9752840dd8 100644 --- a/build-system/eslint-rules/no-array-destructuring.js +++ b/build-system/eslint-rules/no-array-destructuring.js @@ -26,7 +26,7 @@ // Bad: // const [b] = value; // function bad([b]) {} -module.exports = function(context) { +module.exports = function (context) { function isAllowed(node) { const {parent} = node; if (parent.type !== 'VariableDeclarator') { @@ -62,7 +62,7 @@ module.exports = function(context) { } return { - ArrayPattern: function(node) { + ArrayPattern: function (node) { if (isAllowed(node)) { return; } diff --git a/build-system/eslint-rules/no-arrow-on-register-functions.js b/build-system/eslint-rules/no-arrow-on-register-functions.js index 985cb988c23c..1e65537e5071 100644 --- a/build-system/eslint-rules/no-arrow-on-register-functions.js +++ b/build-system/eslint-rules/no-arrow-on-register-functions.js @@ -20,10 +20,10 @@ const expression = [ 'CallExpression[callee.name=/registerService.*/]', ].join(','); -module.exports = function(context) { +module.exports = function (context) { return { - [expression]: function(node) { - node.arguments.forEach(arg => { + [expression]: function (node) { + node.arguments.forEach((arg) => { if (arg.type === 'ArrowFunctionExpression') { // TODO(erwinm): add fixer method. context.report({ diff --git a/build-system/eslint-rules/no-deep-destructuring.js b/build-system/eslint-rules/no-deep-destructuring.js index 7ad96259999b..f76fbb441285 100644 --- a/build-system/eslint-rules/no-deep-destructuring.js +++ b/build-system/eslint-rules/no-deep-destructuring.js @@ -24,9 +24,9 @@ * const { y } = obj.prop.x; * @return {!Object} */ -module.exports = function(context) { +module.exports = function (context) { return { - ObjectPattern: function(node) { + ObjectPattern: function (node) { if (node.parent.type !== 'Property') { return; } diff --git a/build-system/eslint-rules/no-destructure-assignment-params.js b/build-system/eslint-rules/no-destructure-assignment-params.js index 4b2101faadc7..7504b38e56c4 100644 --- a/build-system/eslint-rules/no-destructure-assignment-params.js +++ b/build-system/eslint-rules/no-destructure-assignment-params.js @@ -14,9 +14,9 @@ * limitations under the License. */ -module.exports = function(context) { +module.exports = function (context) { return { - [':function > ObjectPattern']: function(node) { + [':function > ObjectPattern']: function (node) { context.report({ node, message: diff --git a/build-system/eslint-rules/no-duplicate-import.js b/build-system/eslint-rules/no-duplicate-import.js index 78988eaf48fc..3a8dbef9e827 100644 --- a/build-system/eslint-rules/no-duplicate-import.js +++ b/build-system/eslint-rules/no-duplicate-import.js @@ -32,8 +32,8 @@ module.exports = { const imports = new Map(); return { - 'Program:exit': function() { - imports.forEach(imports => { + 'Program:exit': function () { + imports.forEach((imports) => { const original = imports[0]; for (let i = 1; i < imports.length; i++) { diff --git a/build-system/eslint-rules/no-duplicate-name-typedef.js b/build-system/eslint-rules/no-duplicate-name-typedef.js index 51db705f9686..68de4de69590 100644 --- a/build-system/eslint-rules/no-duplicate-name-typedef.js +++ b/build-system/eslint-rules/no-duplicate-name-typedef.js @@ -18,7 +18,7 @@ // Global cache of typedefName: typedefLocation. const typedefs = new Map(); -module.exports = function(context) { +module.exports = function (context) { return { Program() { // When relinting a file, remove all typedefs that it declared. @@ -40,7 +40,7 @@ module.exports = function(context) { return; } - const typedefComment = node.leadingComments.find(comment => { + const typedefComment = node.leadingComments.find((comment) => { return comment.type === 'Block' && /@typedef/.test(comment.value); }); diff --git a/build-system/eslint-rules/no-es2015-number-props.js b/build-system/eslint-rules/no-es2015-number-props.js index e9cb7bd644d5..a3ea07517a7c 100644 --- a/build-system/eslint-rules/no-es2015-number-props.js +++ b/build-system/eslint-rules/no-es2015-number-props.js @@ -31,9 +31,9 @@ function isInvalidProperty(property) { return INVALID_PROPS.indexOf(property) != -1; } -module.exports = function(context) { +module.exports = function (context) { return { - MemberExpression: function(node) { + MemberExpression: function (node) { if ( node.object.name == 'Number' && isInvalidProperty(node.property.name) diff --git a/build-system/eslint-rules/no-export-side-effect.js b/build-system/eslint-rules/no-export-side-effect.js index a445a3845307..b843124cef50 100644 --- a/build-system/eslint-rules/no-export-side-effect.js +++ b/build-system/eslint-rules/no-export-side-effect.js @@ -15,20 +15,20 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { return { - ExportNamedDeclaration: function(node) { + ExportNamedDeclaration: function (node) { if (node.declaration) { const {declaration} = node; if (declaration.type === 'VariableDeclaration') { declaration.declarations - .map(function(declarator) { + .map(function (declarator) { return declarator.init; }) - .filter(function(init) { + .filter(function (init) { return init && /(?:Call|New)Expression/.test(init.type); }) - .forEach(function(init) { + .forEach(function (init) { context.report({ node: init, message: 'Cannot export side-effect', diff --git a/build-system/eslint-rules/no-for-of-statement.js b/build-system/eslint-rules/no-for-of-statement.js index d152de95b5f6..e1ed87e5b46b 100644 --- a/build-system/eslint-rules/no-for-of-statement.js +++ b/build-system/eslint-rules/no-for-of-statement.js @@ -15,9 +15,9 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { return { - ForOfStatement: function(node) { + ForOfStatement: function (node) { context.report({node, message: 'No for-of statement allowed.'}); }, }; diff --git a/build-system/eslint-rules/no-global.js b/build-system/eslint-rules/no-global.js index 26f311473970..690c6d6b4212 100644 --- a/build-system/eslint-rules/no-global.js +++ b/build-system/eslint-rules/no-global.js @@ -21,9 +21,9 @@ const GLOBALS = Object.create(null); GLOBALS.window = 'Use `self` instead.'; GLOBALS.document = 'Reference it as `self.document` or similar instead.'; -module.exports = function(context) { +module.exports = function (context) { return { - Identifier: function(node) { + Identifier: function (node) { const {name} = node; if (!(name in GLOBALS)) { return; diff --git a/build-system/eslint-rules/no-import-rename.js b/build-system/eslint-rules/no-import-rename.js index 73ce1c97b014..ab4d426168fd 100644 --- a/build-system/eslint-rules/no-import-rename.js +++ b/build-system/eslint-rules/no-import-rename.js @@ -49,7 +49,7 @@ const imports = { 'src/log': ['user', 'dev'], }; -module.exports = function(context) { +module.exports = function (context) { function ImportSpecifier(node, modulePath, mods) { const {imported, local} = node; const {name} = imported; diff --git a/build-system/eslint-rules/no-import.js b/build-system/eslint-rules/no-import.js index 0a314f0be6cd..8921345a50ec 100644 --- a/build-system/eslint-rules/no-import.js +++ b/build-system/eslint-rules/no-import.js @@ -29,11 +29,11 @@ const imports = [ }, ]; -module.exports = function(context) { +module.exports = function (context) { return { ImportDeclaration(node) { const comments = context.getCommentsBefore(node.source); - const ok = comments.some(comment => comment.value === 'OK'); + const ok = comments.some((comment) => comment.value === 'OK'); if (ok) { return; } diff --git a/build-system/eslint-rules/no-is-amp-alt.js b/build-system/eslint-rules/no-is-amp-alt.js index 6264b717de6e..b59d1f944b8b 100644 --- a/build-system/eslint-rules/no-is-amp-alt.js +++ b/build-system/eslint-rules/no-is-amp-alt.js @@ -16,9 +16,9 @@ 'use strict'; const selector = 'AssignmentExpression Identifier[name=IS_AMP_ALT]'; -module.exports = function(context) { +module.exports = function (context) { return { - [selector]: function(node) { + [selector]: function (node) { context.report({ node, message: 'No Assignment to IS_AMP_ALT global property allowed', diff --git a/build-system/eslint-rules/no-log-array.js b/build-system/eslint-rules/no-log-array.js index d7b1d88c27e8..66bdd2ed9a87 100644 --- a/build-system/eslint-rules/no-log-array.js +++ b/build-system/eslint-rules/no-log-array.js @@ -22,14 +22,14 @@ const { } = require('../babel-plugins/log-module-metadata.js'); const selector = Object.keys(transformableMethods) - .map(name => `CallExpression[callee.property.name=${name}]`) - .concat(assertAliases.map(name => `CallExpression[callee.name=${name}]`)) + .map((name) => `CallExpression[callee.property.name=${name}]`) + .concat(assertAliases.map((name) => `CallExpression[callee.name=${name}]`)) .join(','); module.exports = { create(context) { return { - [selector]: function(node) { + [selector]: function (node) { // Don't evaluate or transform log.js if (context.getFilename().endsWith(definitionFile)) { return; diff --git a/build-system/eslint-rules/no-mixed-interpolation.js b/build-system/eslint-rules/no-mixed-interpolation.js index 8f0c8c7a5041..f3bc564126c0 100644 --- a/build-system/eslint-rules/no-mixed-interpolation.js +++ b/build-system/eslint-rules/no-mixed-interpolation.js @@ -47,14 +47,14 @@ function hasTemplateLiteral(node) { } const selector = Object.keys(transformableMethods) - .map(name => `CallExpression[callee.property.name=${name}]`) - .concat(assertAliases.map(name => `CallExpression[callee.name=${name}]`)) + .map((name) => `CallExpression[callee.property.name=${name}]`) + .concat(assertAliases.map((name) => `CallExpression[callee.name=${name}]`)) .join(','); module.exports = { create(context) { return { - [selector]: function(node) { + [selector]: function (node) { // Don't evaluate or transform log.js if (context.getFilename().endsWith(definitionFile)) { return; diff --git a/build-system/eslint-rules/no-module-exports.js b/build-system/eslint-rules/no-module-exports.js index 999e551857aa..2c7bcfa3a887 100644 --- a/build-system/eslint-rules/no-module-exports.js +++ b/build-system/eslint-rules/no-module-exports.js @@ -31,7 +31,7 @@ module.exports = { create(context) { return { - 'MemberExpression[object.name=module][property.name=exports]': function( + 'MemberExpression[object.name=module][property.name=exports]': function ( node ) { context.report({node, messageId: 'unexpected'}); diff --git a/build-system/eslint-rules/no-rest.js b/build-system/eslint-rules/no-rest.js index 5da171b23043..526c98205eb7 100644 --- a/build-system/eslint-rules/no-rest.js +++ b/build-system/eslint-rules/no-rest.js @@ -28,16 +28,16 @@ // const [...rest] = [1, 2, 3]; // const {...rest} = {foo: 1}; // ``` -module.exports = function(context) { +module.exports = function (context) { return { - 'ArrayPattern > RestElement': function(node) { + 'ArrayPattern > RestElement': function (node) { context.report({ node, message: 'Collecting elements using a rest element is not allowed.', }); }, - 'ObjectPattern > RestElement, ExperimentalRestProperty': function(node) { + 'ObjectPattern > RestElement, ExperimentalRestProperty': function (node) { context.report({ node, message: 'Collecting props using a rest property is not allowed.', diff --git a/build-system/eslint-rules/no-spread.js b/build-system/eslint-rules/no-spread.js index f67f36f600d1..e825a049b47f 100644 --- a/build-system/eslint-rules/no-spread.js +++ b/build-system/eslint-rules/no-spread.js @@ -27,13 +27,13 @@ // const args = [1, 2, 3, ...array]; // bar(...args); // ``` -module.exports = function(context) { +module.exports = function (context) { return { - 'ArrayExpression > SpreadElement': function(node) { + 'ArrayExpression > SpreadElement': function (node) { context.report({node, message: 'Iterator spreading is not allowed.'}); }, - 'CallExpression > SpreadElement': function(node) { + 'CallExpression > SpreadElement': function (node) { context.report({node, message: 'Iterator spreading is not allowed.'}); }, }; diff --git a/build-system/eslint-rules/no-style-display.js b/build-system/eslint-rules/no-style-display.js index bdcfb7cbfa4d..c7415af0cde0 100644 --- a/build-system/eslint-rules/no-style-display.js +++ b/build-system/eslint-rules/no-style-display.js @@ -15,7 +15,7 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { const setStyleCall = 'CallExpression[callee.name=setStyle]'; const setStylesCall = 'CallExpression[callee.name=setStyles], CallExpression[callee.name=setImportantStyles]'; @@ -28,7 +28,7 @@ module.exports = function(context) { ].join('\n\t'); return { - [setStyleCall]: function(node) { + [setStyleCall]: function (node) { const filePath = context.getFilename(); if (filePath.endsWith('src/style.js')) { return; @@ -65,7 +65,7 @@ module.exports = function(context) { } }, - [setStylesCall]: function(node) { + [setStylesCall]: function (node) { const callName = node.callee.name; const arg = node.arguments[1]; @@ -113,7 +113,7 @@ module.exports = function(context) { } }, - [resetStylesCall]: function(node) { + [resetStylesCall]: function (node) { const arg = node.arguments[1]; if (!arg) { diff --git a/build-system/eslint-rules/no-style-property-setting.js b/build-system/eslint-rules/no-style-property-setting.js index 60467acda9b6..01e7aec0fbcf 100644 --- a/build-system/eslint-rules/no-style-property-setting.js +++ b/build-system/eslint-rules/no-style-property-setting.js @@ -17,9 +17,9 @@ const path = require('path'); -module.exports = function(context) { +module.exports = function (context) { return { - MemberExpression: function(node) { + MemberExpression: function (node) { const filePath = context.getFilename(); const filename = path.basename(filePath); // Ignore specific js files. diff --git a/build-system/eslint-rules/no-unload-listener.js b/build-system/eslint-rules/no-unload-listener.js index 27e7a4910944..40db209720d6 100644 --- a/build-system/eslint-rules/no-unload-listener.js +++ b/build-system/eslint-rules/no-unload-listener.js @@ -15,7 +15,7 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { const listenMethodNames = [ 'listen', 'listenPromise', @@ -23,7 +23,7 @@ module.exports = function(context) { 'listenOncePromise', ]; const listenCall = listenMethodNames - .map(m => `CallExpression[callee.name=${m}]`) + .map((m) => `CallExpression[callee.name=${m}]`) .join(','); const addEventListenerCall = 'CallExpression[callee.property.name=addEventListener]'; @@ -35,7 +35,7 @@ module.exports = function(context) { ].join('\n\t'); return { - [call]: function(node) { + [call]: function (node) { const {callee} = node; const {name} = callee; const argIndex = name && name.lastIndexOf('listen', 0) == 0 ? 1 : 0; @@ -45,7 +45,7 @@ module.exports = function(context) { } const comments = context.getCommentsBefore(arg); - const ok = comments.some(comment => comment.value === 'OK'); + const ok = comments.some((comment) => comment.value === 'OK'); if (ok) { return; } diff --git a/build-system/eslint-rules/preact.js b/build-system/eslint-rules/preact.js index 9097f1690fa2..76bab2f75dff 100644 --- a/build-system/eslint-rules/preact.js +++ b/build-system/eslint-rules/preact.js @@ -60,7 +60,7 @@ module.exports = { const ancestors = context.getAncestors(); const program = ancestors[0]; let firstImport = program.body.find( - node => node.type === 'ImportDeclaration' + (node) => node.type === 'ImportDeclaration' ); if (!firstImport) { firstImport = ancestors[1]; diff --git a/build-system/eslint-rules/prefer-deferred-promise.js b/build-system/eslint-rules/prefer-deferred-promise.js index e498ddc5e552..2680aac5b05e 100644 --- a/build-system/eslint-rules/prefer-deferred-promise.js +++ b/build-system/eslint-rules/prefer-deferred-promise.js @@ -15,7 +15,7 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { function isAssignment(node, name) { if (node.type !== 'AssignmentExpression') { return false; @@ -72,7 +72,7 @@ module.exports = function(context) { } const comments = context.getCommentsBefore(callee); - const ok = comments.some(comment => comment.value === 'OK'); + const ok = comments.some((comment) => comment.value === 'OK'); if (ok) { return; } diff --git a/build-system/eslint-rules/prefer-destructuring.js b/build-system/eslint-rules/prefer-destructuring.js index da0e8fb7ddcc..00f349d8d43c 100644 --- a/build-system/eslint-rules/prefer-destructuring.js +++ b/build-system/eslint-rules/prefer-destructuring.js @@ -94,22 +94,22 @@ module.exports = { const fixes = []; const ids = []; - names.forEach(name => ids.push(name)); + names.forEach((name) => ids.push(name)); const replacement = `{${ids.join(', ')}} = ${base}`; fixes.push(fixer.replaceText(node, replacement)); - declarations.forEach(declaration => { + declarations.forEach((declaration) => { const {declarations} = declaration; - const all = declarations.every(decl => nodes.has(decl)); + const all = declarations.every((decl) => nodes.has(decl)); if (!all) { return; } fixes.push(fixer.remove(declaration)); - declarations.forEach(decl => nodes.delete(decl)); + declarations.forEach((decl) => nodes.delete(decl)); }); - nodes.forEach(node => { + nodes.forEach((node) => { fixes.push(fixer.remove(node)); }); return fixes; @@ -141,7 +141,7 @@ module.exports = { }); }, - 'BlockStatement, Program': function(node) { + 'BlockStatement, Program': function (node) { const {body} = node; const sourceCode = context.getSourceCode(); const letMap = new Map(); diff --git a/build-system/eslint-rules/prefer-spread-props.js b/build-system/eslint-rules/prefer-spread-props.js index d83753179eec..52d5f8bb54c7 100644 --- a/build-system/eslint-rules/prefer-spread-props.js +++ b/build-system/eslint-rules/prefer-spread-props.js @@ -40,7 +40,7 @@ module.exports = { const sourceCode = context.getSourceCode(); return { - 'CallExpression[callee.object.name="Object"][callee.property.name="assign"]': function( + 'CallExpression[callee.object.name="Object"][callee.property.name="assign"]': function ( node ) { const args = node.arguments; @@ -58,7 +58,7 @@ module.exports = { message: 'Prefer using object literals with spread property syntax', fix(fixer) { - const texts = args.map(arg => `...${sourceCode.getText(arg)}`); + const texts = args.map((arg) => `...${sourceCode.getText(arg)}`); if (first.properties.length === 0) { texts.shift(); } diff --git a/build-system/eslint-rules/prefer-unnested-spread-objects.js b/build-system/eslint-rules/prefer-unnested-spread-objects.js index b073a6511ffd..19df38eb8b10 100644 --- a/build-system/eslint-rules/prefer-unnested-spread-objects.js +++ b/build-system/eslint-rules/prefer-unnested-spread-objects.js @@ -63,7 +63,7 @@ module.exports = { fix(fixer) { const {properties, parent} = node; - const texts = properties.map(prop => sourceCode.getText(prop)); + const texts = properties.map((prop) => sourceCode.getText(prop)); if (texts.length > 0) { return fixer.replaceText(node.parent, texts.join(',')); diff --git a/build-system/eslint-rules/private-prop-names.js b/build-system/eslint-rules/private-prop-names.js index 3de31aa78775..f455751818b4 100644 --- a/build-system/eslint-rules/private-prop-names.js +++ b/build-system/eslint-rules/private-prop-names.js @@ -20,7 +20,7 @@ * * @return {!Object} */ -module.exports = function(context) { +module.exports = function (context) { /** * @param {!Array|undefined} commentLines * @return {boolean} @@ -29,7 +29,7 @@ module.exports = function(context) { if (!commentLines) { return false; } - return commentLines.some(function(comment) { + return commentLines.some(function (comment) { return comment.type == 'Block' && /@private/.test(comment.value); }); } @@ -52,7 +52,7 @@ module.exports = function(context) { ); } return { - MethodDefinition: function(node) { + MethodDefinition: function (node) { if ( hasPrivateAnnotation(node.leadingComments) && !hasTrailingUnderscore(node.key.name) @@ -63,7 +63,7 @@ module.exports = function(context) { }); } }, - AssignmentExpression: function(node) { + AssignmentExpression: function (node) { if ( node.parent.type == 'ExpressionStatement' && hasPrivateAnnotation(node.parent.leadingComments) && diff --git a/build-system/eslint-rules/query-selector.js b/build-system/eslint-rules/query-selector.js index f8d4723da4ee..d15809400f50 100644 --- a/build-system/eslint-rules/query-selector.js +++ b/build-system/eslint-rules/query-selector.js @@ -15,7 +15,7 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { function callQuerySelector(node) { const {callee} = node; @@ -29,7 +29,7 @@ module.exports = function(context) { } if (property.leadingComments) { - const ok = property.leadingComments.some(comment => { + const ok = property.leadingComments.some((comment) => { return comment.value === 'OK'; }); if (ok) { @@ -77,7 +77,7 @@ module.exports = function(context) { } if (node.leadingComments) { - const ok = node.leadingComments.some(comment => { + const ok = node.leadingComments.some((comment) => { return comment.value === 'OK'; }); if (ok) { @@ -111,7 +111,7 @@ module.exports = function(context) { } else if (arg.type === 'TemplateLiteral') { // Ensure all template variables are properly escaped. let accumulator = ''; - const quasis = arg.quasis.map(v => v.value.raw); + const quasis = arg.quasis.map((v) => v.value.raw); for (let i = 0; i < arg.expressions.length; i++) { const expression = arg.expressions[i]; accumulator += quasis[i]; @@ -166,7 +166,7 @@ module.exports = function(context) { } // strip out things that can't affect children selection - selector = selector.replace(/\(.*\)|\[.*\]/, function(match) { + selector = selector.replace(/\(.*\)|\[.*\]/, function (match) { return match[0] + match[match.length - 1]; }); diff --git a/build-system/eslint-rules/split-single-pass-comment.js b/build-system/eslint-rules/split-single-pass-comment.js index 46e2438ff73f..d2c66e5594aa 100644 --- a/build-system/eslint-rules/split-single-pass-comment.js +++ b/build-system/eslint-rules/split-single-pass-comment.js @@ -15,12 +15,14 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { return { Program(node) { const {comments} = node; - const comment = comments.find(c => c.value.includes('SPLIT_SINGLE_PASS')); + const comment = comments.find((c) => + c.value.includes('SPLIT_SINGLE_PASS') + ); if (!comment) { return; } diff --git a/build-system/eslint-rules/todo-format.js b/build-system/eslint-rules/todo-format.js index 7ee428692531..b57c39c4f22a 100644 --- a/build-system/eslint-rules/todo-format.js +++ b/build-system/eslint-rules/todo-format.js @@ -15,11 +15,11 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { return { - Program: function(node) { + Program: function (node) { if (node.comments) { - node.comments.forEach(function(comment) { + node.comments.forEach(function (comment) { if ( /TODO/.test(comment.value) && !/TODO\(@?\w+,\s*#\d{1,}\)/.test(comment.value) diff --git a/build-system/eslint-rules/unused-private-field.js b/build-system/eslint-rules/unused-private-field.js index 13c1ee7ab5ec..62a7b68b8341 100644 --- a/build-system/eslint-rules/unused-private-field.js +++ b/build-system/eslint-rules/unused-private-field.js @@ -175,7 +175,7 @@ module.exports = { stack.push({used: new Set(), declared: new Map()}); }, - 'ClassBody:exit': function() { + 'ClassBody:exit': function () { if (shouldIgnoreFile()) { return; } @@ -188,7 +188,7 @@ module.exports = { }); }, - 'ClassBody > MethodDefinition': function(node) { + 'ClassBody > MethodDefinition': function (node) { if (shouldIgnoreFile()) { return; } @@ -203,7 +203,7 @@ module.exports = { declared.set(name, node); }, - 'MethodDefinition[kind="constructor"] MemberExpression': function(node) { + 'MethodDefinition[kind="constructor"] MemberExpression': function (node) { if ( shouldIgnoreFile() || !shouldCheckMember(node) || @@ -219,7 +219,7 @@ module.exports = { } }, - 'ClassBody MemberExpression': function(node) { + 'ClassBody MemberExpression': function (node) { if ( shouldIgnoreFile() || !shouldCheckMember(node, false) || @@ -233,7 +233,7 @@ module.exports = { used.add(name); }, - 'ClassBody VariableDeclarator > ObjectPattern': function(node) { + 'ClassBody VariableDeclarator > ObjectPattern': function (node) { if (shouldIgnoreFile()) { return; } diff --git a/build-system/eslint-rules/vsync.js b/build-system/eslint-rules/vsync.js index dc60bbd5abcc..317c3c2cf649 100644 --- a/build-system/eslint-rules/vsync.js +++ b/build-system/eslint-rules/vsync.js @@ -15,7 +15,7 @@ */ 'use strict'; -module.exports = function(context) { +module.exports = function (context) { return { CallExpression(node) { if (/test-/.test(context.getFilename())) { @@ -33,7 +33,7 @@ module.exports = function(context) { } if (property.leadingComments) { - const ok = property.leadingComments.some(comment => { + const ok = property.leadingComments.some((comment) => { return comment.value === 'OK'; }); if (ok) { diff --git a/build-system/eslint-rules/window-property-name.js b/build-system/eslint-rules/window-property-name.js index 367ecad9bf51..b8a78e920c2b 100644 --- a/build-system/eslint-rules/window-property-name.js +++ b/build-system/eslint-rules/window-property-name.js @@ -39,7 +39,7 @@ const PATHS_TO_IGNORE = [ const WINDOW_PROPERTIES = ['win', 'window', 'global', 'self']; -module.exports = function(context) { +module.exports = function (context) { /** * Looks up value of an identifier property. * E.g. given `window[FOO]`, finds `FOO = 'abc'` in code and returns `'abc'`. @@ -84,11 +84,11 @@ module.exports = function(context) { AssignmentExpression(node) { const filePath = context.getFilename(); // Only check source paths. - if (!PATHS_TO_INCLUDE.some(path => filePath.includes(path))) { + if (!PATHS_TO_INCLUDE.some((path) => filePath.includes(path))) { return; } // Ignore polyfills etc. - if (PATHS_TO_IGNORE.some(path => filePath.includes(path))) { + if (PATHS_TO_IGNORE.some((path) => filePath.includes(path))) { return; } // Ignore test files. diff --git a/build-system/externs/amp.extern.js b/build-system/externs/amp.extern.js index c6682cff9240..bcd9a4c6d998 100644 --- a/build-system/externs/amp.extern.js +++ b/build-system/externs/amp.extern.js @@ -51,12 +51,12 @@ var FetchInitDef; var FetchRequestDef; /** @constructor */ -var FormDataWrapperInterface = function() {}; +var FormDataWrapperInterface = function () {}; -FormDataWrapperInterface.prototype.entries = function() {}; -FormDataWrapperInterface.prototype.getFormData = function() {}; +FormDataWrapperInterface.prototype.entries = function () {}; +FormDataWrapperInterface.prototype.getFormData = function () {}; -FormData.prototype.entries = function() {}; +FormData.prototype.entries = function () {}; /** * A type for Objects that can be JSON serialized or that come from @@ -222,10 +222,10 @@ window.AMP.viewport.getScrollWidth; window.AMP.viewport.getWidth; /** @type {function(!HTMLElement, !Document, !string, Object)} */ -window.AMP.attachShadowDoc = function(element, document, url, options) {}; +window.AMP.attachShadowDoc = function (element, document, url, options) {}; /** @type {function(!HTMLElement, !string, Object)} */ -window.AMP.attachShadowDocAsStream = function(element, url, options) {}; +window.AMP.attachShadowDocAsStream = function (element, url, options) {}; /** @constructor */ function AmpConfigType() {} @@ -317,7 +317,7 @@ window.vg; /** * @type {function(*)} */ -let ReactRender = function() {}; +let ReactRender = function () {}; /** * @dict @@ -362,15 +362,15 @@ ReactDatesConstants.HORIZONTAL_ORIENTATION; var Inputmask = class {}; /** @param {!Object} unusedOpts */ -Inputmask.extendAliases = function(unusedOpts) {}; +Inputmask.extendAliases = function (unusedOpts) {}; /** @param {!Object} unusedOpts */ -Inputmask.extendDefaults = function(unusedOpts) {}; +Inputmask.extendDefaults = function (unusedOpts) {}; /** @param {!Element} unusedElement */ -Inputmask.prototype.mask = function(unusedElement) {}; +Inputmask.prototype.mask = function (unusedElement) {}; -Inputmask.prototype.remove = function() {}; +Inputmask.prototype.remove = function () {}; /** @dict */ window.AMP.dependencies = {}; @@ -379,7 +379,7 @@ window.AMP.dependencies = {}; * @param {!Element} unusedElement * @return {!Inputmask} */ -window.AMP.dependencies.inputmaskFactory = function(unusedElement) {}; +window.AMP.dependencies.inputmaskFactory = function (unusedElement) {}; // Should have been defined in the closure compiler's extern file for // IntersectionObserverEntry, but appears to have been omitted. @@ -406,48 +406,48 @@ var UnlistenDef; var AmpElement; /** @return {!Signals} */ -AmpElement.prototype.signals = function() {}; +AmpElement.prototype.signals = function () {}; var Signals = class {}; /** * @param {string} unusedName * @return {number|!Error|null} */ -Signals.prototype.get = function(unusedName) {}; +Signals.prototype.get = function (unusedName) {}; /** * @param {string} unusedName * @return {!Promise