Bug 1772634 - part 2: Make BrowserParent::RecvSynthesizeNativeTouchPoint relax in the responsive design mode r=smaug
It's used by the DevTools to emulate touch events from mouse events in the responsive design mode. Therefore, we should make it accept IPC messages even if it's not in the automation mode, but it's in the responsive design mode. Differential Revision: https://phabricator.services.mozilla.com/D148365
This commit is contained in:
@@ -1080,6 +1080,10 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId,
|
||||
int32_t aScreenY, double aPressure,
|
||||
uint32_t aOrientation,
|
||||
nsIObserver* aObserver) {
|
||||
// FYI: This was designed for automated tests, but currently, this is used by
|
||||
// DevTools to emulate touch events from mouse events in the responsive
|
||||
// design mode.
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@@ -1960,7 +1960,16 @@ mozilla::ipc::IPCResult BrowserParent::RecvSynthesizeNativeTouchPoint(
|
||||
const uint32_t& aPointerId, const TouchPointerState& aPointerState,
|
||||
const LayoutDeviceIntPoint& aPoint, const double& aPointerPressure,
|
||||
const uint32_t& aPointerOrientation, const uint64_t& aObserverId) {
|
||||
NS_ENSURE_TRUE(xpc::IsInAutomation(), IPC_FAIL(this, "Unexpected event"));
|
||||
// This is used by DevTools to emulate touch events from mouse events in the
|
||||
// responsive design mode. Therefore, we should accept the IPC messages even
|
||||
// if it's not in the automation mode but the browsing context is in RDM pane.
|
||||
// And the IPC message could be just delayed after closing the responsive
|
||||
// design mode. Therefore, we shouldn't return IPC_FAIL since doing it makes
|
||||
// the tab crash.
|
||||
if (!xpc::IsInAutomation()) {
|
||||
NS_ENSURE_TRUE(mBrowsingContext, IPC_OK());
|
||||
NS_ENSURE_TRUE(mBrowsingContext->Top()->GetInRDMPane(), IPC_OK());
|
||||
}
|
||||
|
||||
AutoSynthesizedEventResponder responder(this, aObserverId, "touchpoint");
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
|
||||
@@ -1921,6 +1921,9 @@ void nsIWidget::OnLongTapTimerCallback(nsITimer* aTimer, void* aClosure) {
|
||||
nsresult nsIWidget::ClearNativeTouchSequence(nsIObserver* aObserver) {
|
||||
AutoObserverNotifier notifier(aObserver, "cleartouch");
|
||||
|
||||
// XXX This is odd. This is called by the constructor of nsIWidget. However,
|
||||
// at that point, nsIWidget::mLongTapTimer must be nullptr. Therefore,
|
||||
// this must do nothing at initializing the instance.
|
||||
if (!mLongTapTimer) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user