Skip to content

Commit 67ad0ee

Browse files
committed
We should set event when we setup main frame rubycdp/cuprite#146
1 parent fda404f commit 67ad0ee

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ferrum/page/frames.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ def frames_subscribe
7171
end
7272

7373
on("Runtime.executionContextCreated") do |params|
74+
setting_up_main_frame = false
7475
context_id = params.dig("context", "id")
7576
frame_id = params.dig("context", "auxData", "frameId")
7677

7778
unless @main_frame.id
7879
root_frame = command("Page.getFrameTree").dig("frameTree", "frame", "id")
7980
if frame_id == root_frame
81+
setting_up_main_frame = true
8082
@main_frame.id = frame_id
8183
@frames[frame_id] = @main_frame
8284
end
@@ -85,6 +87,9 @@ def frames_subscribe
8587
frame = @frames[frame_id] || Frame.new(frame_id, self)
8688
frame.set_execution_id(context_id)
8789

90+
# Set event because `execution_id` might raise NoExecutionContextError
91+
@event.set if setting_up_main_frame
92+
8893
@frames[frame_id] ||= frame
8994
end
9095

0 commit comments

Comments
 (0)