Browse Source

Merge pull request #936 from javascript-obfuscator/domain-lock-destination

`domainDest` => `domainLockRedirectUrl` option rename
Timofey Kachalov 3 năm trước cách đây
mục cha
commit
21c6fa803d

+ 4 - 0
CHANGELOG.md

@@ -1,5 +1,9 @@
 Change Log
 
+v2.15.1
+---
+* **Hotfix**: `domainDest` => `domainLockRedirectUrl` option rename
+
 v2.15.0
 ---
 * Added `domainDest` option that option allows the browser to be redirected to a passed domain if the source code isn't run on the domains or URL specified by `domainLock`. Thank you https://github.com/erikdubbelboer!

+ 5 - 5
README.md

@@ -361,7 +361,7 @@ Following options are available for the JS Obfuscator:
     debugProtectionInterval: false,
     disableConsoleOutput: false,
     domainLock: [],
-    domainDest: 'about:blank',
+    domainLockRedirectUrl: 'about:blank',
     forceTransformStrings: [],
     identifierNamesCache: null,
     identifierNamesGenerator: 'hexadecimal',
@@ -422,7 +422,7 @@ Following options are available for the JS Obfuscator:
     --debug-protection-interval <boolean>
     --disable-console-output <boolean>
     --domain-lock '<list>' (comma separated)
-    --domain-dest <string>
+    --domain-lock-redirect-url <string>
     --exclude '<list>' (comma separated)
     --force-transform-strings '<list>' (comma separated)
     --identifier-names-cache-path <string>
@@ -690,17 +690,17 @@ Type: `string[]` Default: `[]`
 
 Allows to run the obfuscated source code only on specific domains and/or sub-domains. This makes really hard for someone to just copy and paste your source code and run it elsewhere.
 
-If the source code isn't run on the domains specified by this option, the browser will be redirected to a passed to the [`domainDest`](#domaindest) option domain or URL.
+If the source code isn't run on the domains specified by this option, the browser will be redirected to a passed to the [`domainLockRedirectUrl`](#domainlockredirecturl) option URL.
 
 ##### Multiple domains and sub-domains
 It's possible to lock your code to more than one domain or sub-domain. For instance, to lock it so the code only runs on **www.example.com** add `www.example.com`. To make it work on the root domain including any sub-domains (`example.com`, `sub.example.com`), use `.example.com`.
 
-### `domainDest`
+### `domainLockRedirectUrl`
 Type: `string` Default: `about:blank`
 
 ##### :warning: This option does not work with `target: 'node'`
 
-Allows the browser to be redirected to a passed domain or URL if the source code isn't run on the domains specified by [`domainLock`](#domainlock)
+Allows the browser to be redirected to a passed URL if the source code isn't run on the domains specified by [`domainLock`](#domainlock)
 
 ### `exclude`
 Type: `string[]` Default: `[]`

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
dist/index.browser.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
dist/index.cli.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
dist/index.js


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "javascript-obfuscator",
-  "version": "2.15.0",
+  "version": "2.15.1",
   "description": "JavaScript obfuscator",
   "keywords": [
     "obfuscator",

+ 2 - 2
src/cli/JavaScriptObfuscatorCLI.ts

@@ -237,8 +237,8 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
                 ArraySanitizer
             )
             .option(
-                '--domain-dest <string>',
-                'Allows the browser to be redirected to a passed domain if the source code isn\'t run on the domains specified by --domain-lock',
+                '--domain-lock-redirect-url <string>',
+                'Allows the browser to be redirected to a passed URL if the source code isn\'t run on the domains specified by --domain-lock',
             )
             .option(
                 '--exclude <list> (comma separated, without whitespaces)',

+ 6 - 6
src/custom-code-helpers/domain-lock/DomainLockCodeHelper.ts

@@ -89,14 +89,14 @@ export class DomainLockCodeHelper extends AbstractCustomCodeHelper {
      */
     protected override getCodeHelperTemplate (): string {
         const domainsString: string = this.options.domainLock.join(';');
-        const domainsDest: string = this.options.domainDest;
+        const domainsLockRedirectUrl: string = this.options.domainLockRedirectUrl;
         const [hiddenDomainsString, domainsStringDiff]: string[] = this.cryptUtils.hideString(
             domainsString,
             domainsString.length * 3
         );
-        const [hiddenDomainDest, domainDestDiff]: string[] = this.cryptUtils.hideString(
-            domainsDest,
-            domainsDest.length * 3
+        const [hiddenDomainLockRedirectUrl, domainLockRedirectUrlDiff]: string[] = this.cryptUtils.hideString(
+            domainsLockRedirectUrl,
+            domainsLockRedirectUrl.length * 3
         );
         const globalVariableTemplate: string = this.options.target !== ObfuscationTarget.BrowserNoEval
             ? this.getGlobalVariableTemplate()
@@ -107,8 +107,8 @@ export class DomainLockCodeHelper extends AbstractCustomCodeHelper {
             domainLockFunctionName: this.domainLockFunctionName,
             domainsStringDiff,
             domains: hiddenDomainsString,
-            domainDestDiff,
-            domainDest: hiddenDomainDest,
+            domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+            hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
             globalVariableTemplate
         });
     }

+ 3 - 3
src/custom-code-helpers/domain-lock/templates/DomainLockTemplate.ts

@@ -107,10 +107,10 @@ export function DomainLockTemplate (): string {
             }
 
             if (!ok) {
-                const regExp2 = new RegExp("[{domainDestDiff}]", "g");
-                const domainDest = "{domainDest}".replace(regExp2, "");
+                const regExp2 = new RegExp("[{domainLockRedirectUrlDiff}]", "g");
+                const domainLockRedirectUrl = "{hiddenDomainLockRedirectUrl}".replace(regExp2, "");
 
-                that[document][location] = domainDest;
+                that[document][location] = domainLockRedirectUrl;
             }
         });
 

+ 1 - 1
src/interfaces/options/IOptions.ts

@@ -20,7 +20,7 @@ export interface IOptions {
     readonly debugProtectionInterval: boolean;
     readonly disableConsoleOutput: boolean;
     readonly domainLock: string[];
-    readonly domainDest: string;
+    readonly domainLockRedirectUrl: string;
     readonly forceTransformStrings: string[];
     readonly identifierNamesCache: TIdentifierNamesCache;
     readonly identifierNamesGenerator: TTypeFromEnum<typeof IdentifierNamesGenerator>;

+ 3 - 3
src/options/Options.ts

@@ -46,7 +46,7 @@ import { HIGH_OBFUSCATION_PRESET } from './presets/HighObfuscation';
 
 import { ValidationErrorsFormatter } from './ValidationErrorsFormatter';
 import { IsAllowedForObfuscationTargets } from './validators/IsAllowedForObfuscationTargets';
-import { IsDomainDestUrl } from './validators/IsDomainDestUrl';
+import { IsDomainLockRedirectUrl } from './validators/IsDomainLockRedirectUrl';
 import { IsIdentifierNamesCache } from './validators/IsIdentifierNamesCache';
 
 @injectable()
@@ -138,8 +138,8 @@ export class Options implements IOptions {
     /**
      * @type {string}
      */
-    @IsDomainDestUrl()
-    public readonly domainDest!: string;
+    @IsDomainLockRedirectUrl()
+    public readonly domainLockRedirectUrl!: string;
 
     /**
      * @type {string[]}

+ 2 - 2
src/options/OptionsNormalizer.ts

@@ -8,7 +8,7 @@ import { IOptionsNormalizer } from '../interfaces/options/IOptionsNormalizer';
 import { ControlFlowFlatteningThresholdRule } from './normalizer-rules/ControlFlowFlatteningThresholdRule';
 import { DeadCodeInjectionRule } from './normalizer-rules/DeadCodeInjectionRule';
 import { DeadCodeInjectionThresholdRule } from './normalizer-rules/DeadCodeInjectionThresholdRule';
-import { DomainDestRule } from './normalizer-rules/DomainDestRule';
+import { DomainLockRedirectUrlRule } from './normalizer-rules/DomainLockRedirectUrlRule';
 import { DomainLockRule } from './normalizer-rules/DomainLockRule';
 import { IdentifierNamesCacheRule } from './normalizer-rules/IdentifierNamesCacheRule';
 import { InputFileNameRule } from './normalizer-rules/InputFileNameRule';
@@ -30,7 +30,7 @@ export class OptionsNormalizer implements IOptionsNormalizer {
         ControlFlowFlatteningThresholdRule,
         DeadCodeInjectionRule,
         DeadCodeInjectionThresholdRule,
-        DomainDestRule,
+        DomainLockRedirectUrlRule,
         DomainLockRule,
         IdentifierNamesCacheRule,
         InputFileNameRule,

+ 2 - 2
src/options/normalizer-rules/DomainDestRule.ts → src/options/normalizer-rules/DomainLockRedirectUrlRule.ts

@@ -8,11 +8,11 @@ import { DEFAULT_PRESET } from '../presets/Default';
  * @param {IOptions} options
  * @returns {IOptions}
  */
-export const DomainDestRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
+export const DomainLockRedirectUrlRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
     if (!options.domainLock.length) {
         options = {
             ...options,
-            domainDest: <string>DEFAULT_PRESET.domainDest
+            domainLockRedirectUrl: <string>DEFAULT_PRESET.domainLockRedirectUrl
         };
     }
 

+ 1 - 1
src/options/presets/Default.ts

@@ -20,7 +20,7 @@ export const DEFAULT_PRESET: TInputOptions = Object.freeze({
     debugProtectionInterval: false,
     disableConsoleOutput: false,
     domainLock: [],
-    domainDest: 'about:blank',
+    domainLockRedirectUrl: 'about:blank',
     exclude: [],
     forceTransformStrings: [],
     identifierNamesCache: null,

+ 1 - 1
src/options/presets/NoCustomNodes.ts

@@ -18,7 +18,7 @@ export const NO_ADDITIONAL_NODES_PRESET: TInputOptions = Object.freeze({
     debugProtectionInterval: false,
     disableConsoleOutput: false,
     domainLock: [],
-    domainDest: 'about:blank',
+    domainLockRedirectUrl: 'about:blank',
     exclude: [],
     forceTransformStrings: [],
     identifierNamesGenerator: IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,

+ 3 - 3
src/options/validators/IsDomainDestUrl.ts → src/options/validators/IsDomainLockRedirectUrl.ts

@@ -13,10 +13,10 @@ import { IsAllowedForObfuscationTargets } from './IsAllowedForObfuscationTargets
 /**
  * @returns {PropertyDecorator}
  */
-export const IsDomainDestUrl = (): PropertyDecorator => {
+export const IsDomainLockRedirectUrl = (): PropertyDecorator => {
     return (target: any, key: string | symbol): void => {
-        ValidateIf(({domainDest}: TInputOptions) => {
-            return domainDest !== DEFAULT_PRESET.domainDest;
+        ValidateIf(({domainLockRedirectUrl}: TInputOptions) => {
+            return domainLockRedirectUrl !== DEFAULT_PRESET.domainLockRedirectUrl;
         })(target, key);
         IsUrl({
             require_protocol: false,

+ 109 - 109
test/functional-tests/custom-code-helpers/domain-lock/templates/DomainLockNodeTemplate.spec.ts

@@ -61,7 +61,7 @@ describe('DomainLockTemplate', () => {
 
     describe('Variant #1: current domain matches with `domainsString`', () => {
         const domainsString: string = ['www.example.com'].join(';');
-        const domainDest: string = 'about:blank';
+        const domainLockRedirectUrl: string = 'about:blank';
         const currentDomain: string = 'www.example.com';
 
         let testFunc: Function;
@@ -74,9 +74,9 @@ describe('DomainLockTemplate', () => {
             ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
             const [
-                hiddenDomainDest,
-                domainDestDiff
-            ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                hiddenDomainLockRedirectUrl,
+                domainLockRedirectUrlDiff
+            ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
             root = {
                 document: {
@@ -90,8 +90,8 @@ describe('DomainLockTemplate', () => {
                     domainLockFunctionName: 'domainLockFunction',
                     domainsStringDiff,
                     domains: hiddenDomainsString,
-                    domainDestDiff,
-                    hiddenDomainDest,
+                    domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                    hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                     globalVariableTemplate: '',
                     singleCallControllerFunctionName
                 },
@@ -108,7 +108,7 @@ describe('DomainLockTemplate', () => {
 
     describe('Variant #2: current domain matches with base domain of `domainsString`', () => {
         const domainsString: string = ['.example.com'].join(';');
-        const domainDest: string = 'about:blank';
+        const domainLockRedirectUrl: string = 'about:blank';
         const currentDomain: string = 'www.example.com';
 
         let testFunc: Function;
@@ -121,9 +121,9 @@ describe('DomainLockTemplate', () => {
             ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
             const [
-                hiddenDomainDest,
-                domainDestDiff
-            ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                hiddenDomainLockRedirectUrl,
+                domainLockRedirectUrlDiff
+            ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
             root = {
                 document: {
@@ -137,8 +137,8 @@ describe('DomainLockTemplate', () => {
                     domainLockFunctionName: 'domainLockFunction',
                     domainsStringDiff,
                     domains: hiddenDomainsString,
-                    domainDestDiff,
-                    hiddenDomainDest,
+                    domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                    hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                     globalVariableTemplate: '',
                     singleCallControllerFunctionName
                 },
@@ -155,7 +155,7 @@ describe('DomainLockTemplate', () => {
 
     describe('Variant #3: current domain matches with root domain of `domainsString`', () => {
         const domainsString: string = ['.example.com'].join(';');
-        const domainDest: string = 'about:blank';
+        const domainLockRedirectUrl: string = 'about:blank';
         const currentDomain: string = 'example.com';
 
         let testFunc: Function;
@@ -168,9 +168,9 @@ describe('DomainLockTemplate', () => {
             ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
             const [
-                hiddenDomainDest,
-                domainDestDiff
-            ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                hiddenDomainLockRedirectUrl,
+                domainLockRedirectUrlDiff
+            ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
             root = {
                 document: {
@@ -184,8 +184,8 @@ describe('DomainLockTemplate', () => {
                     domainLockFunctionName: 'domainLockFunction',
                     domainsStringDiff,
                     domains: hiddenDomainsString,
-                    domainDestDiff,
-                    hiddenDomainDest,
+                    domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                    hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                     globalVariableTemplate: '',
                     singleCallControllerFunctionName
                 },
@@ -203,7 +203,7 @@ describe('DomainLockTemplate', () => {
     describe('Variant #4: current root domain matches with `domainsString`', () => {
         describe('Variant #1', () => {
             const domainsString: string = ['example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'example.com';
 
             let testFunc: Function;
@@ -216,9 +216,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -232,8 +232,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -250,7 +250,7 @@ describe('DomainLockTemplate', () => {
 
         describe('Variant #2', () => {
             const domainsString: string = ['example.com', '.example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'subdomain.example.com';
 
             let testFunc: Function;
@@ -263,9 +263,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -279,8 +279,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -297,7 +297,7 @@ describe('DomainLockTemplate', () => {
 
         describe('Variant #3', () => {
             const domainsString: string = ['.example.com', 'example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'subdomain.example.com';
 
             let testFunc: Function;
@@ -310,9 +310,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -326,8 +326,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -344,7 +344,7 @@ describe('DomainLockTemplate', () => {
 
         describe('Variant #4', () => {
             const domainsString: string = ['sub1.example.com', 'sub2.example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'sub1.example.com';
 
             let testFunc: Function;
@@ -357,9 +357,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -373,8 +373,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -392,7 +392,7 @@ describe('DomainLockTemplate', () => {
 
     describe('Variant #5: current domain matches with base domain of `domainsString` item', () => {
         const domainsString: string = ['www.test.com', '.example.com'].join(';');
-        const domainDest: string = 'about:blank';
+        const domainLockRedirectUrl: string = 'about:blank';
         const currentDomain: string = 'subdomain.example.com';
 
         let testFunc: Function;
@@ -405,9 +405,9 @@ describe('DomainLockTemplate', () => {
             ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
             const [
-                hiddenDomainDest,
-                domainDestDiff
-            ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                hiddenDomainLockRedirectUrl,
+                domainLockRedirectUrlDiff
+            ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
             root = {
                 document: {
@@ -421,8 +421,8 @@ describe('DomainLockTemplate', () => {
                     domainLockFunctionName: 'domainLockFunction',
                     domainsStringDiff,
                     domains: hiddenDomainsString,
-                    domainDestDiff,
-                    hiddenDomainDest,
+                    domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                    hiddenDomainLockRedirectUrl,
                     globalVariableTemplate: '',
                     singleCallControllerFunctionName
                 },
@@ -440,7 +440,7 @@ describe('DomainLockTemplate', () => {
     describe('Variant #6: current domain doesn\'t match with `domainsString`', () => {
         describe('Variant #1', () => {
             const domainsString: string = ['www.example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'www.test.com';
 
             let testFunc: Function;
@@ -453,9 +453,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -469,8 +469,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -481,13 +481,13 @@ describe('DomainLockTemplate', () => {
 
             it('should change document.location', () => {
                 assert.doesNotThrow(() => testFunc.apply(root));
-                assert.equal(root.document.location, domainDest);
+                assert.equal(root.document.location, domainLockRedirectUrl);
             });
         });
 
         describe('Variant #2', () => {
             const domainsString: string = ['sub1.test.com', 'sub2.test.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'sub3.test.com';
 
             let testFunc: Function;
@@ -500,9 +500,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -515,8 +515,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -527,13 +527,13 @@ describe('DomainLockTemplate', () => {
 
             it('should change document.location', () => {
                 assert.doesNotThrow(() => testFunc.apply(root));
-                assert.equal(root.document.location, domainDest);
+                assert.equal(root.document.location, domainLockRedirectUrl);
             });
         });
 
         describe('Variant #3', () => {
             const domainsString: string = ['www.example.com', '.example.com', 'sub.test.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'www.test.com';
 
             let testFunc: Function;
@@ -546,9 +546,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -562,8 +562,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -574,13 +574,13 @@ describe('DomainLockTemplate', () => {
 
             it('should change document.location', () => {
                 assert.doesNotThrow(() => testFunc.apply(root));
-                assert.equal(root.document.location, domainDest);
+                assert.equal(root.document.location, domainLockRedirectUrl);
             });
         });
 
         describe('Variant #4', () => {
             const domainsString: string = ['.example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'example1.com';
 
             let testFunc: Function;
@@ -593,9 +593,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -609,8 +609,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -621,13 +621,13 @@ describe('DomainLockTemplate', () => {
 
             it('should change document.location', () => {
                 assert.doesNotThrow(() => testFunc.apply(root));
-                assert.equal(root.document.location, domainDest);
+                assert.equal(root.document.location, domainLockRedirectUrl);
             });
         });
 
         describe('Variant #5', () => {
             const domainsString: string = ['example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentDomain: string = 'sub.example.com';
 
             let testFunc: Function;
@@ -640,9 +640,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -656,8 +656,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -668,7 +668,7 @@ describe('DomainLockTemplate', () => {
 
             it('should change document.location', () => {
                 assert.doesNotThrow(() => testFunc.apply(root));
-                assert.equal(root.document.location, domainDest);
+                assert.equal(root.document.location, domainLockRedirectUrl);
             });
         });
     });
@@ -676,7 +676,7 @@ describe('DomainLockTemplate', () => {
     describe('Variant #7: location.hostname', () => {
         describe('Variant #1: current location.hostname matches with `domainsString`', () => {
             const domainsString: string = ['www.example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentHostName: string = 'www.example.com';
 
             let testFunc: Function;
@@ -689,9 +689,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -706,8 +706,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -724,7 +724,7 @@ describe('DomainLockTemplate', () => {
 
         describe('Variant #2: current location.hostname doesn\'t match with `domainsString`', () => {
             const domainsString: string = ['www.example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentHostName: string = 'www.test.com';
 
             let testFunc: Function;
@@ -737,9 +737,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -754,8 +754,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -766,7 +766,7 @@ describe('DomainLockTemplate', () => {
 
             it('should change document.location', () => {
                 assert.doesNotThrow(() => testFunc.apply(root));
-                assert.equal(root.document.location, domainDest);
+                assert.equal(root.document.location, domainLockRedirectUrl);
             });
         });
     });
@@ -774,7 +774,7 @@ describe('DomainLockTemplate', () => {
     describe('Variant #8: domain and location.hostname presented', () => {
         describe('Variant #1: current domain matches with `domainsString`', () => {
             const domainsString: string = ['www.example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentHostName: string = 'www.example.com';
 
             let testFunc: Function;
@@ -787,9 +787,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -805,8 +805,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -823,7 +823,7 @@ describe('DomainLockTemplate', () => {
 
         describe('Variant #2: current domain doesn\'t match with `domainsString`', () => {
             const domainsString: string = ['www.example.com'].join(';');
-            const domainDest: string = 'about:blank';
+            const domainLockRedirectUrl: string = 'about:blank';
             const currentHostName: string = 'www.test.com';
 
             let testFunc: Function;
@@ -836,9 +836,9 @@ describe('DomainLockTemplate', () => {
                 ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
 
                 const [
-                    hiddenDomainDest,
-                    domainDestDiff
-                ] = cryptUtils.hideString(domainDest, domainDest.length * 3);
+                    hiddenDomainLockRedirectUrl,
+                    domainLockRedirectUrlDiff
+                ] = cryptUtils.hideString(domainLockRedirectUrl, domainLockRedirectUrl.length * 3);
 
                 root = {
                     document: {
@@ -854,8 +854,8 @@ describe('DomainLockTemplate', () => {
                         domainLockFunctionName: 'domainLockFunction',
                         domainsStringDiff,
                         domains: hiddenDomainsString,
-                        domainDestDiff,
-                        domainDest: hiddenDomainDest,
+                        domainLockRedirectUrlDiff: domainLockRedirectUrlDiff,
+                        hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl,
                         globalVariableTemplate: '',
                         singleCallControllerFunctionName
                     },
@@ -866,7 +866,7 @@ describe('DomainLockTemplate', () => {
 
             it('should change document.location', () => {
                 assert.doesNotThrow(() => testFunc.apply(root));
-                assert.equal(root.document.location, domainDest);
+                assert.equal(root.document.location, domainLockRedirectUrl);
             });
         });
     });

+ 5 - 5
test/functional-tests/options/OptionsNormalizer.spec.ts

@@ -159,7 +159,7 @@ describe('OptionsNormalizer', () => {
             });
         });
 
-        describe('domainDestRule', () => {
+        describe('domainLockRedirectUrlRule', () => {
             describe('Variant #1: `domainLock` option is set', () => {
                 before(() => {
                     optionsPreset = getNormalizedOptions({
@@ -167,7 +167,7 @@ describe('OptionsNormalizer', () => {
                         domainLock: [
                             'localhost'
                         ],
-                        domainDest: 'https://example.com'
+                        domainLockRedirectUrl: 'https://example.com'
                     });
 
                     expectedOptionsPreset = {
@@ -175,7 +175,7 @@ describe('OptionsNormalizer', () => {
                         domainLock: [
                             'localhost'
                         ],
-                        domainDest: 'https://example.com'
+                        domainLockRedirectUrl: 'https://example.com'
                     };
                 });
 
@@ -189,13 +189,13 @@ describe('OptionsNormalizer', () => {
                     optionsPreset = getNormalizedOptions({
                         ...getDefaultOptions(),
                         domainLock: [],
-                        domainDest: 'https://example.com'
+                        domainLockRedirectUrl: 'https://example.com'
                     });
 
                     expectedOptionsPreset = {
                         ...getDefaultOptions(),
                         domainLock: [],
-                        domainDest: 'about:blank'
+                        domainLockRedirectUrl: 'about:blank'
                     };
                 });
 

+ 7 - 7
test/functional-tests/options/domain-dest/Validation.spec.ts → test/functional-tests/options/domain-lock-destination/Validation.spec.ts

@@ -4,8 +4,8 @@ import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade
 
 import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
 
-describe('`domainDest` validation', () => {
-    describe('IsDomainDestUrl', () => {
+describe('`domainLockRedirectUrl` validation', () => {
+    describe('IsDomainLockRedirectUrl', () => {
         describe('Variant #1: positive validation', () => {
             describe('Variant #1: string with url containing protocol, host and some path', () => {
                 let testFunc: () => string;
@@ -15,7 +15,7 @@ describe('`domainDest` validation', () => {
                         '',
                         {
                             ...NO_ADDITIONAL_NODES_PRESET,
-                            domainDest: 'https://example.com/path'
+                            domainLockRedirectUrl: 'https://example.com/path'
                         }
                     ).getObfuscatedCode();
                 });
@@ -33,7 +33,7 @@ describe('`domainDest` validation', () => {
                         '',
                         {
                             ...NO_ADDITIONAL_NODES_PRESET,
-                            domainDest: 'example.com/path'
+                            domainLockRedirectUrl: 'example.com/path'
                         }
                     ).getObfuscatedCode();
                 });
@@ -51,7 +51,7 @@ describe('`domainDest` validation', () => {
                         '',
                         {
                             ...NO_ADDITIONAL_NODES_PRESET,
-                            domainDest: '/path'
+                            domainLockRedirectUrl: '/path'
                         }
                     ).getObfuscatedCode();
                 });
@@ -69,7 +69,7 @@ describe('`domainDest` validation', () => {
                         '',
                         {
                             ...NO_ADDITIONAL_NODES_PRESET,
-                            domainDest: 'about:blank'
+                            domainLockRedirectUrl: 'about:blank'
                         }
                     ).getObfuscatedCode();
                 });
@@ -90,7 +90,7 @@ describe('`domainDest` validation', () => {
                         '',
                         {
                             ...NO_ADDITIONAL_NODES_PRESET,
-                            domainDest: 'foo'
+                            domainLockRedirectUrl: 'foo'
                         }
                     ).getObfuscatedCode();
                 });

+ 1 - 1
test/index.spec.ts

@@ -133,7 +133,7 @@ import './functional-tests/node-transformers/string-array-transformers/string-ar
 import './functional-tests/node-transformers/string-array-transformers/string-array-scope-calls-wrapper-transformer/StringArrayScopeCallsWrapperTransformer.spec';
 import './functional-tests/node-transformers/string-array-transformers/string-array-transformer/StringArrayTransformer.spec';
 import './functional-tests/options/OptionsNormalizer.spec';
-import './functional-tests/options/domain-dest/Validation.spec';
+import './functional-tests/options/domain-lock-destination/Validation.spec';
 import './functional-tests/options/domain-lock/Validation.spec';
 import './functional-tests/options/identifier-names-cache/Validation.spec';
 import './functional-tests/storages/string-array-transformers/string-array-storage/StringArrayStorage.spec';

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác