File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -194,7 +194,11 @@ class SystemCapabilityManager extends _SubManagerBase {
194194 currentWindowId = PredefinedWindows . DEFAULT_WINDOW ;
195195 }
196196 if ( currentWindowId === windowId ) {
197- return windowCapability ;
197+ // Clone WindowCapability to prevent modification of stored WindowCapability in SystemCapabilityManager
198+ const windowCapabilityCopy = new WindowCapability ( JSON . parse ( JSON . stringify ( windowCapability . getParameters ( ) ) ) ) ;
199+ // A null windowID is assumed to be the DefaultWindow according to the spec, but that can be hard for developers to check, so set it explicitly.
200+ windowCapabilityCopy . setWindowID ( windowId ) ;
201+ return windowCapabilityCopy ;
198202 }
199203 }
200204 return null ;
@@ -749,6 +753,16 @@ class SystemCapabilityManager extends _SubManagerBase {
749753 && defaultMainWindow . getImageTypeSupported ( ) !== undefined
750754 && defaultMainWindow . getImageTypeSupported ( ) . length > 0 ) ;
751755
756+ const displayCapabilitiesOld = this . getDisplayCapabilities ( ) ;
757+
758+ if ( displayCapabilitiesOld !== null && displayCapabilitiesOld !== undefined ) { // The capability exists
759+ // Copied from the RAI response, since this parameter is not present in WindowCapability
760+ convertedCapabilities . setScreenParams ( displayCapabilitiesOld . getScreenParams ( ) ) ;
761+ if ( displayCapabilitiesOld . getMediaClockFormats ( ) !== null ) {
762+ convertedCapabilities . setMediaClockFormats ( displayCapabilitiesOld . getMediaClockFormats ( ) ) ;
763+ }
764+ }
765+
752766 return convertedCapabilities ;
753767 }
754768}
You can’t perform that action at this time.
0 commit comments