Commit 7fd8040a authored by Patrick Hulce's avatar Patrick Hulce Committed by Commit Bot

DevTools: Fix cookies for OOPIFs on refresh

* Use isTopFrame to determine when to reset resources panel

BUG=810000

Change-Id: I8cfde733fee4e97b7066411d849a844bc58525c5
Reviewed-on: https://chromium-review.googlesource.com/934962
Commit-Queue: Patrick Hulce <phulce@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539268}
parent a100efe1
Tests that cookies are properly shown after oopif refresh
Page reloaded.
Available cookie domains:
http://127.0.0.1:8000
http://devtools.oopif.test:8000
Visible cookies
test=cookie
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult(`Tests that cookies are properly shown after oopif refresh`);
await TestRunner.loadModule('application_test_runner');
// Note: every test that uses a storage API must manually clean-up state from previous tests.
await ApplicationTestRunner.resetState();
await TestRunner.loadModule('console_test_runner');
await TestRunner.loadModule('cookie_table');
await TestRunner.showPanel('console');
await TestRunner.showPanel('resources');
UI.panels.resources.showCookies(SDK.targetManager.mainTarget(), 'http://127.0.0.1:8000');
await ApplicationTestRunner.waitForCookies();
await TestRunner.navigatePromise('resources/page-out.html');
await TestRunner.evaluateInPageAsync(`document.cookie = 'test=cookie;'`);
await TestRunner.addIframe('http://devtools.oopif.test:8000/devtools/oopif/resources/inner-iframe.html');
await TestRunner.reloadPagePromise();
await TestRunner.addIframe('http://devtools.oopif.test:8000/devtools/oopif/resources/inner-iframe.html');
await ApplicationTestRunner.waitForCookies();
ApplicationTestRunner.dumpCookieDomains();
ApplicationTestRunner.dumpCookies();
TestRunner.completeTest();
})();
\ No newline at end of file
......@@ -99,6 +99,33 @@ ApplicationTestRunner.resourceMatchingURL = function(resourceURL) {
return result;
};
ApplicationTestRunner.waitForCookies = function() {
return new Promise(resolve => {
TestRunner.addSniffer(CookieTable.CookiesTable.prototype, '_rebuildTable', resolve);
});
};
ApplicationTestRunner.dumpCookieDomains = function() {
const cookieListChildren = UI.panels.resources._sidebar.cookieListTreeElement.children();
TestRunner.addResult('Available cookie domains:');
for (const child of cookieListChildren)
TestRunner.addResult(child._cookieDomain);
};
ApplicationTestRunner.dumpCookies = function() {
if (!UI.panels.resources._cookieView || !UI.panels.resources._cookieView.isShowing()) {
TestRunner.addResult('No cookies visible');
return;
}
TestRunner.addResult('Visible cookies');
for (const item of UI.panels.resources._cookieView._cookiesTable._data) {
const cookies = item.cookies || [];
for (const cookie of cookies)
TestRunner.addResult(`${cookie.name()}=${cookie.value()}`);
}
};
ApplicationTestRunner.databaseModel = function() {
return TestRunner.mainTarget.model(Resources.DatabaseModel);
};
......
......@@ -256,7 +256,7 @@ Resources.ApplicationPanelSidebar = class extends UI.VBox {
_frameNavigated(event) {
const frame = event.data;
if (!frame.parentFrame)
if (frame.isTopFrame())
this._reset();
const applicationCacheFrameTreeElement = this._applicationCacheFrameElements[frame.id];
......
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