Closed Bug 1766189 Opened 3 years ago Closed 3 years ago

ScreenOrientation.unlock

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 99
Unspecified
Android
defect

Tracking

()

RESOLVED DUPLICATE of bug 1744125

People

(Reporter: mudza100, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36

Steps to reproduce:

  1. go into fullscreen mode
  2. lock the screen
  3. unlock the screen
  4. exit from full screen

Actual results:

Getting an "NotSupportedError Operation is not supported" errror every time on unlock even though its was supposed to work on the latest version of firefox after firefox 43

Expected results:

The unlock feature should work and should not always throw the error.

Also reported to MDN to update the docs
https://github.com/mdn/browser-compat-data/issues/15854

The Bugbug bot thinks this bug should belong to the 'Core::Graphics' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics
Product: Firefox → Core

Thanks for the bug report, mudza100. Do you have a link to a page that can be used to test this?

Is this bug on Android or on desktop platforms too?

Flags: needinfo?(mudza100)

Hii i reproduced it Firefox desktop on Windows 10 and Linux device.
Haven't got the chance to check on Android platforms.

Flags: needinfo?(mudza100)

the code that was throwing an error for me is this: as it was mentioned in MDN that firefox desktop supports it.. but throws an error every time on: window.screen.orientation.unlock();

const unlockScreenMode = async () => {
  try {
    // For android browsers, unlock orientation and exit fullscreen
    // For details: https://w3c.github.io/screen-orientation/#unlock-method-unlock-screen-to-default-orientation
    if (window.screen?.orientation?.unlock) window.screen.orientation.unlock();
  } catch (error) {
    console.error('error unlocking:', error);
  }
};

It seems to me that this API is only supported on Android: https://searchfox.org/mozilla-central/rev/ea1234192518e01694a88eac8ff090e4cadf5ca4/dom/base/ScreenOrientation.cpp#334

Perhaps our documentation is incorrect. In any case I'll move this over to the DOM component as they will know better than I do.

Component: Graphics → DOM: Window and Location

Dup of bug 1763052?

Component: DOM: Window and Location → DOM: Core & HTML
Flags: needinfo?(m_kato)
OS: Unspecified → Android

(In reply to Hsin-Yi Tsai [:hsinyi] from comment #6)

Dup of bug 1763052?

No, actually this API is disabled by default (dom.screenorientation.allow-lock = false) now. This is dup of bug 1744125.

Flags: needinfo?(m_kato)
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.