From 7f80940225bc1c615517455dc7d30452b0365243 Mon Sep 17 00:00:00 2001 From: Mikhail Losev Date: Wed, 13 Apr 2022 08:27:54 +0400 Subject: [PATCH] chore: add eslint rule 'comma-dangle' (part 1) (#2759) * part 1 * part 2 * part 3 * part 4 * fix ie tests --- .eslintrc | 5 +- Gulpfile.js | 16 +- gulp/saucelabs-settings.js | 24 +- gulp/utils/get-client-test-settings.js | 4 +- src/.eslintrc | 1 - src/client/index.ts | 22 +- .../sandbox/code-instrumentation/index.ts | 14 +- .../code-instrumentation/location/index.ts | 4 +- .../code-instrumentation/location/wrapper.ts | 26 +- .../sandbox/code-instrumentation/methods.ts | 16 +- .../code-instrumentation/properties/index.ts | 12 +- src/client/sandbox/cookie/index.ts | 2 +- src/client/sandbox/cookie/window-sync.ts | 2 +- .../sandbox/event/active-window-tracker.ts | 4 +- .../event/drag-and-drop/data-store-mode.ts | 2 +- .../drag-and-drop/data-transfer-item-kind.ts | 2 +- .../drag-and-drop/data-transfer-item-list.ts | 10 +- .../event/drag-and-drop/data-transfer-item.ts | 8 +- .../event/drag-and-drop/data-transfer.ts | 10 +- .../event/drag-and-drop/drop-effect.ts | 2 +- .../event/drag-and-drop/effect-allowed.ts | 2 +- .../sandbox/event/drag-and-drop/file-list.ts | 4 +- .../sandbox/event/element-editing-watcher.ts | 4 +- src/client/sandbox/event/focus-blur.ts | 14 +- src/client/sandbox/event/index.ts | 2 +- src/client/sandbox/event/listeners.ts | 4 +- src/client/sandbox/event/listening-context.ts | 6 +- src/client/sandbox/event/message.ts | 12 +- src/client/sandbox/event/selection.ts | 4 +- src/client/sandbox/event/simulator.ts | 88 ++-- src/client/sandbox/event/unload.ts | 12 +- src/client/sandbox/fetch.ts | 8 +- src/client/sandbox/ie-debug.ts | 2 +- src/client/sandbox/native-methods.ts | 2 +- src/client/sandbox/node/document/index.ts | 18 +- .../sandbox/node/document/title-storage.ts | 2 +- src/client/sandbox/node/document/writer.ts | 2 +- src/client/sandbox/node/element.ts | 8 +- src/client/sandbox/node/index.ts | 6 +- .../live-node-list/html-collection-wrapper.ts | 16 +- src/client/sandbox/node/window.ts | 122 ++--- src/client/sandbox/shadow-ui.ts | 8 +- src/client/sandbox/storages/index.ts | 14 +- src/client/sandbox/storages/wrapper.ts | 6 +- src/client/sandbox/style.ts | 10 +- .../sandbox/upload/file-list-wrapper.ts | 4 +- src/client/sandbox/upload/hidden-info.ts | 4 +- src/client/sandbox/upload/info-manager.ts | 10 +- src/client/sandbox/xhr.ts | 10 +- src/client/settings.ts | 2 +- src/client/transport/index.ts | 2 +- src/client/utils/cookie.ts | 2 +- src/client/utils/destination-location.ts | 4 +- src/client/utils/dom.ts | 4 +- src/client/utils/event.ts | 12 +- src/client/utils/get-mime-type.ts | 54 +-- src/client/utils/global-context-info.ts | 2 +- src/client/utils/overriding.ts | 2 +- src/client/utils/position.ts | 28 +- src/client/utils/style.ts | 12 +- src/client/utils/url-resolver.ts | 4 +- src/client/utils/url.ts | 12 +- src/index.ts | 2 +- src/messages.ts | 4 +- src/processing/dom/attributes.ts | 4 +- src/processing/dom/base-dom-adapter.ts | 2 +- src/processing/dom/index.ts | 38 +- src/processing/dom/internal-attributes.ts | 2 +- src/processing/dom/internal-properties.ts | 2 +- src/processing/dom/namespaces.ts | 2 +- src/processing/encoding/charset.ts | 8 +- src/processing/encoding/index.ts | 6 +- src/processing/encoding/labels.ts | 2 +- src/processing/resources/page.ts | 12 +- src/processing/resources/script.ts | 2 +- src/processing/script/destructuring.ts | 4 +- src/processing/script/index.ts | 8 +- src/processing/script/instruction.ts | 2 +- src/processing/script/instrumented.ts | 4 +- src/processing/script/node-builder.ts | 4 +- .../transformers/assignment-destructuring.ts | 2 +- .../transformers/computed-property-get.ts | 2 +- .../transformers/computed-property-set.ts | 2 +- .../script/transformers/concat-operator.ts | 2 +- .../transformers/declaration-destructuring.ts | 2 +- .../script/transformers/dynamic-import.ts | 2 +- .../script/transformers/eval-bind.ts | 2 +- .../script/transformers/eval-call-apply.ts | 2 +- .../script/transformers/eval-get.ts | 2 +- src/processing/script/transformers/eval.ts | 2 +- src/processing/script/transformers/for-in.ts | 4 +- src/processing/script/transformers/for-of.ts | 8 +- .../transformers/func-args-destructing.ts | 4 +- src/processing/script/transformers/index.ts | 2 +- .../js-protocol-last-expression.ts | 2 +- .../script/transformers/location-get.ts | 2 +- .../script/transformers/location-set.ts | 2 +- .../script/transformers/method-call.ts | 2 +- .../post-message-call-apply-bind.ts | 2 +- .../script/transformers/post-message-get.ts | 2 +- .../script/transformers/property-set.ts | 2 +- .../script/transformers/static-import.ts | 2 +- .../script/transformers/window-eval-get.ts | 2 +- .../transformers/window-post-message-get.ts | 2 +- src/proxy/index.ts | 14 +- src/proxy/router.ts | 2 +- src/proxy/service-routes.ts | 2 +- src/request-pipeline/builtin-header-names.ts | 2 +- src/request-pipeline/cache.ts | 8 +- src/request-pipeline/context.ts | 10 +- .../create-special-page-response.ts | 4 +- .../destination-request/agent.ts | 12 +- .../default-request-timeout.ts | 2 +- .../destination-request/http2.ts | 8 +- .../destination-request/windows-domain.ts | 2 +- src/request-pipeline/file-request/index.ts | 2 +- .../header-transforms/index.ts | 8 +- .../header-transforms/transforms.ts | 6 +- src/request-pipeline/http-header-parser.ts | 4 +- src/request-pipeline/incoming-message-like.ts | 4 +- .../request-filter-rule/index.ts | 4 +- .../request-filter-rule/stringify.ts | 2 +- .../response-mock/get-response.ts | 2 +- src/request-pipeline/stages.ts | 4 +- src/request-pipeline/utils.ts | 2 +- src/session/command.ts | 2 +- src/session/cookies.ts | 2 +- src/session/events/response-event.ts | 6 +- src/session/index.ts | 22 +- src/session/state-snapshot.ts | 2 +- src/shadow-ui/class-name.ts | 2 +- src/upload/storage.ts | 6 +- src/utils/buffer.ts | 2 +- src/utils/content-type.ts | 4 +- src/utils/cookie.ts | 4 +- src/utils/http.ts | 4 +- src/utils/logger.ts | 8 +- src/utils/parse5.ts | 6 +- src/utils/self-removing-scripts.ts | 2 +- src/utils/stack-processing.ts | 2 +- src/utils/url.ts | 12 +- .../fixtures/sandbox/child-window-test.js | 6 +- .../code-instrumentation/access-error-test.js | 2 +- .../code-instrumentation/common-test.js | 4 +- .../code-instrumentation/getters-test.js | 12 +- .../code-instrumentation/location-test.js | 76 +-- .../code-instrumentation/setters-test.js | 2 +- .../type-verification-test.js | 4 +- test/client/fixtures/sandbox/console-test.js | 14 +- test/client/fixtures/sandbox/cookie-test.js | 22 +- test/client/fixtures/sandbox/electron-test.js | 6 +- .../sandbox/event/event-simulator-test.js | 36 +- .../fixtures/sandbox/event/event-test.js | 18 +- .../sandbox/event/focus-blur-change-test.js | 14 +- .../sandbox/event/internal-listeners-test.js | 2 +- .../fixtures/sandbox/event/message-test.js | 4 +- .../fixtures/sandbox/event/unload-test.js | 2 +- test/client/fixtures/sandbox/fetch-test.js | 48 +- .../fixtures/sandbox/iframe-flag-test.js | 24 +- test/client/fixtures/sandbox/iframe-test.js | 10 +- .../fixtures/sandbox/native-methods-test.js | 2 +- .../fixtures/sandbox/node/attributes-test.js | 18 +- .../fixtures/sandbox/node/classes-test.js | 42 +- .../fixtures/sandbox/node/document-test.js | 10 +- .../sandbox/node/dom-processor-test.js | 2 +- test/client/fixtures/sandbox/node/dom-test.js | 2 +- .../node/html-collection-wrapper-test.js | 2 +- .../fixtures/sandbox/node/methods-test.js | 30 +- .../sandbox/node/text-properties-test.js | 14 +- .../fixtures/sandbox/node/window-test.js | 50 +- .../client/fixtures/sandbox/selection-test.js | 4 +- .../client/fixtures/sandbox/shadow-ui-test.js | 16 +- test/client/fixtures/sandbox/storages-test.js | 4 +- test/client/fixtures/sandbox/upload-test.js | 34 +- .../fixtures/sandbox/windows-storage-test.js | 2 +- test/client/fixtures/sandbox/xhr-test.js | 24 +- test/client/fixtures/target-attr-test.js | 2 +- test/client/fixtures/transport-test.js | 8 +- test/client/fixtures/utils/cookie-test.js | 34 +- test/client/fixtures/utils/dom-test.js | 16 +- test/client/fixtures/utils/extend-test.js | 18 +- .../fixtures/utils/get-mime-type-test.js | 8 +- test/client/fixtures/utils/html-test.js | 8 +- .../replace-proxied-urls-in-stack-test.js | 8 +- test/client/fixtures/utils/style-test.js | 2 +- test/client/fixtures/utils/url-test.js | 22 +- test/client/fixtures/worker-test.js | 14 +- test/server/auth-test.js | 16 +- test/server/charset-test.js | 44 +- test/server/common/constants.js | 4 +- test/server/common/utils.js | 8 +- test/server/cookies-test.js | 14 +- test/server/dom-processor-test.js | 12 +- test/server/encoding-test.js | 2 +- test/server/external-proxy-test.js | 34 +- test/server/performance-test.js | 4 +- test/server/proxy/cache-test.js | 40 +- test/server/proxy/file-protocol-test.js | 50 +- test/server/proxy/http2-client-test.js | 14 +- test/server/proxy/https-test.js | 12 +- test/server/proxy/index-test.js | 206 ++++---- test/server/proxy/regression-test.js | 206 ++++---- test/server/proxy/request-hooks-test.js | 108 ++--- test/server/proxy/web-socket-test.js | 8 +- test/server/request-hook-test.js | 36 +- test/server/router-test.js | 32 +- test/server/script-processor-test.js | 444 +++++++++--------- test/server/upload-test.js | 18 +- test/server/url-test.js | 4 +- 209 files changed, 1553 insertions(+), 1551 deletions(-) diff --git a/.eslintrc b/.eslintrc index aec278630..385338974 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,5 +2,8 @@ "env": { "node": true, "es6": true - } + }, + "rules": { + "comma-dangle": ["error", "always-multiline"] + } } diff --git a/Gulpfile.js b/Gulpfile.js index 8d442d328..619bccd1f 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -29,7 +29,7 @@ ll .tasks('lint') .onlyInDebug([ 'server-scripts', - 'client-scripts-bundle' + 'client-scripts-bundle', ]); // Build @@ -81,13 +81,13 @@ gulp.step('server-scripts-add-exports', () => { } cb(null, file); - } + }, }); return gulp .src([ 'lib/**/*.js', - '!lib/client/**/*.js' + '!lib/client/**/*.js', ]) .pipe(transform) .pipe(gulp.dest('lib')); @@ -113,7 +113,7 @@ gulp.step('lint-js', () => { './test/client/fixtures/**/*.js', './gulp/**/*.js', 'Gulpfile.js', - '!./test/server/data/**/*.js' + '!./test/server/data/**/*.js', ]) .pipe(eslint()) .pipe(eslint.format()) @@ -150,7 +150,7 @@ gulp.step('test-server-run', () => { .pipe(mocha({ // NOTE: Disable timeouts in debug mode. timeout: typeof v8debug !== 'undefined' || !!process.debugPort ? Infinity : 2000, - fullTrace: true + fullTrace: true, })); }); @@ -207,8 +207,8 @@ gulp.step('https-playground-server', () => { ssl: { key: selfSignedCertificate.key, cert: selfSignedCertificate.cert, - needBeautifyScripts - } + needBeautifyScripts, + }, }); }); @@ -222,7 +222,7 @@ gulp.task('cached-http-playground', gulp.series(BUILD_TASK, 'cached-http-playgro gulp.step('test-functional-testcafe-run', gulpRunCommand([ 'chmod +x ./test/functional/run-testcafe-functional-tests.sh', - './test/functional/run-testcafe-functional-tests.sh' + './test/functional/run-testcafe-functional-tests.sh', ])); gulp.task('test-functional-testcafe', gulp.series(BUILD_TASK, 'test-functional-testcafe-run')); diff --git a/gulp/saucelabs-settings.js b/gulp/saucelabs-settings.js index 35980825e..18b6d7083 100644 --- a/gulp/saucelabs-settings.js +++ b/gulp/saucelabs-settings.js @@ -1,51 +1,51 @@ const CLIENT_TESTS_BROWSERS = [ { platform: 'Windows 10', - browserName: 'MicrosoftEdge' + browserName: 'MicrosoftEdge', }, { platform: 'Windows 10', - browserName: 'chrome' + browserName: 'chrome', }, { platform: 'Windows 10', - browserName: 'firefox' + browserName: 'firefox', }, { platform: 'Windows 10', browserName: 'internet explorer', - version: '11.0' + version: '11.0', }, { browserName: 'safari', platform: 'macOS 11.00', - version: '14' + version: '14', }, { browserName: 'safari', platform: 'macOS 12', - version: '15' + version: '15', }, { browserName: 'Safari', deviceName: 'iPhone 7 Plus Simulator', platformVersion: '11.3', - platformName: 'iOS' + platformName: 'iOS', }, { deviceName: 'Android GoogleAPI Emulator', browserName: 'Chrome', platformVersion: '7.1', - platformName: 'Android' + platformName: 'Android', }, { browserName: 'chrome', - platform: 'macOS 12' + platform: 'macOS 12', }, { browserName: 'firefox', - platform: 'macOS 12' - } + platform: 'macOS 12', + }, ]; const SAUCELABS_SETTINGS = { @@ -55,7 +55,7 @@ const SAUCELABS_SETTINGS = { tags: [process.env.TRAVIS_BRANCH || 'master'], browsers: CLIENT_TESTS_BROWSERS, name: 'testcafe-hammerhead client tests', - timeout: 720 + timeout: 720, }; module.exports = SAUCELABS_SETTINGS; diff --git a/gulp/utils/get-client-test-settings.js b/gulp/utils/get-client-test-settings.js index 4cf73b051..811e48281 100644 --- a/gulp/utils/get-client-test-settings.js +++ b/gulp/utils/get-client-test-settings.js @@ -7,9 +7,9 @@ module.exports = function getClientTestSettings () { crossDomainPort: 2001, scripts: [ { src: '/hammerhead.js', path: util.env.dev ? './lib/client/hammerhead.js' : './lib/client/hammerhead.min.js' }, - { src: '/before-test.js', path: './test/client/before-test.js' } + { src: '/before-test.js', path: './test/client/before-test.js' }, ], - configApp: require('../../test/client/config-qunit-server-app') + configApp: require('../../test/client/config-qunit-server-app'), }; }; diff --git a/src/.eslintrc b/src/.eslintrc index c445176ce..f09cda73d 100644 --- a/src/.eslintrc +++ b/src/.eslintrc @@ -15,7 +15,6 @@ "@typescript-eslint/explicit-function-return-type": 0, "@typescript-eslint/no-use-before-define": 0, "@typescript-eslint/no-object-literal-type-assertion": 0, - "@typescript-eslint/no-parameter-properties": 0, "@typescript-eslint/explicit-module-boundary-types": 0, "@typescript-eslint/ban-ts-comment": 0, diff --git a/src/client/index.ts b/src/client/index.ts index 1208cf15c..99eb9d180 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -114,15 +114,15 @@ class Hammerhead { pageNavigationTriggered: this.pageNavigationWatch.PAGE_NAVIGATION_TRIGGERED_EVENT, scriptElementAdded: this.sandbox.node.element.SCRIPT_ELEMENT_ADDED_EVENT, consoleMethCalled: this.sandbox.console.CONSOLE_METH_CALLED_EVENT, - windowOpened: this.sandbox.childWindow.WINDOW_OPENED_EVENT + windowOpened: this.sandbox.childWindow.WINDOW_OPENED_EVENT, }; this.PROCESSING_INSTRUCTIONS = { dom: { script: SCRIPT_PROCESSING_INSTRUCTIONS, internal_attributes: INTERNAL_ATTRIBUTES, - internal_props: INTERNAL_PROPS - } + internal_props: INTERNAL_PROPS, + }, }; this.SHADOW_UI_CLASS_NAME = SHADOW_UI_CLASS_NAME; @@ -152,13 +152,13 @@ class Hammerhead { message: this.sandbox.event.message, timers: this.sandbox.event.timers, DataTransfer: this.sandbox.event.DataTransfer, - DragDataStore: this.sandbox.event.DragDataStore + DragDataStore: this.sandbox.event.DragDataStore, }; const processingUtils = { script: scriptProcessingUtils, header: headerProcessingUtils, - instrumentation: instrumentationProcessingUtils + instrumentation: instrumentationProcessingUtils, }; this.utils = { @@ -179,7 +179,7 @@ class Hammerhead { getMimeType: getMimeType, urlResolver: urlResolver, processing: processingUtils, - removeInjectedScript: removeInjectedScript + removeInjectedScript: removeInjectedScript, }; this.sharedUtils = { @@ -187,7 +187,7 @@ class Hammerhead { url: sharedUrlUtils, headers: sharedHeadersUtils, stackProcessing: sharedStackProcessingUtils, - selfRemovingScripts: sharedSelfRemovingScripts + selfRemovingScripts: sharedSelfRemovingScripts, }; this.settings = settings; @@ -198,7 +198,7 @@ class Hammerhead { ShadowUISandbox, ElectronSandbox, UploadSandbox, - ChildWindowSandbox + ChildWindowSandbox, }; this.sandboxUtils = { @@ -213,13 +213,13 @@ class Hammerhead { StorageWrapper, CodeInstrumentation, LocationInstrumentation, - LocationWrapper + LocationWrapper, }; this.processors = { styleProcessor, domProcessor, - DomProcessor + DomProcessor, }; } @@ -330,7 +330,7 @@ const hammerhead = new Hammerhead(); // So, we need to define the '%hammerhead%' variable as 'configurable' so that it can be redefined. nativeMethods.objectDefineProperty(window, INTERNAL_PROPS.hammerhead, { value: hammerhead, - configurable: true + configurable: true, }); export default hammerhead; diff --git a/src/client/sandbox/code-instrumentation/index.ts b/src/client/sandbox/code-instrumentation/index.ts index 1d53be3df..21a9ae92a 100644 --- a/src/client/sandbox/code-instrumentation/index.ts +++ b/src/client/sandbox/code-instrumentation/index.ts @@ -53,7 +53,7 @@ export default class CodeInstrumentation extends SandboxBase { return evalWrapper; }, - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(window, INSTRUCTION.processScript, { @@ -77,7 +77,7 @@ export default class CodeInstrumentation extends SandboxBase { return script; }, - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(window, INSTRUCTION.processHtml, { @@ -88,7 +88,7 @@ export default class CodeInstrumentation extends SandboxBase { return html; }, - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(window, INSTRUCTION.getProxyUrl, { @@ -107,12 +107,12 @@ export default class CodeInstrumentation extends SandboxBase { return proxyUrl; }, - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(window, INSTRUCTION.restArray, { value: (array: any[], startIndex: number) => nativeMethods.arraySlice.call(array, startIndex), - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(window, INSTRUCTION.arrayFrom, { @@ -125,7 +125,7 @@ export default class CodeInstrumentation extends SandboxBase { return shouldConvertToArray ? nativeMethods.arrayFrom.call(nativeMethods.Array, target) : target; }, - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(window, INSTRUCTION.restObject, { @@ -141,7 +141,7 @@ export default class CodeInstrumentation extends SandboxBase { return rest; }, - configurable: true + configurable: true, }); } } diff --git a/src/client/sandbox/code-instrumentation/location/index.ts b/src/client/sandbox/code-instrumentation/location/index.ts index eaf02ce81..44b7eb3f9 100644 --- a/src/client/sandbox/code-instrumentation/location/index.ts +++ b/src/client/sandbox/code-instrumentation/location/index.ts @@ -52,7 +52,7 @@ export default class LocationAccessorsInstrumentation extends SandboxBase { nativeMethods.objectDefineProperty(document, LOCATION_WRAPPER, { value: locationWrapper, configurable: true }); nativeMethods.objectDefineProperty(window, INSTRUCTION.getLocation, { value: (location: any) => isLocation(location) ? locationWrapper : location, - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(window, INSTRUCTION.setLocation, { value: (location: any, value: any) => { @@ -66,7 +66,7 @@ export default class LocationAccessorsInstrumentation extends SandboxBase { return null; }, - configurable: true + configurable: true, }); } } diff --git a/src/client/sandbox/code-instrumentation/location/wrapper.ts b/src/client/sandbox/code-instrumentation/location/wrapper.ts index 0169ba148..f7a359751 100644 --- a/src/client/sandbox/code-instrumentation/location/wrapper.ts +++ b/src/client/sandbox/code-instrumentation/location/wrapper.ts @@ -1,6 +1,6 @@ import { get as getDestLocation, - getParsed as getParsedDestLocation + getParsed as getParsedDestLocation, } from '../../../utils/destination-location'; import { getProxyUrl, @@ -8,7 +8,7 @@ import { parseProxyUrl, parseResourceType, isChangedOnlyHash, - getCrossDomainProxyPort + getCrossDomainProxyPort, } from '../../../utils/url'; import { getDomain, @@ -16,7 +16,7 @@ import { sameOriginCheck, ensureTrailingSlash, prepareUrl, - SPECIAL_BLANK_PAGE + SPECIAL_BLANK_PAGE, } from '../../../../utils/url'; import * as domUtils from '../../../utils/dom'; import nativeMethods from '../../native-methods'; @@ -62,7 +62,7 @@ export default class LocationWrapper extends LocationInheritor { const resourceType = getResourceTypeString({ isIframe: parsedResourceType.isIframe, - isForm: parsedResourceType.isForm + isForm: parsedResourceType.isForm, }); const getHref = () => { // eslint-disable-next-line no-restricted-properties @@ -123,7 +123,7 @@ export default class LocationWrapper extends LocationInheritor { onChanged(proxiedHref); return href; - } + }, }); // eslint-disable-next-line no-restricted-properties @@ -138,13 +138,13 @@ export default class LocationWrapper extends LocationInheritor { onChanged(newLocation); return search; - } + }, }); // eslint-disable-next-line no-restricted-properties locationProps.origin = createOverriddenDescriptor(locationPropsOwner, 'origin', { getter: () => getDomain(getParsedDestLocation()), - setter: origin => origin + setter: origin => origin, }); locationProps.hash = createOverriddenDescriptor(locationPropsOwner, 'hash', { @@ -153,7 +153,7 @@ export default class LocationWrapper extends LocationInheritor { window.location.hash = hash; return hash; - } + }, }); if (window.location.ancestorOrigins) { @@ -186,7 +186,7 @@ export default class LocationWrapper extends LocationInheritor { const ancestorOrigins = new DOMStringListWrapper(window, messageSandbox ? getCrossDomainOrigin : void 0); locationProps.ancestorOrigins = createOverriddenDescriptor(locationPropsOwner, 'ancestorOrigins', { - getter: () => ancestorOrigins + getter: () => ancestorOrigins, }); } @@ -207,7 +207,7 @@ export default class LocationWrapper extends LocationInheritor { onChanged(newLocation); return value; - } + }, }); }; @@ -225,7 +225,7 @@ export default class LocationWrapper extends LocationInheritor { onChanged(proxiedHref); return result; - } + }, }); locationProps.replace = createOverriddenDescriptor(locationPropsOwner, 'replace', { @@ -236,7 +236,7 @@ export default class LocationWrapper extends LocationInheritor { onChanged(proxiedHref); return result; - } + }, }); locationProps.reload = createOverriddenDescriptor(locationPropsOwner, 'reload', { @@ -246,7 +246,7 @@ export default class LocationWrapper extends LocationInheritor { onChanged(window.location.toString()); return result; - } + }, }); locationProps.toString = createOverriddenDescriptor(locationPropsOwner, 'toString', { value: getHref }); diff --git a/src/client/sandbox/code-instrumentation/methods.ts b/src/client/sandbox/code-instrumentation/methods.ts index 0dea10fd2..2bf80ceb8 100644 --- a/src/client/sandbox/code-instrumentation/methods.ts +++ b/src/client/sandbox/code-instrumentation/methods.ts @@ -17,7 +17,7 @@ export default class MethodCallInstrumentation extends SandboxBase { this.methodWrappers = { postMessage: { condition: isWindow, - method: (contentWindow: Window, args: any[]) => _messageSandbox.postMessage(contentWindow, args) + method: (contentWindow: Window, args: any[]) => _messageSandbox.postMessage(contentWindow, args), }, // NOTE: We cannot get the location wrapper for a cross-domain window. Therefore, we need to @@ -25,8 +25,8 @@ export default class MethodCallInstrumentation extends SandboxBase { replace: { condition: isLocation, method: (location: Location, args: any[]) => location.replace(getProxyUrl(args[0], { - resourceType: MethodCallInstrumentation._getLocationResourceType(location) - })) + resourceType: MethodCallInstrumentation._getLocationResourceType(location), + })), }, // NOTE: We cannot get the location wrapper for a cross-domain window. Therefore, we need to @@ -34,9 +34,9 @@ export default class MethodCallInstrumentation extends SandboxBase { assign: { condition: isLocation, method: (location: Location, args: any[]) => location.assign(getProxyUrl(args[0], { - resourceType: MethodCallInstrumentation._getLocationResourceType(location) - })) - } + resourceType: MethodCallInstrumentation._getLocationResourceType(location), + })), + }, }; } @@ -80,7 +80,7 @@ export default class MethodCallInstrumentation extends SandboxBase { return fastApply(owner, methName, args); }, - configurable: true + configurable: true, }); const methodCallInstrumentation = this; @@ -100,7 +100,7 @@ export default class MethodCallInstrumentation extends SandboxBase { return methodCallInstrumentation._messageSandbox.postMessage(this, args); }; }, - configurable: true + configurable: true, }); } } diff --git a/src/client/sandbox/code-instrumentation/properties/index.ts b/src/client/sandbox/code-instrumentation/properties/index.ts index 539cddd75..64ad8b588 100644 --- a/src/client/sandbox/code-instrumentation/properties/index.ts +++ b/src/client/sandbox/code-instrumentation/properties/index.ts @@ -77,14 +77,14 @@ export default class PropertyAccessorsInstrumentation extends SandboxBase { // eslint-disable-next-line no-restricted-properties get: (crossDomainLocation: Location) => crossDomainLocation.href, - set: PropertyAccessorsInstrumentation._setCrossDomainLocation + set: PropertyAccessorsInstrumentation._setCrossDomainLocation, }, location: { condition: (owner: any) => domUtils.isDocument(owner) || domUtils.isWindow(owner), get: PropertyAccessorsInstrumentation._getLocation, - set: PropertyAccessorsInstrumentation._setLocation - } + set: PropertyAccessorsInstrumentation._setLocation, + }, }; private static _propertyGetter (owner: any, propName: any, optional = false) { @@ -125,12 +125,12 @@ export default class PropertyAccessorsInstrumentation extends SandboxBase { nativeMethods.objectDefineProperties(window, { [INSTRUCTION.getProperty]: { value: PropertyAccessorsInstrumentation._propertyGetter, - configurable: true + configurable: true, }, [INSTRUCTION.setProperty]: { value: PropertyAccessorsInstrumentation._propertySetter, - configurable: true - } + configurable: true, + }, }); } } diff --git a/src/client/sandbox/cookie/index.ts b/src/client/sandbox/cookie/index.ts index 942dc6694..f1d432656 100644 --- a/src/client/sandbox/cookie/index.ts +++ b/src/client/sandbox/cookie/index.ts @@ -13,7 +13,7 @@ import { formatSyncCookie, generateDeleteSyncCookieStr, parseClientSyncCookieStr, - prepareSyncCookieProperties + prepareSyncCookieProperties, } from '../../../utils/cookie'; import { CookieRecord } from '../../../typings/cookie'; import ChildWindowSandbox from '../child-window'; diff --git a/src/client/sandbox/cookie/window-sync.ts b/src/client/sandbox/cookie/window-sync.ts index 836ff223c..c966bdb59 100644 --- a/src/client/sandbox/cookie/window-sync.ts +++ b/src/client/sandbox/cookie/window-sync.ts @@ -51,7 +51,7 @@ export default class WindowSync { this.syncBetweenWindows(message.cookies, source) .then(() => this._messageSandbox.sendServiceMsg({ id: message.id, - cmd: SYNC_COOKIE_DONE_CMD + cmd: SYNC_COOKIE_DONE_CMD, }, source)); } else diff --git a/src/client/sandbox/event/active-window-tracker.ts b/src/client/sandbox/event/active-window-tracker.ts index 8e97f71cb..b49a4d9f0 100644 --- a/src/client/sandbox/event/active-window-tracker.ts +++ b/src/client/sandbox/event/active-window-tracker.ts @@ -18,7 +18,7 @@ export default class ActiveWindowTracker extends SandboxBase { try { if (this._activeWindow.top && this._activeWindow !== this._activeWindow.top) { this._messageSandbox.sendServiceMsg({ - cmd: WINDOW_DEACTIVATED_EVENT + cmd: WINDOW_DEACTIVATED_EVENT, }, this._activeWindow); } } @@ -60,7 +60,7 @@ export default class ActiveWindowTracker extends SandboxBase { } else { this._messageSandbox.sendServiceMsg({ - cmd: WINDOW_ACTIVATED_EVENT + cmd: WINDOW_ACTIVATED_EVENT, }, this.window.top); } } diff --git a/src/client/sandbox/event/drag-and-drop/data-store-mode.ts b/src/client/sandbox/event/drag-and-drop/data-store-mode.ts index d00d23a32..5e97b136f 100644 --- a/src/client/sandbox/event/drag-and-drop/data-store-mode.ts +++ b/src/client/sandbox/event/drag-and-drop/data-store-mode.ts @@ -2,5 +2,5 @@ export default { readwrite: 'readwrite', readonly: 'readonly', - protected: 'protected' + protected: 'protected', }; diff --git a/src/client/sandbox/event/drag-and-drop/data-transfer-item-kind.ts b/src/client/sandbox/event/drag-and-drop/data-transfer-item-kind.ts index 536c11217..f0be1253d 100644 --- a/src/client/sandbox/event/drag-and-drop/data-transfer-item-kind.ts +++ b/src/client/sandbox/event/drag-and-drop/data-transfer-item-kind.ts @@ -1,5 +1,5 @@ // https://html.spec.whatwg.org/multipage/interaction.html#the-drag-data-item-kind export default { string: 'string', - file: 'file' + file: 'file', }; diff --git a/src/client/sandbox/event/drag-and-drop/data-transfer-item-list.ts b/src/client/sandbox/event/drag-and-drop/data-transfer-item-list.ts index 8a4986313..b951060c9 100644 --- a/src/client/sandbox/event/drag-and-drop/data-transfer-item-list.ts +++ b/src/client/sandbox/event/drag-and-drop/data-transfer-item-list.ts @@ -58,7 +58,7 @@ export default class DataTransferItemList { nativeMethods.objectDefineProperty(this, idx, { enumerable: item !== void 0, configurable: true, - value: item + value: item, }); idx++; @@ -138,7 +138,7 @@ export default class DataTransferItemList { nativeMethods.objectDefineProperty(this, 'length', { enumerable: true, - get: () => items.length + get: () => items.length, }); nativeMethods.objectDefineProperty(this, 'remove', { @@ -154,7 +154,7 @@ export default class DataTransferItemList { itemsData.splice(idx, 1); updateIndexes(); }; - } + }, }); nativeMethods.objectDefineProperty(this, 'clear', { @@ -170,7 +170,7 @@ export default class DataTransferItemList { itemsData = []; updateIndexes(); }; - } + }, }); nativeMethods.objectDefineProperty(this, 'add', { @@ -190,7 +190,7 @@ export default class DataTransferItemList { return addItem(data, type, false); }; - } + }, }); } } diff --git a/src/client/sandbox/event/drag-and-drop/data-transfer-item.ts b/src/client/sandbox/event/drag-and-drop/data-transfer-item.ts index 7e8d2b170..d16cdd2f6 100644 --- a/src/client/sandbox/event/drag-and-drop/data-transfer-item.ts +++ b/src/client/sandbox/event/drag-and-drop/data-transfer-item.ts @@ -6,12 +6,12 @@ export default class DataTransferItem { constructor (kind, type, data) { nativeMethods.objectDefineProperty(this, 'kind', { enumerable: true, - get: () => kind + get: () => kind, }); nativeMethods.objectDefineProperty(this, 'type', { enumerable: true, - get: () => type + get: () => type, }); nativeMethods.objectDefineProperty(this, 'getAsString', { @@ -31,7 +31,7 @@ export default class DataTransferItem { nativeMethods.setTimeout.call(window, () => callback(data), 0); }; - } + }, }); nativeMethods.objectDefineProperty(this, 'getAsFile', { @@ -45,7 +45,7 @@ export default class DataTransferItem { return data; }; - } + }, }); } } diff --git a/src/client/sandbox/event/drag-and-drop/data-transfer.ts b/src/client/sandbox/event/drag-and-drop/data-transfer.ts index b29c1ef75..7708d2fd5 100644 --- a/src/client/sandbox/event/drag-and-drop/data-transfer.ts +++ b/src/client/sandbox/event/drag-and-drop/data-transfer.ts @@ -47,7 +47,7 @@ export default class DataTransfer { dropEffect = DROP_EFFECT[value]; return value; - } + }, }); nativeMethods.objectDefineProperty(this, 'effectAllowed', { @@ -60,7 +60,7 @@ export default class DataTransfer { effectAllowed = EFFECT_ALLOWED[value]; return value; - } + }, }); if (!isIE11) { @@ -68,7 +68,7 @@ export default class DataTransfer { configurable: true, enumerable: true, - get: getActualItemList + get: getActualItemList, }); } @@ -76,14 +76,14 @@ export default class DataTransfer { configurable: true, enumerable: true, - get: () => getActualItemListInternals().getTypes() + get: () => getActualItemListInternals().getTypes(), }); nativeMethods.objectDefineProperty(this, 'files', { configurable: true, enumerable: true, - get: () => fileList + get: () => fileList, }); if (!isIE11) { diff --git a/src/client/sandbox/event/drag-and-drop/drop-effect.ts b/src/client/sandbox/event/drag-and-drop/drop-effect.ts index 385c99843..08aa44057 100644 --- a/src/client/sandbox/event/drag-and-drop/drop-effect.ts +++ b/src/client/sandbox/event/drag-and-drop/drop-effect.ts @@ -3,5 +3,5 @@ export default { none: 'none', copy: 'copy', link: 'link', - move: 'move' + move: 'move', }; diff --git a/src/client/sandbox/event/drag-and-drop/effect-allowed.ts b/src/client/sandbox/event/drag-and-drop/effect-allowed.ts index 33aed00c4..3b2d0b5ee 100644 --- a/src/client/sandbox/event/drag-and-drop/effect-allowed.ts +++ b/src/client/sandbox/event/drag-and-drop/effect-allowed.ts @@ -8,5 +8,5 @@ export default { link: 'link', linkMove: 'linkMove', move: 'move', - all: 'all' + all: 'all', }; diff --git a/src/client/sandbox/event/drag-and-drop/file-list.ts b/src/client/sandbox/event/drag-and-drop/file-list.ts index 8a250ed9b..0685d9bc2 100644 --- a/src/client/sandbox/event/drag-and-drop/file-list.ts +++ b/src/client/sandbox/event/drag-and-drop/file-list.ts @@ -7,7 +7,7 @@ export default class FileList { nativeMethods.objectDefineProperty(this, 'length', { enumerable: true, - get: () => 0 + get: () => 0, }); nativeMethods.objectDefineProperty(this, 'item', { @@ -17,7 +17,7 @@ export default class FileList { return function () { return void 0; }; - } + }, }); } } diff --git a/src/client/sandbox/event/element-editing-watcher.ts b/src/client/sandbox/event/element-editing-watcher.ts index d92edb57e..5e41c9019 100644 --- a/src/client/sandbox/event/element-editing-watcher.ts +++ b/src/client/sandbox/event/element-editing-watcher.ts @@ -3,7 +3,7 @@ import { isTextEditableElementAndEditingAllowed, isShadowUIElement, isInputElement, - isTextAreaElement + isTextAreaElement, } from '../../utils/dom'; import EventSimulator from './simulator'; @@ -54,7 +54,7 @@ export default class ElementEditingWatcher { nativeMethods.objectDefineProperties(el, { [EDITING_OBSERVED_FLAG]: { value: true, configurable: true, writable: true }, - [PREVIOUS_VALUE_PROPERTY]: { value: ElementEditingWatcher._getValue(el), configurable: true, writable: true } + [PREVIOUS_VALUE_PROPERTY]: { value: ElementEditingWatcher._getValue(el), configurable: true, writable: true }, }); nativeMethods.addEventListener.call(el, 'blur', this._onBlur); diff --git a/src/client/sandbox/event/focus-blur.ts b/src/client/sandbox/event/focus-blur.ts index a289e9acb..215771c47 100644 --- a/src/client/sandbox/event/focus-blur.ts +++ b/src/client/sandbox/event/focus-blur.ts @@ -21,12 +21,12 @@ const PREVENT_FOCUS_ON_CHANGE = browserUtils.isChrome; const eventsMap = { bubbles: { 'focus': 'focusin', - 'blur': 'focusout' + 'blur': 'focusout', }, nonBubbles: { 'focusin': 'focus', - 'focusout': 'blur' - } + 'focusout': 'blur', + }, }; interface FocusBlurEventOptions { @@ -108,7 +108,7 @@ export default class FocusBlurSandbox extends SandboxBase { if (styleUtils.get(elementParent, 'overflow') === 'hidden') { scrollState.push({ element: elementParent, - state: styleUtils.getElementScroll(elementParent) + state: styleUtils.getElementScroll(elementParent), }); } } @@ -154,7 +154,7 @@ export default class FocusBlurSandbox extends SandboxBase { this._raiseEvent(parentWithTabIndex, 'focus', simulateEvent, { preventScrolling: needPreventScrolling, - forMouseEvent: options.forMouseEvent + forMouseEvent: options.forMouseEvent, }); } // NOTE: Some browsers don't change document.activeElement after calling element.blur() if a browser @@ -330,7 +330,7 @@ export default class FocusBlurSandbox extends SandboxBase { isAsync, forMouseEvent, preventScrolling, - relatedTarget: activeElement + relatedTarget: activeElement, }; this._raiseEvent(el, 'focus', () => { @@ -447,7 +447,7 @@ export default class FocusBlurSandbox extends SandboxBase { withoutHandlers, isAsync, relatedTarget, - focusedOnChange + focusedOnChange, }; this._raiseEvent(el, 'blur', () => { diff --git a/src/client/sandbox/event/index.ts b/src/client/sandbox/event/index.ts index 5cf79d86e..a65b1557f 100644 --- a/src/client/sandbox/event/index.ts +++ b/src/client/sandbox/event/index.ts @@ -120,7 +120,7 @@ export default class EventSandbox extends SandboxBase { sandbox.emit(sandbox.EVENT_PREVENTED_EVENT, this); return nativeMethods.preventDefault.call(this); - } + }, }; } diff --git a/src/client/sandbox/event/listeners.ts b/src/client/sandbox/event/listeners.ts index bacf73907..e5edfbf6a 100644 --- a/src/client/sandbox/event/listeners.ts +++ b/src/client/sandbox/event/listeners.ts @@ -13,7 +13,7 @@ const LISTENED_EVENTS = [ 'MSPointerDown', 'MSPointerMove', 'MSPointerOver', 'MSPointerOut', 'MSPointerUp', 'touchstart', 'touchmove', 'touchend', 'keydown', 'keypress', 'keyup', - 'change', 'focus', 'blur', 'focusin', 'focusout' + 'change', 'focus', 'blur', 'focusin', 'focusout', ]; const EVENT_SANDBOX_DISPATCH_EVENT_FLAG = 'hammerhead|event-sandbox-dispatch-event-flag'; @@ -198,7 +198,7 @@ export default class Listeners extends EventEmitter { listeners.emit(listeners.EVENT_LISTENER_DETACHED_EVENT, { el, listener, eventType }); return res; - } + }, }; } diff --git a/src/client/sandbox/event/listening-context.ts b/src/client/sandbox/event/listening-context.ts index 78b8ac202..feaacbaee 100644 --- a/src/client/sandbox/event/listening-context.ts +++ b/src/client/sandbox/event/listening-context.ts @@ -31,7 +31,7 @@ export function addListeningElement (el, events) { outerHandlers: [], outerHandlersWrapper: null, wrappers: [], - cancelOuterHandlers: false + cancelOuterHandlers: false, }; } } @@ -39,7 +39,7 @@ export function addListeningElement (el, events) { if (!isElementListening(el)) { nativeMethods.objectDefineProperty(el, ELEMENT_LISTENING_EVENTS_STORAGE_PROP, { value: elementCtx, - writable: true + writable: true, }); } } @@ -86,7 +86,7 @@ export function removeInternalBeforeHandler (el, events, handler) { export function wrapEventListener (eventCtx, listener, wrapper, useCapture) { eventCtx.outerHandlers.push({ fn: listener, - useCapture: useCapture || false + useCapture: useCapture || false, }); eventCtx.wrappers.push(wrapper); } diff --git a/src/client/sandbox/event/message.ts b/src/client/sandbox/event/message.ts index 26c54368b..a4a655327 100644 --- a/src/client/sandbox/event/message.ts +++ b/src/client/sandbox/event/message.ts @@ -97,7 +97,7 @@ export default class MessageSandbox extends SandboxBase { const originUrl = formatUrl({ /*eslint-disable no-restricted-properties*/ protocol: parsedDest.protocol, - host: parsedDest.host + host: parsedDest.host, /*eslint-enable no-restricted-properties*/ }); @@ -143,7 +143,7 @@ export default class MessageSandbox extends SandboxBase { // So, we need to define code instrumentation functions as 'configurable' so that they can be redefined. nativeMethods.objectDefineProperty(window, this.RECEIVE_MSG_FN, { value: onMessageHandler, - configurable: true + configurable: true, }); // @ts-ignore @@ -156,7 +156,7 @@ export default class MessageSandbox extends SandboxBase { return data.message; return data; - } + }, }); // @ts-ignore @@ -170,7 +170,7 @@ export default class MessageSandbox extends SandboxBase { nativeMethods.winOnMessageSetter.call(window, this.storedOnMessageHandler ? e => this._onWindowMessage(e, handler) : null); - } + }, }); } @@ -205,7 +205,7 @@ export default class MessageSandbox extends SandboxBase { // NOTE: Cloning a message to prevent this modification. data: parseJSON(stringifyJSON(message)), source: this.window, - ports + ports, }); } // eslint-disable-next-line no-empty @@ -242,7 +242,7 @@ export default class MessageSandbox extends SandboxBase { if (targetWindow) { this.sendServiceMsg({ cmd: this.pingCmd, - isPingRequest: true + isPingRequest: true, }, targetWindow); } }; diff --git a/src/client/sandbox/event/selection.ts b/src/client/sandbox/event/selection.ts index 1f8f659ab..c368aee17 100644 --- a/src/client/sandbox/event/selection.ts +++ b/src/client/sandbox/event/selection.ts @@ -61,7 +61,7 @@ export default class Selection { el[INTERNAL_PROPS.selection] = { selectionStart: el.selectionStart, selectionEnd: el.selectionEnd, - selectionDirection: el.selectionDirection + selectionDirection: el.selectionDirection, }; el.setAttribute('type', savedType); @@ -148,7 +148,7 @@ export default class Selection { return { start: internalSelection ? internalSelection.selectionStart : el.selectionStart, end: internalSelection ? internalSelection.selectionEnd : el.selectionEnd, - direction: internalSelection ? internalSelection.selectionDirection : el.selectionDirection + direction: internalSelection ? internalSelection.selectionDirection : el.selectionDirection, }; } diff --git a/src/client/sandbox/event/simulator.ts b/src/client/sandbox/event/simulator.ts index b006d7546..909ec9c12 100644 --- a/src/client/sandbox/event/simulator.ts +++ b/src/client/sandbox/event/simulator.ts @@ -14,7 +14,7 @@ const TOUCH_EVENT_FORCE = 0.5; const POINTER_EVENT_BUTTON = { noButton: -1, leftButton: 0, - rightButton: 2 + rightButton: 2, }; // NOTE: (IE11 only) 'MouseEvent.detail' value always equals 0 for 'click' and 'dblclick' events. @@ -23,7 +23,7 @@ const DEFAULT_MOUSE_EVENT_DETAIL_PROP_VALUE = { click: browserUtils.isIE ? 0 : 1, dblclick: browserUtils.isIE ? 0 : 2, mousedown: 1, - mouseup: 1 + mouseup: 1, }; const KEY_EVENT_NAME_RE = /^key\w+$/; @@ -52,7 +52,7 @@ const MOUSE_TO_POINTER_EVENT_TYPE_MAP = { const TOUCH_TO_POINTER_EVENT_TYPE_MAP = { touchstart: 'pointerdown', touchend: 'pointerup', - touchmove: 'pointermove' + touchmove: 'pointermove', }; const DISABLEABLE_HTML_ELEMENT_TYPE_CHECKERS = [ @@ -62,7 +62,7 @@ const DISABLEABLE_HTML_ELEMENT_TYPE_CHECKERS = [ domUtils.isOptGroupElement, domUtils.isOptionElement, domUtils.isSelectElement, - domUtils.isTextAreaElement + domUtils.isTextAreaElement, ]; export default class EventSimulator { @@ -93,13 +93,13 @@ export default class EventSimulator { nativeMethods.objectDefineProperty(ev, 'storageArea', { get: () => args.storageArea, - configurable: true + configurable: true, }); if (args.key === null) { nativeMethods.objectDefineProperty(ev, 'key', { get: () => null, - configurable: true + configurable: true, }); } @@ -152,7 +152,7 @@ export default class EventSimulator { cancelBubble: false, defaultPrevented: false, detail: args.detail, - view: args.view + view: args.view, }); } @@ -175,14 +175,14 @@ export default class EventSimulator { ctrlKey: options.ctrlKey || false, altKey: options.altKey || false, shiftKey: options.shiftKey || false, - metaKey: options.metaKey || false + metaKey: options.metaKey || false, }; } static _getStorageEventArgs (options: any = {}) { return extend(options, { canBubble: options.canBubble !== false, - cancelable: options.cancelable !== false + cancelable: options.cancelable !== false, }); } @@ -195,7 +195,7 @@ export default class EventSimulator { button: options.button === void 0 ? eventUtils.BUTTON.left : options.button, buttons: options.buttons === void 0 ? eventUtils.BUTTONS_PARAMETER.leftButton : options.buttons, relatedTarget: options.relatedTarget || null, - which: options.which + which: options.which, }); } @@ -203,7 +203,7 @@ export default class EventSimulator { const keyOptions: any = { keyCode: options.keyCode || 0, charCode: options.charCode || 0, - which: type === 'press' ? options.charCode : options.keyCode + which: type === 'press' ? options.charCode : options.keyCode, }; if ('keyIdentifier' in options) @@ -268,7 +268,7 @@ export default class EventSimulator { button: userOptions.button, which: userOptions.which, buttons: userOptions.buttons, - relatedTarget: userOptions.relatedTarget + relatedTarget: userOptions.relatedTarget, } : {}, options); @@ -298,7 +298,7 @@ export default class EventSimulator { opts = extend(opts, { key: userOptions.key || void 0, keyCode: userOptions.keyCode || 0, - charCode: userOptions.charCode || 0 + charCode: userOptions.charCode || 0, }); if ('keyIdentifier' in userOptions) @@ -330,7 +330,7 @@ export default class EventSimulator { clientY: options.clientY || 0, pageX: options.clientX || 0, pageY: options.clientY || 0, - identifier: this._getTouchIdentifier(type) + identifier: this._getTouchIdentifier(type), }); if (nativeMethods.documentCreateTouch) { @@ -356,7 +356,7 @@ export default class EventSimulator { rotationAngle: 0, radiusX: TOUCH_EVENT_RADIUS, radiusY: TOUCH_EVENT_RADIUS, - force: TOUCH_EVENT_FORCE + force: TOUCH_EVENT_FORCE, }); } @@ -399,7 +399,7 @@ export default class EventSimulator { if (browserUtils.isIE11 && prevWindowEvent) { nativeMethods.objectDefineProperty(curWindow, 'event', { get: () => prevWindowEvent, - configurable: true + configurable: true, }); } } @@ -422,7 +422,7 @@ export default class EventSimulator { metaKey: args.metaKey, keyCode: args.keyCode, charCode: args.charCode, - which: args.which + which: args.which, }; if ('keyIdentifier' in args) @@ -445,26 +445,26 @@ export default class EventSimulator { nativeMethods.objectDefineProperty(ev, 'keyCode', { configurable: true, enumerable: true, - get: () => args.keyCode + get: () => args.keyCode, }); nativeMethods.objectDefineProperty(ev, 'charCode', { configurable: true, enumerable: true, - get: () => args.charCode + get: () => args.charCode, }); nativeMethods.objectDefineProperty(ev, 'which', { configurable: true, enumerable: true, - get: () => args.which + get: () => args.which, }); if ('key' in args) { nativeMethods.objectDefineProperty(ev, 'key', { configurable: true, enumerable: true, - get: () => args.key + get: () => args.key, }); } @@ -472,7 +472,7 @@ export default class EventSimulator { nativeMethods.objectDefineProperty(ev, 'keyIdentifier', { configurable: true, enumerable: true, - get: () => args.keyIdentifier + get: () => args.keyIdentifier, }); } @@ -499,7 +499,7 @@ export default class EventSimulator { ev.preventDefault(); returnValue = value; - } + }, }); } @@ -520,14 +520,14 @@ export default class EventSimulator { if (MOUSE_TO_POINTER_EVENT_TYPE_MAP[type]) { return { eventType: MOUSE_TO_POINTER_EVENT_TYPE_MAP[type], - pointerType: 'mouse' + pointerType: 'mouse', }; } if (TOUCH_TO_POINTER_EVENT_TYPE_MAP[type]) { return { eventType: TOUCH_TO_POINTER_EVENT_TYPE_MAP[type], - pointerType: 'touch' + pointerType: 'touch', }; } @@ -547,7 +547,7 @@ export default class EventSimulator { const elBorders = getBordersWidth(el); const elClientPosition = offsetToClientCoords({ x: elPosition.left + elBorders.left, - y: elPosition.top + elBorders.top + y: elPosition.top + elBorders.top, }); const pointerArgs = extend({ @@ -560,7 +560,7 @@ export default class EventSimulator { pointerId: 1, pointerType, timeStamp: nativeMethods.dateNow(), - isPrimary: true + isPrimary: true, }, args); pointerArgs.type = eventType; @@ -586,16 +586,16 @@ export default class EventSimulator { // NOTE: After dispatching the pointer event, it doesn't contain the 'target' and 'relatedTarget' properties. nativeMethods.objectDefineProperty(pointEvent, 'target', { get: () => el, - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(pointEvent, 'relatedTarget', { get: () => args.relatedTarget, - configurable: true + configurable: true, }); nativeMethods.objectDefineProperty(pointEvent, 'buttons', { - get: () => args.buttons + get: () => args.buttons, }); } else { @@ -674,7 +674,7 @@ export default class EventSimulator { metaKey: args.metaKey, button: args.button, buttons: args.buttons, - relatedTarget: args.relatedTarget + relatedTarget: args.relatedTarget, }); } else { @@ -685,20 +685,20 @@ export default class EventSimulator { args.button, args.relatedTarget); nativeMethods.objectDefineProperty(event, 'buttons', { - get: () => args.buttons + get: () => args.buttons, }); } // NOTE: T188166 (act.hover triggers the mouseenter event with the "which" parameter set to 1). if (args.which !== void 0 && browserUtils.isWebKit) { nativeMethods.objectDefineProperty(event, 'which', { - get: () => args.which + get: () => args.which, }); } if (timeStamp && !browserUtils.isIE) { nativeMethods.objectDefineProperty(event, 'timeStamp', { - get: () => timeStamp + get: () => timeStamp, }); } @@ -706,7 +706,7 @@ export default class EventSimulator { nativeMethods.objectDefineProperty(event, 'dataTransfer', { configurable: true, enumerable: true, - get: () => dataTransfer + get: () => dataTransfer, }); } @@ -724,7 +724,7 @@ export default class EventSimulator { cancelable: false, cancelBubble: false, relatedTarget: relatedTarget, - defaultPrevented: false + defaultPrevented: false, }); } else if (nativeMethods.documentCreateEvent) { @@ -753,7 +753,7 @@ export default class EventSimulator { view: window, data: text, inputMethod: DOM_INPUT_METHOD_KEYBOARD, - locale: navigator.language + locale: navigator.language, }; event.initTextEvent(args.eventType, args.bubbles, args.cancelable, args.view, args.data, args.inputMethod, args.locale); @@ -773,7 +773,7 @@ export default class EventSimulator { composed: eventUtils.isComposedEvent(type), cancelable: true, view: window, - inputType: 'insertText' + inputType: 'insertText', } as InputEventInit; if (data !== void 0) @@ -820,7 +820,7 @@ export default class EventSimulator { // iframe's window.event object manually by using window.event (B254199). nativeMethods.objectDefineProperty(curWindow, 'event', { get: () => window.event, - configurable: true + configurable: true, }); } @@ -846,7 +846,7 @@ export default class EventSimulator { click (el, options) { return this._simulateEvent(el, 'click', options, { button: eventUtils.BUTTON.left, - buttons: eventUtils.BUTTONS_PARAMETER.noButton + buttons: eventUtils.BUTTONS_PARAMETER.noButton, }); } @@ -857,21 +857,21 @@ export default class EventSimulator { dblclick (el, options) { return this._simulateEvent(el, 'dblclick', options, { button: eventUtils.BUTTON.left, - buttons: eventUtils.BUTTONS_PARAMETER.noButton + buttons: eventUtils.BUTTONS_PARAMETER.noButton, }); } rightclick (el, options) { return this._simulateEvent(el, 'click', options, { button: eventUtils.BUTTON.right, - buttons: eventUtils.BUTTONS_PARAMETER.rightButton + buttons: eventUtils.BUTTONS_PARAMETER.rightButton, }); } contextmenu (el, options) { return this._simulateEvent(el, 'contextmenu', options, { button: eventUtils.BUTTON.right, - buttons: eventUtils.BUTTONS_PARAMETER.noButton + buttons: eventUtils.BUTTONS_PARAMETER.noButton, }); } @@ -890,7 +890,7 @@ export default class EventSimulator { return this._simulateEvent(el, 'mouseup', options, { button, - buttons: eventUtils.BUTTONS_PARAMETER.noButton + buttons: eventUtils.BUTTONS_PARAMETER.noButton, }); } diff --git a/src/client/sandbox/event/unload.ts b/src/client/sandbox/event/unload.ts index 3c6e411b2..af7a58873 100644 --- a/src/client/sandbox/event/unload.ts +++ b/src/client/sandbox/event/unload.ts @@ -31,7 +31,7 @@ export default class UnloadSandbox extends SandboxBase { storedHandler: null, nativeEventName: UnloadSandbox._getBeforeUnloadEventName(), eventName: this.BEFORE_UNLOAD_EVENT, - eventPropSetter: UnloadSandbox._getBeforeUnloadPropSetter() + eventPropSetter: UnloadSandbox._getBeforeUnloadPropSetter(), }; this.unloadProperties = { @@ -40,7 +40,7 @@ export default class UnloadSandbox extends SandboxBase { storedHandler: null, nativeEventName: 'unload', eventName: this.UNLOAD_EVENT, - eventPropSetter: nativeMethods.winOnUnloadSetter + eventPropSetter: nativeMethods.winOnUnloadSetter, }; } @@ -60,7 +60,7 @@ export default class UnloadSandbox extends SandboxBase { private _emitEvent (eventProperties: EventProperties): void { this.emit(eventProperties.eventName, { returnValue: eventProperties.storedReturnValue, - prevented: eventProperties.prevented + prevented: eventProperties.prevented, }); } @@ -87,7 +87,7 @@ export default class UnloadSandbox extends SandboxBase { eventProperties.storedReturnValue = UnloadSandbox._prepareStoredReturnValue(value); eventProperties.prevented = isFirefox ? value !== '' : true; - } + }, })); nativeMethods.objectDefineProperty(e, 'preventDefault', createPropertyDesc({ @@ -97,7 +97,7 @@ export default class UnloadSandbox extends SandboxBase { return true; }, - set: () => void 0 + set: () => void 0, })); // NOTE: need to pass `this` scope for https://github.com/DevExpress/testcafe/issues/6563 @@ -141,7 +141,7 @@ export default class UnloadSandbox extends SandboxBase { // @ts-ignore overrideDescriptor(eventPropsOwner, 'on' + eventProperties.nativeEventName, { getter: () => eventProperties.storedHandler, - setter: handler => this.setOnEvent(eventProperties, window, handler) + setter: handler => this.setOnEvent(eventProperties, window, handler), }); } diff --git a/src/client/sandbox/fetch.ts b/src/client/sandbox/fetch.ts index 31f5abd98..c14e8d0ba 100644 --- a/src/client/sandbox/fetch.ts +++ b/src/client/sandbox/fetch.ts @@ -12,7 +12,7 @@ import { addAuthorizationPrefix, hasAuthorizationPrefix, isAuthenticateHeader, isAuthorizationHeader, removeAuthenticatePrefix, - removeAuthorizationPrefix + removeAuthorizationPrefix, } from '../../utils/headers'; function getCredentialsMode (credentialsOpt: any) { @@ -147,13 +147,13 @@ export default class FetchSandbox extends SandboxBaseWithDelayedSettings { overrideDescriptor(window.Request.prototype, 'url', { getter: function (this: Request) { return getDestinationUrl(nativeMethods.requestUrlGetter.call(this)); - } + }, }); overrideDescriptor(window.Request.prototype, 'referrer', { getter: function (this: Request) { return getDestinationUrl(nativeMethods.requestReferrerGetter.call(this)); - } + }, }); overrideFunction(window, 'fetch', function (this: Window, ...args: Parameters) { @@ -189,7 +189,7 @@ export default class FetchSandbox extends SandboxBaseWithDelayedSettings { overrideDescriptor(window.Response.prototype, 'url', { getter: function () { return getDestinationUrl(nativeMethods.responseUrlGetter.call(this)); - } + }, }); overrideFunction(window.Headers.prototype, 'entries', FetchSandbox._entriesWrapper); diff --git a/src/client/sandbox/ie-debug.ts b/src/client/sandbox/ie-debug.ts index a9192beef..f4a9149dc 100644 --- a/src/client/sandbox/ie-debug.ts +++ b/src/client/sandbox/ie-debug.ts @@ -58,7 +58,7 @@ export default class IEDebugSandbox extends SandboxBase { set: fn => { wrapper = this._createFuncWrapper(fn); }, - get: () => wrapper + get: () => wrapper, }); } } diff --git a/src/client/sandbox/native-methods.ts b/src/client/sandbox/native-methods.ts index d3db46cb6..47fd8e580 100644 --- a/src/client/sandbox/native-methods.ts +++ b/src/client/sandbox/native-methods.ts @@ -1148,7 +1148,7 @@ class NativeMethods { log: win.console.log, warn: win.console.warn, error: win.console.error, - info: win.console.info + info: win.console.info, }; } diff --git a/src/client/sandbox/node/document/index.ts b/src/client/sandbox/node/document/index.ts index f8a4dd59a..04c74e8cd 100644 --- a/src/client/sandbox/node/document/index.ts +++ b/src/client/sandbox/node/document/index.ts @@ -184,7 +184,7 @@ export default class DocumentSandbox extends SandboxBase { writeln: function () { return documentSandbox._performDocumentWrite(this, arguments, true); - } + }, }; overrideFunction(window[nativeMethods.documentOpenPropOwnerName].prototype, 'open', overriddenMethods.open); @@ -235,7 +235,7 @@ export default class DocumentSandbox extends SandboxBase { overrideDescriptor(docPrototype, 'documentURI', { getter: function () { return getDestinationUrl(nativeMethods.documentDocumentURIGetter.call(this)); - } + }, }); } @@ -247,7 +247,7 @@ export default class DocumentSandbox extends SandboxBase { return getReferrer(); return isSpecialPage(referrer) ? '' : referrer; - } + }, }); DocumentSandbox._definePropertyDescriptor(docPrototype, htmlDocPrototype, 'referrer', referrerOverriddenDescriptor); @@ -256,7 +256,7 @@ export default class DocumentSandbox extends SandboxBase { getter: function () { // eslint-disable-next-line no-restricted-properties return LocationAccessorsInstrumentation.getLocationWrapper(this).href; - } + }, }); DocumentSandbox._definePropertyDescriptor(docPrototype, htmlDocPrototype, 'URL', urlOverriddenDescriptor); @@ -272,7 +272,7 @@ export default class DocumentSandbox extends SandboxBase { }, setter: value => { storedDomain = value; - } + }, }); DocumentSandbox._definePropertyDescriptor(domainPropertyOwner, htmlDocPrototype, 'domain', domainOverriddenDescriptor); @@ -282,14 +282,14 @@ export default class DocumentSandbox extends SandboxBase { const styleSheets = nativeMethods.documentStyleSheetsGetter.call(this); return documentSandbox._shadowUI._filterStyleSheetList(styleSheets, styleSheets.length); - } + }, }); const documentCookiePropOwnerPrototype = window[nativeMethods.documentCookiePropOwnerName].prototype; overrideDescriptor(documentCookiePropOwnerPrototype, 'cookie', { getter: () => documentSandbox._cookieSandbox.getCookie(), - setter: value => documentSandbox._cookieSandbox.setCookie(String(value)) + setter: value => documentSandbox._cookieSandbox.setCookie(String(value)), }); overrideDescriptor(docPrototype, 'activeElement', { @@ -300,7 +300,7 @@ export default class DocumentSandbox extends SandboxBase { return documentSandbox._shadowUI.getLastActiveElement() || this.body; return activeElement; - } + }, }); if (this._documentTitleStorageInitializer && !partialInitializationForNotLoadedIframe) { @@ -310,7 +310,7 @@ export default class DocumentSandbox extends SandboxBase { } , setter: function (value) { documentSandbox._documentTitleStorageInitializer.storage.setTitle(value); - } + }, }); } } diff --git a/src/client/sandbox/node/document/title-storage.ts b/src/client/sandbox/node/document/title-storage.ts index 8b973d01c..7a93a76d1 100644 --- a/src/client/sandbox/node/document/title-storage.ts +++ b/src/client/sandbox/node/document/title-storage.ts @@ -83,7 +83,7 @@ export default class DocumentTitleStorage extends EventEmitter { else nativeMethods.objectDefineProperty(element, INTERNAL_TITLE_PROP_NAME, { value, - writable: true + writable: true, }); } diff --git a/src/client/sandbox/node/document/writer.ts b/src/client/sandbox/node/document/writer.ts index ace5db9af..3928592a6 100644 --- a/src/client/sandbox/node/document/writer.ts +++ b/src/client/sandbox/node/document/writer.ts @@ -266,7 +266,7 @@ export default class DocumentWriter { htmlChunk = this._wrapHtmlChunk(htmlChunk); htmlChunk = htmlUtils.processHtml(htmlChunk, { prepareDom: container => this._prepareDom(container, isDocumentCleaned), - processedContext: this.window + processedContext: this.window, }); htmlChunk = this._unwrapHtmlChunk(htmlChunk); diff --git a/src/client/sandbox/node/element.ts b/src/client/sandbox/node/element.ts index b05f7133d..e7f500296 100644 --- a/src/client/sandbox/node/element.ts +++ b/src/client/sandbox/node/element.ts @@ -211,7 +211,7 @@ export default class ElementSandbox extends SandboxBase { nativeMethods.objectDefineProperty(el, INTERNAL_PROPS.currentBaseUrl, { value: urlResolver.getBaseUrl(document), configurable: true, - writable: true + writable: true, }); } } @@ -612,7 +612,7 @@ export default class ElementSandbox extends SandboxBase { if (args.length > 1 && html !== null && parent) { args[1] = processHtml(String(html), { parentTag: parent['tagName'], - processedContext: parent[INTERNAL_PROPS.processedContext] + processedContext: parent[INTERNAL_PROPS.processedContext], }); } @@ -836,7 +836,7 @@ export default class ElementSandbox extends SandboxBase { } return nativeMethods.registerElement.apply(this, args); - } + }, }; } @@ -1067,7 +1067,7 @@ export default class ElementSandbox extends SandboxBase { ElementSandbox._setProxiedSrc(this); nativeMethods.htmlElementOnloadSetter.call(this, handler); - } + }, }); } diff --git a/src/client/sandbox/node/index.ts b/src/client/sandbox/node/index.ts index 8075cee02..cdca9ca9e 100644 --- a/src/client/sandbox/node/index.ts +++ b/src/client/sandbox/node/index.ts @@ -53,7 +53,7 @@ export default class NodeSandbox extends SandboxBase { // NOTE: We need to define the property with the 'writable' descriptor for testing purposes nativeMethods.objectDefineProperty(document, INTERNAL_PROPS.documentCharset, { value: domUtils.parseDocumentCharset(), - writable: true + writable: true, }); this._documentTitleStorageInitializer = NodeSandbox._createDocumentTitleStorageInitializer(); @@ -98,7 +98,7 @@ export default class NodeSandbox extends SandboxBase { if (canAddNewProp || canUpdateExistingProp) { nativeMethods.objectDefineProperty(el, INTERNAL_PROPS.processedContext, { value: this.window, - writable: true + writable: true, }); } @@ -179,7 +179,7 @@ export default class NodeSandbox extends SandboxBase { this.processNodes(el, doc); }, - configurable: true + configurable: true, }); // NOTE: In some browsers (for example Firefox), the 'window.document' object is different when iframe is diff --git a/src/client/sandbox/node/live-node-list/html-collection-wrapper.ts b/src/client/sandbox/node/live-node-list/html-collection-wrapper.ts index 7f22a47d5..76526e5d7 100644 --- a/src/client/sandbox/node/live-node-list/html-collection-wrapper.ts +++ b/src/client/sandbox/node/live-node-list/html-collection-wrapper.ts @@ -31,7 +31,7 @@ export default class HTMLCollectionWrapper extends HTMLCollectionInheritor { _tagName: { value: tagName }, _version: { value: -Infinity, writable: true }, _namedProps: { value: ELEMENTS_WITH_NAME_ATTRIBUTE.indexOf(tagName) !== -1 ? [] : null }, - _lastNativeLength: { value: 0, writable: true } + _lastNativeLength: { value: 0, writable: true }, }); this._refreshCollection(); @@ -74,13 +74,13 @@ const additionalProtoMethods = { value: HTMLCollectionWrapper.constructor, configurable: true, enumerable: false, - writable: true + writable: true, }, _refreshCollection: { value: HTMLCollectionWrapper.prototype._refreshCollection, - enumerable: false - } + enumerable: false, + }, } as PropertyDescriptorMap; if (HTMLCollection.prototype.namedItem) { @@ -94,7 +94,7 @@ if (HTMLCollection.prototype.namedItem) { }, enumerable: true, configurable: true, - writable: true + writable: true, }; } @@ -109,7 +109,7 @@ function addShadowGetters (count: number) { nativeMethods.objectDefineProperty(HTMLCollectionWrapper.prototype, idx, { get: function () { this.item(idx); - } + }, }); } } @@ -124,7 +124,7 @@ function updateCollectionIndexGetters (wrapper: HTMLCollectionWrapper, oldLength nativeMethods.objectDefineProperty(wrapper, idx, { enumerable: true, configurable: true, - get: () => wrapper.item(idx) + get: () => wrapper.item(idx), }); } @@ -156,7 +156,7 @@ function updateNamedProps (wrapper: HTMLCollectionWrapper, oldNamedProps, curren this._refreshCollection(); return wrapper._collection[prop]; - } + }, }); } } diff --git a/src/client/sandbox/node/window.ts b/src/client/sandbox/node/window.ts index f965ec7a2..331cacce5 100644 --- a/src/client/sandbox/node/window.ts +++ b/src/client/sandbox/node/window.ts @@ -15,7 +15,7 @@ import { stringifyResourceType, resolveUrlAsDest, getDestinationUrl, - getScope + getScope, } from '../../utils/url'; import { @@ -24,7 +24,7 @@ import { isIE, isAndroid, isMSEdge, - version as browserVersion + version as browserVersion, } from '../../utils/browser'; import { @@ -42,7 +42,7 @@ import { isBodyElement, isHtmlElement, isTitleElement, - getFrameElement + getFrameElement, } from '../../utils/dom'; import { isPrimitiveType } from '../../utils/types'; @@ -304,7 +304,7 @@ export default class WindowSandbox extends SandboxBase { }, setter: function (this: HTMLElement, value) { windowSandbox.nodeSandbox.element.setAttributeCore(this, [attr, value]); - } + }, }); } } @@ -319,7 +319,7 @@ export default class WindowSandbox extends SandboxBase { }, setter: function (this: HTMLElement, value) { windowSandbox.nodeSandbox.element.setAttributeCore(this, [attr, value]); - } + }, }); } } @@ -332,7 +332,7 @@ export default class WindowSandbox extends SandboxBase { }, setter: function (this: HTMLElement, value) { setAnchorProperty(this, nativePropSetter, value); - } + }, }); } @@ -348,9 +348,9 @@ export default class WindowSandbox extends SandboxBase { this.listenersSandbox.emit(this.listenersSandbox.EVENT_LISTENER_ATTACHED_EVENT, { el: window, listener: handler, - eventType: eventName + eventType: eventName, }); - } + }, }); } @@ -575,7 +575,7 @@ export default class WindowSandbox extends SandboxBase { cmd: SET_BLOB_WORKER_SETTINGS, sessionId: settings.get().sessionId, windowId: settings.get().windowId, - origin: destLocation.getOriginHeader() + origin: destLocation.getOriginHeader(), }); } @@ -715,7 +715,7 @@ export default class WindowSandbox extends SandboxBase { currentScope: getScope(url), optsScope: getScope(opts && opts.scope), protocol: parsedProxyUrl.destResourceInfo.protocol, // eslint-disable-line no-restricted-properties - host: parsedProxyUrl.destResourceInfo.host // eslint-disable-line no-restricted-properties + host: parsedProxyUrl.destResourceInfo.host, // eslint-disable-line no-restricted-properties }, [channel.port1]); channel.port2.onmessage = (e) => { @@ -745,7 +745,7 @@ export default class WindowSandbox extends SandboxBase { if (typeof tagString === 'string') { args[0] = processHtml(tagString, { - processedContext: this.startContainer && this.startContainer[INTERNAL_PROPS.processedContext] + processedContext: this.startContainer && this.startContainer[INTERNAL_PROPS.processedContext], }); } @@ -900,7 +900,7 @@ export default class WindowSandbox extends SandboxBase { return parsedUrl.destUrl.replace(HTTP_PROTOCOL_RE, 'ws'); return url; - } + }, }); } } @@ -925,7 +925,7 @@ export default class WindowSandbox extends SandboxBase { } return origin; - } + }, }); overrideDescriptor(window.HTMLCollection.prototype, 'length', { @@ -936,7 +936,7 @@ export default class WindowSandbox extends SandboxBase { return windowSandbox.shadowUI.getShadowUICollectionLength(this, length); return length; - } + }, }); overrideDescriptor(window.NodeList.prototype, 'length', { @@ -947,7 +947,7 @@ export default class WindowSandbox extends SandboxBase { return windowSandbox.shadowUI.getShadowUICollectionLength(this, length); return length; - } + }, }); overrideDescriptor(window.Element.prototype, 'childElementCount', { @@ -960,7 +960,7 @@ export default class WindowSandbox extends SandboxBase { } return nativeMethods.elementChildElementCountGetter.call(this); - } + }, }); if (nativeMethods.performanceEntryNameGetter) { @@ -976,7 +976,7 @@ export default class WindowSandbox extends SandboxBase { } return name; - } + }, }); } @@ -986,7 +986,7 @@ export default class WindowSandbox extends SandboxBase { return UploadSandbox.getFiles(this); return nativeMethods.inputFilesGetter.call(this); - } + }, }); overrideDescriptor(window.HTMLInputElement.prototype, 'value', { @@ -1006,7 +1006,7 @@ export default class WindowSandbox extends SandboxBase { if (valueChanged && !isShadowUIElement(this) && isTextEditableElementAndEditingAllowed(this)) windowSandbox.elementEditingWatcher.restartWatchingElementEditing(this); - } + }, }); // NOTE: HTMLInputElement raises the `change` event on `disabled` only in Chrome @@ -1025,7 +1025,7 @@ export default class WindowSandbox extends SandboxBase { } nativeMethods.inputDisabledSetter.call(this, value); - } + }, }); } @@ -1040,7 +1040,7 @@ export default class WindowSandbox extends SandboxBase { windowSandbox.nodeSandbox.element.setAttributeCore(this, ['required', '']); else windowSandbox.nodeSandbox.element.removeAttributeCore(this, ['required']); - } + }, }); overrideDescriptor(window.HTMLTextAreaElement.prototype, 'value', { @@ -1050,7 +1050,7 @@ export default class WindowSandbox extends SandboxBase { if (!isShadowUIElement(this) && isTextEditableElementAndEditingAllowed(this)) windowSandbox.elementEditingWatcher.restartWatchingElementEditing(this); - } + }, }); this._overrideUrlAttrDescriptors('data', [window.HTMLObjectElement]); @@ -1063,21 +1063,21 @@ export default class WindowSandbox extends SandboxBase { window.HTMLMediaElement, window.HTMLInputElement, window.HTMLFrameElement, - window.HTMLIFrameElement + window.HTMLIFrameElement, ]); this._overrideUrlAttrDescriptors('action', [window.HTMLFormElement]); this._overrideUrlAttrDescriptors('formAction', [ window.HTMLInputElement, - window.HTMLButtonElement + window.HTMLButtonElement, ]); this._overrideUrlAttrDescriptors('href', [ window.HTMLAnchorElement, window.HTMLLinkElement, window.HTMLAreaElement, - window.HTMLBaseElement + window.HTMLBaseElement, ]); if (nativeMethods.htmlManifestGetter) @@ -1087,12 +1087,12 @@ export default class WindowSandbox extends SandboxBase { window.HTMLAnchorElement, window.HTMLFormElement, window.HTMLAreaElement, - window.HTMLBaseElement + window.HTMLBaseElement, ]); this._overrideAttrDescriptors('formTarget', [ window.HTMLInputElement, - window.HTMLButtonElement + window.HTMLButtonElement, ]); this._overrideAttrDescriptors('autocomplete', [window.HTMLInputElement]); @@ -1113,7 +1113,7 @@ export default class WindowSandbox extends SandboxBase { getter: null, setter: function (this: HTMLInputElement, value) { windowSandbox.nodeSandbox.element.setAttributeCore(this, ['type', value]); - } + }, }); overrideDescriptor(window.HTMLIFrameElement.prototype, 'sandbox', { @@ -1131,7 +1131,7 @@ export default class WindowSandbox extends SandboxBase { nativeMethods.objectDefineProperty(this, SANDBOX_DOM_TOKEN_LIST_UPDATE_FN, { value: function (value) { span.className = value; - } + }, }); } @@ -1142,7 +1142,7 @@ export default class WindowSandbox extends SandboxBase { if (this[SANDBOX_DOM_TOKEN_LIST_UPDATE_FN]) this[SANDBOX_DOM_TOKEN_LIST_UPDATE_FN](windowSandbox.nodeSandbox.element.getAttributeCore(this, ['sandbox']) || ''); - } + }, }); if (nativeMethods.iframeSrcdocGetter) { @@ -1152,7 +1152,7 @@ export default class WindowSandbox extends SandboxBase { }, setter: function (this: HTMLIFrameElement, value) { windowSandbox.nodeSandbox.element.setAttributeCore(this, ['srcdoc', value]); - } + }, }); } @@ -1170,12 +1170,12 @@ export default class WindowSandbox extends SandboxBase { if (!imageHref[CONTEXT_SVG_IMAGE_ELEMENT]) { nativeMethods.objectDefineProperty(imageHref, CONTEXT_SVG_IMAGE_ELEMENT, { value: this, - configurable: true + configurable: true, }); } return imageHref; - } + }, }); overrideDescriptor(window.SVGAnimatedString.prototype, 'baseVal', { @@ -1198,7 +1198,7 @@ export default class WindowSandbox extends SandboxBase { } nativeMethods.svgAnimStrBaseValSetter.call(this, value); - } + }, }); overrideDescriptor(window.SVGAnimatedString.prototype, 'animVal', { @@ -1209,28 +1209,28 @@ export default class WindowSandbox extends SandboxBase { return getDestinationUrl(animVal); return animVal; - } + }, }); if (nativeMethods.anchorOriginGetter) { overrideDescriptor(window.HTMLAnchorElement.prototype, 'origin', { getter: function (this: HTMLAnchorElement) { return getAnchorProperty(this, nativeMethods.anchorOriginGetter); - } + }, }); } overrideDescriptor(window.StyleSheet.prototype, 'href', { getter: function () { return getDestinationUrl(nativeMethods.styleSheetHrefGetter.call(this)); - } + }, }); if (nativeMethods.cssStyleSheetHrefGetter) { overrideDescriptor(window.CSSStyleSheet.prototype, 'href', { getter: function () { return getDestinationUrl(nativeMethods.cssStyleSheetHrefGetter.call(this)); - } + }, }); } @@ -1238,7 +1238,7 @@ export default class WindowSandbox extends SandboxBase { overrideDescriptor(window.Node.prototype, 'baseURI', { getter: function () { return getDestinationUrl(nativeMethods.nodeBaseURIGetter.call(this)); - } + }, }); } @@ -1268,7 +1268,7 @@ export default class WindowSandbox extends SandboxBase { return windowSandbox.shadowUI.getFirstChild(this); return nativeMethods.nodeFirstChildGetter.call(this); - } + }, }); overrideDescriptor(window.Element.prototype, 'firstElementChild', { @@ -1277,7 +1277,7 @@ export default class WindowSandbox extends SandboxBase { return windowSandbox.shadowUI.getFirstElementChild(this); return nativeMethods.elementFirstElementChildGetter.call(this); - } + }, }); overrideDescriptor(window.Node.prototype, 'lastChild', { @@ -1286,7 +1286,7 @@ export default class WindowSandbox extends SandboxBase { return windowSandbox.shadowUI.getLastChild(this); return nativeMethods.nodeLastChildGetter.call(this); - } + }, }); overrideDescriptor(window.Element.prototype, 'lastElementChild', { @@ -1295,31 +1295,31 @@ export default class WindowSandbox extends SandboxBase { return windowSandbox.shadowUI.getLastElementChild(this); return nativeMethods.elementLastElementChildGetter.call(this); - } + }, }); overrideDescriptor(window.Node.prototype, 'nextSibling', { getter: function () { return windowSandbox.shadowUI.getNextSibling(this); - } + }, }); overrideDescriptor(window.Node.prototype, 'previousSibling', { getter: function () { return windowSandbox.shadowUI.getPrevSibling(this); - } + }, }); overrideDescriptor(window.Element.prototype, 'nextElementSibling', { getter: function () { return windowSandbox.shadowUI.getNextElementSibling(this); - } + }, }); overrideDescriptor(window.Element.prototype, 'previousElementSibling', { getter: function () { return windowSandbox.shadowUI.getPrevElementSibling(this); - } + }, }); overrideDescriptor(window[nativeMethods.elementHTMLPropOwnerName].prototype, 'innerHTML', { @@ -1357,7 +1357,7 @@ export default class WindowSandbox extends SandboxBase { else { processedValue = processHtml(processedValue, { parentTag: el.tagName, - processedContext: el[INTERNAL_PROPS.processedContext] + processedContext: el[INTERNAL_PROPS.processedContext], }); } } @@ -1404,7 +1404,7 @@ export default class WindowSandbox extends SandboxBase { if (isHtmlElement(el) || isBodyElement(el)) nativeMethods.setTimeout.call(window, () => windowSandbox.nodeMutation.onBodyContentChanged(el), 0); } - } + }, }); overrideDescriptor(window[nativeMethods.elementHTMLPropOwnerName].prototype, 'outerHTML', { @@ -1425,7 +1425,7 @@ export default class WindowSandbox extends SandboxBase { nativeMethods.elementOuterHTMLSetter.call(el, processHtml(String(value), { parentTag: parentEl && parentEl['tagName'], - processedContext: el[INTERNAL_PROPS.processedContext] + processedContext: el[INTERNAL_PROPS.processedContext], })); windowSandbox._setSandboxedTextForTitleElements(parentEl); @@ -1445,7 +1445,7 @@ export default class WindowSandbox extends SandboxBase { } else nativeMethods.elementOuterHTMLSetter.call(el, value); - } + }, }); overrideDescriptor(window.HTMLElement.prototype, 'innerText', { @@ -1469,7 +1469,7 @@ export default class WindowSandbox extends SandboxBase { DOMMutationTracker.onChildrenChanged(this); nativeMethods.htmlElementInnerTextSetter.call(this, processedValue); - } + }, }); overrideDescriptor(window.HTMLScriptElement.prototype, 'text', { @@ -1482,7 +1482,7 @@ export default class WindowSandbox extends SandboxBase { const processedValue = value ? processScript(String(value), true, false, convertToProxyUrl) : value; nativeMethods.scriptTextSetter.call(this, processedValue); - } + }, }); overrideDescriptor(window.HTMLAnchorElement.prototype, 'text', { @@ -1497,7 +1497,7 @@ export default class WindowSandbox extends SandboxBase { DOMMutationTracker.onChildrenChanged(this); nativeMethods.anchorTextSetter.call(this, processedValue); - } + }, }); overrideDescriptor(window.Node.prototype, 'textContent', { @@ -1521,13 +1521,13 @@ export default class WindowSandbox extends SandboxBase { DOMMutationTracker.onChildrenChanged(this); nativeMethods.nodeTextContentSetter.call(this, processedValue); - } + }, }); overrideDescriptor(window[nativeMethods.elementAttributesPropOwnerName].prototype, 'attributes', { getter: function () { return getAttributes(this); - } + }, }); overrideFunction(window.DOMTokenList.prototype, 'add', this._createOverriddenDOMTokenListMethod(nativeMethods.tokenListAdd)); @@ -1560,7 +1560,7 @@ export default class WindowSandbox extends SandboxBase { if (tokenListOwner) // eslint-disable-next-line no-restricted-properties windowSandbox.nodeSandbox.element.setAttributeCore(tokenListOwner, ['sandbox', this.value]); - } + }, }); } @@ -1577,7 +1577,7 @@ export default class WindowSandbox extends SandboxBase { const originNextSibling = nativeMethods.mutationRecordNextSiblingGetter.call(this); return windowSandbox.shadowUI.getMutationRecordNextSibling(originNextSibling); - } + }, }); overrideDescriptor(window.MutationRecord.prototype, 'previousSibling', { @@ -1585,7 +1585,7 @@ export default class WindowSandbox extends SandboxBase { const originPrevSibling = nativeMethods.mutationRecordPrevSiblingGetter.call(this); return windowSandbox.shadowUI.getMutationRecordPrevSibling(originPrevSibling); - } + }, }); if (nativeMethods.windowOriginGetter) { @@ -1616,7 +1616,7 @@ export default class WindowSandbox extends SandboxBase { setter: function (this: Window, value) { return nativeMethods.windowOriginSetter.call(this, value); - } + }, }); } @@ -1627,7 +1627,7 @@ export default class WindowSandbox extends SandboxBase { }, setter: function (this: HTMLTitleElement, value) { windowSandbox._documentTitleStorageInitializer.storage.setTitleElementPropertyValue(this, value); - } + }, }); } } diff --git a/src/client/sandbox/shadow-ui.ts b/src/client/sandbox/shadow-ui.ts index e56220510..08c1c55e9 100644 --- a/src/client/sandbox/shadow-ui.ts +++ b/src/client/sandbox/shadow-ui.ts @@ -95,7 +95,7 @@ export default class ShadowUI extends SandboxBase { if (elContextWindow !== window) { this._messageSandbox.sendServiceMsg({ - cmd: this.BODY_CONTENT_CHANGED_COMMAND + cmd: this.BODY_CONTENT_CHANGED_COMMAND, }, elContextWindow); } else @@ -134,12 +134,12 @@ export default class ShadowUI extends SandboxBase { } nativeMethods.objectDefineProperty(filteredList, 'item', { - value: index => index >= filteredList.length ? null : filteredList[index] + value: index => index >= filteredList.length ? null : filteredList[index], }); if (list.namedItem) { nativeMethods.objectDefineProperty(filteredList, 'namedItem', { - value: name => list.namedItem(name) + value: name => list.namedItem(name), }); } @@ -224,7 +224,7 @@ export default class ShadowUI extends SandboxBase { return sandbox._filterNodeList(list, length); }; - } + }, }; } diff --git a/src/client/sandbox/storages/index.ts b/src/client/sandbox/storages/index.ts index d7259f2e2..64f6fd815 100644 --- a/src/client/sandbox/storages/index.ts +++ b/src/client/sandbox/storages/index.ts @@ -9,7 +9,7 @@ import { createOverriddenDescriptor, overrideConstructor, overrideDescriptor, - overrideFunction + overrideFunction, } from '../../utils/overriding'; import hammerhead from '../../index'; import Listeners from '../event/listeners'; @@ -118,7 +118,7 @@ export default class StorageSandbox extends SandboxBase { if (storedArea) { nativeMethods.objectDefineProperty(event, 'storageArea', { get: () => storedArea, - set: () => void 0 + set: () => void 0, }); } @@ -143,7 +143,7 @@ export default class StorageSandbox extends SandboxBase { backup (): StoragesBackup { return { localStorage: stringifyJSON(this.localStorageProxy.unwrapProxy().getCurrentState()), - sessionStorage: stringifyJSON(this.sessionStorageProxy.unwrapProxy().getCurrentState()) + sessionStorage: stringifyJSON(this.sessionStorageProxy.unwrapProxy().getCurrentState()), }; } @@ -215,7 +215,7 @@ export default class StorageSandbox extends SandboxBase { getter: function (this: StorageWrapper) { return nativeMethods.objectKeys(this).length }, - setter: null + setter: null, }); } @@ -238,7 +238,7 @@ export default class StorageSandbox extends SandboxBase { this.localStorageProxy.unwrapProxy().setContext(window); return this.localStorageProxy; - } + }, }), 'sessionStorage': createOverriddenDescriptor(storagesPropsOwner, 'sessionStorage', { @@ -247,8 +247,8 @@ export default class StorageSandbox extends SandboxBase { this.sessionStorageProxy.unwrapProxy().setContext(window); return this.sessionStorageProxy; - } - }) + }, + }), }); } diff --git a/src/client/sandbox/storages/wrapper.ts b/src/client/sandbox/storages/wrapper.ts index 9f2a8b0b1..f26f758f1 100644 --- a/src/client/sandbox/storages/wrapper.ts +++ b/src/client/sandbox/storages/wrapper.ts @@ -41,7 +41,7 @@ class StorageWrapper extends StorageInheritor { ctx: window, lastState: null, eventEmitter: new EventEmitter(), - nativeStorage, nativeStorageKey + nativeStorage, nativeStorageKey, }); this.loadStorage(); @@ -76,7 +76,7 @@ class StorageWrapper extends StorageInheritor { target['removeItem'](key); return true; - } + }, }) as StorageProxy; } @@ -215,7 +215,7 @@ for (const method of ourMethods) { value: StorageWrapper.prototype[method], configurable: false, enumerable: false, - writable: false + writable: false, }); } diff --git a/src/client/sandbox/style.ts b/src/client/sandbox/style.ts index 48ded6849..799f81d1a 100644 --- a/src/client/sandbox/style.ts +++ b/src/client/sandbox/style.ts @@ -101,7 +101,7 @@ export default class StyleSandbox extends SandboxBase { value = styleProcessor.process(value, getProxyUrl); nativeMethods.styleSetProperty.call(this, dashedProp, value); - } + }, }); } @@ -120,7 +120,7 @@ export default class StyleSandbox extends SandboxBase { value = styleProcessor.process(value, getProxyUrl); nativeMethods.styleSetProperty.call(this, dashedProp, value); - } + }, }); } @@ -165,7 +165,7 @@ export default class StyleSandbox extends SandboxBase { target[prop] = value; return true; - } + }, }); this.nativeMethods.objectDefineProperty(style, CSS_STYLE_PROXY_OBJECT, { value: proxyObject }); @@ -213,7 +213,7 @@ export default class StyleSandbox extends SandboxBase { const processedCss = styleProcessor.process(value, getProxyUrl); nativeMethods.htmlElementStyleSetter.call(this, processedCss); - } : null + } : null, }); if (this.FEATURES.css2PropertiesProtoContainsAllProps) { @@ -247,7 +247,7 @@ export default class StyleSandbox extends SandboxBase { value = styleProcessor.process(value, getProxyUrl); nativeMethods.styleCssTextSetter.call(this, value); - } + }, }); overrideFunction(window.CSSStyleSheet.prototype, 'insertRule', function (this: CSSStyleSheet, rule, index) { diff --git a/src/client/sandbox/upload/file-list-wrapper.ts b/src/client/sandbox/upload/file-list-wrapper.ts index 5bbc23482..c6812519c 100644 --- a/src/client/sandbox/upload/file-list-wrapper.ts +++ b/src/client/sandbox/upload/file-list-wrapper.ts @@ -5,7 +5,7 @@ export default class FileListWrapper { constructor (fileList) { nativeMethods.objectDefineProperty(this, 'length', { - get: () => fileList.length + get: () => fileList.length, }); for (let i = 0; i < fileList.length; i++) @@ -44,7 +44,7 @@ export default class FileListWrapper { if (!window.Blob) { wrapper = { size: fileInfo.info.size, - type: fileInfo.info.type + type: fileInfo.info.type, }; } else if (fileInfo.blob) { diff --git a/src/client/sandbox/upload/hidden-info.ts b/src/client/sandbox/upload/hidden-info.ts index f73fb878f..2b231d299 100644 --- a/src/client/sandbox/upload/hidden-info.ts +++ b/src/client/sandbox/upload/hidden-info.ts @@ -48,7 +48,7 @@ export function addInputInfo (input, fileList, value) { files.push({ name: file.name, type: file.type, - data: file.base64 + data: file.base64, }); } @@ -57,7 +57,7 @@ export function addInputInfo (input, fileList, value) { id: input.id, name: input.name, files: files, - value: value + value: value, }; if (inputInfoIndex === -1) diff --git a/src/client/sandbox/upload/info-manager.ts b/src/client/sandbox/upload/info-manager.ts index d167c20c0..843355b5b 100644 --- a/src/client/sandbox/upload/info-manager.ts +++ b/src/client/sandbox/upload/info-manager.ts @@ -57,7 +57,7 @@ export default class UploadInfoManager { loadFilesInfoFromServer (filePaths: string | string[]) { return this._transport.asyncServiceMsg({ cmd: COMMAND.getUploadedFiles, - filePaths: typeof filePaths === 'string' ? [filePaths] : filePaths + filePaths: typeof filePaths === 'string' ? [filePaths] : filePaths, } as GetUploadedFilesServiceMessage); } @@ -74,7 +74,7 @@ export default class UploadInfoManager { return { errs: errs, - fileList: new FileListWrapper(validFilesInfo) + fileList: new FileListWrapper(validFilesInfo), }; } @@ -82,7 +82,7 @@ export default class UploadInfoManager { return this._transport.asyncServiceMsg({ cmd: COMMAND.uploadFiles, data: UploadInfoManager._getFileListData(fileList), - fileNames: fileNames + fileNames: fileNames, } as StoreUploadedFilesServiceMessage); } @@ -137,7 +137,7 @@ export default class UploadInfoManager { fileReader.addEventListener('load', (e: ProgressEvent) => { const info: any = { type: file.type, - name: file.name + name: file.name, }; if (typeof file.lastModified === 'number') @@ -151,7 +151,7 @@ export default class UploadInfoManager { readedFiles.push({ data: dataUrl.substr(dataUrl.indexOf(',') + 1), blob: file.slice(0, file.size), - info + info, }); if (fileList[++index]) { diff --git a/src/client/sandbox/xhr.ts b/src/client/sandbox/xhr.ts index 64c7a0f07..febf280b1 100644 --- a/src/client/sandbox/xhr.ts +++ b/src/client/sandbox/xhr.ts @@ -10,7 +10,7 @@ import { addAuthorizationPrefix, hasAuthenticatePrefix, isAuthenticateHeader, isAuthorizationHeader, - removeAuthenticatePrefix + removeAuthenticatePrefix, } from '../../utils/headers'; const XHR_READY_STATES = ['UNSENT', 'OPENED', 'HEADERS_RECEIVED', 'LOADING', 'DONE']; @@ -36,7 +36,7 @@ export default class XhrSandbox extends SandboxBaseWithDelayedSettings { XhrSandbox.REQUESTS_OPTIONS.set(req, { withCredentials, openArgs: args, - headers: [] + headers: [], }); } @@ -121,7 +121,7 @@ export default class XhrSandbox extends SandboxBaseWithDelayedSettings { overrideConstructor(window, 'XMLHttpRequest', xmlHttpRequestWrapper); nativeMethods.objectDefineProperty(xmlHttpRequestProto, 'constructor', { - value: xmlHttpRequestWrapper + value: xmlHttpRequestWrapper, }); overrideFunction(xmlHttpRequestProto, 'abort', function (this: XMLHttpRequest, ...args: Parameters) { @@ -131,7 +131,7 @@ export default class XhrSandbox extends SandboxBaseWithDelayedSettings { nativeMethods.xhrAbort.apply(this, args); xhrSandbox.emit(xhrSandbox.XHR_ERROR_EVENT, { err: new Error('XHR aborted'), - xhr: this + xhr: this, }); }); @@ -196,7 +196,7 @@ export default class XhrSandbox extends SandboxBaseWithDelayedSettings { overrideDescriptor(window.XMLHttpRequest.prototype, 'responseURL', { getter: function () { return getDestinationUrl(nativeMethods.xhrResponseURLGetter.call(this)); - } + }, }); } diff --git a/src/client/settings.ts b/src/client/settings.ts index 7d60d97d2..c50b4cbab 100644 --- a/src/client/settings.ts +++ b/src/client/settings.ts @@ -16,7 +16,7 @@ class Settings { cookie: '', allowMultipleWindows: false, isRecordMode: false, - windowId: '' + windowId: '', }; } diff --git a/src/client/transport/index.ts b/src/client/transport/index.ts index 23d8768bc..47d451c8c 100644 --- a/src/client/transport/index.ts +++ b/src/client/transport/index.ts @@ -28,7 +28,7 @@ export default class Transport extends TransportLegacy { this._transportWorker.postMessage({ cmd: SET_INITIAL_WORKER_SETTINGS_CMD, sessionId: settings.get().sessionId, - serviceMsgUrl: settings.get().serviceMsgUrl + serviceMsgUrl: settings.get().serviceMsgUrl, } as InitialWorkerSettings); this._transportWorker.addEventListener('message', (e: Event) => this._onWorkerMessage(e as MessageEvent)); diff --git a/src/client/utils/cookie.ts b/src/client/utils/cookie.ts index 5cb14b02d..d6e0de62c 100644 --- a/src/client/utils/cookie.ts +++ b/src/client/utils/cookie.ts @@ -22,7 +22,7 @@ export function parse (str) { const parsedCookie: any = { key: keyValueParsingResult[1] ? trim(keyValueParsingResult[2]) : '', - value: trim(keyValueParsingResult[3]) + value: trim(keyValueParsingResult[3]), }; if (firstSemicolonIdx === -1) diff --git a/src/client/utils/destination-location.ts b/src/client/utils/destination-location.ts index e9d638410..755e3c3cd 100644 --- a/src/client/utils/destination-location.ts +++ b/src/client/utils/destination-location.ts @@ -111,7 +111,7 @@ function parseLocationThroughAnchor (url: string) { host: destPort ? nativeMethods.anchorHostGetter.call(resolver) : hostname, pathname: pathname, hash: resolver.hash, - search: nativeMethods.anchorSearchGetter.call(resolver) + search: nativeMethods.anchorSearchGetter.call(resolver), }; } @@ -126,7 +126,7 @@ function parseLocationThroughURL (url: string) { host: parsedUrl.host, pathname: parsedUrl.pathname, hash: parsedUrl.hash, - search: parsedUrl.search + search: parsedUrl.search, }; /* eslint-enable no-restricted-properties */ } diff --git a/src/client/utils/dom.ts b/src/client/utils/dom.ts index 8553b9e47..0ea17302b 100644 --- a/src/client/utils/dom.ts +++ b/src/client/utils/dom.ts @@ -13,7 +13,7 @@ let scrollbarSize = 0; const NATIVE_MAP_ELEMENT_STRINGS = [ '[object HTMLMapElement]', - '[object HTMLAreaElement]' + '[object HTMLAreaElement]', ]; const WINDOW_IS_UNDEFINED = typeof window === 'undefined'; @@ -147,7 +147,7 @@ export function getIframeLocation (iframe) { return { documentLocation: parsedProxyDocumentLocation ? parsedProxyDocumentLocation.destUrl : documentLocation, - srcLocation: parsedProxySrcLocation ? parsedProxySrcLocation.destUrl : srcLocation + srcLocation: parsedProxySrcLocation ? parsedProxySrcLocation.destUrl : srcLocation, }; } diff --git a/src/client/utils/event.ts b/src/client/utils/event.ts index 0e81bde41..8e8906c6e 100644 --- a/src/client/utils/event.ts +++ b/src/client/utils/event.ts @@ -15,33 +15,33 @@ const COMPOSED_EVENTS = [ 'beforeinput', 'input', 'keydown', - 'keyup' + 'keyup', ]; export const BUTTON = { left: 0, middle: 1, - right: 2 + right: 2, }; export const BUTTONS_PARAMETER = { noButton: 0, leftButton: 1, - rightButton: 2 + rightButton: 2, }; export const WHICH_PARAMETER = { noButton: 0, leftButton: 1, middleButton: 2, - rightButton: 3 + rightButton: 3, }; export const KEYBOARD_MODIFIERS_PARAMETER = { altKey: 'Alt', ctrlKey: 'Control', shiftKey: 'Shift', - metaKey: 'Meta' + metaKey: 'Meta', }; export const DOM_EVENTS = [ @@ -54,7 +54,7 @@ export const DOM_EVENTS = [ 'MSPointerDown', 'MSPointerMove', 'MSPointerOver', 'MSPointerOut', 'MSPointerUp', 'pointerdown', 'pointermove', 'pointerover', 'pointerout', 'pointerup', 'pointerenter', 'pointerleave', 'dragstart', 'drop', - 'focusin', 'focusout' + 'focusin', 'focusout', ]; export function preventDefault (ev, allowBubbling?: boolean) { diff --git a/src/client/utils/get-mime-type.ts b/src/client/utils/get-mime-type.ts index 0ec314370..6adeb0917 100644 --- a/src/client/utils/get-mime-type.ts +++ b/src/client/utils/get-mime-type.ts @@ -7,124 +7,124 @@ const IMAGE_TYPE_PATTERNS = [ { mime: 'image/x-icon', pattern: [0x00, 0x00, 0x01, 0x00], - mask: [0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'image/x-icon', pattern: [0x00, 0x00, 0x02, 0x00], - mask: [0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'image/bmp', pattern: [0x42, 0x4D], - mask: [0xFF, 0xFF] + mask: [0xFF, 0xFF], }, { mime: 'image/gif', pattern: [0x47, 0x49, 0x46, 0x38, 0x37, 0x61], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'image/gif', pattern: [0x47, 0x49, 0x46, 0x38, 0x39, 0x61], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'image/webp', pattern: [0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x45, 0x42, 0x50, 0x56, 0x50], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'image/png', pattern: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'image/jpeg', pattern: [0xFF, 0xD8, 0xFF], - mask: [0xFF, 0xFF, 0xFF] - } + mask: [0xFF, 0xFF, 0xFF], + }, ]; const AUDIO_VIDEO_TYPE_PATTERNS = [ { mime: 'audio/basic', pattern: [0x2E, 0x73, 0x6E, 0x64], - mask: [0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'audio/aiff', pattern: [0x46, 0x4F, 0x52, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x41, 0x49, 0x46, 0x46], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'audio/mpeg', pattern: [0x49, 0x44, 0x33], - mask: [0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF], }, { mime: 'application/ogg', pattern: [0x4F, 0x67, 0x67, 0x53, 0x00], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'audio/midi', pattern: [0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'video/avi', pattern: [0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x41, 0x56, 0x49, 0x20], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'audio/wave', pattern: [0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF] - } + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF], + }, ]; const FONT_TYPE_PATTERNS = [ { mime: 'application/vnd.ms-fontobject', pattern: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x50], - mask: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF] + mask: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF], }, { mime: 'application/octet-stream', // TrueType font does not have an assigned MIME type pattern: [0x00, 0x01, 0x00, 0x00], - mask: [0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'application/octet-stream', // OpenType font does not have an assigned MIME type pattern: [0x4F, 0x54, 0x54, 0x4F], - mask: [0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'application/octet-stream', // TrueType Collection pattern: [0x74, 0x74, 0x63, 0x66], - mask: [0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'application/font-woff', pattern: [0x77, 0x4F, 0x46, 0x46], - mask: [0xFF, 0xFF, 0xFF, 0xFF] - } + mask: [0xFF, 0xFF, 0xFF, 0xFF], + }, ]; const ARCHIVE_TYPE_PATTERNS = [ { mime: 'application/x-gzip', pattern: [0x1F, 0x8B, 0x08], - mask: [0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF], }, { mime: 'application/zip', pattern: [0x50, 0x4B, 0x03, 0x04], - mask: [0xFF, 0xFF, 0xFF, 0xFF] + mask: [0xFF, 0xFF, 0xFF, 0xFF], }, { mime: 'application/x-rar-compressed', pattern: [0x52, 0x61, 0x72, 0x20, 0x1A, 0x07, 0x00], - mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] - } + mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], + }, ]; function matchPattern (pattern, data) { diff --git a/src/client/utils/global-context-info.ts b/src/client/utils/global-context-info.ts index 6fe440db6..01d8e2663 100644 --- a/src/client/utils/global-context-info.ts +++ b/src/client/utils/global-context-info.ts @@ -5,5 +5,5 @@ export default { isInWorker, global, - isServiceWorker: isInWorker && !global.XMLHttpRequest + isServiceWorker: isInWorker && !global.XMLHttpRequest, } diff --git a/src/client/utils/overriding.ts b/src/client/utils/overriding.ts index 34b690b1a..79c8490f4 100644 --- a/src/client/utils/overriding.ts +++ b/src/client/utils/overriding.ts @@ -70,7 +70,7 @@ function overrideFunctionName (fn: Function, name: string): void { function overrideToString (nativeFnWrapper: Function, nativeFn: Function): void { nativeMethods.objectDefineProperty(nativeFnWrapper, INTERNAL_PROPS.nativeStrRepresentation, { value: nativeMethods.Function.prototype.toString.call(nativeFn), - configurable: true + configurable: true, }); } diff --git a/src/client/utils/position.ts b/src/client/utils/position.ts index 8496f0a06..b50f04464 100644 --- a/src/client/utils/position.ts +++ b/src/client/utils/position.ts @@ -35,7 +35,7 @@ function getAreaElementRectangle (el, mapContainer) { height: coords[3] - coords[1], left: coords[0], top: coords[1], - width: coords[2] - coords[0] + width: coords[2] - coords[0], }; } @@ -47,7 +47,7 @@ function getAreaElementRectangle (el, mapContainer) { height: coords[2] * 2, left: coords[0] - coords[2], top: coords[1] - coords[2], - width: coords[2] * 2 + width: coords[2] * 2, }; } @@ -104,7 +104,7 @@ function getMapElementRectangle (el) { height: 0, left: 0, top: 0, - width: 0 + width: 0, }; } @@ -126,7 +126,7 @@ function getSelectChildRectangle (el) { top: selectRectangle.top + selectBorders.top + styleUtils.getElementPadding(select).top + optionVisibleIndex * optionHeight, - width: selectRectangle.width - (selectBorders.left + selectBorders.right) - selectRightScrollbar + width: selectRectangle.width - (selectBorders.left + selectBorders.right) - selectRightScrollbar, }; } @@ -141,7 +141,7 @@ function getSvgElementRelativeRectangle (el) { height: !isSvgTextElement ? boundingClientRect.height : el.offsetHeight, left: boundingClientRect.left + (document.body.scrollLeft || document.documentElement.scrollLeft), top: boundingClientRect.top + (document.body.scrollTop || document.documentElement.scrollTop), - width: !isSvgTextElement ? boundingClientRect.width : el.offsetWidth + width: !isSvgTextElement ? boundingClientRect.width : el.offsetWidth, }; if (isSvgTextElement) { @@ -154,7 +154,7 @@ function getSvgElementRelativeRectangle (el) { height: elementRect.height || boundingClientRect.height, left: offsetParentIsBody ? el.offsetLeft || elOffset.left : offsetParentOffset.left + el.offsetLeft, top: offsetParentIsBody ? el.offsetTop || elOffset.top : offsetParentOffset.top + el.offsetTop, - width: elementRect.width || boundingClientRect.width + width: elementRect.width || boundingClientRect.width, }; } @@ -214,7 +214,7 @@ export function getElementRectangle (el) { height: relativeRectangle.height, left: elementOffset.left, top: elementOffset.top, - width: relativeRectangle.width + width: relativeRectangle.width, }; } @@ -253,7 +253,7 @@ function calcOffsetPosition (el, borders, offsetPosition) { return { left: isSvg ? relativeRectangle.left + borders.left : offsetPosition.left + borders.left, - top: isSvg ? relativeRectangle.top + borders.top : offsetPosition.top + borders.top + top: isSvg ? relativeRectangle.top + borders.top : offsetPosition.top + borders.top, }; } @@ -273,19 +273,19 @@ function calcOffsetPositionInIframe (el, borders, offsetPosition, doc, currentIf clientPosition = { x: relativeRectangle.left - (document.body.scrollLeft || document.documentElement.scrollLeft) + borders.left, - y: relativeRectangle.top - (document.body.scrollTop || document.documentElement.scrollTop) + borders.top + y: relativeRectangle.top - (document.body.scrollTop || document.documentElement.scrollTop) + borders.top, }; } else { clientPosition = offsetToClientCoords({ x: offsetPosition.left + borders.left, - y: offsetPosition.top + borders.top + y: offsetPosition.top + borders.top, }, doc); } return { left: iframeOffset.left + clientPosition.x + iframePadding.left, - top: iframeOffset.top + clientPosition.y + iframePadding.top + top: iframeOffset.top + clientPosition.y + iframePadding.top, }; } @@ -295,7 +295,7 @@ export function getOffsetPosition (el, roundFn = Math.round) { return { left: rectangle.left, - top: rectangle.top + top: rectangle.top, }; } @@ -311,7 +311,7 @@ export function getOffsetPosition (el, roundFn = Math.round) { // but there’s no way to access its body. const borders = doc.body ? styleUtils.getBordersWidth(doc.body) : { left: 0, - top: 0 + top: 0, }; const calcOffsetPositionFn = !isInIframe || !currentIframe ? calcOffsetPosition : calcOffsetPositionInIframe; @@ -338,6 +338,6 @@ export function offsetToClientCoords (coords, currentDocument?: Document) { return { x: coords.x - scrollLeft, - y: coords.y - scrollTop + y: coords.y - scrollTop, }; } diff --git a/src/client/utils/style.ts b/src/client/utils/style.ts index c61011f56..589d79aa3 100644 --- a/src/client/utils/style.ts +++ b/src/client/utils/style.ts @@ -33,7 +33,7 @@ export function getBordersWidth (el) { bottom: getIntValue(get(el, 'borderBottomWidth')), left: getIntValue(get(el, 'borderLeftWidth')), right: getIntValue(get(el, 'borderRightWidth')), - top: getIntValue(get(el, 'borderTopWidth')) + top: getIntValue(get(el, 'borderTopWidth')), }; } @@ -54,7 +54,7 @@ export function getElementMargin (el) { bottom: getIntValue(get(el, 'marginBottom')), left: getIntValue(get(el, 'marginLeft')), right: getIntValue(get(el, 'marginRight')), - top: getIntValue(get(el, 'marginTop')) + top: getIntValue(get(el, 'marginTop')), }; } @@ -63,7 +63,7 @@ export function getElementPadding (el) { bottom: getIntValue(get(el, 'paddingBottom')), left: getIntValue(get(el, 'paddingLeft')), right: getIntValue(get(el, 'paddingRight')), - top: getIntValue(get(el, 'paddingTop')) + top: getIntValue(get(el, 'paddingTop')), }; } @@ -82,7 +82,7 @@ export function getElementScroll (el: any): ScrollState { return { left: getScrollLeft(targetEl), - top: getScrollTop(targetEl) + top: getScrollTop(targetEl), }; } @@ -307,7 +307,7 @@ export function getOffset (el) { if (!docElement.contains(el) || el === docElement) { return { top: clientRect.top, - left: clientRect.left + left: clientRect.left, }; } @@ -321,7 +321,7 @@ export function getOffset (el) { return { top: clientRect.top + scrollTop - clientTop, - left: clientRect.left + scrollLeft - clientLeft + left: clientRect.left + scrollLeft - clientLeft, }; } diff --git a/src/client/utils/url-resolver.ts b/src/client/utils/url-resolver.ts index a422197fc..8fb8c60f1 100644 --- a/src/client/utils/url-resolver.ts +++ b/src/client/utils/url-resolver.ts @@ -25,7 +25,7 @@ export default { if (!doc[DOCUMENT_URL_RESOLVER]) { nativeMethods.objectDefineProperty(doc, DOCUMENT_URL_RESOLVER, { value: this._createResolver(doc), - writable: true + writable: true, }); } @@ -112,5 +112,5 @@ export default { dispose (doc) { doc[DOCUMENT_URL_RESOLVER] = null; - } + }, }; diff --git a/src/client/utils/url.ts b/src/client/utils/url.ts index a35adf1aa..f5d6145d1 100644 --- a/src/client/utils/url.ts +++ b/src/client/utils/url.ts @@ -27,7 +27,7 @@ export const DEFAULT_PROXY_SETTINGS = (function () { return { hostname: proxyLocation.hostname, port: proxyLocation.port.toString(), - protocol: proxyLocation.protocol + protocol: proxyLocation.protocol, }; /*eslint-enable no-restricted-properties*/ })(); @@ -99,7 +99,7 @@ export let getProxyUrl = function (url: string, opts?): string { resourceType, charset, reqOrigin, - credentials + credentials, }); } @@ -146,7 +146,7 @@ export let getProxyUrl = function (url: string, opts?): string { charset, reqOrigin, windowId, - credentials + credentials, }); } @@ -182,7 +182,7 @@ export function getNavigationUrl (url: string, win) { export let getCrossDomainIframeProxyUrl = function (url: string) { return getProxyUrl(url, { proxyPort: settings.get().crossDomainProxyPort, - resourceType: sharedUrlUtils.getResourceTypeString({ isIframe: true }) + resourceType: sharedUrlUtils.getResourceTypeString({ isIframe: true }), }); } @@ -247,7 +247,7 @@ export let convertToProxyUrl = function (url: string, resourceType, charset, isC return getProxyUrl(url, { resourceType, charset, // eslint-disable-next-line no-restricted-properties - proxyPort: isCrossDomain ? settings.get().crossDomainProxyPort : DEFAULT_PROXY_SETTINGS.port + proxyPort: isCrossDomain ? settings.get().crossDomainProxyPort : DEFAULT_PROXY_SETTINGS.port, }); } @@ -278,7 +278,7 @@ export function changeDestUrlPart (proxyUrl: string, nativePropSetter, value, re /*eslint-enable no-restricted-properties*/ sessionId, - resourceType + resourceType, }); } diff --git a/src/index.ts b/src/index.ts index 2a32ce4a5..72a6316c1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,5 +29,5 @@ export default { responseMockSetBodyMethod, RequestEvent, ConfigureResponseEvent, - ResponseEvent + ResponseEvent, }; diff --git a/src/messages.ts b/src/messages.ts index 4ec723f4e..389ceefac 100644 --- a/src/messages.ts +++ b/src/messages.ts @@ -10,9 +10,9 @@ export const MESSAGE = { cantReadFile: 'Failed to read a file at {url} because of the error:\n\n{message}', nodeError: { 'HPE_HEADER_OVERFLOW': 'The request header\'s size is {headerSize} bytes which exceeds the set limit.\nIt causes an internal Node.js error on parsing this header.\nTo fix the problem, you need to add the \'--max-http-header-size=...\' flag to the \'NODE_OPTIONS\' environment variable:\n\nmacOS, Linux (bash, zsh)\nexport NODE_OPTIONS=\'--max-http-header-size={recommendedMaxHeaderSize}\'\n\nWindows (powershell)\n$env:NODE_OPTIONS=\'--max-http-header-size={recommendedMaxHeaderSize}\'\n\nWindows (cmd)\nset NODE_OPTIONS="--max-http-header-size={recommendedMaxHeaderSize}"\n\nand then start your tests.', - 'HPE_INVALID_HEADER_TOKEN': 'The request contains a header that doesn\'t comply with the specification https://tools.ietf.org/html/rfc7230#section-3.2.4.\nIt causes an internal Node.js error on parsing this header.\n\nInvalid characters:\n{invalidChars}\n\nTo fix the problem, you can add the \'--insecure-http-parser\' flag to the \'NODE_OPTIONS\' environment variable:\n\nmacOS, Linux (bash, zsh)\nexport NODE_OPTIONS=\'--insecure-http-parser\'\n\nWindows (powershell)\n$env:NODE_OPTIONS=\'--insecure-http-parser\'\n\nWindows (cmd)\nset NODE_OPTIONS="--insecure-http-parser"\n\nand then start your tests.' + 'HPE_INVALID_HEADER_TOKEN': 'The request contains a header that doesn\'t comply with the specification https://tools.ietf.org/html/rfc7230#section-3.2.4.\nIt causes an internal Node.js error on parsing this header.\n\nInvalid characters:\n{invalidChars}\n\nTo fix the problem, you can add the \'--insecure-http-parser\' flag to the \'NODE_OPTIONS\' environment variable:\n\nmacOS, Linux (bash, zsh)\nexport NODE_OPTIONS=\'--insecure-http-parser\'\n\nWindows (powershell)\n$env:NODE_OPTIONS=\'--insecure-http-parser\'\n\nWindows (cmd)\nset NODE_OPTIONS="--insecure-http-parser"\n\nand then start your tests.', }, - invalidHeaderCharacter: 'Character with code "{charCode}" in header "{name}" {location} at index {index}' + invalidHeaderCharacter: 'Character with code "{charCode}" in header "{name}" {location} at index {index}', }; export function getText (template: string, parameters: Partial>): string { diff --git a/src/processing/dom/attributes.ts b/src/processing/dom/attributes.ts index bf972d397..e7a17ff95 100644 --- a/src/processing/dom/attributes.ts +++ b/src/processing/dom/attributes.ts @@ -9,14 +9,14 @@ export const URL_ATTR_TAGS = { action: ['form'], formaction: ['button', 'input'], manifest: ['html'], - data: ['object'] + data: ['object'], }; export const URL_ATTRS = ['href', 'src', 'action', 'formaction', 'manifest', 'data']; export const TARGET_ATTR_TAGS = { target: ['a', 'form', 'area', 'base'], - formtarget: ['input', 'button'] + formtarget: ['input', 'button'], }; export const TARGET_ATTRS = ['target', 'formtarget']; diff --git a/src/processing/dom/base-dom-adapter.ts b/src/processing/dom/base-dom-adapter.ts index f0796a6c2..a806634c7 100644 --- a/src/processing/dom/base-dom-adapter.ts +++ b/src/processing/dom/base-dom-adapter.ts @@ -13,7 +13,7 @@ export default abstract class BaseDomAdapter { 'onpointerdown', 'onpointerup', 'onpointercancel', 'onpointermove', 'onpointerover', 'onpointerout', 'onpointerenter', 'onpointerleave', 'ongotpointercapture', 'onlostpointercapture', 'onmspointerdown', 'onmspointerup', 'onmspointercancel', 'onmspointermove', 'onmspointerover', - 'onmspointerout', 'onmspointerenter', 'onmspointerleave', 'onmsgotpointercapture', 'onmslostpointercapture' + 'onmspointerout', 'onmspointerenter', 'onmspointerleave', 'onmsgotpointercapture', 'onmslostpointercapture', ]; abstract removeAttr (el: HTMLElement | ASTNode, attr: string): void; diff --git a/src/processing/dom/index.ts b/src/processing/dom/index.ts index 89ab0d878..0a7e53334 100644 --- a/src/processing/dom/index.ts +++ b/src/processing/dom/index.ts @@ -15,7 +15,7 @@ import { parseUrl, isSpecialPage, isSupportedProtocol, - processMetaRefreshContent + processMetaRefreshContent, } from '../../utils/url'; import trim from '../../utils/string-trim'; import BUILTIN_HEADERS from '../../request-pipeline/builtin-header-names'; @@ -35,7 +35,7 @@ const SVG_XLINK_HREF_TAGS = [ 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'mpath', 'set', //animation elements 'linearGradient', 'radialGradient', 'stop', //gradient elements 'a', 'altglyph', 'color-profile', 'cursor', 'feimage', 'filter', 'font-face-uri', 'glyphref', 'image', - 'mpath', 'pattern', 'script', 'textpath', 'use', 'tref' + 'mpath', 'pattern', 'script', 'textpath', 'use', 'tref', ]; const INTEGRITY_ATTR_TAGS = ['script', 'link']; @@ -195,68 +195,68 @@ export default class DomProcessor { SVG_XLINK_HREF_TAGS.indexOf(adapter.getTagName(el)) !== -1; }, - IS_SVG_ELEMENT_WITH_XML_BASE_ATTR: (el: HTMLElement) => adapter.isSVGElement(el) && adapter.hasAttr(el, 'xml:base') + IS_SVG_ELEMENT_WITH_XML_BASE_ATTR: (el: HTMLElement) => adapter.isSVGElement(el) && adapter.hasAttr(el, 'xml:base'), }; return [ { selector: selectors.HAS_FORMTARGET_ATTR, targetAttr: 'formtarget', - elementProcessors: [this._processTargetBlank] + elementProcessors: [this._processTargetBlank], }, { selector: selectors.HAS_HREF_ATTR, urlAttr: 'href', targetAttr: 'target', - elementProcessors: [this._processTargetBlank, this._processUrlAttrs, this._processUrlJsAttr] + elementProcessors: [this._processTargetBlank, this._processUrlAttrs, this._processUrlJsAttr], }, { selector: selectors.HAS_SRC_ATTR, urlAttr: 'src', targetAttr: 'target', - elementProcessors: [this._processTargetBlank, this._processUrlAttrs, this._processUrlJsAttr] + elementProcessors: [this._processTargetBlank, this._processUrlAttrs, this._processUrlJsAttr], }, { selector: selectors.HAS_ACTION_ATTR, urlAttr: 'action', targetAttr: 'target', - elementProcessors: [this._processTargetBlank, this._processUrlAttrs, this._processUrlJsAttr] + elementProcessors: [this._processTargetBlank, this._processUrlAttrs, this._processUrlJsAttr], }, { selector: selectors.HAS_FORMACTION_ATTR, urlAttr: 'formaction', targetAttr: 'formtarget', - elementProcessors: [this._processUrlAttrs, this._processUrlJsAttr] + elementProcessors: [this._processUrlAttrs, this._processUrlJsAttr], }, { selector: selectors.HAS_MANIFEST_ATTR, urlAttr: 'manifest', - elementProcessors: [this._processUrlAttrs, this._processUrlJsAttr] + elementProcessors: [this._processUrlAttrs, this._processUrlJsAttr], }, { selector: selectors.HAS_DATA_ATTR, urlAttr: 'data', - elementProcessors: [this._processUrlAttrs, this._processUrlJsAttr] + elementProcessors: [this._processUrlAttrs, this._processUrlJsAttr], }, { selector: selectors.HAS_SRCDOC_ATTR, - elementProcessors: [this._processSrcdocAttr] + elementProcessors: [this._processSrcdocAttr], }, { selector: selectors.HTTP_EQUIV_META, urlAttr: 'content', - elementProcessors: [this._processMetaElement] + elementProcessors: [this._processMetaElement], }, { selector: selectors.IS_SCRIPT, - elementProcessors: [this._processScriptElement, this._processIntegrityAttr] + elementProcessors: [this._processScriptElement, this._processIntegrityAttr], }, { selector: selectors.ALL, elementProcessors: [this._processStyleAttr] }, { selector: selectors.IS_LINK, relAttr: 'rel', - elementProcessors: [this._processIntegrityAttr, this._processRelPrefetch] + elementProcessors: [this._processIntegrityAttr, this._processRelPrefetch], }, { selector: selectors.IS_STYLE, elementProcessors: [this._processStylesheetElement] }, { selector: selectors.IS_INPUT, elementProcessors: [this._processAutoComplete] }, @@ -266,13 +266,13 @@ export default class DomProcessor { { selector: selectors.IS_SVG_ELEMENT_WITH_XLINK_HREF_ATTR, urlAttr: 'xlink:href', - elementProcessors: [this._processSVGXLinkHrefAttr, this._processUrlAttrs] + elementProcessors: [this._processSVGXLinkHrefAttr, this._processUrlAttrs], }, { selector: selectors.IS_SVG_ELEMENT_WITH_XML_BASE_ATTR, urlAttr: 'xml:base', - elementProcessors: [this._processUrlAttrs] - } + elementProcessors: [this._processUrlAttrs], + }, ]; } @@ -304,7 +304,7 @@ export default class DomProcessor { isForm: tagName === 'form' || tagName === 'input' || tagName === 'button', isScript: tagName === 'script', isHtmlImport: tagName === 'link' && this._getRelAttribute(el) === 'import', - isObject: tagName === 'object' + isObject: tagName === 'object', }); } @@ -459,7 +459,7 @@ export default class DomProcessor { if (attrValue) { this._processJsAttr(el, events[i], { isJsProtocol: DomProcessor.isJsProtocol(attrValue), - isEventAttr: true + isEventAttr: true, }); } } diff --git a/src/processing/dom/internal-attributes.ts b/src/processing/dom/internal-attributes.ts index eea135925..714e825f4 100644 --- a/src/processing/dom/internal-attributes.ts +++ b/src/processing/dom/internal-attributes.ts @@ -7,5 +7,5 @@ export default { storedAttrPostfix: '-hammerhead-stored-value', hoverPseudoClass: 'data-hammerhead-hovered', focusPseudoClass: 'data-hammerhead-focused', - uploadInfoHiddenInputName: 'hammerhead|upload-info-hidden-input-name' + uploadInfoHiddenInputName: 'hammerhead|upload-info-hidden-input-name', }; diff --git a/src/processing/dom/internal-properties.ts b/src/processing/dom/internal-properties.ts index 257a441dd..404d900fe 100644 --- a/src/processing/dom/internal-properties.ts +++ b/src/processing/dom/internal-properties.ts @@ -17,5 +17,5 @@ export default { cachedImage: 'hammerhead|image|cached-image', sandboxIsReattached: 'hammerhead|sandbox-is-reattached', nativeStrRepresentation: 'hammerhead|native-string-representation', - currentBaseUrl: 'hammerhead|current-base-url' + currentBaseUrl: 'hammerhead|current-base-url', }; diff --git a/src/processing/dom/namespaces.ts b/src/processing/dom/namespaces.ts index b66e22154..29c2f5095 100644 --- a/src/processing/dom/namespaces.ts +++ b/src/processing/dom/namespaces.ts @@ -6,5 +6,5 @@ export const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink'; export const NAMESPACE_PREFIX_MAP = { xml: XML_NAMESPACE, xlink: XLINK_NAMESPACE, - xmlns: XMLNS_NAMESPACE + xmlns: XMLNS_NAMESPACE, }; diff --git a/src/processing/encoding/charset.ts b/src/processing/encoding/charset.ts index 09b2f0327..4627b7408 100644 --- a/src/processing/encoding/charset.ts +++ b/src/processing/encoding/charset.ts @@ -17,18 +17,18 @@ interface CharsetBOM { const CHARSET_BOM_LIST: CharsetBOM[] = [ { charset: 'utf-8', - bom: Buffer.from([0xEF, 0xBB, 0xBF]) + bom: Buffer.from([0xEF, 0xBB, 0xBF]), }, { charset: 'utf-16le', - bom: Buffer.from([0xFF, 0xFE]) + bom: Buffer.from([0xFF, 0xFE]), }, { charset: 'utf-16be', - bom: Buffer.from([0xFE, 0xFF]) - } + bom: Buffer.from([0xFE, 0xFF]), + }, ]; enum CharsetPriority { diff --git a/src/processing/encoding/index.ts b/src/processing/encoding/index.ts index 4f37c31b8..dd05077e5 100644 --- a/src/processing/encoding/index.ts +++ b/src/processing/encoding/index.ts @@ -27,7 +27,7 @@ const enum CONTENT_ENCODING { // GH-1915 const GZIP_DECODING_OPTIONS = { flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH + finishFlush: zlib.Z_SYNC_FLUSH, }; // NOTE: https://github.com/DevExpress/testcafe-hammerhead/issues/2743 @@ -37,8 +37,8 @@ const GZIP_DECODING_OPTIONS = { const BROTLI_DECODING_OPTIONS = { params: { - [zlib.constants.BROTLI_PARAM_QUALITY]: 5 - } + [zlib.constants.BROTLI_PARAM_QUALITY]: 5, + }, }; // NOTE: IIS has a bug when it sends 'raw deflate' compressed data for the 'Deflate' Accept-Encoding header. diff --git a/src/processing/encoding/labels.ts b/src/processing/encoding/labels.ts index 12e4966d6..a39e99673 100644 --- a/src/processing/encoding/labels.ts +++ b/src/processing/encoding/labels.ts @@ -41,7 +41,7 @@ const ENCODING_LABELS = { 'replacement': ['csiso2022kr', 'hz-gb-2312', 'iso-2022-cn', 'iso-2022-cn-ext', 'iso-2022-kr'], 'utf-16be': ['utf-16be'], 'utf-16le': ['utf-16', 'utf-16le'], - 'x-user-defined': ['x-user-defined'] + 'x-user-defined': ['x-user-defined'], }; const LOOKUP_TABLE = Object.keys(ENCODING_LABELS).reduce((table, encoding) => { diff --git a/src/processing/resources/page.ts b/src/processing/resources/page.ts index ff7276ef6..972132671 100644 --- a/src/processing/resources/page.ts +++ b/src/processing/resources/page.ts @@ -57,7 +57,7 @@ class PageProcessor extends ResourceProcessorBase { stylesheets: ctx.getInjectableStyles(), scripts: ctx.getInjectableScripts(), urlReplacer: urlReplacer, - isIframeWithImageSrc: ctx.contentInfo && ctx.contentInfo.isIframeWithImageSrc + isIframeWithImageSrc: ctx.contentInfo && ctx.contentInfo.isIframeWithImageSrc, }; } @@ -68,7 +68,7 @@ class PageProcessor extends ResourceProcessorBase { metas.push({ httpEquiv: domAdapter.getAttr(metaEls[i], 'http-equiv'), content: domAdapter.getAttr(metaEls[i], 'content'), - charset: domAdapter.getAttr(metaEls[i], 'charset') + charset: domAdapter.getAttr(metaEls[i], 'charset'), }); } @@ -84,7 +84,7 @@ class PageProcessor extends ResourceProcessorBase { { name: 'rel', value: 'stylesheet' }, { name: 'type', value: 'text/css' }, { name: 'class', value: SHADOW_UI_CLASSNAME.uiStylesheet }, - { name: 'href', value: stylesheetUrl } + { name: 'href', value: stylesheetUrl }, ])); }); @@ -96,7 +96,7 @@ class PageProcessor extends ResourceProcessorBase { { name: 'type', value: 'text/javascript' }, { name: 'class', value: SHADOW_UI_CLASSNAME.script }, { name: 'charset', value: 'UTF-8' }, - { name: 'src', value: scriptUrl } + { name: 'src', value: scriptUrl }, ])); }); } @@ -110,7 +110,7 @@ class PageProcessor extends ResourceProcessorBase { private static _getTaskScriptNodeIndex (head: ASTNode, ctx: RequestPipelineContext): number { const taskScriptUrls = [ ctx.resolveInjectableUrl(SERVICE_ROUTES.task), - ctx.resolveInjectableUrl(SERVICE_ROUTES.iframeTask) + ctx.resolveInjectableUrl(SERVICE_ROUTES.iframeTask), ]; return parse5Utils.findNodeIndex(head, node => { @@ -142,7 +142,7 @@ class PageProcessor extends ResourceProcessorBase { private static _addCharsetInfo (head: ASTNode, charset: string): void { parse5Utils.unshiftElement(parse5Utils.createElement('meta', [ { name: 'class', value: SHADOW_UI_CLASSNAME.charset }, - { name: 'charset', value: charset } + { name: 'charset', value: charset }, ]), head); } diff --git a/src/processing/resources/script.ts b/src/processing/resources/script.ts index ff7d6735f..b7e6dac8d 100644 --- a/src/processing/resources/script.ts +++ b/src/processing/resources/script.ts @@ -14,7 +14,7 @@ class ScriptResourceProcessor extends ResourceProcessorBase { this.jsCache = new LRUCache({ max: 50 * 1024 * 1024, // NOTE: Max cache size is 50 MBytes. - length: n => n.length // NOTE: 1 char ~ 1 byte. + length: n => n.length, // NOTE: 1 char ~ 1 byte. }); } diff --git a/src/processing/script/destructuring.ts b/src/processing/script/destructuring.ts index 415c36292..062e1ad6c 100644 --- a/src/processing/script/destructuring.ts +++ b/src/processing/script/destructuring.ts @@ -6,7 +6,7 @@ import { AssignmentPattern, AssignmentProperty, Identifier, - CallExpression + CallExpression, } from 'estree'; import { Syntax } from 'esotope-hammerhead'; import { @@ -18,7 +18,7 @@ import { createMemberExpression, createSimpleCallExpression, createSimpleLiteral, - createUndefined + createUndefined, } from './node-builder'; import TempVariables from './transformers/temp-variables'; import INSTRUCTION from './instruction'; diff --git a/src/processing/script/index.ts b/src/processing/script/index.ts index 872275d86..5e8a4e3cd 100644 --- a/src/processing/script/index.ts +++ b/src/processing/script/index.ts @@ -26,12 +26,12 @@ const PROCESSED_SCRIPT_RE = new RegExp([ reEscape(INSTRUCTION.processScript), reEscape(INSTRUCTION.processHtml), reEscape(INSTRUCTION.getPostMessage), - reEscape(INSTRUCTION.getProxyUrl) + reEscape(INSTRUCTION.getProxyUrl), ].join('|')); const PARSING_OPTIONS = { allowReturnOutsideFunction: true, allowImportExportEverywhere: true, - ecmaVersion: 13 + ecmaVersion: 13, }; // Code pre/post-processing @@ -92,8 +92,8 @@ function getCode (ast: Node, src: string): string { format: { quotes: 'double', escapeless: true, - compact: true - } + compact: true, + }, }); return src ? removeTrailingSemicolon(code, src) : code; diff --git a/src/processing/script/instruction.ts b/src/processing/script/instruction.ts index 7487acb1a..e40bb0d30 100644 --- a/src/processing/script/instruction.ts +++ b/src/processing/script/instruction.ts @@ -18,5 +18,5 @@ export default { arrayFrom: '__arrayFrom$', restObject: '__rest$Object', - swScopeHeaderValue: '__swScopeHeaderValue' + swScopeHeaderValue: '__swScopeHeaderValue', }; diff --git a/src/processing/script/instrumented.ts b/src/processing/script/instrumented.ts index b40884a38..c9efeba5d 100644 --- a/src/processing/script/instrumented.ts +++ b/src/processing/script/instrumented.ts @@ -7,12 +7,12 @@ export const METHODS = [ 'postMessage', 'replace', - 'assign' + 'assign', ]; export const PROPERTIES = [ 'href', - 'location' + 'location', ]; const INSTRUMENTED_METHOD_RE = new RegExp(`^(${METHODS.join('|')})$`); diff --git a/src/processing/script/node-builder.ts b/src/processing/script/node-builder.ts index 205ade8aa..804361981 100644 --- a/src/processing/script/node-builder.ts +++ b/src/processing/script/node-builder.ts @@ -31,7 +31,7 @@ import { FunctionExpression, ConditionalExpression, UnaryOperator, - UnaryExpression + UnaryExpression, } from 'estree'; import { Syntax } from 'esotope-hammerhead'; import INSTRUCTION from './instruction'; @@ -146,7 +146,7 @@ export function createLocationSetWrapper (locationIdentifier: Identifier, value: const callIdentifier = createIdentifier('call'); const functionWrapper = createFunctionExpression(null, [], createBlockStatement([ createVariableDeclaration('var', [createVariableDeclarator(tempIdentifier, value)]), - createReturnStatement(createLogicalExpression(setLocationCall, '||', locationAssignment)) + createReturnStatement(createLogicalExpression(setLocationCall, '||', locationAssignment)), ])); const functionWrapperCallMember = createMemberExpression(functionWrapper, callIdentifier, false); const functionWrapperCall = createSimpleCallExpression(functionWrapperCallMember, [createThisExpression()]); diff --git a/src/processing/script/transformers/assignment-destructuring.ts b/src/processing/script/transformers/assignment-destructuring.ts index 9dfa4f1dd..8cb287277 100644 --- a/src/processing/script/transformers/assignment-destructuring.ts +++ b/src/processing/script/transformers/assignment-destructuring.ts @@ -49,7 +49,7 @@ const transformer: Transformer = { assignments.push(firstTemp); return createSequenceExpression(assignments); - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/computed-property-get.ts b/src/processing/script/transformers/computed-property-get.ts index 7a4ea7c3e..44c9db3ef 100644 --- a/src/processing/script/transformers/computed-property-get.ts +++ b/src/processing/script/transformers/computed-property-get.ts @@ -55,7 +55,7 @@ const transformer: Transformer = { return true; }, - run: node => createComputedPropertyGetWrapper(node.property, node.object as Expression, node.optional) + run: node => createComputedPropertyGetWrapper(node.property, node.object as Expression, node.optional), }; export default transformer; diff --git a/src/processing/script/transformers/computed-property-set.ts b/src/processing/script/transformers/computed-property-set.ts index 9d40b7ecb..899685fc1 100644 --- a/src/processing/script/transformers/computed-property-set.ts +++ b/src/processing/script/transformers/computed-property-set.ts @@ -35,7 +35,7 @@ const transformer: Transformer = { const memberExpression = node.left as MemberExpression; return createComputedPropertySetWrapper(memberExpression.property, memberExpression.object as Expression, node.right); - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/concat-operator.ts b/src/processing/script/transformers/concat-operator.ts index 319713bb4..d6a023b1c 100644 --- a/src/processing/script/transformers/concat-operator.ts +++ b/src/processing/script/transformers/concat-operator.ts @@ -43,7 +43,7 @@ const transformer: Transformer = { return false; }, - run: node => createExpandedConcatOperation(node.left as Identifier | MemberExpression, node.right) + run: node => createExpandedConcatOperation(node.left as Identifier | MemberExpression, node.right), }; export default transformer; diff --git a/src/processing/script/transformers/declaration-destructuring.ts b/src/processing/script/transformers/declaration-destructuring.ts index e87ec8dc0..d8a67e41f 100644 --- a/src/processing/script/transformers/declaration-destructuring.ts +++ b/src/processing/script/transformers/declaration-destructuring.ts @@ -55,7 +55,7 @@ const transformer: Transformer = { } return createVariableDeclaration(node.kind, declarations); - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/dynamic-import.ts b/src/processing/script/transformers/dynamic-import.ts index 0d0c840ac..5b7b43e86 100644 --- a/src/processing/script/transformers/dynamic-import.ts +++ b/src/processing/script/transformers/dynamic-import.ts @@ -27,7 +27,7 @@ const transformer: Transformer = { replaceNode(node.source, newSource, node, 'source'); return null; - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/eval-bind.ts b/src/processing/script/transformers/eval-bind.ts index 80e435274..97bde9848 100644 --- a/src/processing/script/transformers/eval-bind.ts +++ b/src/processing/script/transformers/eval-bind.ts @@ -44,7 +44,7 @@ const transformer: Transformer = { replaceNode(callee.object, getEvalNode, callee, 'object'); return null; - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/eval-call-apply.ts b/src/processing/script/transformers/eval-call-apply.ts index b42534c84..7b354b441 100644 --- a/src/processing/script/transformers/eval-call-apply.ts +++ b/src/processing/script/transformers/eval-call-apply.ts @@ -53,7 +53,7 @@ const transformer: Transformer = { replaceNode(node.arguments[1], newArg, node, 'arguments'); return null; - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/eval-get.ts b/src/processing/script/transformers/eval-get.ts index eda9358a4..288689f57 100644 --- a/src/processing/script/transformers/eval-get.ts +++ b/src/processing/script/transformers/eval-get.ts @@ -91,7 +91,7 @@ const transformer: Transformer = { return false; }, - run: createGetEvalMethodCall + run: createGetEvalMethodCall, }; export default transformer; diff --git a/src/processing/script/transformers/eval.ts b/src/processing/script/transformers/eval.ts index c1e0cd3fb..5ce6baff9 100644 --- a/src/processing/script/transformers/eval.ts +++ b/src/processing/script/transformers/eval.ts @@ -39,7 +39,7 @@ const transformer: Transformer = { replaceNode(node.arguments[0], newArgs, node, 'arguments'); return null; - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/for-in.ts b/src/processing/script/transformers/for-in.ts index 63df7e71d..7812057b6 100644 --- a/src/processing/script/transformers/for-in.ts +++ b/src/processing/script/transformers/for-in.ts @@ -11,7 +11,7 @@ import { createVariableDeclarator, createVariableDeclaration, createBlockStatement, - createIdentifier + createIdentifier, } from '../node-builder'; import replaceNode from './replace-node'; import TempVariables from './temp-variables'; @@ -40,7 +40,7 @@ const transformer: Transformer = { replaceNode(node.left, varDeclaration, node, 'left'); return null; - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/for-of.ts b/src/processing/script/transformers/for-of.ts index 257cd8772..f2b9b195f 100644 --- a/src/processing/script/transformers/for-of.ts +++ b/src/processing/script/transformers/for-of.ts @@ -12,7 +12,7 @@ import { Statement, VariableDeclaration, VariableDeclarator, - Node + Node, } from 'estree'; import { Transformer } from './index'; @@ -22,7 +22,7 @@ import { createVariableDeclarator, createVariableDeclaration, createBlockStatement, - createIdentifier + createIdentifier, } from '../node-builder'; import replaceNode from './replace-node'; import TempVariables from './temp-variables'; @@ -111,7 +111,7 @@ const forOfTransformer: Transformer = { replaceDuplicateDeclarators(node); statementWithTempAssignment = createVariableDeclaration(forOfLeft.kind, [ - createVariableDeclarator(forOfLeft.declarations[0].id, tempIdentifier) + createVariableDeclarator(forOfLeft.declarations[0].id, tempIdentifier), ]); statementWithTempAssignment.reTransform = true; @@ -132,7 +132,7 @@ const forOfTransformer: Transformer = { replaceNode(node.body, createBlockStatement([statementWithTempAssignment, node.body]), node, 'body'); return null; - } + }, }; export default forOfTransformer; diff --git a/src/processing/script/transformers/func-args-destructing.ts b/src/processing/script/transformers/func-args-destructing.ts index ee2a7af92..0b3e9b48e 100644 --- a/src/processing/script/transformers/func-args-destructing.ts +++ b/src/processing/script/transformers/func-args-destructing.ts @@ -10,7 +10,7 @@ import { createIdentifier, createReturnStatement, createVariableDeclaration, - createVariableDeclarator + createVariableDeclarator, } from '../node-builder'; import { Syntax } from 'esotope-hammerhead'; import replaceNode from './replace-node'; @@ -89,6 +89,6 @@ export default function create[] = [ jsProtocolLastExpression, staticImportTransformer, dynamicImportTransformer, - declarationDestructuring + declarationDestructuring, ]; function createTransformerMap (): Map['nodeTypes'], Transformer[]> { diff --git a/src/processing/script/transformers/js-protocol-last-expression.ts b/src/processing/script/transformers/js-protocol-last-expression.ts index 571d2c3eb..750829deb 100644 --- a/src/processing/script/transformers/js-protocol-last-expression.ts +++ b/src/processing/script/transformers/js-protocol-last-expression.ts @@ -24,7 +24,7 @@ const transformer: Transformer = { transformer.wrapLastExpr = false; return createHtmlProcessorWrapper(node); - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/location-get.ts b/src/processing/script/transformers/location-get.ts index 17999ebd2..611b4586e 100644 --- a/src/processing/script/transformers/location-get.ts +++ b/src/processing/script/transformers/location-get.ts @@ -85,7 +85,7 @@ const transformer: Transformer = { return true; }, - run: createLocationGetWrapper + run: createLocationGetWrapper, }; export default transformer; diff --git a/src/processing/script/transformers/location-set.ts b/src/processing/script/transformers/location-set.ts index 383768f8c..1d5f8c9ca 100644 --- a/src/processing/script/transformers/location-set.ts +++ b/src/processing/script/transformers/location-set.ts @@ -28,7 +28,7 @@ const transformer: Transformer = { (parent.type !== Syntax.SequenceExpression || parent.expressions[0] === node); return createLocationSetWrapper(node.left as Identifier, node.right, wrapWithSequence); - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/method-call.ts b/src/processing/script/transformers/method-call.ts index d0eb35e4b..4c71f96de 100644 --- a/src/processing/script/transformers/method-call.ts +++ b/src/processing/script/transformers/method-call.ts @@ -42,7 +42,7 @@ const transformer: Transformer = { : createSimpleLiteral((callee.property as Identifier).name); // eslint-disable-line no-extra-parens return createMethodCallWrapper(callee.object as Expression, method, node.arguments); - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/post-message-call-apply-bind.ts b/src/processing/script/transformers/post-message-call-apply-bind.ts index 432bd58fa..ed0d640da 100644 --- a/src/processing/script/transformers/post-message-call-apply-bind.ts +++ b/src/processing/script/transformers/post-message-call-apply-bind.ts @@ -54,7 +54,7 @@ const transformer: Transformer = { replaceNode(callee.object, getPostMessageNode, callee, 'object'); return null; - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/post-message-get.ts b/src/processing/script/transformers/post-message-get.ts index a9e0096e2..dc3b852e7 100644 --- a/src/processing/script/transformers/post-message-get.ts +++ b/src/processing/script/transformers/post-message-get.ts @@ -87,7 +87,7 @@ const transformer: Transformer = { return true; }, - run: createGetPostMessageMethodCall + run: createGetPostMessageMethodCall, }; export default transformer; diff --git a/src/processing/script/transformers/property-set.ts b/src/processing/script/transformers/property-set.ts index ec890f41b..93ea0e715 100644 --- a/src/processing/script/transformers/property-set.ts +++ b/src/processing/script/transformers/property-set.ts @@ -34,7 +34,7 @@ const transformer: Transformer = { const identifier = memberExpression.property as Identifier; return createPropertySetWrapper(identifier.name, memberExpression.object as Expression, node.right); - } + }, }; export default transformer; diff --git a/src/processing/script/transformers/static-import.ts b/src/processing/script/transformers/static-import.ts index 0a742d2d0..564c48330 100644 --- a/src/processing/script/transformers/static-import.ts +++ b/src/processing/script/transformers/static-import.ts @@ -22,7 +22,7 @@ const transformer: Transformer = { parent.type === Syntax.ExportAllDeclaration || parent.type === Syntax.ExportNamedDeclaration) && parent.source === node, - run: node => transformer.resolver ? getProxyUrlLiteral(node, transformer.resolver) : null + run: node => transformer.resolver ? getProxyUrlLiteral(node, transformer.resolver) : null, }; export default transformer; diff --git a/src/processing/script/transformers/window-eval-get.ts b/src/processing/script/transformers/window-eval-get.ts index 61609337d..4d116cacc 100644 --- a/src/processing/script/transformers/window-eval-get.ts +++ b/src/processing/script/transformers/window-eval-get.ts @@ -51,7 +51,7 @@ const transformer: Transformer = { return false; }, - run: createGetEvalMethodCall + run: createGetEvalMethodCall, }; export default transformer; diff --git a/src/processing/script/transformers/window-post-message-get.ts b/src/processing/script/transformers/window-post-message-get.ts index 838a2e0b9..44b06058f 100644 --- a/src/processing/script/transformers/window-post-message-get.ts +++ b/src/processing/script/transformers/window-post-message-get.ts @@ -51,7 +51,7 @@ const transformer: Transformer = { return false; }, - run: createGetPostMessageMethodCall + run: createGetPostMessageMethodCall, }; export default transformer; diff --git a/src/proxy/index.ts b/src/proxy/index.ts index b4740e512..8f947dfe9 100644 --- a/src/proxy/index.ts +++ b/src/proxy/index.ts @@ -6,7 +6,7 @@ import { StaticContent, ServiceMessage, ServerInfo, - ProxyOptions + ProxyOptions, } from '../typings/proxy'; import http, { ServerOptions } from 'http'; import https from 'https'; @@ -41,7 +41,7 @@ function createServerInfo (hostname: string, port: number, crossDomainPort: numb crossDomainPort, protocol, cacheRequests, - domain: `${protocol}//${hostname}:${port}` + domain: `${protocol}//${hostname}:${port}`, }; } @@ -129,17 +129,17 @@ export default class Proxy extends Router { this.GET(SERVICE_ROUTES.hammerhead, { contentType: 'application/x-javascript', - content: hammerheadScriptContent + content: hammerheadScriptContent, }); this.GET(SERVICE_ROUTES.transportWorker, { contentType: 'application/x-javascript', - content: transportWorkerContent + content: transportWorkerContent, }); this.GET(SERVICE_ROUTES.workerHammerhead, { contentType: 'application/x-javascript', - content: workerHammerheadContent + content: workerHammerheadContent, }); this.POST(SERVICE_ROUTES.messaging, (req: http.IncomingMessage, res: http.ServerResponse, serverInfo: ServerInfo) => this._onServiceMessage(req, res, serverInfo)); @@ -188,7 +188,7 @@ export default class Proxy extends Router { serverInfo, isIframe, withPayload: true, - windowId + windowId, }); res.end(taskScript); @@ -242,7 +242,7 @@ export default class Proxy extends Router { proxyPort: this.server1Info.port.toString(), proxyProtocol: this.server1Info.protocol, sessionId: session.id, - windowId: session.options.windowId + windowId: session.options.windowId, }); } diff --git a/src/proxy/router.ts b/src/proxy/router.ts index 00c44c020..956b2afe6 100644 --- a/src/proxy/router.ts +++ b/src/proxy/router.ts @@ -71,7 +71,7 @@ export default abstract class Router { return { paramNames, - re: new RegExp(`^${method} ${reParts.join('/')}$`) + re: new RegExp(`^${method} ${reParts.join('/')}$`), }; } diff --git a/src/proxy/service-routes.ts b/src/proxy/service-routes.ts index 859a8a8d5..e52dafb68 100644 --- a/src/proxy/service-routes.ts +++ b/src/proxy/service-routes.ts @@ -4,5 +4,5 @@ export default { iframeTask: '/iframe-task.js', messaging: '/messaging', transportWorker: '/transport-worker.js', - workerHammerhead: '/worker-hammerhead.js' + workerHammerhead: '/worker-hammerhead.js', }; diff --git a/src/request-pipeline/builtin-header-names.ts b/src/request-pipeline/builtin-header-names.ts index 53a22c960..42f975f26 100644 --- a/src/request-pipeline/builtin-header-names.ts +++ b/src/request-pipeline/builtin-header-names.ts @@ -42,5 +42,5 @@ export default { contentSecurityPolicyReportOnly: 'content-security-policy-report-only', xContentSecurityPolicy: 'x-content-security-policy', xContentSecurityPolicyReportOnly: 'x-content-security-policy-report-only', - xWebkitCsp: 'x-webkit-csp' + xWebkitCsp: 'x-webkit-csp', }; diff --git a/src/request-pipeline/cache.ts b/src/request-pipeline/cache.ts index 9dbf91028..ccce45ac2 100644 --- a/src/request-pipeline/cache.ts +++ b/src/request-pipeline/cache.ts @@ -13,7 +13,7 @@ const requestsCache = new LRUCache({ // NOTE: Length is resource content size. // 1 character is 1 bite. return responseCacheEntry.res.getBody()?.length || 0; - } + }, }); function getCacheKey (requestOptions: RequestOptions): string { @@ -38,8 +38,8 @@ export function create (reqOptions: RequestOptions, res: DestinationResponse): R value: { cachePolicy, res: IncomingMessageLike.createFrom(res as IncomingMessage), - hitCount: 0 - } + hitCount: 0, + }, }; } @@ -67,7 +67,7 @@ export function getResponse (reqOptions: RequestOptions): ResponseCacheEntryBase return { res, - hitCount: cachedResponse.hitCount + hitCount: cachedResponse.hitCount, }; } diff --git a/src/request-pipeline/context.ts b/src/request-pipeline/context.ts index 56c674bd7..361a8b657 100644 --- a/src/request-pipeline/context.ts +++ b/src/request-pipeline/context.ts @@ -157,7 +157,7 @@ export default class RequestPipelineContext { isObject: !!parsedResourceType.isObject, charset: parsed.charset || '', reqOrigin: parsed.reqOrigin || '', - credentials: parsed.credentials + credentials: parsed.credentials, }; return { dest, sessionId: parsed.sessionId, windowId: parsed.windowId }; @@ -306,7 +306,7 @@ export default class RequestPipelineContext { isIframe: this.isIframe, isAjax: this.isAjax, - isForm, isScript + isForm, isScript, }) || ''; // NOTE: We need charset information if we are going to process the resource. @@ -333,7 +333,7 @@ export default class RequestPipelineContext { isNotModified, isRedirect, isAttachment, - isTextPage + isTextPage, }; logger.proxy.onContentInfoBuilt(this); @@ -448,7 +448,7 @@ export default class RequestPipelineContext { charset, windowId, reqOrigin, - credentials + credentials, }); } @@ -456,7 +456,7 @@ export default class RequestPipelineContext { return urlUtils.getDomain({ protocol: this.serverInfo.protocol, hostname: this.serverInfo.hostname, - port: isCrossDomain ? this.serverInfo.crossDomainPort : this.serverInfo.port + port: isCrossDomain ? this.serverInfo.crossDomainPort : this.serverInfo.port, }); } diff --git a/src/request-pipeline/create-special-page-response.ts b/src/request-pipeline/create-special-page-response.ts index a1343662d..a2d9e0aea 100644 --- a/src/request-pipeline/create-special-page-response.ts +++ b/src/request-pipeline/create-special-page-response.ts @@ -5,8 +5,8 @@ export default function createSpecialPageResponse () { return new IncomingMessageLike({ headers: { [BUILTIN_HEADERS.contentType]: 'text/html', - [BUILTIN_HEADERS.contentLength]: '0' - } + [BUILTIN_HEADERS.contentLength]: '0', + }, }); } diff --git a/src/request-pipeline/destination-request/agent.ts b/src/request-pipeline/destination-request/agent.ts index 4fa848913..95e41fb0a 100644 --- a/src/request-pipeline/destination-request/agent.ts +++ b/src/request-pipeline/destination-request/agent.ts @@ -20,18 +20,18 @@ const agents = { [TYPE.SSL3]: { instance: null, Ctor: https.Agent, - secureProtocol: 'SSLv3_method' + secureProtocol: 'SSLv3_method', }, [TYPE.TLS]: { instance: null, - Ctor: https.Agent + Ctor: https.Agent, }, [TYPE.HTTP]: { instance: null, - Ctor: http.Agent - } + Ctor: http.Agent, + }, }; @@ -43,7 +43,7 @@ function getAgent (type: string) { // @ts-ignore: Cannot use 'new' with an expression whose type lacks a call or construct signature. agent.instance = new agent.Ctor({ keepAlive: true, - secureProtocol: agent.secureProtocol + secureProtocol: agent.secureProtocol, }); } @@ -62,7 +62,7 @@ export function assign (reqOpts: RequestOptions): void { if (proxy && reqOpts.protocol === 'https:') { reqOpts.agent = tunnel.httpsOverHttp({ proxy, - rejectUnauthorized: false + rejectUnauthorized: false, }); return; diff --git a/src/request-pipeline/destination-request/default-request-timeout.ts b/src/request-pipeline/destination-request/default-request-timeout.ts index eb03fa924..7af60126d 100644 --- a/src/request-pipeline/destination-request/default-request-timeout.ts +++ b/src/request-pipeline/destination-request/default-request-timeout.ts @@ -1,6 +1,6 @@ const DEFAULT_REQUEST_TIMEOUT = { ajax: 2 * 60 * 1000, - page: 25 * 1000 + page: 25 * 1000, }; export default DEFAULT_REQUEST_TIMEOUT; diff --git a/src/request-pipeline/destination-request/http2.ts b/src/request-pipeline/destination-request/http2.ts index f5d173524..702fce80c 100644 --- a/src/request-pipeline/destination-request/http2.ts +++ b/src/request-pipeline/destination-request/http2.ts @@ -16,7 +16,7 @@ const { HTTP2_HEADER_PROXY_CONNECTION, HTTP2_HEADER_TRANSFER_ENCODING, HTTP2_HEADER_HTTP2_SETTINGS, - HTTP2_HEADER_HOST + HTTP2_HEADER_HOST, } = http2.constants; const HTTP2_SESSIONS_CACHE_SIZE = 100; @@ -25,7 +25,7 @@ const HTTP2_CONNECT_TIMEOUT = 5_000; const HTTP2_LOCAL_SETTINGS_TIMEOUT = 3_000; const HTTP2_UNSUPPORTED_HEADERS = [ HTTP2_HEADER_CONNECTION, HTTP2_HEADER_UPGRADE, HTTP2_HEADER_HTTP2_SETTINGS, HTTP2_HEADER_KEEP_ALIVE, - HTTP2_HEADER_PROXY_CONNECTION, HTTP2_HEADER_TRANSFER_ENCODING, HTTP2_HEADER_HOST + HTTP2_HEADER_PROXY_CONNECTION, HTTP2_HEADER_TRANSFER_ENCODING, HTTP2_HEADER_HOST, ]; const unsupportedOrigins = [] as string[]; @@ -35,7 +35,7 @@ const sessionsCache = new LRUCache({ dispose: (_, session) => { if (!session.closed) session.close(); - } + }, }); export async function getHttp2Session (requestId: string, origin: string): Promise { @@ -113,7 +113,7 @@ export function formatRequestHttp2Headers (opts: RequestOptions) { }, { [HTTP2_HEADER_METHOD]: opts.method, [HTTP2_HEADER_PATH]: opts.path, - [HTTP2_HEADER_AUTHORITY]: opts.headers.host + [HTTP2_HEADER_AUTHORITY]: opts.headers.host, }); } diff --git a/src/request-pipeline/destination-request/windows-domain.ts b/src/request-pipeline/destination-request/windows-domain.ts index 5b6e8df31..353152072 100644 --- a/src/request-pipeline/destination-request/windows-domain.ts +++ b/src/request-pipeline/destination-request/windows-domain.ts @@ -18,7 +18,7 @@ export async function assign (credentials: WindowCredentials): Promise { if (!cached) { cached = { domain: await queryOSForCredential('echo %userdomain%'), - workstation: await queryOSForCredential('hostname') + workstation: await queryOSForCredential('hostname'), }; } diff --git a/src/request-pipeline/file-request/index.ts b/src/request-pipeline/file-request/index.ts index f2fd1cbf4..1fe6c65d9 100644 --- a/src/request-pipeline/file-request/index.ts +++ b/src/request-pipeline/file-request/index.ts @@ -48,7 +48,7 @@ export default class FileRequest extends EventEmitter { stream = Object.assign(stream, { statusCode: 200, trailers: {}, - headers: { [BUILTIN_HEADERS.contentType]: mime.lookup(this._path) } + headers: { [BUILTIN_HEADERS.contentType]: mime.lookup(this._path) }, }); this.emit('response', stream); diff --git a/src/request-pipeline/header-transforms/index.ts b/src/request-pipeline/header-transforms/index.ts index efa227f4c..264c2c98f 100644 --- a/src/request-pipeline/header-transforms/index.ts +++ b/src/request-pipeline/header-transforms/index.ts @@ -6,19 +6,19 @@ import { requestTransforms, forcedRequestTransforms, responseTransforms, - forcedResponseTransforms + forcedResponseTransforms, } from './transforms'; const FORCED_REQ_HEADERS_BROWSER_CASES = [ { lowerCase: BUILTIN_HEADERS.cookie, - browserCase: 'Cookie' + browserCase: 'Cookie', }, { lowerCase: BUILTIN_HEADERS.origin, - browserCase: 'Origin' - } + browserCase: 'Origin', + }, ]; function transformHeaders (srcHeaders, ctx: RequestPipelineContext, transformList, forcedTransforms) { diff --git a/src/request-pipeline/header-transforms/transforms.ts b/src/request-pipeline/header-transforms/transforms.ts index 05db4af40..d4aee86b9 100644 --- a/src/request-pipeline/header-transforms/transforms.ts +++ b/src/request-pipeline/header-transforms/transforms.ts @@ -103,12 +103,12 @@ export const requestTransforms = { [BUILTIN_HEADERS.ifModifiedSince]: skipIfStateSnapshotIsApplied, [BUILTIN_HEADERS.ifNoneMatch]: skipIfStateSnapshotIsApplied, [BUILTIN_HEADERS.authorization]: transformAuthorizationHeader, - [BUILTIN_HEADERS.proxyAuthorization]: transformAuthorizationHeader + [BUILTIN_HEADERS.proxyAuthorization]: transformAuthorizationHeader, }; export const forcedRequestTransforms = { [BUILTIN_HEADERS.cookie]: (_src: string, ctx: RequestPipelineContext) => - shouldOmitCredentials(ctx) ? void 0 : ctx.session.cookies.getHeader(ctx.dest.url) || void 0 + shouldOmitCredentials(ctx) ? void 0 : ctx.session.cookies.getHeader(ctx.dest.url) || void 0, }; // Response headers @@ -174,7 +174,7 @@ export const responseTransforms = { return void 0; return src; - } + }, }; export const forcedResponseTransforms = { diff --git a/src/request-pipeline/http-header-parser.ts b/src/request-pipeline/http-header-parser.ts index 5234a9b76..d194fff51 100644 --- a/src/request-pipeline/http-header-parser.ts +++ b/src/request-pipeline/http-header-parser.ts @@ -43,7 +43,7 @@ function getInvalidCharacters (name: string, body: string): InvalidCharactersRec name: name, location: HEADER_INVALID_CHAR_LOCATIONS.name, charCode: '' + name[i].charCodeAt(0), - index: i.toString() + index: i.toString(), }); } } @@ -54,7 +54,7 @@ function getInvalidCharacters (name: string, body: string): InvalidCharactersRec name: name, location: HEADER_INVALID_CHAR_LOCATIONS.body, charCode: '' + body[i].charCodeAt(0), - index: i.toString() + index: i.toString(), }); } } diff --git a/src/request-pipeline/incoming-message-like.ts b/src/request-pipeline/incoming-message-like.ts index 4932fc2eb..1466a9e62 100644 --- a/src/request-pipeline/incoming-message-like.ts +++ b/src/request-pipeline/incoming-message-like.ts @@ -32,7 +32,7 @@ export default class IncomingMessageLike extends Readable { headers: Object.assign({}, init.headers), trailers: Object.assign({}, init.trailers), statusCode: init.statusCode || DEFAULT_STATUS_CODE, - body: init.body || Buffer.alloc(0) + body: init.body || Buffer.alloc(0), } } @@ -67,7 +67,7 @@ export default class IncomingMessageLike extends Readable { return new IncomingMessageLike({ headers, trailers, - statusCode + statusCode, }); } diff --git a/src/request-pipeline/request-hooks/request-filter-rule/index.ts b/src/request-pipeline/request-hooks/request-filter-rule/index.ts index 1d56b9e15..b9f123135 100644 --- a/src/request-pipeline/request-hooks/request-filter-rule/index.ts +++ b/src/request-pipeline/request-hooks/request-filter-rule/index.ts @@ -2,7 +2,7 @@ import { isRegExp, isString, isObject, - castArray + castArray, } from 'lodash'; import { RequestFilterRuleInit } from './rule-init'; @@ -14,7 +14,7 @@ import isPredicate from '../is-predicate'; const DEFAULT_OPTIONS: Partial = { url: void 0, method: void 0, - isAjax: void 0 + isAjax: void 0, }; const MATCH_ANY_REQUEST_REG_EX = /.*/; diff --git a/src/request-pipeline/request-hooks/request-filter-rule/stringify.ts b/src/request-pipeline/request-hooks/request-filter-rule/stringify.ts index 74cd86cf3..607a5c4c7 100644 --- a/src/request-pipeline/request-hooks/request-filter-rule/stringify.ts +++ b/src/request-pipeline/request-hooks/request-filter-rule/stringify.ts @@ -10,7 +10,7 @@ function stringifyObjectOptions (rule: RequestFilterRule) { const stringifiedOptions = [ { name: 'url', value: ruleOptions.url }, { name: 'method', value: ruleOptions.method }, - { name: 'isAjax', value: ruleOptions.isAjax } + { name: 'isAjax', value: ruleOptions.isAjax }, ]; const msg = stringifiedOptions.filter(option => !!option.value) diff --git a/src/request-pipeline/request-hooks/response-mock/get-response.ts b/src/request-pipeline/request-hooks/response-mock/get-response.ts index 612f81a9f..3f602e4fd 100644 --- a/src/request-pipeline/request-hooks/response-mock/get-response.ts +++ b/src/request-pipeline/request-hooks/response-mock/get-response.ts @@ -19,7 +19,7 @@ function getContentType (body?: ResponseMockBodyInit): string { export default async function (mock: ResponseMock): Promise { let response = { headers: { [BUILTIN_HEADERS.contentType]: getContentType(mock.body) }, - statusCode: mock.statusCode + statusCode: mock.statusCode, } as IncomingMessageLikeInitOptions; if (mock.headers) diff --git a/src/request-pipeline/stages.ts b/src/request-pipeline/stages.ts index 43a38c9fe..22608bc9d 100644 --- a/src/request-pipeline/stages.ts +++ b/src/request-pipeline/stages.ts @@ -12,7 +12,7 @@ import { callOnResponseEventCallbackWithoutBodyForNonProcessedResource, callResponseEventCallbackForProcessedRequest, error, - sendRequest + sendRequest, } from './utils'; import ConfigureResponseEvent from '../session/events/configure-response-event'; import ConfigureResponseEventOptions from '../session/events/configure-response-event-options'; @@ -179,5 +179,5 @@ export default [ ctx.res.write(ctx.destResBody); ctx.res.end(); }); - } + }, ]; diff --git a/src/request-pipeline/utils.ts b/src/request-pipeline/utils.ts index 6c0c38754..4cf141f54 100644 --- a/src/request-pipeline/utils.ts +++ b/src/request-pipeline/utils.ts @@ -70,7 +70,7 @@ export function sendRequest (ctx: RequestPipelineContext) { message: MESSAGE.nodeError[err.code] || err.toString(), headerSize: headerSize, recommendedMaxHeaderSize: getRecommendedMaxHeaderSize(headerSize).toString(), - invalidChars: getFormattedInvalidCharacters(rawHeadersStr) + invalidChars: getFormattedInvalidCharacters(rawHeadersStr), })); } diff --git a/src/session/command.ts b/src/session/command.ts index c4e96b4a4..33725dd77 100644 --- a/src/session/command.ts +++ b/src/session/command.ts @@ -7,7 +7,7 @@ const ServiceCommands = { getUploadedFiles: 'hammerhead|command|get-uploaded-files', setCookie: 'hammerhead|command|set-cookie', - uploadFiles: 'hammerhead|command|upload-files' + uploadFiles: 'hammerhead|command|upload-files', }; export default ServiceCommands; diff --git a/src/session/cookies.ts b/src/session/cookies.ts index 40d4af79a..3b9e78a5b 100644 --- a/src/session/cookies.ts +++ b/src/session/cookies.ts @@ -94,7 +94,7 @@ export default class Cookies { const parsedCookie = this._cookieJar.setCookieSync(cookie, url, { http: !isClient, ignoreError: true, - loose: true + loose: true, }); if (parsedCookie) diff --git a/src/session/events/response-event.ts b/src/session/events/response-event.ts index a110d5895..6dd447b13 100644 --- a/src/session/events/response-event.ts +++ b/src/session/events/response-event.ts @@ -31,7 +31,7 @@ export default class ResponseEvent { sessionId, isSameOriginPolicyFailed, headers, - body + body, } = preparedResponseInfo; this.requestId = requestId; @@ -54,7 +54,7 @@ export default class ResponseEvent { sessionId, isSameOriginPolicyFailed, headers, - body + body, } = data as SerializedResponseEvent; const responseEvent = new ResponseEvent(requestFilterRule, { @@ -63,7 +63,7 @@ export default class ResponseEvent { sessionId, isSameOriginPolicyFailed, headers, - body + body, }); responseEvent.id = id; diff --git a/src/session/index.ts b/src/session/index.ts index 0c0f876e1..bd4b28137 100644 --- a/src/session/index.ts +++ b/src/session/index.ts @@ -12,7 +12,7 @@ import { Credentials, ExternalProxySettings, ExternalProxySettingsRaw, - RequestEventListenerError + RequestEventListenerError, } from '../typings/session'; import { GetUploadedFilesServiceMessage, StoreUploadedFilesServiceMessage } from '../typings/upload'; import StateSnapshot from './state-snapshot'; @@ -125,7 +125,7 @@ export default abstract class Session extends EventEmitter { private _initRequestHookEventData (): RequestHookEventData { return { mocks: new Map(), - configureResponse: new Map() + configureResponse: new Map(), }; } @@ -141,7 +141,7 @@ export default abstract class Session extends EventEmitter { disablePageCaching: false, allowMultipleWindows: false, windowId: '', - requestTimeout + requestTimeout, }, options); } @@ -175,7 +175,7 @@ export default abstract class Session extends EventEmitter { domain: syncCookie.domain || '', path: syncCookie.path || '', lastAccessed: new Date(), - syncKey: '' + syncKey: '', })); } @@ -199,7 +199,7 @@ export default abstract class Session extends EventEmitter { payloadScript, allowMultipleWindows, isRecordMode, - windowId: windowId || '' + windowId: windowId || '', }); } @@ -212,7 +212,7 @@ export default abstract class Session extends EventEmitter { iframeTaskScriptTemplate: null, payloadScript: await this.getIframePayloadScript(true), allowMultipleWindows: this.options.allowMultipleWindows, - isRecordMode: this._recordMode + isRecordMode: this._recordMode, }); return JSON.stringify(taskScriptTemplate); @@ -234,7 +234,7 @@ export default abstract class Session extends EventEmitter { payloadScript, allowMultipleWindows: this.options.allowMultipleWindows, isRecordMode: this._recordMode, - windowId + windowId, }); this.pageLoadCount++; @@ -256,7 +256,7 @@ export default abstract class Session extends EventEmitter { if (parsedUrl && parsedUrl.host) { settings = { host: parsedUrl.host, - hostname: parsedUrl.hostname || '' + hostname: parsedUrl.hostname || '', }; if (bypassRules) @@ -295,7 +295,7 @@ export default abstract class Session extends EventEmitter { const listenersData = { listeners, errorHandler, - rule + rule, }; this.requestEventListeners.set(rule.id, listenersData); @@ -368,7 +368,7 @@ export default abstract class Session extends EventEmitter { const event = { error: e, - methodName: eventName + methodName: eventName, }; errorHandler(event); @@ -390,7 +390,7 @@ export default abstract class Session extends EventEmitter { eventData = { opts: ConfigureResponseEventOptions.DEFAULT, setHeaders: [], - removedHeaders: [] + removedHeaders: [], }; } diff --git a/src/session/state-snapshot.ts b/src/session/state-snapshot.ts index b159ea23a..b01702ae5 100644 --- a/src/session/state-snapshot.ts +++ b/src/session/state-snapshot.ts @@ -12,7 +12,7 @@ export default class StateSnapshot { static empty () { return new StateSnapshot(null, { localStorage: '[[],[]]', - sessionStorage: '[[],[]]' + sessionStorage: '[[],[]]', }); } } diff --git a/src/shadow-ui/class-name.ts b/src/shadow-ui/class-name.ts index 1403a08f5..678f90279 100644 --- a/src/shadow-ui/class-name.ts +++ b/src/shadow-ui/class-name.ts @@ -11,5 +11,5 @@ export default { charset: 'charset' + POSTFIX, script: 'script' + POSTFIX, selfRemovingScript: 'self-removing-script' + POSTFIX, - uiStylesheet: 'ui-stylesheet' + POSTFIX + uiStylesheet: 'ui-stylesheet' + POSTFIX, }; diff --git a/src/upload/storage.ts b/src/upload/storage.ts index b93dccdbc..51df68fd2 100644 --- a/src/upload/storage.ts +++ b/src/upload/storage.ts @@ -129,7 +129,7 @@ export default class UploadStorage { result.push({ err: `Cannot find the ${filePath}. None path of these exists: ${nonExistingPaths.join(', ')}.`, path: filePath, - resolvedPaths: nonExistingPaths + resolvedPaths: nonExistingPaths, }); } } @@ -156,8 +156,8 @@ export default class UploadStorage { lastModifiedDate: fileStats.mtime, lastModified: fileStats.mtimeMs, name: path.basename(resolvedPath), - type: mime.lookup(resolvedPath) - } + type: mime.lookup(resolvedPath), + }, }); } catch (e) { diff --git a/src/utils/buffer.ts b/src/utils/buffer.ts index 4110930ca..bfa845b70 100644 --- a/src/utils/buffer.ts +++ b/src/utils/buffer.ts @@ -21,7 +21,7 @@ export function createLineIterator (buffer: Buffer) { start = i + CRLF_LENGTH; } } - } + }, }; } diff --git a/src/utils/content-type.ts b/src/utils/content-type.ts index 06d6b2234..837a39add 100644 --- a/src/utils/content-type.ts +++ b/src/utils/content-type.ts @@ -8,7 +8,7 @@ const PAGE_MIMES = [ 'text/xml', 'application/xhtml+xml', 'application/xml', - 'application/x-ms-application' + 'application/x-ms-application', ]; const SCRIPT_MIMES = [ @@ -27,7 +27,7 @@ const SCRIPT_MIMES = [ 'text/jscript', 'text/livescript', 'text/x-ecmascript', - 'text/x-javascript' + 'text/x-javascript', ]; const TEXT_PAGE_MIMES = [ diff --git a/src/utils/cookie.ts b/src/utils/cookie.ts index 2951226c1..29a0e86b9 100644 --- a/src/utils/cookie.ts +++ b/src/utils/cookie.ts @@ -14,7 +14,7 @@ const KEY_VALUE_REGEX = /(?:^([^=]+)=([\s\S]*))?/; export const SYNCHRONIZATION_TYPE = { server: 's', client: 'c', - window: 'w' + window: 'w', }; const SYNCHRONIZATION_TYPE_RE = new RegExp(`^[${SYNCHRONIZATION_TYPE.server}${SYNCHRONIZATION_TYPE.client}${SYNCHRONIZATION_TYPE.window}]+`); @@ -117,7 +117,7 @@ export function parseSyncCookie (cookieStr: string): CookieRecord | null { syncKey: key, value, - cookieStr + cookieStr, }; } diff --git a/src/utils/http.ts b/src/utils/http.ts index 7fd7e7a2f..5cae5b5c1 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -7,12 +7,12 @@ import { stringify as stringifyJSON } from './json'; const STATIC_RESOURCES_DEFAULT_CACHING_OPTIONS = { maxAge: 30, - mustRevalidate: true + mustRevalidate: true, }; export const PREVENT_CACHING_HEADERS = { [BUILTIN_HEADERS.cacheControl]: 'no-cache, no-store, must-revalidate', - [BUILTIN_HEADERS.pragma]: 'no-cache' + [BUILTIN_HEADERS.pragma]: 'no-cache', }; export function addPreventCachingHeaders (res: ServerResponse): void { diff --git a/src/utils/logger.ts b/src/utils/logger.ts index a15e23fe8..0c25c8e8a 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -89,7 +89,7 @@ const proxy = { onContentInfoBuilt: (ctx: RequestPipelineContext) => { proxyLogger('Proxy resource content info %s %i', ctx.requestId, ctx); - } + }, }; const serviceMsg = { @@ -102,7 +102,7 @@ const serviceMsg = { const errMsg = isError ? err : getIncorrectErrorTypeMessage(err); serviceMsgLogger('Service message %j, error %o', msg, errMsg); - } + }, }; const destination = { @@ -172,7 +172,7 @@ const destination = { onError: (opts: RequestOptions, err: Error) => { destinationLogger('Destination error %s %o', opts.requestId, err); - } + }, }; const destinationSocket = { @@ -185,7 +185,7 @@ const destinationSocket = { onError: (opts: RequestOptions, err: Error) => { destinationSocketLogger('Destination request socket error %s %o', opts.requestId, err); - } + }, }; export default { proxy, destination, destinationSocket, serviceMsg }; diff --git a/src/utils/parse5.ts b/src/utils/parse5.ts index 3b37bd5f1..354664d96 100644 --- a/src/utils/parse5.ts +++ b/src/utils/parse5.ts @@ -21,12 +21,12 @@ function parseAttrName (attr: string): any { if (parts.length === 2) { return { prefix: parts[0], - name: parts[1] + name: parts[1], }; } return { - name: parts[0] + name: parts[0], }; } @@ -142,7 +142,7 @@ export function createTextNode (content: string, parent: ASTNode): ASTNode { return { nodeName: '#text', value: content, - parentNode: parent + parentNode: parent, } as ASTNode; } diff --git a/src/utils/self-removing-scripts.ts b/src/utils/self-removing-scripts.ts index 88b6b5cea..a9c96d1dc 100644 --- a/src/utils/self-removing-scripts.ts +++ b/src/utils/self-removing-scripts.ts @@ -75,5 +75,5 @@ export default { restoreStorages: create(` window.localStorage.setItem("%s", %s); window.sessionStorage.setItem("%s", %s); - `) + `), }; diff --git a/src/utils/stack-processing.ts b/src/utils/stack-processing.ts index 5b8b3d593..aa3ef681f 100644 --- a/src/utils/stack-processing.ts +++ b/src/utils/stack-processing.ts @@ -4,7 +4,7 @@ const STACK_FRAME_REG_EXPS = [ /^\s*at .*\((\S+)\)/, // Chrome, IE (with function name) /^\s*at (\S+)/, // Chrome, IE (without function name) /^.*@(\S+)/, // Safari - /(.+)/ // Any string + /(.+)/, // Any string ]; const STACK_FRAME_REGEX = /(?:^|\n)(?:\s*at |.*@)(?:.*\()?(\S+?):\d+:\d+\)?/g; diff --git a/src/utils/url.ts b/src/utils/url.ts index f2bfc5ed8..f7dd2eddb 100644 --- a/src/utils/url.ts +++ b/src/utils/url.ts @@ -36,7 +36,7 @@ const SPECIAL_PAGE_DEST_RESOURCE_INFO = { host: '', hostname: '', port: '', - partAfterHost: '' + partAfterHost: '', }; const RESOURCE_TYPES = [ { name: 'isIframe', flag: 'i' }, @@ -47,7 +47,7 @@ const RESOURCE_TYPES = [ { name: 'isWebSocket', flag: 'w'}, { name: 'isServiceWorker', flag: 'c'}, { name: 'isAjax', flag: 'a'}, - { name: 'isObject', flag: 'o'} + { name: 'isObject', flag: 'o'}, ] as { name: keyof ResourceType, flag: string }[]; export function parseResourceType (resourceType: string): ResourceType { @@ -183,7 +183,7 @@ export function getDomain (parsed: { protocol?: string, host?: string, hostname? protocol: parsed.protocol, host: parsed.host, hostname: parsed.hostname, - port: String(parsed.port || '') + port: String(parsed.port || ''), }); } @@ -262,7 +262,7 @@ export function parseProxyUrl (proxyUrl: string): ParsedProxyUrl | null { proxy: { hostname: parsedUrl.hostname || '', - port: parsedUrl.port || '' + port: parsedUrl.port || '', }, sessionId: parsedDesc.sessionId, @@ -270,7 +270,7 @@ export function parseProxyUrl (proxyUrl: string): ParsedProxyUrl | null { charset: parsedDesc.charset, reqOrigin: parsedDesc.reqOrigin, windowId: parsedDesc.windowId, - credentials: parsedDesc.credentials + credentials: parsedDesc.credentials, }; } @@ -292,7 +292,7 @@ export function parseUrl (url: string | URL): ParsedUrl { host: urlMatch[3], hostname: urlMatch[4], port: urlMatch[5], - partAfterHost: urlMatch[6] + partAfterHost: urlMatch[6], } : {}; } diff --git a/test/client/fixtures/sandbox/child-window-test.js b/test/client/fixtures/sandbox/child-window-test.js index 86affb79f..eca4e0d88 100644 --- a/test/client/fixtures/sandbox/child-window-test.js +++ b/test/client/fixtures/sandbox/child-window-test.js @@ -69,7 +69,7 @@ test('open child window considering base element', function () { openedWindowUrl = url; return { - windowId: Date.now() + windowId: Date.now(), }; }; @@ -122,7 +122,7 @@ test('Should not open in window if the default behavior was prevented', function openedWindowUrl = url; return { - windowId: Date.now() + windowId: Date.now(), }; }; @@ -161,7 +161,7 @@ test('Should not open in window if the default behavior was prevented in parent windowOpenCounter++; return { - windowId: Date.now() + windowId: Date.now(), }; }; diff --git a/test/client/fixtures/sandbox/code-instrumentation/access-error-test.js b/test/client/fixtures/sandbox/code-instrumentation/access-error-test.js index dac7f58a6..bfe9002ec 100644 --- a/test/client/fixtures/sandbox/code-instrumentation/access-error-test.js +++ b/test/client/fixtures/sandbox/code-instrumentation/access-error-test.js @@ -16,7 +16,7 @@ test('calling not function', function () { var obj = { yo1: 123, yo2: null, - yo3: 'hey ya' + yo3: 'hey ya', }; throws(function () { diff --git a/test/client/fixtures/sandbox/code-instrumentation/common-test.js b/test/client/fixtures/sandbox/code-instrumentation/common-test.js index 7c2dfd3ab..e8e5d31b4 100644 --- a/test/client/fixtures/sandbox/code-instrumentation/common-test.js +++ b/test/client/fixtures/sandbox/code-instrumentation/common-test.js @@ -20,7 +20,7 @@ if (nativeMethods.Proxy) { ' "use strict";', ' return eval(arguments[0]);', ' };', - '}' + '}', ]; // eslint-disable-next-line no-new-func @@ -35,7 +35,7 @@ if (nativeMethods.Proxy) { }, has: function (target, name) { return name === 'eval' || name in target; - } + }, }); evalFactory(proxy)('strictEqual(data.a, 777);'); diff --git a/test/client/fixtures/sandbox/code-instrumentation/getters-test.js b/test/client/fixtures/sandbox/code-instrumentation/getters-test.js index cc000a438..553d794ca 100644 --- a/test/client/fixtures/sandbox/code-instrumentation/getters-test.js +++ b/test/client/fixtures/sandbox/code-instrumentation/getters-test.js @@ -221,24 +221,24 @@ test('should not create proxy url for invalid url (GH-778)', function () { var testCases = [ { value: '//', - skipForIE: false + skipForIE: false, }, { value: '//:0', - skipForIE: false + skipForIE: false, }, { value: '//:0/', - skipForIE: false + skipForIE: false, }, { value: 'http://test:0', - skipForIE: false + skipForIE: false, }, { value: 'http://test:123456789', - skipForIE: true - } + skipForIE: true, + }, ]; var storedBaseUrl = urlResolver.getBaseUrl(document); diff --git a/test/client/fixtures/sandbox/code-instrumentation/location-test.js b/test/client/fixtures/sandbox/code-instrumentation/location-test.js index 02f096b43..fc35ffcc2 100644 --- a/test/client/fixtures/sandbox/code-instrumentation/location-test.js +++ b/test/client/fixtures/sandbox/code-instrumentation/location-test.js @@ -42,11 +42,11 @@ var getWindowMock = function (opts) { replace: function (url) { this.href = url; - } + }, }, Location: Location, - document: document + document: document, }; winMock.top = opts.isTop ? winMock : { document: document }; @@ -58,36 +58,36 @@ var getWindowMock = function (opts) { var ENSURE_URL_TRAILING_SLASH_TEST_CASES = [ { url: 'http://example.com', - shoudAddTrailingSlash: true + shoudAddTrailingSlash: true, }, { url: 'https://localhost:8080', - shoudAddTrailingSlash: true + shoudAddTrailingSlash: true, }, { url: 'about:blank', - shoudAddTrailingSlash: false + shoudAddTrailingSlash: false, }, { url: 'http://example.com/page.html', - shoudAddTrailingSlash: false + shoudAddTrailingSlash: false, }, { url: 'file://localhost/etc/fstab', // Unix file URI scheme - shoudAddTrailingSlash: false + shoudAddTrailingSlash: false, }, { url: 'file:///etc/fstab', // Unix file URI scheme - shoudAddTrailingSlash: false + shoudAddTrailingSlash: false, }, { url: 'file://localhost/c:/WINDOWS/clock.avi', // Windows file URI scheme - shoudAddTrailingSlash: false + shoudAddTrailingSlash: false, }, { url: 'file:///c:/WINDOWS/clock.avi', // Windows file URI scheme - shoudAddTrailingSlash: false - } + shoudAddTrailingSlash: false, + }, ]; test('location native behavior', function () { @@ -166,37 +166,37 @@ test('location object of iframe with empty src should have properties with corre strictEqual( eval(processScript('iframe.contentDocument.location.protocol')), nativeIframe.contentDocument.location.protocol, - 'protocol property in iframe with "' + iframeSrcAttribute + '" src attribute' + 'protocol property in iframe with "' + iframeSrcAttribute + '" src attribute' //eslint-disable-line comma-dangle ); strictEqual( eval(processScript('iframe.contentDocument.location.port')), nativeIframe.contentDocument.location.port, - 'port property in iframe with "' + iframeSrcAttribute + '" src attribute' + 'port property in iframe with "' + iframeSrcAttribute + '" src attribute' //eslint-disable-line comma-dangle ); strictEqual( eval(processScript('iframe.contentDocument.location.host')), nativeIframe.contentDocument.location.host, - 'host property in iframe with "' + iframeSrcAttribute + '" src attribute' + 'host property in iframe with "' + iframeSrcAttribute + '" src attribute' //eslint-disable-line comma-dangle ); strictEqual( eval(processScript('iframe.contentDocument.location.hostname')), nativeIframe.contentDocument.location.hostname, - 'hostname property in iframe with "' + iframeSrcAttribute + '" src attribute' + 'hostname property in iframe with "' + iframeSrcAttribute + '" src attribute' //eslint-disable-line comma-dangle ); strictEqual( eval(processScript('iframe.contentDocument.location.pathname')), nativeIframe.contentDocument.location.pathname, - 'pathname property in iframe with "' + iframeSrcAttribute + '" src attribute' + 'pathname property in iframe with "' + iframeSrcAttribute + '" src attribute' //eslint-disable-line comma-dangle ); strictEqual( eval(processScript('iframe.contentDocument.location.hash')), nativeIframe.contentDocument.location.hash, - 'hash property in iframe with "' + iframeSrcAttribute + '" src attribute' + 'hash property in iframe with "' + iframeSrcAttribute + '" src attribute' //eslint-disable-line comma-dangle ); strictEqual( eval(processScript('iframe.contentDocument.location.search')), nativeIframe.contentDocument.location.search, - 'search property in iframe with "' + iframeSrcAttribute + '" src attribute' + 'search property in iframe with "' + iframeSrcAttribute + '" src attribute' //eslint-disable-line comma-dangle ); }); } @@ -308,32 +308,32 @@ test('different url types for locationWrapper methods (href, replace, assign) (G var testCases = [ { url: null, - expectedUrl: 'https://example.com/null' + expectedUrl: 'https://example.com/null', }, { url: void 0, - expectedUrl: 'https://example.com/undefined' + expectedUrl: 'https://example.com/undefined', }, { url: { url: '/some-path' }, - expectedUrl: 'https://example.com/[object%20Object]' + expectedUrl: 'https://example.com/[object%20Object]', }, { url: { url: '/some-path', toString: function () { return this.url; - } + }, }, - expectedUrl: 'https://example.com/some-path' - } + expectedUrl: 'https://example.com/some-path', + }, ]; // NOTE: IE11 doesn't support 'URL()' if (!browserUtils.isIE11) { testCases.push({ url: new URL('https://example.com/some-path'), - expectedUrl: 'https://example.com/some-path' + expectedUrl: 'https://example.com/some-path', }); } @@ -358,7 +358,7 @@ test('throwing errors on calling locationWrapper methods (href, replace, assign) var invalidUrlObject = { toString: function () { return {}; - } + }, }; var windowMock = getWindowMock({ isTop: true }); @@ -426,12 +426,12 @@ test('different url types for "location" property (GH-1613)', function () { checkLocationAssignment({ toString: function () { return '/some-path'; - } + }, }, '{' + ' toString: function () {\n' + ' return "/some-path";\n' + ' }' + - '}') + '}'), ]; // NOTE: IE11 doesn't support 'URL()' @@ -528,7 +528,7 @@ test('should omit the default port on page navigation', function () { var locationWrapper = new LocationWrapper(windowMock, null, window.noop); hammerhead.win = { - location: '' + location: '', }; function testUrl (url, shouldOmitPort) { @@ -581,10 +581,10 @@ if (window.location.ancestorOrigins) { location: { toString: function () { return destLocation.getLocation(); - } + }, }, 'hammerhead|location-wrapper': locationWrapper, - frameElement: null + frameElement: null, }; ok(ancestorOrigins instanceof nestedIframe.contentWindow.DOMStringList); @@ -601,7 +601,7 @@ if (window.location.ancestorOrigins) { ok(ancestorOrigins.contains({ toString: function () { return 'https://example.com'; - } + }, })); ok(!ancestorOrigins.contains('https://another-domain.com')); ok(!ancestorOrigins.contains({})); @@ -638,7 +638,7 @@ if (window.location.ancestorOrigins) { .then(function (iframe) { callMethod(iframe.contentWindow, 'postMessage', [{ type: 'get ancestorOrigin', - nestedIframeSrc: getCrossDomainPageUrl('../../../data/iframe/simple-iframe.html') + nestedIframeSrc: getCrossDomainPageUrl('../../../data/iframe/simple-iframe.html'), }, '*']); return new Promise(function (resolve) { @@ -722,7 +722,7 @@ test('set cross domain location in same domain iframe', function () { iframe.addEventListener('load', resolve.bind(null, iframe)); callMethod(iframe.contentWindow, 'postMessage', [ getCrossDomainPageUrl('../../../data/cross-domain/set-cross-domain-location.html'), - '*' + '*', ]); }); }) @@ -738,12 +738,12 @@ test('emulate a native browser behaviour related with trailing slashes for locat var testCases = [ { url: 'http://localhost:3000', - expectedLocation: 'http://localhost:3000/' + expectedLocation: 'http://localhost:3000/', }, { url: 'http://localhost:3000/', - expectedLocation: 'http://localhost:3000' - } + expectedLocation: 'http://localhost:3000', + }, ]; var overrideGetResolverElement = function (resolvedHref) { @@ -822,7 +822,7 @@ test('set a relative url to a cross-domain location', function () { return Promise.all([ createTestIframe({ src: crossDomainUrl }), - createTestIframe({ src: crossDomainUrl }) + createTestIframe({ src: crossDomainUrl }), ]) .then(function (iframes) { var waitForLoad = function (iframe) { diff --git a/test/client/fixtures/sandbox/code-instrumentation/setters-test.js b/test/client/fixtures/sandbox/code-instrumentation/setters-test.js index f39c8c152..d5b66168c 100644 --- a/test/client/fixtures/sandbox/code-instrumentation/setters-test.js +++ b/test/client/fixtures/sandbox/code-instrumentation/setters-test.js @@ -326,7 +326,7 @@ test('should not throw an error on setting the body.innerHtml when document.body ' window.hasError = true;', ' }', ' <' + '/script>', - '' + '' // eslint-disable-line comma-dangle ); ok(!iframe.contentWindow.hasError); diff --git a/test/client/fixtures/sandbox/code-instrumentation/type-verification-test.js b/test/client/fixtures/sandbox/code-instrumentation/type-verification-test.js index 2665fb7b4..cfd720696 100644 --- a/test/client/fixtures/sandbox/code-instrumentation/type-verification-test.js +++ b/test/client/fixtures/sandbox/code-instrumentation/type-verification-test.js @@ -3,7 +3,7 @@ var urlUtils = hammerhead.utils.url; test('is window instance', function () { var savedGetProxyUrl = urlUtils.getProxyUrl; var fakeWin = { - location: '' + location: '', }; urlUtils.overrideGetProxyUrl(function () { @@ -19,7 +19,7 @@ test('is window instance', function () { test('is location instance', function () { var savedGetProxyUrl = urlUtils.getProxyUrl; var fakeLocation = { - href: '' + href: '', }; urlUtils.overrideGetProxyUrl(function () { diff --git a/test/client/fixtures/sandbox/console-test.js b/test/client/fixtures/sandbox/console-test.js index 9079627cc..92d205334 100644 --- a/test/client/fixtures/sandbox/console-test.js +++ b/test/client/fixtures/sandbox/console-test.js @@ -18,8 +18,8 @@ if (window.console && typeof window.console.log !== 'undefined') { { toString: function () { return Object.create(null); - } - } + }, + }, ]; var expectedHandledConsoleMethodLines = ['true', 'false', 'null', 'undefined', '42', 'string', '[object Object]', @@ -41,7 +41,7 @@ if (window.console && typeof window.console.log !== 'undefined') { window.console.log, window.console.warn, window.console.error, - window.console.info + window.console.info, ] .forEach(function (consoleMeth) { handledConsoleMethodLines = []; @@ -65,14 +65,14 @@ if (window.console && typeof window.console.log !== 'undefined') { var objWithToString = { toString: function () { return '123'; - } + }, }; var originMethods = { log: nativeMethods.consoleMeths.log, warn: nativeMethods.consoleMeths.warn, error: nativeMethods.consoleMeths.error, - info: nativeMethods.consoleMeths.info + info: nativeMethods.consoleMeths.info, }; function addToLog () { @@ -83,7 +83,7 @@ if (window.console && typeof window.console.log !== 'undefined') { log: addToLog, warn: addToLog, error: addToLog, - info: addToLog + info: addToLog, }; function onConsoleMethCalled (e) { @@ -109,7 +109,7 @@ if (window.console && typeof window.console.log !== 'undefined') { log: originMethods.log, warn: originMethods.warn, error: originMethods.error, - info: originMethods.info + info: originMethods.info, }; hammerhead.off(hammerhead.EVENTS.consoleMethCalled, onConsoleMethCalled); diff --git a/test/client/fixtures/sandbox/cookie-test.js b/test/client/fixtures/sandbox/cookie-test.js index ff8097eb2..2d7fe677b 100644 --- a/test/client/fixtures/sandbox/cookie-test.js +++ b/test/client/fixtures/sandbox/cookie-test.js @@ -55,7 +55,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase 'Test8=Expired; expires=Wed, 13-Jan-1977 22:23:01 GMT; path=/', 'Test9=Duplicate; One=More; expires=' + validDateStr + '; path=/', 'Test10=' + new Array(350).join('(big cookie)'), - 'value without key' + 'value without key', ], 'Test1=Basic; Test2=PathMatch; Test4=DomainMatch; Test7=Secure; Test9=Duplicate; value without key'); testCookies('http://localhost', [ @@ -79,7 +79,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase 'Test6=DomainNotMatch; domain=123', 'Test7=DomainNotMatch; domain=sub.example', 'Test8=DomainNotMatch; domain=example.co', - 'Test9=DomainNotMatch; domain=b.example.com' + 'Test9=DomainNotMatch; domain=b.example.com', ], 'Test1=DomainMatch; Test2=DomainMatch; Test3=DomainMatch; Test4=DomainMatch; Test5=DomainMatch'); destLocation.forceLocation(storedForcedLocation); @@ -345,7 +345,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase return Promise.all([ createTestIframe({ src: crossDomainSrc }), createTestIframe({ src: sameDomainSrc }), - createTestIframe({ src: crossDomainSrc }) + createTestIframe({ src: crossDomainSrc }), ]) .then(function (frames) { iframes = frames; @@ -358,7 +358,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase return Promise.all([ checkCrossDomainIframeCookie(iframes[0], ''), - checkCrossDomainIframeCookie(iframes[2], '') + checkCrossDomainIframeCookie(iframes[2], ''), ]); }) .then(function () { @@ -374,7 +374,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase .then(function () { return Promise.all([ checkCrossDomainIframeCookie(iframes[0], expectedCookies), - checkCrossDomainIframeCookie(iframes[2], expectedCookies) + checkCrossDomainIframeCookie(iframes[2], expectedCookies), ]); }) .then(function () { @@ -389,7 +389,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase return Promise.all([ checkCrossDomainIframeCookie(iframes[0], 'test=123; set=cookie'), - checkCrossDomainIframeCookie(iframes[2], 'test=123; set=cookie') + checkCrossDomainIframeCookie(iframes[2], 'test=123; set=cookie'), ]); }) .then(function () { @@ -412,7 +412,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase return Promise.all([ checkCrossDomainIframeCookie(iframes[0], 'test=123; set=cookie; client=cookie'), - checkCrossDomainIframeCookie(iframes[2], 'test=123; set=cookie; client=cookie') + checkCrossDomainIframeCookie(iframes[2], 'test=123; set=cookie; client=cookie'), ]); }); }); @@ -448,7 +448,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase 's|sessionId|cookie1|example.com|%2F||1fckm5lnl=outdated;path=/', 's|sessionId|cookie1|example.com|%2F||1fckm5lnz=server;path=/', 'w|sessionId|cookie2|example.com|%2F||1fckm5lnl=remove;path=/', - 'cw|sessionId|cookie3|example.com|%2F||1fckm5lnl=stay client;path=/' + 'cw|sessionId|cookie3|example.com|%2F||1fckm5lnl=stay client;path=/', ]; for (var i = 0; i < syncCookies.length; i++) @@ -462,7 +462,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase 'cw|sessionId|cookie3|example.com|%2F||1fckm5lnl=stay client', 's|sessionId|cookie1|example.com|%2F||1fckm5lnl=outdated', 's|sessionId|cookie1|example.com|%2F||1fckm5lnz=server', - 'w|sessionId|cookie2|example.com|%2F||1fckm5lnl=remove' + 'w|sessionId|cookie2|example.com|%2F||1fckm5lnl=remove', ]); unloadSandbox.emit(iframeUnloadSandbox.UNLOAD_EVENT); @@ -547,7 +547,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase urlUtils.overrideParseProxyUrl(function (url) { return { - destResourceInfo: urlUtils.parseUrl(url) + destResourceInfo: urlUtils.parseUrl(url), }; }); @@ -572,7 +572,7 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase urlUtils.overrideParseProxyUrl(function (url) { return { - destResourceInfo: urlUtils.parseUrl(url) + destResourceInfo: urlUtils.parseUrl(url), }; }); diff --git a/test/client/fixtures/sandbox/electron-test.js b/test/client/fixtures/sandbox/electron-test.js index 4f6479e53..61a788baa 100644 --- a/test/client/fixtures/sandbox/electron-test.js +++ b/test/client/fixtures/sandbox/electron-test.js @@ -9,19 +9,19 @@ QUnit.testStart(function () { runInContext: window.noop, runInNewContext: window.noop, runInThisContext: window.noop, - runInDebugContext: window.noop + runInDebugContext: window.noop, }; window.windowMock = { require: function () { return window.vmMock; - } + }, }; window.nativeMethodsMock = { refreshElectronMeths: function () { return true; - } + }, }; window.eval = function () { diff --git a/test/client/fixtures/sandbox/event/event-simulator-test.js b/test/client/fixtures/sandbox/event/event-simulator-test.js index a33b49660..1e80a8b11 100644 --- a/test/client/fixtures/sandbox/event/event-simulator-test.js +++ b/test/client/fixtures/sandbox/event/event-simulator-test.js @@ -483,7 +483,7 @@ test('drag and drop events', function () { 'drop-input', 'drop-document', 'dragend-link', - 'dragend-document' + 'dragend-document', ]; strictEqual(eventLog.join('\n'), expectedEvents.join('\n')); @@ -542,7 +542,7 @@ test('mouse event buttons properties', function () { type: e.type, button: e.button, buttons: getButtonsProperty(e.buttons), - which: e.which + which: e.which, }; actualLog[e.type] = args; @@ -553,7 +553,7 @@ test('mouse event buttons properties', function () { type: type, button: button, buttons: getButtonsProperty(buttons), - which: which + which: which, }; }; @@ -564,21 +564,21 @@ test('mouse event buttons properties', function () { browserUtils.isWebKit ? eventUtils.WHICH_PARAMETER.noButton : eventUtils.WHICH_PARAMETER.leftButton), action: function () { eventSimulator[type](domElement); - } + }, }, { expected: getArgs(type, eventUtils.BUTTON.left, eventUtils.BUTTONS_PARAMETER.leftButton, eventUtils.WHICH_PARAMETER.leftButton), action: function () { eventSimulator[type](domElement, { buttons: eventUtils.BUTTONS_PARAMETER.leftButton }); - } + }, }, { expected: getArgs(type, eventUtils.BUTTON.left, eventUtils.BUTTONS_PARAMETER.rightButton, browserUtils.isWebKit ? eventUtils.WHICH_PARAMETER.rightButton : eventUtils.WHICH_PARAMETER.leftButton), action: function () { eventSimulator[type](domElement, { buttons: eventUtils.BUTTONS_PARAMETER.rightButton }); - } + }, }]; }; @@ -592,7 +592,7 @@ test('mouse event buttons properties', function () { eventUtils.WHICH_PARAMETER.leftButton), action: function () { eventSimulator.click(domElement); - } + }, }, { expected: @@ -603,7 +603,7 @@ test('mouse event buttons properties', function () { eventUtils.WHICH_PARAMETER.leftButton), action: function () { eventSimulator.dblclick(domElement); - } + }, }, { expected: @@ -614,7 +614,7 @@ test('mouse event buttons properties', function () { eventUtils.WHICH_PARAMETER.rightButton), action: function () { eventSimulator.contextmenu(domElement); - } + }, }, { expected: getArgs( @@ -624,7 +624,7 @@ test('mouse event buttons properties', function () { eventUtils.WHICH_PARAMETER.leftButton), action: function () { eventSimulator.mousedown(domElement); - } + }, }, { expected: @@ -635,7 +635,7 @@ test('mouse event buttons properties', function () { eventUtils.WHICH_PARAMETER.rightButton), action: function () { eventSimulator.mousedown(domElement, { button: eventUtils.BUTTON.right }); - } + }, }, { expected: @@ -646,7 +646,7 @@ test('mouse event buttons properties', function () { eventUtils.WHICH_PARAMETER.leftButton), action: function () { eventSimulator.mouseup(domElement); - } + }, }, { expected: @@ -657,8 +657,8 @@ test('mouse event buttons properties', function () { eventUtils.WHICH_PARAMETER.rightButton), action: function () { eventSimulator.mouseup(domElement, { button: eventUtils.BUTTON.right }); - } - } + }, + }, ] .concat(getExpectedMouseMoveEvents('mousemove')) .concat(getExpectedMouseMoveEvents('mouseover')) @@ -707,7 +707,7 @@ module('mouse events on disabled elements', { this.getEventLog = function () { return eventLog; }; - } + }, }, function () { test('
', function () { var div = document.createElement('div'); @@ -755,7 +755,7 @@ module('mouse events on disabled elements', { deepEqual(this.getEventLog(), [ 'mousedown', 'click', - 'mouseup' + 'mouseup', ]); document.body.removeChild(button); @@ -956,7 +956,7 @@ if (!browserUtils.isFirefox) { deepEqual(firedEvents, { input: true, - change: true + change: true, }); }); } @@ -1056,7 +1056,7 @@ if (!browserUtils.isIE) { 'beforeinput': true, 'input': true, 'keydown': true, - 'keyup': true + 'keyup': true, }; function handler (e) { diff --git a/test/client/fixtures/sandbox/event/event-test.js b/test/client/fixtures/sandbox/event/event-test.js index ee3ec1435..5245a514e 100644 --- a/test/client/fixtures/sandbox/event/event-test.js +++ b/test/client/fixtures/sandbox/event/event-test.js @@ -32,7 +32,7 @@ test('remove event listener in the context of optional parameters ("options" obj { addEventListener: [unexpectedClickHandler, true], removeEventListener: [unexpectedClickHandler, true] }, { addEventListener: [unexpectedClickHandler], removeEventListener: [unexpectedClickHandler, false] }, { addEventListener: [unexpectedClickHandler, false], removeEventListener: [unexpectedClickHandler] }, - { addEventListener: [unexpectedClickHandler, { capture: false }], removeEventListener: [unexpectedClickHandler, { capture: false }] } + { addEventListener: [unexpectedClickHandler, { capture: false }], removeEventListener: [unexpectedClickHandler, { capture: false }] }, ]; // NOTE: IE11 doesn't support 'options.capture' option @@ -41,7 +41,7 @@ test('remove event listener in the context of optional parameters ("options" obj { addEventListener: [unexpectedClickHandler, { capture: false }], removeEventListener: [unexpectedClickHandler] }, { addEventListener: [unexpectedClickHandler], removeEventListener: [unexpectedClickHandler, { capture: false }] }, { addEventListener: [expectedClickHandler, { capture: true }], removeEventListener: [expectedClickHandler, false] }, - { addEventListener: [expectedClickHandler, false], removeEventListener: [expectedClickHandler, { capture: true }] } + { addEventListener: [expectedClickHandler, false], removeEventListener: [expectedClickHandler, { capture: true }] }, ]); } @@ -184,7 +184,7 @@ test('firing and dispatching the events created in different ways (Q532574)', fu event = new MouseEvent('click', { 'view': window, 'bubbles': true, - 'cancelable': true + 'cancelable': true, }); } catch (e) { @@ -227,7 +227,7 @@ asyncTest('handler not the function for addEventListener (T261234)', function () clickCount: 0, handleEvent: function () { this.clickCount++; - } + }, }; var eventObjWrap = { @@ -236,7 +236,7 @@ asyncTest('handler not the function for addEventListener (T261234)', function () this.clickCount++; test(); - } + }, }; function test () { @@ -409,7 +409,7 @@ asyncTest('mouse events in iframe', function () { 'mouseenter', 'click', 'dblclick', - 'contextmenu' + 'contextmenu', ]; allEvents = [ @@ -428,7 +428,7 @@ asyncTest('mouse events in iframe', function () { 'mouseenter', 'click', 'dblclick', - 'contextmenu' + 'contextmenu', ]; } else { @@ -440,7 +440,7 @@ asyncTest('mouse events in iframe', function () { 'mouseenter', 'click', 'dblclick', - 'contextmenu' + 'contextmenu', ]; allEvents = [ @@ -456,7 +456,7 @@ asyncTest('mouse events in iframe', function () { 'mouseenter', 'click', 'dblclick', - 'contextmenu' + 'contextmenu', ]; } diff --git a/test/client/fixtures/sandbox/event/focus-blur-change-test.js b/test/client/fixtures/sandbox/event/focus-blur-change-test.js index c9d55300d..674bf1e53 100644 --- a/test/client/fixtures/sandbox/event/focus-blur-change-test.js +++ b/test/client/fixtures/sandbox/event/focus-blur-change-test.js @@ -798,7 +798,7 @@ asyncTest('check that scrolling does not happen when focus is set (after mouse e width: '110%', height: '500px', overflow: 'scroll', - marginBottom: '500px' + marginBottom: '500px', }) .attr('tabIndex', 1); @@ -807,7 +807,7 @@ asyncTest('check that scrolling does not happen when focus is set (after mouse e $(childDiv) .css({ marginLeft: '110%', - marginTop: '110%' + marginTop: '110%', }) .attr('innerHTML', 'Child'); @@ -846,7 +846,7 @@ asyncTest('focus() should not scroll to the element if "preventScrolling" argume width: '500px', height: '500px', top: '2500px', - position: 'absolute' + position: 'absolute', }) .attr('tabIndex', 1); @@ -1074,7 +1074,7 @@ asyncTest('scrolling elements with "overflow=hidden" should be restored after fo backgroundColor: 'grey', width: '500px', height: '150px', - overflow: 'hidden' + overflow: 'hidden', }) .attr('id', 'parent'); @@ -1084,14 +1084,14 @@ asyncTest('scrolling elements with "overflow=hidden" should be restored after fo height: '100px', position: 'relative', left: '80%', - overflow: 'hidden' + overflow: 'hidden', }); $(childDiv) .css({ width: '150px', height: '100px', - background: 'red' + background: 'red', }) .attr('id', 'child'); @@ -1513,7 +1513,7 @@ if (!browserUtils.isIE11) { get: function () { return null; - } + }, }); activeInput.dispatchEvent(new CustomEvent('focus')); diff --git a/test/client/fixtures/sandbox/event/internal-listeners-test.js b/test/client/fixtures/sandbox/event/internal-listeners-test.js index 0eed5058c..11f35c283 100644 --- a/test/client/fixtures/sandbox/event/internal-listeners-test.js +++ b/test/client/fixtures/sandbox/event/internal-listeners-test.js @@ -390,7 +390,7 @@ test('ie service handlers should be ignored (GH-379)', function () { var ieServiceHandlerMock = { toString: function () { return '[object FunctionWrapper]'; - } + }, }; var listenerWrapper = Listeners._getEventListenerWrapper({}, ieServiceHandlerMock); diff --git a/test/client/fixtures/sandbox/event/message-test.js b/test/client/fixtures/sandbox/event/message-test.js index 8bf59b100..04ea7ab4d 100644 --- a/test/client/fixtures/sandbox/event/message-test.js +++ b/test/client/fixtures/sandbox/event/message-test.js @@ -12,7 +12,7 @@ asyncTest('onmessage event (handler has "object" type) (GH-133)', function () { strictEqual(this, eventHandlerObject); window.removeEventListener('message', eventHandlerObject); start(); - } + }, }; window.addEventListener('message', eventHandlerObject); @@ -28,7 +28,7 @@ asyncTest('should pass "transfer" argument for "postMessage" (GH-1535)', functio strictEqual(e.ports.length, 1); window.removeEventListener('message', eventHandlerObject); start(); - } + }, }; window.addEventListener('message', eventHandlerObject); diff --git a/test/client/fixtures/sandbox/event/unload-test.js b/test/client/fixtures/sandbox/event/unload-test.js index 9fe4a86ce..8244dcd5b 100644 --- a/test/client/fixtures/sandbox/event/unload-test.js +++ b/test/client/fixtures/sandbox/event/unload-test.js @@ -84,7 +84,7 @@ if (!browserUtils.isSafari) { postMessage(iframe.contentWindow, [{ cmd: 'reload', returnValue: 'Message', - realReturn: 'return event object' + realReturn: 'return event object', }, '*']); return waitForMessage(window); diff --git a/test/client/fixtures/sandbox/fetch-test.js b/test/client/fixtures/sandbox/fetch-test.js index 96d5738ea..1a87f12c6 100644 --- a/test/client/fixtures/sandbox/fetch-test.js +++ b/test/client/fixtures/sandbox/fetch-test.js @@ -46,15 +46,15 @@ if (window.fetch) { test('pass arguments', function () { var data = { param1: 'value1', - param2: 'value2' + param2: 'value2', }; return fetch('/echo-request-body', { method: 'post', body: JSON.stringify(data), headers: { - 'Content-Type': 'application/json; charset=UTF-8' - } + 'Content-Type': 'application/json; charset=UTF-8', + }, }) .then(function (response) { return response.json(); @@ -68,35 +68,35 @@ if (window.fetch) { var testCases = [ { args: [new URL('https://example.com/some-path')], - expectedUrl: 'https://example.com/some-path' + expectedUrl: 'https://example.com/some-path', }, { args: [null], - expectedUrl: 'https://example.com/null' + expectedUrl: 'https://example.com/null', }, { args: [void 0], - expectedUrl: 'https://example.com/undefined' + expectedUrl: 'https://example.com/undefined', }, { args: [{ url: '/some-path' }], - expectedUrl: 'https://example.com/[object%20Object]' + expectedUrl: 'https://example.com/[object%20Object]', }, { args: [{ url: '/some-path', toString: function () { return this.url; - } + }, }], - expectedUrl: 'https://example.com/some-path' - } + expectedUrl: 'https://example.com/some-path', + }, ]; if (browserUtils.isSafari) { testCases.push({ args: [], - expectedUrl: 'https://example.com/undefined' + expectedUrl: 'https://example.com/undefined', }); } @@ -332,7 +332,7 @@ if (window.fetch) { var headers = { 'content-type': 'text/plain', 'Authorization': 'Basic qwerty', - 'proxy-Authorization': 'Digital abcdifg' + 'proxy-Authorization': 'Digital abcdifg', }; var storedFetch = nativeMethods.fetch; @@ -404,7 +404,7 @@ if (window.fetch) { var checkUrl = function (url) { return Promise.all([ performRequest(fetch, url), - performRequest(nativeMethods.fetch, url) + performRequest(nativeMethods.fetch, url), ]) .then(function (logs) { strictEqual(logs[0], logs[1]); @@ -413,7 +413,7 @@ if (window.fetch) { return Promise.all([ checkUrl('/close-request'), - checkUrl('/respond-500') + checkUrl('/respond-500'), ]); }); @@ -432,8 +432,8 @@ if (window.fetch) { checkArg({ toString: function () { return {}; - } - }) + }, + }), ]; // NOTE: Safari processed `fetch()` without `Promise` rejection (GH-1613) @@ -448,7 +448,7 @@ if (window.fetch) { window.Promise = { reject: function () { - } + }, }; var fetchPromise = fetch(); @@ -466,10 +466,10 @@ if (window.fetch) { return; var initWithHeader1 = { - headers: { header1: 'value1' } + headers: { header1: 'value1' }, }; var initWithHeader3 = { - headers: { header3: 'value3' } + headers: { header3: 'value3' }, }; var retrieveRequestBodyAsJson = function (fetchPromise) { return fetchPromise @@ -506,7 +506,7 @@ if (window.fetch) { retrieveRequestBodyAsJson(fetch(request, initWithHeader3)), retrieveRequestBodyAsJson(nativeMethods.fetch.call(window, proxiedUrl, initWithHeader1)), retrieveRequestBodyAsJson(nativeMethods.fetch.call(window, nativeRequest)), - retrieveRequestBodyAsJson(nativeMethods.fetch.call(window, nativeRequest, initWithHeader3)) + retrieveRequestBodyAsJson(nativeMethods.fetch.call(window, nativeRequest, initWithHeader3)), ]) .then(function (data) { var request1Headers = data[0]; @@ -565,7 +565,7 @@ if (window.fetch) { return fetch({ toString: function () { return {}; - } + }, }); }) .catch(function () { @@ -599,7 +599,7 @@ if (window.fetch) { var headersArr = [ ['content-type', 'text/xml'], ['breaking-bad', '<3'], - ['authorization', '123'] + ['authorization', '123'], ]; return fetch('/echo-request-headers', { method: 'post', headers: headersArr }) @@ -617,8 +617,8 @@ if (window.fetch) { var request = new Request('/echo-request-headers', { headers: { 'Authorization': '123', - 'Content-Type': 'charset=utf-8' - } + 'Content-Type': 'charset=utf-8', + }, }); return fetch(request, { cache: 'no-cache' }) diff --git a/test/client/fixtures/sandbox/iframe-flag-test.js b/test/client/fixtures/sandbox/iframe-flag-test.js index 8f37959b8..2fe0022a4 100644 --- a/test/client/fixtures/sandbox/iframe-flag-test.js +++ b/test/client/fixtures/sandbox/iframe-flag-test.js @@ -18,7 +18,7 @@ var tagUrlAttr = { a: 'href', form: 'action', area: 'href', - base: 'href' + base: 'href', }; function testIframeFlagViaAttrs (doc, iframeFlagResults) { @@ -56,7 +56,7 @@ function testIframeFlagViaAttrs (doc, iframeFlagResults) { var tagFormTargetAttr = { input: 'formAction', - button: 'formAction' + button: 'formAction', }; function testIframeFlagViaFormTarget (doc, iframeFlagResults) { @@ -107,7 +107,7 @@ test('assign a url attribute to elements with the "target" attribute in top wind _parent: false, _top: false, window_name: true, - unknow_window: false + unknow_window: false, }); /* eslint-enable camelcase */ }); @@ -132,7 +132,7 @@ test('assign a url attribute to elements with the "target" attribute in iframe', _parent: false, _top: false, window_name: true, - unknow_window: false + unknow_window: false, }); /* eslint-enable camelcase */ }); @@ -152,7 +152,7 @@ test('assign a url attribute to elements with the "target" attribute in embedded return createTestIframe({ src: getSameDomainPageUrl('../../data/iframe/simple-iframe.html'), - name: 'window_name' + name: 'window_name', }, embeddedIframe.contentDocument.body); }) .then(function () { @@ -163,7 +163,7 @@ test('assign a url attribute to elements with the "target" attribute in embedded _parent: true, _top: false, window_name: true, - unknow_window: false + unknow_window: false, }); /* eslint-enable camelcase */ }); @@ -281,7 +281,7 @@ test('assign a "formaction" attribute to elements with the "formtarget" attribut _parent: false, _top: false, window_name: true, - unknow_window: false + unknow_window: false, }); /* eslint-enable camelcase */ }); @@ -306,7 +306,7 @@ test('assign a "formaction" attribute to elements with the "formtarget" attribut _parent: false, _top: false, window_name: true, - unknow_window: false + unknow_window: false, }); /* eslint-enable camelcase */ }); @@ -326,7 +326,7 @@ test('assign a "formaction" attribute to elements with the "formtarget" attribut return createTestIframe({ src: getSameDomainPageUrl('../../data/iframe/simple-iframe.html'), - name: 'window_name' + name: 'window_name', }, embeddedIframe.contentDocument.body); }) .then(function () { @@ -337,7 +337,7 @@ test('assign a "formaction" attribute to elements with the "formtarget" attribut _parent: true, _top: false, window_name: true, - unknow_window: false + unknow_window: false, }); /* eslint-enable camelcase */ }); @@ -350,13 +350,13 @@ test('change a url via location from cross-domain window', function () { hammerhead.sandbox.codeInstrumentation._methodCallInstrumentation.methodWrappers.assign.method({ assign: function (url) { ok(hasIframeFlag(url)); - } + }, }, ['https://example.com/']); hammerhead.sandbox.codeInstrumentation._methodCallInstrumentation.methodWrappers.replace.method({ replace: function (url) { ok(hasIframeFlag(url)); - } + }, }, ['https://example.com/']); }); diff --git a/test/client/fixtures/sandbox/iframe-test.js b/test/client/fixtures/sandbox/iframe-test.js index b15043ca4..7cba6b748 100644 --- a/test/client/fixtures/sandbox/iframe-test.js +++ b/test/client/fixtures/sandbox/iframe-test.js @@ -24,7 +24,7 @@ test('should not miss the Hammerhead instance after the iframe.contentDocument.c return Promise.all([ createTestIframe(), - createTestIframe({ src: getSameDomainPageUrl('../../data/iframe/simple-iframe.html') }) + createTestIframe({ src: getSameDomainPageUrl('../../data/iframe/simple-iframe.html') }), ]) .then(function (iframes) { var iframeWithoutSrc = iframes[0]; @@ -573,7 +573,7 @@ if (!browserUtils.isFirefox) { var testedSandboxes = [ iframeHammerhead.shadowUI._iframeSandbox, iframeHammerhead.shadowUI._nodeMutation, - iframeHammerhead.sandbox.codeInstrumentation._locationAccessorsInstrumentation + iframeHammerhead.sandbox.codeInstrumentation._locationAccessorsInstrumentation, ]; testedSandboxes.forEach(function (sandbox) { @@ -604,15 +604,15 @@ test('hammerhead should not use overridden contentWindow, contentDocument getter ok('false', 'contentWindow'); }, enumerable: true, - configurable: true + configurable: true, }, contentDocument: { get: function () { /* eslint-disable-line getter-return */ ok('false', 'contentDocument'); }, enumerable: true, - configurable: true - } + configurable: true, + }, }); ok(domUtils.isIframeWithoutSrc(iframe)); diff --git a/test/client/fixtures/sandbox/native-methods-test.js b/test/client/fixtures/sandbox/native-methods-test.js index 825edee34..a720a135d 100644 --- a/test/client/fixtures/sandbox/native-methods-test.js +++ b/test/client/fixtures/sandbox/native-methods-test.js @@ -20,7 +20,7 @@ if (nativeMethods.inputValueSetter) { }, set: function (value) { return value; - } + }, }); el.value = '123'; diff --git a/test/client/fixtures/sandbox/node/attributes-test.js b/test/client/fixtures/sandbox/node/attributes-test.js index 6b3f65ea9..06fab7a4d 100644 --- a/test/client/fixtures/sandbox/node/attributes-test.js +++ b/test/client/fixtures/sandbox/node/attributes-test.js @@ -128,7 +128,7 @@ test('url attributes overridden by descriptor', function () { { tagName: 'link', attr: 'href', getter: nativeMethods.linkHrefGetter }, { tagName: 'form', attr: 'action', getter: nativeMethods.formActionGetter }, { tagName: 'input', attr: 'formAction', getter: nativeMethods.inputFormActionGetter }, - { tagName: 'button', attr: 'formAction', getter: nativeMethods.buttonFormActionGetter } + { tagName: 'button', attr: 'formAction', getter: nativeMethods.buttonFormActionGetter }, ]; if (nativeMethods.htmlManifestGetter) @@ -709,7 +709,7 @@ test('process html', function () { { relValue: 'preload', hasRelAttr: true, hasStoredRelAttr: false }, { relValue: 'prev', hasRelAttr: true, hasStoredRelAttr: false }, { relValue: 'search', hasRelAttr: true, hasStoredRelAttr: false }, - { relValue: 'stylesheet', hasRelAttr: true, hasStoredRelAttr: false } + { relValue: 'stylesheet', hasRelAttr: true, hasStoredRelAttr: false }, ]; relAttrCases.forEach(function (relAttrCase) { @@ -741,7 +741,7 @@ test('setAttribute', function () { { relValue: 'preload', nativeGetAttrExpected: 'preload' }, { relValue: 'prev', nativeGetAttrExpected: 'prev' }, { relValue: 'search', nativeGetAttrExpected: 'search' }, - { relValue: 'stylesheet', nativeGetAttrExpected: 'stylesheet' } + { relValue: 'stylesheet', nativeGetAttrExpected: 'stylesheet' }, ]; var link = document.createElement('link'); @@ -802,7 +802,7 @@ test('process html', function () { { typeValue: 'file', requiredValue: 'required' }, { typeValue: 'file', requiredValue: '' }, { typeValue: 'radio', requiredValue: 'required' }, - { typeValue: null, requiredValue: '' } + { typeValue: null, requiredValue: '' }, ]; var storedRequiredAttr = DomProcessor.getStoredAttrName('required'); @@ -827,7 +827,7 @@ test('setAttribute', function () { { typeValue: 'file', requiredValue: 'required' }, { typeValue: 'file', requiredValue: '' }, { typeValue: 'radio', requiredValue: 'required' }, - { typeValue: null, requiredValue: '' } + { typeValue: null, requiredValue: '' }, ]; var input = document.createElement('input'); @@ -851,7 +851,7 @@ test('hasAttribute, removeAttribute', function () { { typeValue: 'file', requiredValue: 'required' }, { typeValue: 'file', requiredValue: '' }, { typeValue: 'radio', requiredValue: 'required' }, - { typeValue: null, requiredValue: '' } + { typeValue: null, requiredValue: '' }, ]; var input = document.createElement('input'); @@ -879,7 +879,7 @@ test('"required" property', function () { { typeValue: 'radio', requiredValue: true }, { typeValue: 'radio', requiredValue: false }, { typeValue: null, requiredValue: true }, - { typeValue: null, requiredValue: false } + { typeValue: null, requiredValue: false }, ]; var input = document.createElement('input'); @@ -950,7 +950,7 @@ test('"type" attribute removed (GH-1645)', function () { { typeValue: 'file', requiredValue: 'required' }, { typeValue: 'file', requiredValue: '' }, { typeValue: 'radio', requiredValue: 'required' }, - { typeValue: null, requiredValue: '' } + { typeValue: null, requiredValue: '' }, ]; var storedRequiredAttr = DomProcessor.getStoredAttrName('required'); @@ -1085,7 +1085,7 @@ test('the "Maximum call stack size exceeded" error should not occurs when the se sandbox: document.createElement('iframe'), src: document.createElement('img'), target: document.createElement('a'), - style: document.createElement('span') + style: document.createElement('span'), }; if (nativeMethods.htmlManifestGetter) diff --git a/test/client/fixtures/sandbox/node/classes-test.js b/test/client/fixtures/sandbox/node/classes-test.js index 133702d9d..1b3e1ea82 100644 --- a/test/client/fixtures/sandbox/node/classes-test.js +++ b/test/client/fixtures/sandbox/node/classes-test.js @@ -48,7 +48,7 @@ test('refreshed classes "toString" method', function () { { refreshedClass: window.EventSource, storedClass: nativeMethods.EventSource }, { refreshedClass: window.Proxy, storedClass: nativeMethods.Proxy }, { refreshedClass: window.DataTransferItemList, storedClass: nativeMethods.DataTransferItemList }, - { refreshedClass: window.DataTransferItem, storedClass: nativeMethods.DataTransferItem } + { refreshedClass: window.DataTransferItem, storedClass: nativeMethods.DataTransferItem }, ]; testCases.forEach(function (testCase) { @@ -61,7 +61,7 @@ module('Blob'); test('window.Blob([data], { type: "" }) should return correct result for `ArrayBuffer`, `Uint8Array` and `DataView` data types (GH-1599)', function () { var bmpExample = { - signature: [0x42, 0x4D] + signature: [0x42, 0x4D], }; var testConstructor = function (constructor) { @@ -119,7 +119,7 @@ test('window.Blob([data], { type: "" }) should return correct result for `ArrayB return Promise.all([ testConstructor(ArrayBuffer), testConstructor(Uint8Array), - testConstructor(DataView) + testConstructor(DataView), ]); }); @@ -159,20 +159,20 @@ if (canCreateBlobFromNumberBooleanArray) { var testCases = [ { blobParts: unprocessableBlobParts, - options: { type: '' } + options: { type: '' }, }, { blobParts: unprocessableBlobParts, - options: { type: 'text/javascript' } + options: { type: 'text/javascript' }, }, { blobParts: processableBlobParts.concat([new nativeMethods.Blob(['unprocessable part'])]), - options: { type: '' } + options: { type: '' }, }, { blobParts: processableBlobParts.concat([new nativeMethods.Blob(['unprocessable part'])]), - options: { type: 'text/javascript' } - } + options: { type: 'text/javascript' }, + }, ]; var readBlobContent = function (blob) { @@ -228,7 +228,7 @@ if (isFileConstructable) { test('window.File([data], "file.name", { type: "" }) should return correct result for `ArrayBuffer`, `Uint8Array` and `DataView` data types', function () { var bmpExample = { - signature: [0x42, 0x4D] + signature: [0x42, 0x4D], }; var testConstructor = function (constructor) { @@ -286,7 +286,7 @@ if (isFileConstructable) { return Promise.all([ testConstructor(ArrayBuffer), testConstructor(Uint8Array), - testConstructor(DataView) + testConstructor(DataView), ]); }); @@ -314,20 +314,20 @@ if (isFileConstructable) { var testCases = [ { fileParts: unprocessableFileParts, - options: { type: '' } + options: { type: '' }, }, { fileParts: unprocessableFileParts, - options: { type: 'text/javascript' } + options: { type: 'text/javascript' }, }, { fileParts: processableFileParts.concat([new nativeMethods.File(['unprocessable part'], 'file.name')]), - options: { type: '' } + options: { type: '' }, }, { fileParts: processableFileParts.concat([new nativeMethods.File(['unprocessable part'], 'file.name')]), - options: { type: 'text/javascript' } - } + options: { type: 'text/javascript' }, + }, ]; var readFileContent = function (file) { @@ -604,20 +604,20 @@ if (window.Blob) { description: 'without parameters', newBlobFunc: function () { return new window.Blob(); - } + }, }, { description: 'only "parts" parameter', newBlobFunc: function () { return new window.Blob(['text']); - } + }, }, { description: '"parts" and "opts" parameters', newBlobFunc: function () { return new window.Blob(['text'], { type: 'text/plain' }); - } - } + }, + }, ]; testCases.forEach(function (testCase) { @@ -646,12 +646,12 @@ if (window.FormData) { info: { size: 4, type: 'text/plain', - name: 'correctName.txt' + name: 'correctName.txt', }, // NOTE: window.File in IE11 is not constructable. blob: nativeMethods.File ? new File(['text'], 'correctName.txt', { type: 'text/plain' }) - : new Blob(['text'], { type: 'text/plain' }) + : new Blob(['text'], { type: 'text/plain' }), })); formData.append(INTERNAL_ATTRS.uploadInfoHiddenInputName, '[]'); diff --git a/test/client/fixtures/sandbox/node/document-test.js b/test/client/fixtures/sandbox/node/document-test.js index 289f8a963..87ca64965 100644 --- a/test/client/fixtures/sandbox/node/document-test.js +++ b/test/client/fixtures/sandbox/node/document-test.js @@ -538,7 +538,7 @@ module('document.title', { }, afterEach: function () { strictEqual(nativeMethods.documentTitleGetter.call(document), 'Test title', 'check into afterEach hook'); - } + }, }); test('basic', function () { @@ -924,7 +924,7 @@ test('an iframe should not contain injected scripts after loading (GH-2622)', fu // (allow-same-origin allow-scripts) in our internal iframe processing logic return createTestIframe({ src: getSameDomainPageUrl('../../../data/iframe/simple-iframe.html'), - sandbox: '' + sandbox: '', }) .then(function (iframe) { var iframeInjectedScripts = nativeMethods.querySelectorAll.call(iframe.contentDocument, '.' + SHADOW_UI_CLASSNAME.script); @@ -988,8 +988,8 @@ if (document.registerElement) { test('should not raise an error if processed element is created via non-overriden way and it is locked (GH-1300)', function () { var CustomElementConstructor = document.registerElement('custom-element', { prototype: { - __proto__: HTMLElement.prototype - } + __proto__: HTMLElement.prototype, + }, }); var customElement1 = new CustomElementConstructor(); var customElement2 = new CustomElementConstructor(); @@ -1057,7 +1057,7 @@ test('should not throw an error if the `children` property is overridden by clie Object.defineProperty(Element.prototype, 'children', { get: function () { throw new Error(); - } + }, }); var div = document.createElement('div'); diff --git a/test/client/fixtures/sandbox/node/dom-processor-test.js b/test/client/fixtures/sandbox/node/dom-processor-test.js index fce69c2b7..e9e3f4940 100644 --- a/test/client/fixtures/sandbox/node/dom-processor-test.js +++ b/test/client/fixtures/sandbox/node/dom-processor-test.js @@ -471,7 +471,7 @@ test('crossdomain src', function () { var proxyUrl = urlUtils.getProxyUrl(url, { proxyHostname: location.hostname, proxyPort: 2001, - resourceType: 'i' + resourceType: 'i', }); var processed = htmlUtils.processHtml(''); diff --git a/test/client/fixtures/sandbox/node/dom-test.js b/test/client/fixtures/sandbox/node/dom-test.js index 8265300ec..ff5b86cba 100644 --- a/test/client/fixtures/sandbox/node/dom-test.js +++ b/test/client/fixtures/sandbox/node/dom-test.js @@ -120,7 +120,7 @@ test('process a text node when it is appended to script', function () { var scriptEl = document.createElement('script'); var textNode = document.createTextNode( 'window.testAnchor = document.createElement("a");' + - 'window.testAnchor.href = "' + url + '";' + 'window.testAnchor.href = "' + url + '";' // eslint-disable-line comma-dangle ); scriptEl.appendChild(textNode); diff --git a/test/client/fixtures/sandbox/node/html-collection-wrapper-test.js b/test/client/fixtures/sandbox/node/html-collection-wrapper-test.js index f5cd4f5c0..eee802768 100644 --- a/test/client/fixtures/sandbox/node/html-collection-wrapper-test.js +++ b/test/client/fixtures/sandbox/node/html-collection-wrapper-test.js @@ -38,7 +38,7 @@ module('getElementsByTagName', function () { {}, '', function () { - } + }, ]; var result = null; var nativeResult = null; diff --git a/test/client/fixtures/sandbox/node/methods-test.js b/test/client/fixtures/sandbox/node/methods-test.js index 358b92426..02da939a4 100644 --- a/test/client/fixtures/sandbox/node/methods-test.js +++ b/test/client/fixtures/sandbox/node/methods-test.js @@ -260,36 +260,36 @@ test('canvasRenderingContext2D.drawImage', function () { args: [crossDomainImg, 1, 2], testImgFn: function (img) { return nativeMethods.imageSrcGetter.call(img) === crossDomainUrl; - } + }, }, { description: 'image with local url', args: [localImg, 4, 3, 2, 1], testImgFn: function (img) { return nativeMethods.imageSrcGetter.call(img) === urlUtils.getProxyUrl(localUrl); - } + }, }, { description: 'image created with Image constructor', args: [imgCreatedViaConstr, 4, 3, 2], testImgFn: function (img) { return img === imgCreatedViaConstr; - } + }, }, { description: 'canvas element', args: [otherCanvas, 1, 3, 5, 7, 2, 4, 6, 8], testImgFn: function (img) { return img === otherCanvas; - } + }, }, { description: 'canvas context', args: [otherCanvasContext, 11, 12], testImgFn: function (img) { return img === otherCanvasContext; - } - } + }, + }, ]; nativeMethods.imageSrcSetter.call(crossDomainImg, crossDomainUrl); @@ -320,7 +320,7 @@ if (!browserUtils.isFirefox) { eval(processScript([ 'iframe.contentDocument.write("
");', - 'iframe.contentDocument.write("