-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow backend to send commands to execute preamble scripts. #1122
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,8 @@ extern "C" void V8RecordReplayFinishRecording(); | |
extern "C" void V8RecordReplaySetCrashReason(const char* reason); | ||
extern "C" char* V8RecordReplayReadAssetFileContents(const char* aPath, size_t* aLength); | ||
|
||
static void RunScript(v8::Isolate* isolate, v8::Local<v8::Context> context, const char* source_raw, const char* filename); | ||
|
||
static const char REPLAY_CDT_PAUSE_OBJECT_GROUP[] = | ||
"REPLAY_CDT_PAUSE_OBJECT_GROUP"; | ||
|
||
|
@@ -825,7 +827,7 @@ const char* gOnNewWindowScript = R""""( | |
window.__RECORD_REPLAY__ = window.top.__RECORD_REPLAY__; | ||
window.__RECORD_REPLAY_ARGUMENTS__ = window.top.__RECORD_REPLAY_ARGUMENTS__; | ||
|
||
for (g of window.top.__RECORD_REPLAY_GLOBALS__) { | ||
for (const g of window.top.__RECORD_REPLAY_GLOBALS__) { | ||
window[g] = window.top[g]; | ||
} | ||
})() | ||
|
@@ -2547,7 +2549,7 @@ static void InitializeRecordReplayApiObjects(v8::Isolate* isolate, LocalFrame* l | |
DefineProperty(isolate, context->Global(), "__RECORD_REPLAY_ARGUMENTS__", | ||
args); | ||
|
||
v8::Local<v8::Object> globals = v8::Object::New(isolate); | ||
v8::Local<v8::Object> globals = v8::Map::New(isolate); | ||
DefineProperty(isolate, context->Global(), "__RECORD_REPLAY_GLOBALS__", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will reset the globals on every root-level navigation. We probably want to keep them around or re-run the preamble. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I was also confused about this. do we need to store the scripts somewhere so we can rerun them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Domi and I have been chatting about our context handling, which is a tad naiive to say the least; we aren't going to worry about it in this PR, but rather address it wholly in another. |
||
globals); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: My previous concern was not addressed -
__RECORD_REPLAY_GLOBALS__
itself.__RECORD_REPLAY_GLOBALS__
, and just force any user of this API to go through that, rather than adding random globals into a global context that is shared with arbitrary user JS.