You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Blink may create multiple v8::Context associated with a single blink::WebLocalFrame. For example:
The MainWorldScriptContext which the client can use to add bindings on the JS Window object. This is returned via CefFrame::GetV8Context.
Other Contexts created for purposes like DevTools access or WebWorkers that the client will likely choose to ignore.
Contexts are grouped into separate Worlds with an associated WorldId value. The MainWorld Context will have a value of 0 (kMainWorldId) whereas other Contexts will have values > 0.
This WorldId value (|world_id| parameter) is currently passed to DidCreateScriptContext and WillReleaseScriptContext but is not forwarded to the client via OnContextCreated and OnContextReleased.
Describe the solution you'd like
Pass the |world_id| parameter to OnContextCreated and OnContextReleased.
Describe alternatives you've considered
The client can currently check frame->GetV8Context()->IsSame(context) in OnContextCreated to implicitly test for the MainWorld Context.
Inside CEF, various World values can also be queried (from blink_glue.cc) using code like:
Additional context
A v8::Context may be created for Inspector integration if a DevTools window is opened. This DevTools Context has the same CefBrowser and CefFrame as the MainWorld Context.
This behavior is seen with the V8Test.OnUncaughtExceptionDevTools test failing on MacOS. The DevTools Context is being stored in |test_context_| here when OnContextCreated is called (unexpectedly) for the 2nd time.
[ RUN ] V8Test.OnUncaughtExceptionDevTools
/Users/marshall/Downloads/cef_binary_133.0.0-master.3115+gaefa6e6+chromium-133.0.6886.0_macosarm64/tests/ceftests/v8_unittest.cc:3095: Failure
Value of: test_context_->IsSame(context)
Actual: false
Expected: true
/Users/marshall/Downloads/cef_binary_133.0.0-master.3115+gaefa6e6+chromium-133.0.6886.0_macosarm64/tests/ceftests/v8_unittest.cc:3520: Failure
Value of: handler->got_success_
Actual: false
Expected: true
[ FAILED ] V8Test.OnUncaughtExceptionDevTools (1501 ms)
Callstack (at M133) for the unexpected DevTools Context creation:
Is your feature request related to a problem? Please describe.
Blink may create multiple v8::Context associated with a single blink::WebLocalFrame. For example:
Contexts are grouped into separate Worlds with an associated WorldId value. The MainWorld Context will have a value of 0 (kMainWorldId) whereas other Contexts will have values > 0.
This WorldId value (|world_id| parameter) is currently passed to DidCreateScriptContext and WillReleaseScriptContext but is not forwarded to the client via OnContextCreated and OnContextReleased.
Describe the solution you'd like
Pass the |world_id| parameter to OnContextCreated and OnContextReleased.
Describe alternatives you've considered
The client can currently check
frame->GetV8Context()->IsSame(context)
in OnContextCreated to implicitly test for the MainWorld Context.Inside CEF, various World values can also be queried (from blink_glue.cc) using code like:
Or by calling existing methods like WebLocalFrame::GetScriptContextWorldId.
Additional context
A v8::Context may be created for Inspector integration if a DevTools window is opened. This DevTools Context has the same CefBrowser and CefFrame as the MainWorld Context.
This behavior is seen with the
V8Test.OnUncaughtExceptionDevTools
test failing on MacOS. The DevTools Context is being stored in |test_context_| here when OnContextCreated is called (unexpectedly) for the 2nd time.Callstack (at M133) for the unexpected DevTools Context creation:
Note that ScriptController::CreateNewInspectorIsolatedWorld creates a World of type kInspectorIsolated.
The text was updated successfully, but these errors were encountered: