Commit c444b63a authored by Alex Turner's avatar Alex Turner Committed by Commit Bot

Deterministic script ordering for createAdFrameWithWindowStopAbortedLoad

The scripts added by createAdFrameWithWindowStopAbortedLoad must have
async set to false to ensure that they are loaded in insertion order.
This allows the last script's onload handler signal that all three
scripts have loaded.

The current behavior -- with non-deterministic ordering -- is believed
to be the cause of a flaky test (AdTaggingBrowserTest.
ChildrenOfFrameWithWindowStopAbortedLoad_StillCorrectlyTagged)

Bug: 1069346
Change-Id: I854eeee46c924920b9842701a6256a119cf676ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144832Reviewed-by: default avatarJohn Delaney <johnidel@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758213}
parent 8c3bd160
...@@ -65,16 +65,21 @@ function createAdFrameWithWindowStopAbortedLoad(name) { ...@@ -65,16 +65,21 @@ function createAdFrameWithWindowStopAbortedLoad(name) {
document.body.appendChild(frame); document.body.appendChild(frame);
frame.contentWindow.stop(); frame.contentWindow.stop();
// We load the scripts in frame_factory.html to allow subframe creation. // We load the scripts in frame_factory.html to allow subframe creation. We
// set the async attribute to false to ensure that these scripts are loaded in
// insertion order.
let script1 = document.createElement('script'); let script1 = document.createElement('script');
script1.async = false;
script1.src = 'create_frame.js'; script1.src = 'create_frame.js';
frame.contentDocument.head.appendChild(script1); frame.contentDocument.head.appendChild(script1);
let script2 = document.createElement('script'); let script2 = document.createElement('script');
script2.async = false;
script2.src = 'ad_script.js'; script2.src = 'ad_script.js';
frame.contentDocument.head.appendChild(script2); frame.contentDocument.head.appendChild(script2);
let script3 = document.createElement('script'); let script3 = document.createElement('script');
script3.async = false;
script3.src = 'ad_script_2.js'; script3.src = 'ad_script_2.js';
// Set title so we know when all scripts have loaded. // Set title so we know when all scripts have loaded.
script3.onload = function() { script3.onload = function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment