bug 837729 - don't create text-runs for JS source code loaded in a hidden-window iframe, and remove source text from the DOM as soon as we've extracted it. r=gavin,markh

This commit is contained in:
Jonathan Kew 2013-02-05 09:18:15 +00:00
parent 206ac2e59c
commit a26ae62acc

View File

@ -202,6 +202,10 @@ FrameWorker.prototype = {
return;
}
// now that we've got the script text, remove it from the DOM;
// no need for it to keep occupying memory there
workerWindow.document.body.textContent = "";
// the iframe has loaded the js file as text - first inject the magic
// port-handling code into the sandbox.
try {
@ -316,6 +320,8 @@ function makeHiddenFrame() {
iframe.setAttribute("mozframetype", "content");
// allow-same-origin is necessary for localStorage to work in the sandbox.
iframe.setAttribute("sandbox", "allow-same-origin");
// don't create text frames and runs for the JS source!
iframe.style.display = "none";
hiddenDoc.documentElement.appendChild(iframe);