Commit 4cd84f23 authored by jstritar@chromium.org's avatar jstritar@chromium.org

Fix crash in CreateTabFunction::RunImpl().

BUG=112314
TEST=ExtensionApiTest.Tabs2

Review URL: https://chromiumcodereview.appspot.com/9320016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120121 0039d316-1c4b-4281-b951-d872f2087c98
parent e232dc87
......@@ -961,6 +961,9 @@ bool CreateTabFunction::RunImpl() {
params.tabstrip_add_types = add_types;
browser::Navigate(&params);
// The tab may have been created in a different window, so make sure we look
// at the right tab strip.
tab_strip = params.browser->tabstrip_model();
int new_index = tab_strip->GetIndexOfTabContents(params.target_contents);
if (opener)
tab_strip->SetOpenerOfTabContentsAt(new_index, opener);
......
......@@ -110,6 +110,18 @@ chrome.test.runTests([
});
// Pretend to click a link (openers aren't tracked when using tabs.create).
clickLink("test_link");
}
},
// The window on chrome.tabs.create is ignored if it doesn't accept tabs.
function testRedirectingToAnotherWindow() {
chrome.windows.create(
{url: 'about:blank', type: 'popup'},
pass(function(window) {
chrome.tabs.create(
{url: 'about:blank', windowId: window.id},
pass(function(tab) {
assertTrue(window.id != tab.windowId);
}));
}));
}
]);
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