// Execute a second time so that the WebConsoleActor set this._lastConsoleInputEvaluation to another value // and so we prevent freeing `window.foo`
await commands.scriptCommand.execute("");
// Hold off the weak reference on SpecialPowsers so that it can be accessed in the next SpecialPowers.spawn
SpecialPowers.weakRef = weakRef;
// Nullify this variable so that it should be freed // unless the DevTools inspection still hold it in memory
content.wrappedJSObject.foo = null;
Cu.forceGC();
Cu.forceCC();
ok(SpecialPowers.weakRef.get(), "The 'foo' object can't be freed because of DevTools keeping a reference on it");
});
info("Release the server side actors which are keeping the object in memory"); const objectFront = evaluationResponse.result;
await commands.objectCommand.releaseObjects([objectFront]);
ok(objectFront.isDestroyed(), "The passed object front has been destroyed");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
await ContentTaskUtils.waitForCondition(() => {
Cu.forceGC();
Cu.forceCC(); return !SpecialPowers.weakRef.get();
}, "Wait for JS object to be freed", 500);
ok(!SpecialPowers.weakRef.get(), "The 'foo' object has been freed");
});
const evaluationResponse1 = await commands.scriptCommand.execute( "window"
); const evaluationResponse2 = await commands.scriptCommand.execute( "window", {
selectedTargetFront: iframeTarget,
}
); const object1 = evaluationResponse1.result; const object2 = evaluationResponse2.result;
isnot(object1, object2, "The two window object fronts are different");
isnot(object1.targetFront, object2.targetFront, "The two window object fronts relates to two distinct targets");
is(object2.targetFront, iframeTarget, "The second object relates to the iframe target");
await commands.objectCommand.releaseObjects([object1, object2]);
ok(object1.isDestroyed(), "The first object front is destroyed");
ok(object2.isDestroyed(), "The second object front is destroyed");
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.