gecko-dev/hal/sandbox/PHal.ipdl
Makoto Kato 3493d2727e Bug 1753574 - hal::LockOrientation can return error status. r=smaug,geckoview-reviewers,agi,calu
From https://w3c.github.io/screen-orientation/#apply-an-orientation-lock

> 7.2. Apply an orientation lock
>
> The steps to apply an orientation lock to a Document using orientation are as
> follows:
>
>  1. If the user agent does not support locking the screen orientation, return
>     a promise rejected with a "NotSupportedError" DOMException and abort
>     these steps.

So if orientation controller delegate isn't set, we should throw
`NotSupportedError`.  But, actually, we throws `AbortError`, so this isn't
correct.

To return any DOM error from platform implementation of
`screen.orientation.lock`, I would like to change return value to
`GenericPromise`'s.

Differential Revision: https://phabricator.services.mozilla.com/D137970
2022-03-02 03:48:14 +00:00

100 lines
2.7 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PContent;
include protocol PBrowser;
include "mozilla/dom/ReferrerInfoUtils.h";
include "mozilla/GfxMessageUtils.h";
using hal::ScreenOrientation from "mozilla/HalIPCUtils.h";
using mozilla::hal::SensorType from "mozilla/HalSensor.h";
using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
using nsIntRect from "nsRect.h";
using PRTime from "prtime.h";
namespace mozilla {
namespace hal {
struct BatteryInformation {
double level;
bool charging;
double remainingTime;
};
struct SensorData {
SensorType sensor;
PRTime timestamp;
float[] values;
};
struct NetworkInformation {
uint32_t type;
bool isWifi;
uint32_t dhcpGateway;
};
struct WakeLockInformation {
nsString topic;
uint32_t numLocks;
uint32_t numHidden;
uint64_t[] lockingProcesses;
};
} // namespace hal
namespace hal_sandbox {
[ManualDealloc, NestedUpTo=inside_cpow, ChildImpl=virtual, ParentImpl=virtual]
sync protocol PHal {
manager PContent;
child:
async NotifyBatteryChange(BatteryInformation aBatteryInfo);
async NotifyNetworkChange(NetworkInformation aNetworkInfo);
async NotifyWakeLockChange(WakeLockInformation aWakeLockInfo);
parent:
async Vibrate(uint32_t[] pattern, uint64_t[] id, PBrowser browser);
async CancelVibrate(uint64_t[] id, PBrowser browser);
async EnableBatteryNotifications();
async DisableBatteryNotifications();
sync GetCurrentBatteryInformation()
returns (BatteryInformation aBatteryInfo);
async EnableNetworkNotifications();
async DisableNetworkNotifications();
sync GetCurrentNetworkInformation()
returns (NetworkInformation aNetworkInfo);
async ModifyWakeLock(nsString aTopic,
WakeLockControl aLockAdjust,
WakeLockControl aHiddenAdjust,
uint64_t aProcessID);
async EnableWakeLockNotifications();
async DisableWakeLockNotifications();
sync GetWakeLockInfo(nsString aTopic)
returns (WakeLockInformation aWakeLockInfo);
async LockScreenOrientation(ScreenOrientation aOrientation)
returns (nsresult result);
async UnlockScreenOrientation();
child:
async NotifySensorChange(SensorData aSensorData);
parent:
async EnableSensorNotifications(SensorType aSensor);
async DisableSensorNotifications(SensorType aSensor);
async __delete__();
};
} // namespace hal
} // namespace mozilla