Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
browser(firefox): do not capture cursor in screencast (#3118)
Yury Semikhatskyda25a5b5012a
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBERindex d391eb1213..ab823b015d 100644--- a/browser_patches/firefox/BUILD_NUMBER+++ b/browser_patches/firefox/BUILD_NUMBER@@ -1,2 +1,2 @@-1141-Changed: [email protected] Fri 24 Jul 2020 03:10:49 PM PDT+1142+Changed: [email protected] Mon Jul 27 16:21:29 PDT 2020diff --git a/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp b/browser_patches/firefox/juggler/screencast/nsScreencastService.cppindex 6889d8b380..c30aa4c7e4 100644--- a/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp+++ b/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp@@ -46,7 +46,8 @@ rtc::scoped_refptr<webrtc::VideoCaptureModule> CreateWindowCapturer(nsIWidget* w}nsCString windowId;windowId.AppendPrintf("%" PRIuPTR, rawWindowId);- return webrtc::DesktopCaptureImpl::Create(sessionId, windowId.get(), webrtc::CaptureDeviceType::Window);+ bool captureCursor = false;+ return webrtc::DesktopCaptureImpl::Create(sessionId, windowId.get(), webrtc::CaptureDeviceType::Window, captureCursor);}void NotifyScreencastStopped(int32_t sessionId) {diff --git a/browser_patches/firefox/patches/bootstrap.diff b/browser_patches/firefox/patches/bootstrap.diffindex fe73f6ac9b..1c88c3ae68 100644--- a/browser_patches/firefox/patches/bootstrap.diff+++ b/browser_patches/firefox/patches/bootstrap.diff@@ -928,6 +928,98 @@ index 2b17323d8a939a18a788d34367a8c427740c0f17..b4764f1c0406b4f93b6936b32104f3deNS_IMETHODIMP BrowserChild::OnProgressChange(nsIWebProgress* aWebProgress,nsIRequest* aRequest,int32_t aCurSelfProgress,+diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.cc b/dom/media/systemservices/video_engine/desktop_capture_impl.cc+index 6fdb72a8ec50fecc9895911a4ee7ccbccb441c61..229aa455da74950ff601378b88e12bf7425b89e7 100644+--- a/dom/media/systemservices/video_engine/desktop_capture_impl.cc++++ b/dom/media/systemservices/video_engine/desktop_capture_impl.cc+@@ -211,8 +211,9 @@ int32_t AppDeviceInfoImpl::GetOrientation(const char* deviceUniqueIdUTF8,++ VideoCaptureModule* DesktopCaptureImpl::Create(const int32_t id,+ const char* uniqueId,+- const CaptureDeviceType type) {+- return new rtc::RefCountedObject<DesktopCaptureImpl>(id, uniqueId, type);++ const CaptureDeviceType type,++ bool captureCursor) {++ return new rtc::RefCountedObject<DesktopCaptureImpl>(id, uniqueId, type, captureCursor);+ }++ int32_t WindowDeviceInfoImpl::Init() {+@@ -358,19 +359,24 @@ int32_t DesktopCaptureImpl::Init() {+ DesktopCapturer::SourceId sourceId = atoi(_deviceUniqueId.c_str());+ pWindowCapturer->SelectSource(sourceId);++- MouseCursorMonitor* pMouseCursorMonitor =+- MouseCursorMonitor::CreateForWindow(+- webrtc::DesktopCaptureOptions::CreateDefault(), sourceId);+- desktop_capturer_cursor_composer_ =+- std::unique_ptr<DesktopAndCursorComposer>(new DesktopAndCursorComposer(+- pWindowCapturer.release(), pMouseCursorMonitor));++ if (capture_cursor_) {++ MouseCursorMonitor* pMouseCursorMonitor =++ MouseCursorMonitor::CreateForWindow(++ webrtc::DesktopCaptureOptions::CreateDefault(), sourceId);++ desktop_capturer_cursor_composer_ =++ std::unique_ptr<DesktopAndCursorComposer>(new DesktopAndCursorComposer(++ pWindowCapturer.release(), pMouseCursorMonitor));++ } else {++ desktop_capturer_cursor_composer_ = std::move(pWindowCapturer);++ }+ }++ return 0;+ }++ DesktopCaptureImpl::DesktopCaptureImpl(const int32_t id, const char* uniqueId,+- const CaptureDeviceType type)++ const CaptureDeviceType type,++ bool captureCursor)+ : _id(id),+ _deviceUniqueId(uniqueId),+ _deviceType(type),+@@ -381,6 +387,7 @@ DesktopCaptureImpl::DesktopCaptureImpl(const int32_t id, const char* uniqueId,+ delta_ntp_internal_ms_(+ Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() -+ last_capture_time_),++ capture_cursor_(captureCursor),+ time_event_(EventWrapper::Create()),+ #if defined(_WIN32)+ capturer_thread_(+diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.h b/dom/media/systemservices/video_engine/desktop_capture_impl.h+index 4270926fbb83664427574d26982a8561cab8bec3..24859f58c3d4f018684106223eea32a28226302b 100644+--- a/dom/media/systemservices/video_engine/desktop_capture_impl.h++++ b/dom/media/systemservices/video_engine/desktop_capture_impl.h+@@ -159,7 +159,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,+ /* Create a screen capture modules object+ */+ static VideoCaptureModule* Create(const int32_t id, const char* uniqueId,+- const CaptureDeviceType type);++ const CaptureDeviceType type,++ bool captureCursor = true);+ static VideoCaptureModule::DeviceInfo* CreateDeviceInfo(+ const int32_t id, const CaptureDeviceType type);++@@ -191,7 +192,7 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,++ protected:+ DesktopCaptureImpl(const int32_t id, const char* uniqueId,+- const CaptureDeviceType type);++ const CaptureDeviceType type, bool captureCursor);+ virtual ~DesktopCaptureImpl();+ int32_t DeliverCapturedFrame(webrtc::VideoFrame& captureFrame,+ int64_t capture_time);+@@ -239,10 +240,11 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,+ void process();++ private:++ bool capture_cursor_ = true;+ // This is created on the main thread and accessed on both the main thread+ // and the capturer thread. It is created prior to the capturer thread+ // starting and is destroyed after it is stopped.+- std::unique_ptr<DesktopAndCursorComposer> desktop_capturer_cursor_composer_;++ std::unique_ptr<DesktopCapturer> desktop_capturer_cursor_composer_;++ std::unique_ptr<EventWrapper> time_event_;+ #if defined(_WIN32)diff --git a/dom/script/ScriptSettings.cpp b/dom/script/ScriptSettings.cppindex 3f69c0f398ab6d849fe011e836343c09110673ef..4c06a9100a1d41119cb2984ee3734a1043a9c50a 100644--- a/dom/script/ScriptSettings.cpp