зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ebb61065ad47 (bug 1690747) for failing mochitests at test_focus_design_mode.html on a CLOSED TREE
This commit is contained in:
Родитель
08d51f6fb0
Коммит
c546ab6198
|
@ -2148,22 +2148,11 @@ void BrowsingContext::Focus(CallerType aCallerType, ErrorResult& aError) {
|
|||
}
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanBlurCheck(CallerType aCallerType) {
|
||||
// If dom.disable_window_flip == true, then content should not be allowed
|
||||
// to do blur (this would allow popunders, bug 369306)
|
||||
return aCallerType == CallerType::System ||
|
||||
!Preferences::GetBool("dom.disable_window_flip", true);
|
||||
}
|
||||
|
||||
void BrowsingContext::Blur(CallerType aCallerType, ErrorResult& aError) {
|
||||
if (!CanBlurCheck(aCallerType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
void BrowsingContext::Blur(ErrorResult& aError) {
|
||||
if (ContentChild* cc = ContentChild::GetSingleton()) {
|
||||
cc->SendWindowBlur(this, aCallerType);
|
||||
cc->SendWindowBlur(this);
|
||||
} else if (ContentParent* cp = Canonical()->GetContentParent()) {
|
||||
Unused << cp->SendWindowBlur(this, aCallerType);
|
||||
Unused << cp->SendWindowBlur(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -610,7 +610,7 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||
void Close(CallerType aCallerType, ErrorResult& aError);
|
||||
bool GetClosed(ErrorResult&) { return GetClosed(); }
|
||||
void Focus(CallerType aCallerType, ErrorResult& aError);
|
||||
void Blur(CallerType aCallerType, ErrorResult& aError);
|
||||
void Blur(ErrorResult& aError);
|
||||
WindowProxyHolder GetFrames(ErrorResult& aError);
|
||||
int32_t Length() const { return Children().Length(); }
|
||||
Nullable<WindowProxyHolder> GetTop(ErrorResult& aError);
|
||||
|
@ -784,8 +784,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||
// Returns canFocus, isActive
|
||||
std::tuple<bool, bool> CanFocusCheck(CallerType aCallerType);
|
||||
|
||||
bool CanBlurCheck(CallerType aCallerType);
|
||||
|
||||
PopupBlocker::PopupControlState RevisePopupAbuseLevel(
|
||||
PopupBlocker::PopupControlState aControl);
|
||||
|
||||
|
|
|
@ -3736,8 +3736,8 @@ nsresult nsGlobalWindowInner::Focus(CallerType aCallerType) {
|
|||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
void nsGlobalWindowInner::Blur(CallerType aCallerType, ErrorResult& aError) {
|
||||
FORWARD_TO_OUTER_OR_THROW(BlurOuter, (aCallerType), aError, );
|
||||
void nsGlobalWindowInner::Blur(ErrorResult& aError) {
|
||||
FORWARD_TO_OUTER_OR_THROW(BlurOuter, (), aError, );
|
||||
}
|
||||
|
||||
void nsGlobalWindowInner::Stop(ErrorResult& aError) {
|
||||
|
|
|
@ -608,7 +608,7 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
|
|||
void Focus(mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aError);
|
||||
nsresult Focus(mozilla::dom::CallerType aCallerType) override;
|
||||
void Blur(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aError);
|
||||
void Blur(mozilla::ErrorResult& aError);
|
||||
mozilla::dom::WindowProxyHolder GetFrames(mozilla::ErrorResult& aError);
|
||||
uint32_t Length();
|
||||
mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> GetTop(
|
||||
|
|
|
@ -5117,8 +5117,10 @@ nsresult nsGlobalWindowOuter::Focus(CallerType aCallerType) {
|
|||
FORWARD_TO_INNER(Focus, (aCallerType), NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
void nsGlobalWindowOuter::BlurOuter(CallerType aCallerType) {
|
||||
if (!GetBrowsingContext()->CanBlurCheck(aCallerType)) {
|
||||
void nsGlobalWindowOuter::BlurOuter() {
|
||||
// If dom.disable_window_flip == true, then content should not be allowed
|
||||
// to call this function (this would allow popunders, bug 369306)
|
||||
if (!CanSetProperty("dom.disable_window_flip")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
|
|||
void FocusOuter(mozilla::dom::CallerType aCallerType, bool aFromOtherProcess,
|
||||
uint64_t aActionId);
|
||||
nsresult Focus(mozilla::dom::CallerType aCallerType) override;
|
||||
void BlurOuter(mozilla::dom::CallerType aCallerType);
|
||||
void BlurOuter();
|
||||
mozilla::dom::WindowProxyHolder GetFramesOuter();
|
||||
uint32_t Length();
|
||||
mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> GetTopOuter();
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>activeElement design-mode inner document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Inner</h1>
|
||||
<script>
|
||||
let innerlog = "innerlog:";
|
||||
|
||||
document.designmode = "on";
|
||||
|
||||
window.onmessage = function(e) {
|
||||
if (e.data == "focus") {
|
||||
document.documentElement.focus();
|
||||
} else if (e.data == "getlog") {
|
||||
innerlog += "activeElement:" + document.activeElement.tagName + ",";
|
||||
parent.postMessage(innerlog, "*");
|
||||
}
|
||||
};
|
||||
|
||||
window.onfocus = function() {
|
||||
innerlog += "windowfocus,";
|
||||
};
|
||||
|
||||
window.onblur = function() {
|
||||
innerlog += "windowblur,";
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -657,9 +657,6 @@ skip-if = toolkit == 'android' && !is_fennec # Bug 1525959
|
|||
[test_focus_scrollable_input.html]
|
||||
[test_focus_scrollable_fieldset.html]
|
||||
[test_focus_scroll_padding_tab.html]
|
||||
[test_focus_design_mode.html]
|
||||
support-files =
|
||||
file_focus_design_mode_inner.html
|
||||
[test_getAttribute_after_createAttribute.html]
|
||||
[test_getElementById.html]
|
||||
[test_getTranslationNodes.html]
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1690747
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1690747</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1690747">Mozilla Bug 1690747</a>
|
||||
<p id="display"></p>
|
||||
<div id='content'>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<iframe src="https://example.org/tests/dom/base/test/file_focus_design_mode_inner.html"></iframe>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1690747 **/
|
||||
|
||||
let iframe = document.querySelector("iframe");
|
||||
|
||||
function waitForEvent(target, event, checkFn) {
|
||||
return new Promise(resolve => {
|
||||
target.addEventListener(event, e => {
|
||||
if (checkFn && !checkFn(e)) {
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
}, { once: true });
|
||||
});
|
||||
}
|
||||
|
||||
async function getLog() {
|
||||
let log = "";
|
||||
SimpleTest.executeSoon(function() {
|
||||
iframe.contentWindow.postMessage("getlog", "*");
|
||||
});
|
||||
await waitForEvent(window, "message", (e) => {
|
||||
log = e.data;
|
||||
return true;
|
||||
});
|
||||
return log;
|
||||
}
|
||||
|
||||
add_task(async function activeElementAfterBluring() {
|
||||
iframe.contentWindow.postMessage("focus", "*");
|
||||
is(await getLog(), "innerlog:windowfocus,activeElement:HTML,", "check activeElement");
|
||||
iframe.contentWindow.blur();
|
||||
is(await getLog(), "innerlog:windowfocus,activeElement:HTML,activeElement:HTML,", "check activeElement after bluring");
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -3734,7 +3734,7 @@ mozilla::ipc::IPCResult ContentChild::RecvWindowFocus(
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvWindowBlur(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, CallerType aCallerType) {
|
||||
const MaybeDiscarded<BrowsingContext>& aContext) {
|
||||
if (aContext.IsNullOrDiscarded()) {
|
||||
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
|
||||
("ChildIPC: Trying to send a message to dead or detached context"));
|
||||
|
@ -3748,7 +3748,7 @@ mozilla::ipc::IPCResult ContentChild::RecvWindowBlur(
|
|||
("ChildIPC: Trying to send a message to a context without a window"));
|
||||
return IPC_OK();
|
||||
}
|
||||
nsGlobalWindowOuter::Cast(window)->BlurOuter(aCallerType);
|
||||
nsGlobalWindowOuter::Cast(window)->BlurOuter();
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -712,7 +712,7 @@ class ContentChild final : public PContentChild,
|
|||
const MaybeDiscarded<BrowsingContext>& aContext, CallerType aCallerType,
|
||||
uint64_t aActionId);
|
||||
mozilla::ipc::IPCResult RecvWindowBlur(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, CallerType aCallerType);
|
||||
const MaybeDiscarded<BrowsingContext>& aContext);
|
||||
mozilla::ipc::IPCResult RecvRaiseWindow(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, CallerType aCallerType,
|
||||
uint64_t aActionId);
|
||||
|
|
|
@ -6817,7 +6817,7 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowFocus(
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvWindowBlur(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, CallerType aCallerType) {
|
||||
const MaybeDiscarded<BrowsingContext>& aContext) {
|
||||
if (aContext.IsNullOrDiscarded()) {
|
||||
MOZ_LOG(
|
||||
BrowsingContext::GetLog(), LogLevel::Debug,
|
||||
|
@ -6829,7 +6829,7 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowBlur(
|
|||
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||
ContentParent* cp =
|
||||
cpm->GetContentProcessById(ContentParentId(context->OwnerProcessId()));
|
||||
Unused << cp->SendWindowBlur(context, aCallerType);
|
||||
Unused << cp->SendWindowBlur(context);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -679,7 +679,7 @@ class ContentParent final
|
|||
const MaybeDiscarded<BrowsingContext>& aContext, CallerType aCallerType,
|
||||
uint64_t aActionId);
|
||||
mozilla::ipc::IPCResult RecvWindowBlur(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, CallerType aCallerType);
|
||||
const MaybeDiscarded<BrowsingContext>& aContext);
|
||||
mozilla::ipc::IPCResult RecvRaiseWindow(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, CallerType aCallerType,
|
||||
uint64_t aActionId);
|
||||
|
|
|
@ -1799,8 +1799,7 @@ both:
|
|||
bool aTrustedCaller);
|
||||
async WindowFocus(MaybeDiscardedBrowsingContext aContext,
|
||||
CallerType aCallerType, uint64_t aActionId);
|
||||
async WindowBlur(MaybeDiscardedBrowsingContext aContext,
|
||||
CallerType aCallerType);
|
||||
async WindowBlur(MaybeDiscardedBrowsingContext aContext);
|
||||
async RaiseWindow(MaybeDiscardedBrowsingContext aContext, CallerType aCallerType, uint64_t aActionId);
|
||||
async ClearFocus(MaybeDiscardedBrowsingContext aContext);
|
||||
async SetFocusedBrowsingContext(MaybeDiscardedBrowsingContext aContext);
|
||||
|
|
|
@ -226,7 +226,7 @@ typedef OfflineResourceList ApplicationCache;
|
|||
[Throws, CrossOriginReadable] readonly attribute boolean closed;
|
||||
[Throws] void stop();
|
||||
[Throws, CrossOriginCallable, NeedsCallerType] void focus();
|
||||
[Throws, CrossOriginCallable, NeedsCallerType] void blur();
|
||||
[Throws, CrossOriginCallable] void blur();
|
||||
[Replaceable, Pref="dom.window.event.enabled"] readonly attribute any event;
|
||||
|
||||
// other browsing contexts
|
||||
|
|
Загрузка…
Ссылка в новой задаче