Repository navigation
fix: ScriptState crash for non-Blink v8::Contexts - #25910
codebytere wants to merge 2 commits into
Conversation
|
but the code will hit the electron crash(Utils::ApiCheck) because i::EmbedderDataSlot(*data, index).ToAlignedPointer(&result) always false |
|
@caihuan i didn't experience any issues when testing with https://gist.github.com/7d0072e815f31a0ef54a625bd0b17d96 after this fix -
was successfully printed to console. |
a430fe3 to
576cb52
Compare
the problem is post exception on node VM. console.log can print an integer value. you should test code like console.log(aaa). debug version will crash on Utils::ApiCheck(i::EmbedderDataSlot(*data, index).ToAlignedPointer(&result)) |
zcbenz
left a comment
There was a problem hiding this comment.
Patching blink like this would be an endless game, if we fixed console.log it is still possible to crash other unpatched code by passing things like WebAudio.
Even if we managed to patch all places of blink to ignore non-blink contexts, I think it would then raise questions about security.
|
yeah - we may honestly want to simply leave this broken and mark it somewhere in docs |
|
I agree with @zcbenz here, blink surely assumes in many places that all Contexts come with a ScriptState, and we're never going to be able to patch out all those assumptions. Using node's |
So let's deprecate it? The web platform has proposals for a worlds API iirc so The Web Way isn't a too distant future |
|
we already override some stuff in the renderer - seems reasonable to intercept |
I'm pretty interested in learning more about such a proposal, since at Bloomberg we've needed to hack Chromium quite a bit to get ordinary V8 contexts to cooperate with those created by Blink. I couldn't find a link to any discussion or documents; do you have any references? |
Description of Change
Closes #25888.
In the renderer process it's possible that a
v8::Contextwill be created by Node.js and therefore not have an associatedScriptState. Blink assumes one will be associated always, and thus crashes when trying tofetch the
DOMWrapperWorldfor aScriptStatecreated from a non-Blinkv8::Context.This adds extra safety checks to ensure that
ScriptContext::Fromcorrectly returnsnullptrfor those cases.Tested with https://gist.github.com/7d0072e815f31a0ef54a625bd0b17d96.
Checklist
npm testpassesRelease Notes
Notes: Fixed a potential crash when creating and using a new
vm.Contextin the renderer process.