Skip to content

Commit

Permalink
Add a runtime flag for ImageCapture
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265188
rdar://118185086

Reviewed by Eric Carlson.

We add a runtime flag for ImageCapture to enable it or disable it.
We make it off by default.
We disable it even if enabled by default for zoom until we figure out what the issue might be.

Manually tested.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Modules/mediastream/ImageCapture.idl:
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldAllowImageCaptureQuirk const):
* Source/WebCore/page/Quirks.h:

Canonical link: https://commits.webkit.org/271048@main
  • Loading branch information
youennf committed Nov 22, 2023
1 parent 7b8bf7b commit 41ea8e9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3111,6 +3111,21 @@ ImageAnimationControlEnabled:
WebCore:
default: true

ImageCaptureEnabled:
type: bool
status: testable
category: media
humanReadableName: "Image Capture API"
humanReadableDescription: "Enable Image Capture API"
condition: ENABLE(MEDIA_STREAM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
default: false
WebCore:
default: false

ImageControlsEnabled:
type: bool
status: unstable
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/Modules/mediastream/ImageCapture.idl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
Conditional=MEDIA_STREAM,
SecureContext,
JSGenerateToNativeObject,
EnabledBySetting=ImageCaptureEnabled,
DisabledByQuirk=shouldDisableImageCapture,
Exposed=Window
] interface ImageCapture {
[CallWith=CurrentDocument] constructor(MediaStreamTrack videoTrack);
Expand Down
12 changes: 12 additions & 0 deletions Source/WebCore/page/Quirks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,18 @@ bool Quirks::shouldEnableLegacyGetUserMediaQuirk() const
}
return m_shouldEnableLegacyGetUserMediaQuirk.value();
}

// zoom.us rdar://118185086
bool Quirks::shouldDisableImageCaptureQuirk() const
{
if (!needsQuirks())
return false;

if (!m_shouldDisableImageCaptureQuirk)
m_shouldDisableImageCaptureQuirk = isDomain("zoom.us"_s);

return m_shouldDisableImageCaptureQuirk.value();
}
#endif

// hulu.com rdar://55041979
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/page/Quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class Quirks {

#if ENABLE(MEDIA_STREAM)
bool shouldEnableLegacyGetUserMediaQuirk() const;
bool shouldDisableImageCaptureQuirk() const;
#endif

bool needsCanPlayAfterSeekedQuirk() const;
Expand Down Expand Up @@ -218,6 +219,7 @@ class Quirks {
mutable std::optional<bool> m_requiresUserGestureToLoadInPictureInPicture;
#if ENABLE(MEDIA_STREAM)
mutable std::optional<bool> m_shouldEnableLegacyGetUserMediaQuirk;
mutable std::optional<bool> m_shouldDisableImageCaptureQuirk;
#endif
mutable std::optional<bool> m_blocksReturnToFullscreenFromPictureInPictureQuirk;
mutable std::optional<bool> m_blocksEnteringStandardFullscreenFromPictureInPictureQuirk;
Expand Down

0 comments on commit 41ea8e9

Please sign in to comment.