Bug 698371 - Fixup front-end callers and enable some thumbnail tests for e10s. r=dao

This commit is contained in:
Jim Mathies 2014-10-17 18:13:58 -05:00
parent 40bf73a626
commit 19b348ce43
7 changed files with 24 additions and 35 deletions

View File

@ -47,10 +47,6 @@ var tabPreviews = {
}, },
capture: function tabPreviews_capture(aTab, aShouldCache) { capture: function tabPreviews_capture(aTab, aShouldCache) {
// Bug 863512 - Make page thumbnails work in electrolysis
if (gMultiProcessBrowser)
return new Image();
let browser = aTab.linkedBrowser; let browser = aTab.linkedBrowser;
let uri = browser.currentURI.spec; let uri = browser.currentURI.spec;
@ -77,7 +73,7 @@ var tabPreviews = {
aTab.__thumbnail_lastURI = uri; aTab.__thumbnail_lastURI = uri;
} }
PageThumbs.captureToCanvas(aTab.linkedBrowser.contentWindow, canvas); PageThumbs.captureToCanvas(browser, canvas);
return canvas; return canvas;
}, },

View File

@ -33,10 +33,6 @@ let gBrowserThumbnails = {
_tabEvents: ["TabClose", "TabSelect"], _tabEvents: ["TabClose", "TabSelect"],
init: function Thumbnails_init() { init: function Thumbnails_init() {
// Bug 863512 - Make page thumbnails work in electrolysis
if (gMultiProcessBrowser)
return;
PageThumbs.addExpirationFilter(this); PageThumbs.addExpirationFilter(this);
gBrowser.addTabsProgressListener(this); gBrowser.addTabsProgressListener(this);
Services.prefs.addObserver(this.PREF_DISK_CACHE_SSL, this, false); Services.prefs.addObserver(this.PREF_DISK_CACHE_SSL, this, false);
@ -52,10 +48,6 @@ let gBrowserThumbnails = {
}, },
uninit: function Thumbnails_uninit() { uninit: function Thumbnails_uninit() {
// Bug 863512 - Make page thumbnails work in electrolysis
if (gMultiProcessBrowser)
return;
PageThumbs.removeExpirationFilter(this); PageThumbs.removeExpirationFilter(this);
gBrowser.removeTabsProgressListener(this); gBrowser.removeTabsProgressListener(this);
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this); Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this);
@ -125,10 +117,6 @@ let gBrowserThumbnails = {
// FIXME: This should be part of the PageThumbs API. (bug 1062414) // FIXME: This should be part of the PageThumbs API. (bug 1062414)
_shouldCapture: function Thumbnails_shouldCapture(aBrowser) { _shouldCapture: function Thumbnails_shouldCapture(aBrowser) {
// Don't try to capture in e10s yet (because of bug 698371)
if (gMultiProcessBrowser)
return false;
// Capture only if it's the currently selected tab. // Capture only if it's the currently selected tab.
if (aBrowser != gBrowser.selectedBrowser) if (aBrowser != gBrowser.selectedBrowser)
return false; return false;
@ -144,14 +132,18 @@ let gBrowserThumbnails = {
if (doc instanceof SVGDocument || doc instanceof XMLDocument) if (doc instanceof SVGDocument || doc instanceof XMLDocument)
return false; return false;
// There's no point in taking screenshot of loading pages.
if (aBrowser.docShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
return false;
// Don't take screenshots of about: pages. // Don't take screenshots of about: pages.
if (aBrowser.currentURI.schemeIs("about")) if (aBrowser.currentURI.schemeIs("about"))
return false; return false;
// FIXME e10s work around, we need channel information. bug 1073957
if (!aBrowser.docShell)
return true;
// There's no point in taking screenshot of loading pages.
if (aBrowser.docShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
return false;
let channel = aBrowser.docShell.currentDocumentChannel; let channel = aBrowser.docShell.currentDocumentChannel;
// No valid document channel. We shouldn't take a screenshot. // No valid document channel. We shouldn't take a screenshot.

View File

@ -707,7 +707,7 @@
canvas.mozOpaque = true; canvas.mozOpaque = true;
canvas.width = 160 * scale; canvas.width = 160 * scale;
canvas.height = 90 * scale; canvas.height = 90 * scale;
PageThumbs.captureToCanvas(chatbox.contentWindow, canvas); PageThumbs.captureToCanvas(chatbox, canvas);
dt.setDragImage(canvas, -16 * scale, -16 * scale); dt.setDragImage(canvas, -16 * scale, -16 * scale);
event.stopPropagation(); event.stopPropagation();

View File

@ -4530,7 +4530,7 @@
canvas.height = 90 * scale; canvas.height = 90 * scale;
if (!gMultiProcessBrowser) { if (!gMultiProcessBrowser) {
// Bug 863512 - Make page thumbnails work in e10s // Bug 863512 - Make page thumbnails work in e10s
PageThumbs.captureToCanvas(browser.contentWindow, canvas); PageThumbs.captureToCanvas(browser, canvas);
} }
dt.setDragImage(canvas, -16 * scale, -16 * scale); dt.setDragImage(canvas, -16 * scale, -16 * scale);

View File

@ -1383,15 +1383,9 @@ TabCanvas.prototype = Utils.extend(new Subscribable(), {
if (!w || !h) if (!w || !h)
return; return;
if (!this.tab.linkedBrowser.contentWindow) { gPageThumbnails.captureToCanvas(this.tab.linkedBrowser, this.canvas, () => {
Utils.log('no tab.linkedBrowser.contentWindow in TabCanvas.paint()'); this._sendToSubscribers("painted");
return; });
}
let win = this.tab.linkedBrowser.contentWindow;
gPageThumbnails.captureToCanvas(win, this.canvas);
this._sendToSubscribers("painted");
}, },
// ---------- // ----------

View File

@ -1,5 +1,4 @@
[DEFAULT] [DEFAULT]
skip-if = e10s # Bug 863512 - thumbnails are disabled with e10s enabled.
support-files = support-files =
background_red.html background_red.html
background_red_redirect.sjs background_red_redirect.sjs
@ -12,15 +11,16 @@ support-files =
[browser_thumbnails_bg_bad_url.js] [browser_thumbnails_bg_bad_url.js]
[browser_thumbnails_bg_crash_during_capture.js] [browser_thumbnails_bg_crash_during_capture.js]
skip-if = buildapp == 'mulet' || !crashreporter skip-if = buildapp == 'mulet' || !crashreporter || e10s # crashing the remote thumbnailer crashes the remote test tab
[browser_thumbnails_bg_crash_while_idle.js] [browser_thumbnails_bg_crash_while_idle.js]
skip-if = buildapp == 'mulet' || !crashreporter skip-if = buildapp == 'mulet' || !crashreporter || e10s
[browser_thumbnails_bg_basic.js] [browser_thumbnails_bg_basic.js]
[browser_thumbnails_bg_queueing.js] [browser_thumbnails_bg_queueing.js]
[browser_thumbnails_bg_timeout.js] [browser_thumbnails_bg_timeout.js]
[browser_thumbnails_bg_redirect.js] [browser_thumbnails_bg_redirect.js]
[browser_thumbnails_bg_destroy_browser.js] [browser_thumbnails_bg_destroy_browser.js]
[browser_thumbnails_bg_no_cookies_sent.js] [browser_thumbnails_bg_no_cookies_sent.js]
skip-if = e10s # e10s cookie problems
[browser_thumbnails_bg_no_cookies_stored.js] [browser_thumbnails_bg_no_cookies_stored.js]
[browser_thumbnails_bg_no_auth_prompt.js] [browser_thumbnails_bg_no_auth_prompt.js]
[browser_thumbnails_bg_no_alert.js] [browser_thumbnails_bg_no_alert.js]
@ -29,12 +29,18 @@ skip-if = buildapp == 'mulet' || !crashreporter
[browser_thumbnails_bug726727.js] [browser_thumbnails_bug726727.js]
skip-if = buildapp == 'mulet' skip-if = buildapp == 'mulet'
[browser_thumbnails_bug727765.js] [browser_thumbnails_bug727765.js]
skip-if = e10s # tries to open crypto/local file from the child
[browser_thumbnails_bug818225.js] [browser_thumbnails_bug818225.js]
skip-if = (e10s && os == 'linux') # load event issues. see original bug for follow up.
[browser_thumbnails_capture.js] [browser_thumbnails_capture.js]
skip-if = e10s # tries to call drawWindow with a remote browser.
[browser_thumbnails_expiration.js] [browser_thumbnails_expiration.js]
[browser_thumbnails_privacy.js] [browser_thumbnails_privacy.js]
skip-if = e10s # nsSSLStatus has null mServerCert, bug 820466
[browser_thumbnails_redirect.js] [browser_thumbnails_redirect.js]
skip-if = e10s # bug 1050869
[browser_thumbnails_storage.js] [browser_thumbnails_storage.js]
[browser_thumbnails_storage_migrate3.js] [browser_thumbnails_storage_migrate3.js]
skip-if = buildapp == 'mulet' skip-if = buildapp == 'mulet'
[browser_thumbnails_update.js] [browser_thumbnails_update.js]
skip-if = e10s # tries to open crypto/local file from the child

View File

@ -137,6 +137,7 @@ function captureAndCheckColor(aRed, aGreen, aBlue, aMessage) {
/** /**
* For a given URL, loads the corresponding thumbnail * For a given URL, loads the corresponding thumbnail
* to a canvas and passes its image data to the callback. * to a canvas and passes its image data to the callback.
* Note, not compat with e10s!
* @param aURL The url associated with the thumbnail. * @param aURL The url associated with the thumbnail.
* @param aCallback The function to pass the image data to. * @param aCallback The function to pass the image data to.
*/ */