| OLD | NEW |
| (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 // If panel-subframe is (expectedly) in the same BrowsingInstance as | |
| 6 // background-subframe, then window.open should find the existing iframe. | |
| 7 // | |
| 8 // Otherwise window.open will cause a new tab to be opened and we will | |
| 9 // find this out and fail the test when comparing newNumberOfTabs and | |
| 10 // oldNumberOfTabs in background.js. | |
| 11 // | |
| 12 // Note that we can't verify if |w| is a new window by looking | |
| 13 // at |w.parent|, because this leads to an error similar to: | |
| 14 // Uncaught SecurityError: Blocked a frame with origin "http://foo.com:36559" | |
| 15 // from accessing a frame with origin | |
| 16 // "chrome-extension://jmanjdlcdjhgbdccaamcmmcilljchoad". The frame | |
| 17 // requesting access has a protocol of "http", the frame being accessed has a | |
| 18 // protocol of "chrome-extension". Protocols must match. | |
| 19 var w = window.open('http://blah', 'background-subframe-name') | |
| 20 | |
| 21 // Quick and very dirty query parameters parsing... ok only for test code. | |
| 22 extensionId = window.location.href.substr( | |
| 23 window.location.href.lastIndexOf('=') + 1); | |
| 24 | |
| 25 // Let background.js know that it can now calculate newNumberOfTabs. | |
| 26 chrome.runtime.sendMessage(extensionId, { windowOpened: true }); | |
| 27 | |
| OLD | NEW |