Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Issue 2800103002: extensions: Fix synchronization in ContentScriptApiTest.ContentScriptOtherExtensions (Closed)

Created:
3 years, 8 months ago by Sami
Modified:
3 years, 8 months ago
Reviewers:
Finnur
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

extensions: Fix synchronization in ContentScriptApiTest.ContentScriptOtherExtensions The ContentScriptApiTest.ContentScriptOtherExtensions has the following flow: 1. Register the inject.js content script to run at 'document_end' time. 2. Load iframe_content.{html,js} in an iframe. 3. On DOMContentLoaded, set a 10ms timer to report the iframe's contents to the test harness. 4. In 'inject.js', rewrite the page's content. 5. In the test harness, verify that the page reports the content mutated by inject.js. The problem is that the timer registered in step 3 races with the task[1] triggering the injection script since there's no explicit synchronization between the two. Currently this works by accident, but an upcoming change[2] in the Blink Scheduler will cause the test to actually become flaky. This change fixes the test by making the iframe report its contents based on the load event rather than DOMContentLoaded. Since this is guaranteed to happen after the injection has finished, there's no possibility of out-of-order execution. BUG=696001, 701223 [1] blink::FrameLoader::finishedParsing => extensions::ScriptInjection::InjectJs => blink::SuspendableScriptExecutor::create [2] https://bugs.chromium.org/p/chromium/issues/detail?id=701223#c4 Review-Url: https://codereview.chromium.org/2800103002 Cr-Commit-Position: refs/heads/master@{#463294} Committed: https://chromium.googlesource.com/chromium/src/+/7d68ce72674bc9189bd8bcf305823d75c044489d

Patch Set 1 #

Patch Set 2 : Fix typo (document => window) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -9 lines) Patch
M chrome/test/data/extensions/api_test/content_scripts/other_extensions/iframe_content.js View 1 1 chunk +6 lines, -9 lines 0 comments Download

Messages

Total messages: 17 (13 generated)
Sami
PTAL
3 years, 8 months ago (2017-04-07 16:42:47 UTC) #3
Finnur
LGTM.
3 years, 8 months ago (2017-04-10 15:39:22 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2800103002/20001
3 years, 8 months ago (2017-04-10 15:40:43 UTC) #14
commit-bot: I haz the power
3 years, 8 months ago (2017-04-10 16:48:20 UTC) #17
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/7d68ce72674bc9189bd8bcf30582...

Powered by Google App Engine
This is Rietveld 408576698