From a3798380b5bd81f035cdb99a4a7f290d9014551d Mon Sep 17 00:00:00 2001 From: Francisco Jordano Date: Tue, 6 Oct 2015 14:56:51 +0100 Subject: [PATCH] Bug 1211582 Performance regression in contacts: dont add iframe, as it's injected on demand, but get the proper reference to the content document r=ferjm --- apps/communications/contacts/index.html | 1 - shared/pages/import/js/curtain.js | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/communications/contacts/index.html b/apps/communications/contacts/index.html index 8278482ea042..9b74d9cf8e03 100644 --- a/apps/communications/contacts/index.html +++ b/apps/communications/contacts/index.html @@ -259,6 +259,5 @@

- diff --git a/shared/pages/import/js/curtain.js b/shared/pages/import/js/curtain.js index d00fe17693ee..10e5d3c1fb9e 100644 --- a/shared/pages/import/js/curtain.js +++ b/shared/pages/import/js/curtain.js @@ -22,14 +22,16 @@ var Curtain = (function() { parent.document.body.appendChild(curtainFrame); } - var doc = curtainFrame.contentDocument; + function getDoc() { + return curtainFrame.contentWindow.document; + } var cpuWakeLock, cancelButton, retryButton, okButton, progressElement, form, progressTitle; var messages = []; var elements = ['error', 'timeout', 'wait', 'message', 'progress', 'alert']; - if (doc.readyState === 'complete') { + if (getDoc().readyState === 'complete') { init(); } else { // The curtain could not be loaded at this moment @@ -40,6 +42,7 @@ var Curtain = (function() { } function init() { + var doc = getDoc(); cancelButton = doc.querySelector('#cancel'); retryButton = doc.querySelector('#retry'); okButton = doc.querySelector('#ok');