Ignore:
Timestamp:
Apr 9, 2020, 3:49:01 PM (5 years ago)
Author:
[email protected]
Message:

[JSC] ModuleEnvironment do not have JSGlobalLexicalEnvironment as its upper scope
https://bugs.webkit.org/show_bug.cgi?id=193347

Reviewed by Tadeu Zagallo.

JSTests:

  • stress/global-lexical-environment-access-from-module.js: Added.

(shouldBe):
(import.string_appeared_here.then):

  • stress/resources/global-lexical-environment-access-from-module-child.js: Added.

(export.read):
(export.write):

LayoutTests/imported/w3c:

  • web-platform-tests/html/semantics/scripting-1/the-script-element/module/inline-async-execorder-expected.txt:

Source/JavaScriptCore:

The upper scope of module scope should be global lexical environment instead of global object.
This patch fixes it to allow modules to access global lexical environment's variables.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::notifyLexicalBindingUpdate):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • runtime/JSModuleEnvironment.h:
  • runtime/JSModuleRecord.cpp:

(JSC::JSModuleRecord::instantiateDeclarations):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r259676 r259835  
    28852885void CodeBlock::notifyLexicalBindingUpdate()
    28862886{
    2887     // FIXME: Currently, module code do not query to JSGlobalLexicalEnvironment. So this case should be removed once it is fixed.
    2888     // https://bugs.webkit.org/show_bug.cgi?id=193347
    2889     if (scriptMode() == JSParserScriptMode::Module)
    2890         return;
    28912887    JSGlobalObject* globalObject = m_globalObject.get();
    28922888    JSGlobalLexicalEnvironment* globalLexicalEnvironment = jsCast<JSGlobalLexicalEnvironment*>(globalObject->globalScope());
Note: See TracChangeset for help on using the changeset viewer.