Bug 1654758 - [devtools] Remove usage of actorHasMethod in responsive/ui module r=bradwerth

All the backward compatibility code can be removed.

"setMaxTouchPoints" was added in https://bugzilla.mozilla.org/show_bug.cgi?id=1500672 (FF77)
"simulateScreenOrientationChange" was added in https://bugzilla.mozilla.org/show_bug.cgi?id=1357774 (FF69)
"captureScreenshot" was added in https://bugzilla.mozilla.org/show_bug.cgi?id=1579133 (FF71)

Differential Revision: https://phabricator.services.mozilla.com/D95313
This commit is contained in:
Julian Descottes 2020-11-03 16:48:25 +00:00
Родитель d55fc399a4
Коммит 5f04ebe1d9
1 изменённых файлов: 8 добавлений и 30 удалений

Просмотреть файл

@ -670,17 +670,10 @@ class ResponsiveUI {
}
async onScreenshot() {
const captureScreenshotSupported = await this.currentTarget.actorHasMethod(
"responsive",
"captureScreenshot"
);
const data = await this.responsiveFront.captureScreenshot();
await saveScreenshot(this.browserWindow, {}, data);
if (captureScreenshotSupported) {
const data = await this.responsiveFront.captureScreenshot();
await saveScreenshot(this.browserWindow, {}, data);
message.post(this.rdmFrame.contentWindow, "screenshot-captured");
}
message.post(this.rdmFrame.contentWindow, "screenshot-captured");
}
onToggleLeftAlignment(event) {
@ -896,20 +889,12 @@ class ResponsiveUI {
* reloaded/navigated to, so we should not be simulating "orientationchange".
*/
async updateScreenOrientation(type, angle, isViewportRotated = false) {
const simulateOrientationChangeSupported = await this.currentTarget.actorHasMethod(
"responsive",
"simulateScreenOrientationChange"
await this.responsiveFront.simulateScreenOrientationChange(
type,
angle,
isViewportRotated
);
// Ensure that simulateScreenOrientationChange is supported.
if (simulateOrientationChangeSupported) {
await this.responsiveFront.simulateScreenOrientationChange(
type,
angle,
isViewportRotated
);
}
// Used by tests.
if (!isViewportRotated) {
this.emit("only-viewport-orientation-changed");
@ -923,14 +908,7 @@ class ResponsiveUI {
* Whether or not touch is enabled for the simulated device.
*/
async updateMaxTouchPointsEnabled(touchSimulationEnabled) {
const setMaxTouchPointsSupported = await this.currentTarget.actorHasMethod(
"responsive",
"setMaxTouchPoints"
);
if (setMaxTouchPointsSupported) {
await this.responsiveFront.setMaxTouchPoints(touchSimulationEnabled);
}
return this.responsiveFront.setMaxTouchPoints(touchSimulationEnabled);
}
/**