mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Backed out changeset c3813936e074 (bug 1589913) for mochitest assertion failures at nsGlobalWindowInner.cpp. CLOSED TREE
This commit is contained in:
parent
3eaf139d31
commit
9a4043957e
@ -6,7 +6,7 @@
|
||||
/* import-globals-from common.js */
|
||||
|
||||
// Configuration vars
|
||||
let homeURL = "https://webxr.today/";
|
||||
let homeURL = "https://www.mozilla.org/en-US/";
|
||||
// Bug 1586294 - Localize the privacy policy URL (Services.urlFormatter?)
|
||||
let privacyPolicyURL = "https://www.mozilla.org/en-US/privacy/firefox/";
|
||||
let reportIssueURL = "https://mzl.la/fxr";
|
||||
|
@ -1402,8 +1402,7 @@ Promise* Navigator::Share(const ShareData& aData, ErrorResult& aRv) {
|
||||
// The spec does the "triggered by user activation" after the data checks.
|
||||
// Unfortunately, both Chrome and Safari behave this way, so interop wins.
|
||||
// https://github.com/w3c/web-share/pull/118
|
||||
if (StaticPrefs::dom_webshare_requireinteraction() &&
|
||||
!UserActivation::IsHandlingUserInput()) {
|
||||
if (StaticPrefs::dom_webshare_requireinteraction() && !UserActivation::IsHandlingUserInput()) {
|
||||
NS_WARNING("Attempt to share not triggered by user activation");
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
@ -1489,61 +1488,15 @@ already_AddRefed<Promise> Navigator::GetVRDisplays(ErrorResult& aRv) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<BrowserChild> browser(BrowserChild::GetFrom(mWindow));
|
||||
if (!browser) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
FinishGetVRDisplays(true, p);
|
||||
} else {
|
||||
RefPtr<Navigator> self(this);
|
||||
int browserID = browser->ChromeOuterWindowID();
|
||||
|
||||
browser->SendIsWindowSupportingWebVR(browserID)->Then(
|
||||
GetCurrentThreadSerialEventTarget(), __func__,
|
||||
[self, p](bool isSupported) {
|
||||
self->FinishGetVRDisplays(isSupported, p);
|
||||
},
|
||||
[](const mozilla::ipc::ResponseRejectReason) {
|
||||
MOZ_CRASH("Failed to make IPC call to IsWindowSupportingWebVR");
|
||||
});
|
||||
// We pass mWindow's id to RefreshVRDisplays, so NotifyVRDisplaysUpdated will
|
||||
// be called asynchronously, resolving the promises in mVRGetDisplaysPromises.
|
||||
if (!VRDisplay::RefreshVRDisplays(win->WindowID())) {
|
||||
p->MaybeReject(NS_ERROR_FAILURE);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void Navigator::FinishGetVRDisplays(bool isWebVRSupportedInwindow, Promise* p) {
|
||||
if (isWebVRSupportedInwindow) {
|
||||
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
|
||||
|
||||
// Since FinishGetVRDisplays can be called asynchronously after an IPC
|
||||
// response, it's possible that the Window can be torn down before this
|
||||
// call. In that case, the Window's cyclic references to VR objects are
|
||||
// also torn down and should not be recreated via
|
||||
// NotifyVREventListenerAdded.
|
||||
if (!win->IsDying()) {
|
||||
win->NotifyVREventListenerAdded();
|
||||
// We pass mWindow's id to RefreshVRDisplays, so
|
||||
// NotifyVRDisplaysUpdated will be called asynchronously, resolving
|
||||
// the promises in mVRGetDisplaysPromises.
|
||||
if (!VRDisplay::RefreshVRDisplays(win->WindowID())) {
|
||||
// Failed to refresh, reject the promise now
|
||||
p->MaybeRejectWithTypeError(u"Failed to find attached VR displays.");
|
||||
} else {
|
||||
// Succeeded, so cache the promise to resolve later
|
||||
mVRGetDisplaysPromises.AppendElement(p);
|
||||
}
|
||||
} else {
|
||||
// The Window has been torn down, so there is no further work that can
|
||||
// be done.
|
||||
p->MaybeRejectWithTypeError(
|
||||
u"Unable to return VRDisplays for a closed window.");
|
||||
}
|
||||
} else {
|
||||
// WebVR in this window is not supported, so resolve the promise
|
||||
// with no displays available
|
||||
nsTArray<RefPtr<VRDisplay>> vrDisplaysEmpty;
|
||||
p->MaybeResolve(vrDisplaysEmpty);
|
||||
}
|
||||
mVRGetDisplaysPromises.AppendElement(p);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void Navigator::GetActiveVRDisplays(
|
||||
|
@ -179,7 +179,6 @@ class Navigator final : public nsISupports, public nsWrapperCache {
|
||||
void GetGamepads(nsTArray<RefPtr<Gamepad>>& aGamepads, ErrorResult& aRv);
|
||||
GamepadServiceTest* RequestGamepadServiceTest();
|
||||
already_AddRefed<Promise> GetVRDisplays(ErrorResult& aRv);
|
||||
void FinishGetVRDisplays(bool isWebVRSupportedInwindow, Promise* p);
|
||||
void GetActiveVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDisplays) const;
|
||||
VRServiceTest* RequestVRServiceTest();
|
||||
bool IsWebVRContentDetected() const;
|
||||
|
@ -4092,7 +4092,6 @@ void nsGlobalWindowInner::DisableGamepadUpdates() {
|
||||
}
|
||||
|
||||
void nsGlobalWindowInner::EnableVRUpdates() {
|
||||
MOZ_ASSERT(!IsDying());
|
||||
if (mHasVREvents && !mVREventObserver) {
|
||||
mVREventObserver = new VREventObserver(this);
|
||||
nsPIDOMWindowOuter* outer = GetOuterWindow();
|
||||
|
@ -3996,19 +3996,5 @@ mozilla::ipc::IPCResult BrowserParent::RecvIsWindowSupportingProtectedMedia(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvIsWindowSupportingWebVR(
|
||||
const uint64_t& aOuterWindowID,
|
||||
IsWindowSupportingWebVRResolver&& aResolve) {
|
||||
#ifdef XP_WIN
|
||||
bool isFxrWindow =
|
||||
FxRWindowManager::GetInstance()->IsFxRWindow(aOuterWindowID);
|
||||
aResolve(!isFxrWindow);
|
||||
#else
|
||||
aResolve(true);
|
||||
#endif
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -507,10 +507,6 @@ class BrowserParent final : public PBrowserParent,
|
||||
const uint64_t& aOuterWindowID,
|
||||
IsWindowSupportingProtectedMediaResolver&& aResolve);
|
||||
|
||||
mozilla::ipc::IPCResult RecvIsWindowSupportingWebVR(
|
||||
const uint64_t& aOuterWindowID,
|
||||
IsWindowSupportingWebVRResolver&& aResolve);
|
||||
|
||||
void LoadURL(nsIURI* aURI);
|
||||
|
||||
void ResumeLoad(uint64_t aPendingSwitchID);
|
||||
|
@ -1035,11 +1035,6 @@ parent:
|
||||
*/
|
||||
async IsWindowSupportingProtectedMedia(uint64_t aOuterWindowID) returns(bool isSupported);
|
||||
|
||||
/**
|
||||
* Fetches whether this window supports WebVR, which is sent back in response.
|
||||
*/
|
||||
async IsWindowSupportingWebVR(uint64_t aOuterWindowID) returns(bool isSupported);
|
||||
|
||||
/** Records a history visit. */
|
||||
async VisitURI(URIParams aURI, URIParams? aLastVisitedURI,
|
||||
uint32_t aFlags);
|
||||
|
@ -65,10 +65,6 @@ nsFxrCommandLineHandler::Handle(nsICommandLine* aCmdLine) {
|
||||
nsresult result =
|
||||
aCmdLine->HandleFlag(NS_LITERAL_STRING("fxr"), false, &handleFlagRetVal);
|
||||
if (result == NS_OK && handleFlagRetVal) {
|
||||
if (XRE_IsParentProcess() && !XRE_IsE10sParentProcess()) {
|
||||
MOZ_CRASH("--fxr not supported without e10s");
|
||||
}
|
||||
|
||||
aCmdLine->SetPreventDefault(true);
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch =
|
||||
|
Loading…
Reference in New Issue
Block a user