зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1683279, fix intermittent test error and use the focused window in PrintingSelectionChild.jsm r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D102618
This commit is contained in:
Родитель
cc349bf06f
Коммит
f3948b301e
|
@ -12,17 +12,19 @@ class PrintingSelectionChild extends JSWindowActorChild {
|
|||
receiveMessage(message) {
|
||||
switch (message.name) {
|
||||
case "PrintingSelection:HasSelection":
|
||||
return this.hasSelection(this.document.ownerGlobal);
|
||||
return this.hasSelection();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
hasSelection(global) {
|
||||
const { content } = global;
|
||||
hasSelection() {
|
||||
let focusedWindow = Services.focus.focusedWindow;
|
||||
if (focusedWindow) {
|
||||
let selection = focusedWindow.getSelection();
|
||||
return selection.type == "Range";
|
||||
}
|
||||
|
||||
let focusedWindow = Services.focus.focusedWindow || content;
|
||||
let selection = focusedWindow.getSelection();
|
||||
return selection.type == "Range";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,8 +235,7 @@ var PrintUtils = {
|
|||
"PrintingSelection"
|
||||
);
|
||||
hasSelection = await sourceActor.sendQuery(
|
||||
"PrintingSelection:HasSelection",
|
||||
{}
|
||||
"PrintingSelection:HasSelection"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче