Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
LazyClassStructure::setConstructor should not store the constructor t…
…o the global object https://bugs.webkit.org/show_bug.cgi?id=201484 <rdar://problem/50400451> Reviewed by Yusuke Suzuki. JSTests: * stress/web-assembly-constructors-should-not-override-global-object-property.js: Added. Source/JavaScriptCore: LazyClassStructure::setConstructor sets the constructor as a property of the global object. This became a problem when it started being used for WebAssembly constructors, such as Module and Instance, since they are properties of the WebAssembly object, not the global object. That resulted in properties of the global object replaced whenever a lazy WebAssembly constructor was first accessed. e.g. globalThis.Module = x; WebAssembly.Module; globalThis.Module === WebAssembly.Module; * runtime/LazyClassStructure.cpp: (JSC::LazyClassStructure::Initializer::setConstructor): * runtime/LazyClassStructure.h: * runtime/Lookup.h: (JSC::reifyStaticProperty): Canonical link: https://commits.webkit.org/215142@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249538 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
f5d7933
commit 11978ff
Showing
6 changed files
with
42 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
JSTests/stress/web-assembly-constructors-should-not-override-global-object-property.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
var originalModule = this.Module = {}; | ||
WebAssembly.Module; | ||
if (Module !== originalModule) | ||
throw new Error('Global property `Module` was overwritten!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters