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

Side by Side Diff: chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js

Issue 1433343003: [Extensions] Wait until the Window object is cleared before classifying contexts Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var windowLoaded = false;
6 var messaged = false;
7 var iframeI18n = undefined;
8 var appWindow = undefined;
9
10 chrome.app.runtime.onLaunched.addListener(function() {
11 chrome.app.window.create('window.html', {
12 id: "mainwin",
13 innerBounds: {
14 width: 700,
15 height: 600
16 }
17 }, function(win) {
18 appWindow = win;
19 appWindow.contentWindow.onload = function() {
20 windowLoaded = true;
21 chrome.test.log('Window loaded: ' + windowLoaded);
22 chrome.test.log('Iframe i18n: ' + iframeI18n);
23 // If the message already arrived, report the i18n state.
24 if (messaged) {
25 appWindow.contentWindow.reportChromeI18nState(
26 chrome.i18n != undefined, iframeI18n);
27 }
28 };
29 });
30 });
31
32 function initialize() {
33 var iframe = document.createElement('iframe');
34 iframe.src = '/iframe.html';
35 iframe.style.display = 'none';
36
37 document.body.appendChild(iframe);
38
39 window.addEventListener('message', function(e) {
40 messaged = true;
41 iframeI18n = e.data;
42 if (windowLoaded) {
43 appWindow.contentWindow.reportChromeI18nState(
44 chrome.i18n != undefined, iframeI18n);
45 }
46 });
47 };
48
49 initialize();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698