| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7568ce7 commit 5c692cb
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -919,6 +919,7 @@ const contextifiedObject = vm.createContext({ secret: 42 }); | |||
| 919 | 919 | const module = new vm.SourceTextModule( | |
| 920 | 920 | 'Object.getPrototypeOf(import.meta.prop).secret = secret;', | |
| 921 | 921 | { | |
| 922 | + context: contextifiedObject, | ||
| 922 | 923 | initializeImportMeta(meta) { | |
| 923 | 924 | // Note: this object is created in the top context. As such, | |
| 924 | 925 | // Object.getPrototypeOf(import.meta.prop) points to the | |
@@ -937,7 +938,7 @@ await module.evaluate(); | |||
| 937 | 938 | // To fix this problem, replace | |
| 938 | 939 | // meta.prop = {}; | |
| 939 | 940 | // above with | |
| 940 | - // meta.prop = vm.runInContext('{}', contextifiedObject); | ||
| 941 | + // meta.prop = vm.runInContext('({})', contextifiedObject); | ||
| 941 | 942 | ``` | |
| 942 | 943 | ||
| 943 | 944 | ```cjs | |
@@ -947,6 +948,7 @@ const contextifiedObject = vm.createContext({ secret: 42 }); | |||
| 947 | 948 | const module = new vm.SourceTextModule( | |
| 948 | 949 | 'Object.getPrototypeOf(import.meta.prop).secret = secret;', | |
| 949 | 950 | { | |
| 951 | + context: contextifiedObject, | ||
| 950 | 952 | initializeImportMeta(meta) { | |
| 951 | 953 | // Note: this object is created in the top context. As such, | |
| 952 | 954 | // Object.getPrototypeOf(import.meta.prop) points to the | |
@@ -964,7 +966,7 @@ const contextifiedObject = vm.createContext({ secret: 42 }); | |||
| 964 | 966 | // To fix this problem, replace | |
| 965 | 967 | // meta.prop = {}; | |
| 966 | 968 | // above with | |
| 967 | - // meta.prop = vm.runInContext('{}', contextifiedObject); | ||
| 969 | + // meta.prop = vm.runInContext('({})', contextifiedObject); | ||
| 968 | 970 | })(); | |
| 969 | 971 | ``` | |
| 970 | 972 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments