зеркало из https://github.com/mozilla/gecko-dev.git
Bug 986467 - Remove the iframes before finishing the tests. r=jwalker
This commit is contained in:
Родитель
7300c8e659
Коммит
b1cea7579c
|
@ -783,14 +783,8 @@ let StorageActor = exports.StorageActor = protocol.ActorClass({
|
|||
this.childActorPool = new Map();
|
||||
this.childWindowPool = new Set();
|
||||
|
||||
// Get the top level content docshell for the tab we are targetting.
|
||||
this.topDocshell = tabActor.window
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem);
|
||||
// Fetch all the inner iframe windows in this tab.
|
||||
this.fetchChildWindows(this.topDocshell);
|
||||
this.fetchChildWindows(this.parentActor.docShell);
|
||||
|
||||
// Initialize the registered store types
|
||||
for (let [store, actor] of storageTypePool) {
|
||||
|
@ -805,6 +799,7 @@ let StorageActor = exports.StorageActor = protocol.ActorClass({
|
|||
tabActor.browser.addEventListener("pageshow", this.onPageChange, true);
|
||||
tabActor.browser.addEventListener("pagehide", this.onPageChange, true);
|
||||
|
||||
this.destroyed = false;
|
||||
this.boundUpdate = {};
|
||||
// The time which periodically flushes and transfers the updated store
|
||||
// objects.
|
||||
|
@ -820,9 +815,11 @@ let StorageActor = exports.StorageActor = protocol.ActorClass({
|
|||
destroy: function() {
|
||||
this.updateTimer.cancel();
|
||||
this.updateTimer = null;
|
||||
this.layoutHelper = null;
|
||||
// Remove observers
|
||||
Services.obs.removeObserver(this, "content-document-global-created", false);
|
||||
Services.obs.removeObserver(this, "inner-window-destroyed", false);
|
||||
this.destroyed = true;
|
||||
if (this.parentActor.browser) {
|
||||
this.parentActor.browser.removeEventListener(
|
||||
"pageshow", this.onPageChange, true);
|
||||
|
@ -834,7 +831,8 @@ let StorageActor = exports.StorageActor = protocol.ActorClass({
|
|||
actor.destroy();
|
||||
}
|
||||
this.childActorPool.clear();
|
||||
this.topDocshell = null;
|
||||
this.childWindowPool.clear();
|
||||
this.childWindowPool = this.childActorPool = null;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -897,7 +895,7 @@ let StorageActor = exports.StorageActor = protocol.ActorClass({
|
|||
else if (topic == "inner-window-destroyed") {
|
||||
let window = this.getWindowFromInnerWindowID(subject);
|
||||
if (window) {
|
||||
this.childActorPool.delete(window);
|
||||
this.childWindowPool.delete(window);
|
||||
events.emit(this, "window-destroyed", window);
|
||||
}
|
||||
}
|
||||
|
@ -905,6 +903,9 @@ let StorageActor = exports.StorageActor = protocol.ActorClass({
|
|||
},
|
||||
|
||||
onPageChange: function({target, type}) {
|
||||
if (this.destroyed) {
|
||||
return;
|
||||
}
|
||||
let window = target.defaultView;
|
||||
if (type == "pagehide" && this.childWindowPool.delete(window)) {
|
||||
events.emit(this, "window-destroyed", window)
|
||||
|
@ -918,7 +919,7 @@ let StorageActor = exports.StorageActor = protocol.ActorClass({
|
|||
},
|
||||
|
||||
/**
|
||||
* Lists the availabel hosts for all the registered storage types.
|
||||
* Lists the available hosts for all the registered storage types.
|
||||
*
|
||||
* @returns {object} An object containing with the following structure:
|
||||
* - <storageType> : [{
|
||||
|
@ -929,7 +930,7 @@ let StorageActor = exports.StorageActor = protocol.ActorClass({
|
|||
listStores: method(function() {
|
||||
// Explictly recalculate the window-tree
|
||||
this.childWindowPool.clear();
|
||||
this.fetchChildWindows(this.topDocshell);
|
||||
this.fetchChildWindows(this.parentActor.docShell);
|
||||
|
||||
let toReturn = {};
|
||||
for (let [name, value] of this.childActorPool) {
|
||||
|
|
|
@ -32,8 +32,12 @@ registerCleanupFunction(function() {
|
|||
});
|
||||
|
||||
function finishTests(client) {
|
||||
// Forcing GC/CC to get rid of docshells and windows created by this test.
|
||||
forceCollections();
|
||||
client.close(() => {
|
||||
forceCollections();
|
||||
DebuggerServer.destroy();
|
||||
forceCollections();
|
||||
DebuggerClient = DebuggerServer = gFront = null;
|
||||
finish();
|
||||
});
|
||||
|
|
|
@ -135,8 +135,12 @@ const storeMap = {
|
|||
};
|
||||
|
||||
function finishTests(client) {
|
||||
// Forcing GC/CC to get rid of docshells and windows created by this test.
|
||||
forceCollections();
|
||||
client.close(() => {
|
||||
forceCollections();
|
||||
DebuggerServer.destroy();
|
||||
forceCollections();
|
||||
DebuggerClient = DebuggerServer = null;
|
||||
finish();
|
||||
});
|
||||
|
|
|
@ -25,8 +25,12 @@ registerCleanupFunction(function() {
|
|||
});
|
||||
|
||||
function finishTests(client) {
|
||||
// Forcing GC/CC to get rid of docshells and windows created by this test.
|
||||
forceCollections();
|
||||
client.close(() => {
|
||||
forceCollections();
|
||||
DebuggerServer.destroy();
|
||||
forceCollections();
|
||||
DebuggerClient = DebuggerServer = gTests = null;
|
||||
finish();
|
||||
});
|
||||
|
|
|
@ -15,8 +15,7 @@ const ALT_DOMAIN_SECURED = "https://sectest1.example.org:443/" + PATH;
|
|||
/**
|
||||
* Open a new tab at a URL and call a callback on load
|
||||
*/
|
||||
function addTab(aURL, aCallback)
|
||||
{
|
||||
function addTab(aURL, aCallback) {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
@ -36,6 +35,16 @@ function addTab(aURL, aCallback)
|
|||
browser.addEventListener("load", onTabLoad, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces GC, CC and Shrinking GC to get rid of disconnected docshells and
|
||||
* windows.
|
||||
*/
|
||||
function forceCollections() {
|
||||
Cu.forceGC();
|
||||
Cu.forceCC();
|
||||
Cu.forceShrinkingGC();
|
||||
}
|
||||
|
||||
registerCleanupFunction(function tearDown() {
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
|
|
Загрузка…
Ссылка в новой задаче