@@ -40,7 +40,7 @@ use rand::{Rng, SeedableRng, StdRng, random};
4040use script_traits:: { AnimationState , AnimationTickType , CompositorEvent } ;
4141use script_traits:: { ConstellationControlMsg , ConstellationMsg as FromCompositorMsg } ;
4242use script_traits:: { DocumentState , LayoutControlMsg , LoadData } ;
43- use script_traits:: { IFrameLoadInfo , IFrameSandboxState , TimerEventRequest } ;
43+ use script_traits:: { IFrameLoadInfo , IFrameLoadInfoWithData , IFrameSandboxState , TimerEventRequest } ;
4444use script_traits:: { LayoutMsg as FromLayoutMsg , ScriptMsg as FromScriptMsg , ScriptThreadFactory } ;
4545use script_traits:: { LogEntry , ServiceWorkerMsg , webdriver_msg} ;
4646use script_traits:: { MozBrowserErrorType , MozBrowserEvent , WebDriverCommandMsg , WindowSizeData } ;
@@ -824,11 +824,17 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
824824 }
825825 FromScriptMsg :: ScriptLoadedURLInIFrame ( load_info) => {
826826 debug ! ( "constellation got iframe URL load message {:?} {:?} {:?}" ,
827- load_info. parent_pipeline_id,
827+ load_info. info . parent_pipeline_id,
828828 load_info. old_pipeline_id,
829- load_info. new_pipeline_id) ;
829+ load_info. info . new_pipeline_id) ;
830830 self . handle_script_loaded_url_in_iframe_msg ( load_info) ;
831831 }
832+ FromScriptMsg :: ScriptDidLoadURLInIFrame ( load_info, sc, lc) => {
833+ debug ! ( "constellation got did load iframe URL message {:?} {:?}" ,
834+ load_info. parent_pipeline_id,
835+ load_info. new_pipeline_id) ;
836+ self . handle_script_did_load_url_in_iframe_msg ( load_info, sc, lc) ;
837+ }
832838 FromScriptMsg :: ChangeRunningAnimationsState ( pipeline_id, animation_state) => {
833839 self . handle_change_running_animations_state ( pipeline_id, animation_state)
834840 }
@@ -1233,14 +1239,14 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
12331239 // will result in a new pipeline being spawned and a frame tree being added to
12341240 // parent_pipeline_id's frame tree's children. This message is never the result of a
12351241 // page navigation.
1236- fn handle_script_loaded_url_in_iframe_msg ( & mut self , load_info : IFrameLoadInfo ) {
1242+ fn handle_script_loaded_url_in_iframe_msg ( & mut self , load_info : IFrameLoadInfoWithData ) {
12371243 let ( load_data, script_chan, window_size, is_private) = {
12381244 let old_pipeline = load_info. old_pipeline_id
12391245 . and_then ( |old_pipeline_id| self . pipelines . get ( & old_pipeline_id) ) ;
12401246
1241- let source_pipeline = match self . pipelines . get ( & load_info. parent_pipeline_id ) {
1247+ let source_pipeline = match self . pipelines . get ( & load_info. info . parent_pipeline_id ) {
12421248 Some ( source_pipeline) => source_pipeline,
1243- None => return warn ! ( "Script loaded url in closed iframe {}." , load_info. parent_pipeline_id) ,
1249+ None => return warn ! ( "Script loaded url in closed iframe {}." , load_info. info . parent_pipeline_id) ,
12441250 } ;
12451251
12461252 // If no url is specified, reload.
@@ -1258,7 +1264,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
12581264 // then reuse the script thread in creating the new pipeline
12591265 let source_url = & source_pipeline. url ;
12601266
1261- let is_private = load_info. is_private || source_pipeline. is_private ;
1267+ let is_private = load_info. info . is_private || source_pipeline. is_private ;
12621268
12631269 // FIXME(#10968): this should probably match the origin check in
12641270 // HTMLIFrameElement::contentDocument.
@@ -1287,23 +1293,66 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
12871293 ( load_data, script_chan, window_size, is_private)
12881294 } ;
12891295
1290-
12911296 // Create the new pipeline, attached to the parent and push to pending frames
1292- self . new_pipeline ( load_info. new_pipeline_id ,
1293- load_info. frame_id ,
1294- Some ( ( load_info. parent_pipeline_id , load_info. frame_type ) ) ,
1297+ self . new_pipeline ( load_info. info . new_pipeline_id ,
1298+ load_info. info . frame_id ,
1299+ Some ( ( load_info. info . parent_pipeline_id , load_info. info . frame_type ) ) ,
12951300 load_info. old_pipeline_id ,
12961301 window_size,
12971302 script_chan,
12981303 load_data,
12991304 is_private) ;
13001305
13011306 self . pending_frames . push ( FrameChange {
1302- frame_id : load_info. frame_id ,
1307+ frame_id : load_info. info . frame_id ,
13031308 old_pipeline_id : load_info. old_pipeline_id ,
1304- new_pipeline_id : load_info. new_pipeline_id ,
1309+ new_pipeline_id : load_info. info . new_pipeline_id ,
1310+ document_ready : false ,
1311+ replace : load_info. info . replace ,
1312+ } ) ;
1313+ }
1314+
1315+ fn handle_script_did_load_url_in_iframe_msg ( & mut self ,
1316+ load_info : IFrameLoadInfo ,
1317+ script_sender : IpcSender < ConstellationControlMsg > ,
1318+ layout_sender : IpcSender < LayoutControlMsg > ) {
1319+ let IFrameLoadInfo {
1320+ parent_pipeline_id,
1321+ new_pipeline_id,
1322+ frame_type,
1323+ replace,
1324+ frame_id,
1325+ is_private,
1326+ } = load_info;
1327+
1328+ let pipeline = {
1329+ let parent_pipeline = match self . pipelines . get ( & parent_pipeline_id) {
1330+ Some ( parent_pipeline) => parent_pipeline,
1331+ None => return warn ! ( "Script loaded url in closed iframe {}." , parent_pipeline_id) ,
1332+ } ;
1333+
1334+ let url = Url :: parse ( "about:blank" ) . expect ( "infallible" ) ;
1335+ Pipeline :: spawned ( new_pipeline_id,
1336+ frame_id,
1337+ Some ( ( parent_pipeline_id, frame_type) ) ,
1338+ script_sender,
1339+ layout_sender,
1340+ self . compositor_proxy . clone_compositor_proxy ( ) ,
1341+ is_private || parent_pipeline. is_private ,
1342+ url,
1343+ None ,
1344+ parent_pipeline. visible )
1345+ } ;
1346+
1347+ assert ! ( !self . pipelines. contains_key( & new_pipeline_id) ) ;
1348+ self . pipelines . insert ( new_pipeline_id, pipeline) ;
1349+
1350+ self . pending_frames . push ( FrameChange {
1351+ frame_id : frame_id,
1352+ old_pipeline_id : None ,
1353+ new_pipeline_id : new_pipeline_id,
13051354 document_ready : false ,
1306- replace : load_info . replace ,
1355+ replace : replace,
13071356 } ) ;
13081357 }
13091358
0 commit comments