зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1652344 p2. Fix the print settings creation in the print preview tests. r=hiro
nsIWebBrowserPrint.globalPrintSettings returns a new object each time. That is why the code in these tests doesn't work, and why they have the workaround to set the pref to disable the progress dialog. This patch fixes the code and removes the prefs setting workaround. This patch also changes the code to use the print settings service to get the print settings. That's all that nsIWebBrowserPrint.globalPrintSettings does anyway. Making this change allows me to remove nsIWebBrowserPrint.globalPrintSettings in the next patch. Differential Revision: https://phabricator.services.mozilla.com/D83279
This commit is contained in:
Родитель
d1e60a800a
Коммит
dc75460193
|
@ -38,13 +38,10 @@ function printpreview() {
|
|||
throw Components.Exception("", Cr.NS_NOINTERFACE);
|
||||
}
|
||||
}
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefBranch);
|
||||
prefs.setBoolPref('print.show_print_progress', false);
|
||||
//XXX I would have thought this would work, instead I'm forced to use prefs service
|
||||
gWbp.globalPrintSettings.showPrintProgress = false;
|
||||
gWbp.printPreview(gWbp.globalPrintSettings, frameElts[0].contentWindow, listener);
|
||||
prefs.clearUserPref('print.show_print_progress');
|
||||
let settings = Cc["@mozilla.org/gfx/printsettings-service;1"]
|
||||
.getService(Ci.nsIPrintSettingsService).globalPrintSettings;
|
||||
settings.showPrintProgress = false;
|
||||
gWbp.printPreview(settings, frameElts[0].contentWindow, listener);
|
||||
}
|
||||
|
||||
function exitprintpreview() {
|
||||
|
|
|
@ -38,13 +38,10 @@ function printpreview() {
|
|||
throw Components.Exception("", Cr.NS_NOINTERFACE);
|
||||
}
|
||||
}
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefBranch);
|
||||
prefs.setBoolPref('print.show_print_progress', false);
|
||||
//XXX I would have thought this would work, instead I'm forced to use prefs service
|
||||
gWbp.globalPrintSettings.showPrintProgress = false;
|
||||
gWbp.printPreview(gWbp.globalPrintSettings, frameElts[0].contentWindow, listener);
|
||||
prefs.clearUserPref('print.show_print_progress');
|
||||
let settings = Cc["@mozilla.org/gfx/printsettings-service;1"]
|
||||
.getService(Ci.nsIPrintSettingsService).globalPrintSettings;
|
||||
settings.showPrintProgress = false;
|
||||
gWbp.printPreview(settings, frameElts[0].contentWindow, listener);
|
||||
}
|
||||
|
||||
function exitprintpreview() {
|
||||
|
|
|
@ -45,10 +45,8 @@ function printpreview(hasMozPrintCallback) {
|
|||
throw Components.Exception("", Cr.NS_NOINTERFACE);
|
||||
}
|
||||
}
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefBranch);
|
||||
prefs.setBoolPref('print.show_print_progress', false);
|
||||
let settings = gWbp.globalPrintSettings;
|
||||
var settings = Cc["@mozilla.org/gfx/printsettings-service;1"]
|
||||
.getService(Ci.nsIPrintSettingsService).globalPrintSettings;
|
||||
settings.showPrintProgress = false;
|
||||
var before = 0;
|
||||
var after = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче