Commit Graph

66 Commits

Author SHA1 Message Date
alwu
fa7fe1ff9d Bug 1627999 - part6 : modify 'test_trigger_actionhanlder.html'. r=bryce
This patch will do :
- play media from different frame, rather than alway playing media from the main frame

The advantage of doing so :
- to make the media session in child frame become the active media session because that can only be the context with the audio focus

Differential Revision: https://phabricator.services.mozilla.com/D72500
2020-05-15 21:49:54 +00:00
alwu
b37d0955bb Bug 1627999 - part5 : remove out-of-date test. r=bryce
This patch will do :
- remove out-of-date test that uses the previous implementation of determining the active media session

The advantage of doing so :
- prevent the failure causing by out-of-date test

Differential Revision: https://phabricator.services.mozilla.com/D72499
2020-05-15 21:49:56 +00:00
Csoregi Natalia
b6df18cc7a Backed out 9 changesets (bug 1627999) for bustages on HTMLMediaElement.cpp. CLOSED TREE
Backed out changeset 05ba58699a1b (bug 1627999)
Backed out changeset b9025bab4036 (bug 1627999)
Backed out changeset 2e1c8f9e8f88 (bug 1627999)
Backed out changeset 55ac831f54f3 (bug 1627999)
Backed out changeset e0fa806a6942 (bug 1627999)
Backed out changeset f4d85f0b61d9 (bug 1627999)
Backed out changeset 84434656006c (bug 1627999)
Backed out changeset 021c014ba882 (bug 1627999)
Backed out changeset 76c6b64928e9 (bug 1627999)
2020-05-16 00:22:23 +03:00
alwu
973d534b7f Bug 1627999 - part6 : modify 'test_trigger_actionhanlder.html'. r=bryce
This patch will do :
- play media from different frame, rather than alway playing media from the main frame

The advantage of doing so :
- to make the media session in child frame become the active media session because that can only be the context with the audio focus

Differential Revision: https://phabricator.services.mozilla.com/D72500
2020-05-14 09:33:35 +00:00
alwu
129153228a Bug 1627999 - part5 : remove out-of-date test. r=bryce
This patch will do :
- remove out-of-date test that uses the previous implementation of determining the active media session

The advantage of doing so :
- prevent the failure causing by out-of-date test

Differential Revision: https://phabricator.services.mozilla.com/D72499
2020-05-14 09:33:37 +00:00
Cosmin Sabou
3ed8e5317b Backed out 8 changesets (bug 1627999) for wpt failures on MediaPlaybackStatus.h. CLOSED TREE
Backed out changeset 98e98e2ecb56 (bug 1627999)
Backed out changeset 5533b1c9e3ed (bug 1627999)
Backed out changeset c9c9f78e131d (bug 1627999)
Backed out changeset 37b8f7a47ede (bug 1627999)
Backed out changeset 433a0eb70fc6 (bug 1627999)
Backed out changeset 72a1340bc112 (bug 1627999)
Backed out changeset 10e3550226eb (bug 1627999)
Backed out changeset 039ecd63e3fb (bug 1627999)
2020-05-14 12:29:01 +03:00
alwu
9262f91450 Bug 1627999 - part6 : modify 'test_trigger_actionhanlder.html'. r=bryce
This patch will do :
- play media from different frame, rather than alway playing media from the main frame

The advantage of doing so :
- to make the media session in child frame become the active media session because that can only be the context with the audio focus

Differential Revision: https://phabricator.services.mozilla.com/D72500
2020-05-13 22:01:07 +00:00
alwu
8fe88f56fa Bug 1627999 - part5 : remove out-of-date test. r=bryce
This patch will do :
- remove out-of-date test that uses the previous implementation of determining the active media session

The advantage of doing so :
- prevent the failure causing by out-of-date test

Differential Revision: https://phabricator.services.mozilla.com/D72499
2020-05-12 18:23:44 +00:00
alwu
ef4977969c Bug 1633010 - part8 : rename MediaSessionController to MediaStatusManager r=chunmin
This patch will do :
- rename `MediaSessionController` to `MediaStatusManager`
- move `MediaStatusManager.*` to the folder under `mediacontrol`
- update the comment for `MediaStatusManager`

The advantage of doing so :
- increase the readability

More details :
We've extended the responsibility of `MediaSessionController` and it now handle a broader concept of media related status, not just media session related. Therefore, renaming it to precisely represent o its responsibility.

Differential Revision: https://phabricator.services.mozilla.com/D73493
2020-05-13 22:09:23 +00:00
alwu
97b23b9267 Bug 1633010 - part7 : rename variables and remove unnecessary spaces r=chunmin
This patch will do :
- rename variables and remove unnecessary spaces

The advantage of doing so :
- increase the readability

Differential Revision: https://phabricator.services.mozilla.com/D73491
2020-05-13 22:08:40 +00:00
alwu
2ae724e750 Bug 1633010 - part6 : use IMediaController if we only want to access control related methods r=chunmin
This patch will do :
- create an interface `IMediaController` including only control related methods

The advantage of doing so :
- It's clear to use `IMediaController` as the only surface to control media
- explictly restrict which functions are available which can avoid using control related functions on those situations

Differential Revision: https://phabricator.services.mozilla.com/D73490
2020-05-13 22:08:01 +00:00
alwu
af00afa1f0 Bug 1633010 - part5 : extend IMediaInfoUpdater. r=chunmin
This patch will do :
- make all functions which are used to update information from the content process become a part of `IMediaInfoUpdater`

The advantage of doing so :
- It's clear to use `IMediaInfoUpdater` as the only surface to update the media related status
- explictly restrict which functions are available which can avoid using control related functions on those situations

Differential Revision: https://phabricator.services.mozilla.com/D73489
2020-05-13 22:07:44 +00:00
alwu
12e184256b Bug 1633010 - part4 : move declared and guessed playback state into MediaSessionController. r=chunmin
This patch will do :
- move the logic of determining `actual playback state` to `MediaSessionController`

The advantage of doing so :
- increate the cohesion of `MediaSessionController` because it should be the class to determine the final playback status, not `MediaController`

Differential Revision: https://phabricator.services.mozilla.com/D73488
2020-05-13 21:18:06 +00:00
alwu
329f82761a Bug 1633010 - part3 : move MediaPlaybackStatus to MediaSessionController. r=chunmin
This patch will do :
- move the instance of `MediaPlaybackStatus` to the `MediaSessionController` to allow `MediaSessionController` handle all media related status

The advantage of doing so :
- encapsulate all media related status details to `MediaSessionController` and simplify the code in `MediaController`

Differential Revision: https://phabricator.services.mozilla.com/D73487
2020-05-13 20:58:02 +00:00
Neil Deakin
c0e5a6c003 Bug 1594752, expose WindowGlobalParent's document title attribute to script, and fire a pagetitlechanged event on the frame/browser when it changes, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D72561
2020-05-13 19:25:45 +00:00
Mihai Alexandru Michis
7686b00958 Backed out 2 changesets (bug 1594752) for causing failures in browser_e10s_switchbrowser.js
CLOSED TREE

Backed out changeset b54107a687e4 (bug 1594752)
Backed out changeset 801d1e226947 (bug 1594752)
2020-05-11 18:11:24 +03:00
Neil Deakin
effc8401b2 Bug 1594752, expose WindowGlobalParent's document title attribute to script, and fire a pagetitlechanged event on the frame/browser when it changes, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D72561
2020-05-11 11:24:16 +00:00
alwu
7edac7d87c Bug 1633904 - add tag 'mediacontrol' for related test configs. r=bryce
This patch will do :
- add tag `mediacontrol` in media control related `ini` files.

The advantage of doing so :
- to run all tests in one simple command, `$./mach mochitest --tag mediacontrol`

Differential Revision: https://phabricator.services.mozilla.com/D72959
2020-05-06 21:16:38 +00:00
Simon Giesecke
f7f5462a4b Bug 1626570 - Improve handling of copying arrays in dom/media/. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D73627
2020-05-05 11:38:10 +00:00
alwu
73f487dece Bug 1631770 - check if info exists before update the declared playback state. r=bryce
One possible place where `SetDeclaredPlaybackState()` would be called without having a info is that, media session changes its declared playback state after CC unlink process that would result in removing correspond `MediaSessionInfo` from the `mMediaSessionInfoMap`.

Therefore, replace the assertion with an early return check.

Differential Revision: https://phabricator.services.mozilla.com/D71854
2020-04-23 02:30:22 +00:00
alwu
5a70c0ed78 Bug 1631075 - Clear the event source's metadata when we clear the main controller. r=bryce
When we clear the main controller, which means there is no any media we need to control at that time, we would reset its playback state, but we should clear its metadata as well.

Differential Revision: https://phabricator.services.mozilla.com/D71428
2020-04-20 15:59:06 +00:00
Nika Layzell
f5ff895032 Bug 1624711 - Traverse and Unlink MediaSession::mActionHandlers r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D68091

--HG--
extra : moz-landing-system : lando
2020-03-24 21:20:26 +00:00
alwu
8fe54c2cae Bug 1623950 - remove destroyed browsing context Id from the 'mMediaSessionInfoMap'. r=chunmin
If the browsing context which media session belongs to has been detroyed and it wasn't be removed correctly via the IPC message (that could happen if the browsing context was destroyed before ContentPatent receives the remove message [1]), then we should remove it and continue to iterate other elements.

[1] https://searchfox.org/mozilla-central/rev/202a285024f174c2d2bf2152d9cba90a03723eab/dom/ipc/ContentParent.cpp#5854-5856

Differential Revision: https://phabricator.services.mozilla.com/D67910

--HG--
extra : moz-landing-system : lando
2020-03-23 22:07:08 +00:00
alwu
371b11291d Bug 1582509 - part1 : implement 'MediaPositionState' and 'setPositionState()'. r=emilio
According to the spec [1], implement the dictionary `MediaPositionState` and `setPositionState()`.

[1] https://w3c.github.io/mediasession/#dom-mediasession-setpositionstate

Differential Revision: https://phabricator.services.mozilla.com/D66500

--HG--
extra : moz-landing-system : lando
2020-03-19 19:29:40 +00:00
Chun-Min Chang
ce0d9c74e7 Bug 1621779 - Make sure BrowsingContext exists before using it. r=alwu
A declare of a pointer in the init-statement within if need to be
checked if it's a NULL before it's being used, to avoid a potential
crash.

To prevent any goes wrong in mMediaSessionInfoMap and lead to create a
null BrowsingContext pointer from it, using an assertion is more
straightforward.

Differential Revision: https://phabricator.services.mozilla.com/D66491

--HG--
extra : moz-landing-system : lando
2020-03-19 17:53:42 +00:00
Chun-Min Chang
acef9be28a Bug 1580623 - P2: Fire seek{for,back}ward action handler if it's set r=alwu
Depends on D45459

Differential Revision: https://phabricator.services.mozilla.com/D66619

--HG--
extra : moz-landing-system : lando
2020-03-17 23:39:10 +00:00
Chun-Min Chang
ce354ff512 Bug 1580623 - P1: Add seek{back,for}ward to MediaSessionAction and implement seekOffset r=webidl,alwu,baku
Differential Revision: https://phabricator.services.mozilla.com/D45459

--HG--
extra : moz-landing-system : lando
2020-03-17 23:39:10 +00:00
Ciure Andrei
35bf0da2a1 Backed out 3 changesets (bug 1620077, bug 1580623) for causing mochitest failures CLOSED TREE
Backed out changeset 981e37f4d18d (bug 1620077)
Backed out changeset 0333485a02ed (bug 1580623)
Backed out changeset d729f6a0050b (bug 1580623)
2020-03-18 01:24:26 +02:00
Chun-Min Chang
8874ca494f Bug 1580623 - P2: Fire seek{for,back}ward action handler if it's set r=alwu
Depends on D45459

Differential Revision: https://phabricator.services.mozilla.com/D66619

--HG--
extra : moz-landing-system : lando
2020-03-17 22:05:02 +00:00
Chun-Min Chang
c0d25f3402 Bug 1580623 - P1: Add seek{back,for}ward to MediaSessionAction and implement seekOffset r=webidl,alwu,baku
Differential Revision: https://phabricator.services.mozilla.com/D45459

--HG--
extra : moz-landing-system : lando
2020-03-17 22:04:34 +00:00
alwu
c369eaed94 Bug 1582508 - part4 : propagate declared playback state to media session controller. r=chunmin
This patch includes the implementation of propagating declared playback state from the media session in the content process to the media session controller in the chrome process.

Differential Revision: https://phabricator.services.mozilla.com/D66341

--HG--
extra : moz-landing-system : lando
2020-03-17 00:17:36 +00:00
alwu
030d275312 Bug 1582508 - part3 : create new structure 'MediaSessionInfo' to store the declared playback state for media session. r=chunmin
As we would need to preserve media session's playback state as well, we create a new struture to store each media session's propagated properties.

Differential Revision: https://phabricator.services.mozilla.com/D66340

--HG--
extra : moz-landing-system : lando
2020-03-17 00:03:44 +00:00
alwu
9bf5424e0e Bug 1582508 - part1 : implement 'MediaSessionPlaybackState'. r=webidl,chunmin,Ehsan
Implement `playbackstate`[1] attribute for media session interface.

[1] https://w3c.github.io/mediasession/#dom-mediasession-playbackstate

Differential Revision: https://phabricator.services.mozilla.com/D66338

--HG--
extra : moz-landing-system : lando
2020-03-13 23:31:16 +00:00
alwu
14e789d818 Bug 1620470 - part1 : always use default metadata if we're in private browsing. r=MeFisto94
From [1], it shows why private browsing mode is something we should be aware of when we display metadata on the virtual control interface. But not just the default metadata we generate has this concern, we should also prevent to show the media session's metadata in private browsing in order not to expose website's information.

[1] https://searchfox.org/mozilla-central/rev/e7fc3314b0dfcc61fb7dc7a09f9555660a2eafc5/dom/media/mediasession/MediaSessionController.cpp#140-144

Differential Revision: https://phabricator.services.mozilla.com/D65664

--HG--
extra : moz-landing-system : lando
2020-03-09 17:02:08 +00:00
alwu
daa1390c63 Bug 1615112 - part2 : use default title and favicon to fill missing properties if needed. r=MeFisto94
We don't want to show empty information on the virtual control interface when media session's title and artwork are empty or doesn't be set properly. Therefore, in this situation, we should use default title and favicon icon instead.

Differential Revision: https://phabricator.services.mozilla.com/D65656

--HG--
extra : moz-landing-system : lando
2020-03-07 12:58:30 +00:00
alwu
9faa8f0aa9 Bug 1615112 - part1 : create 'GetDefaultTitle()'. r=MeFisto94
We would use the default title in other places in the future, so make it as a separate function to re-use those code.

Differential Revision: https://phabricator.services.mozilla.com/D65655

--HG--
extra : moz-landing-system : lando
2020-03-09 16:50:28 +00:00
Mark Banner
15cfe23b88 Bug 1620542 - Automatically fix ESLint errors in .eslintrc.js files. r=mossop
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D65703

--HG--
extra : moz-landing-system : lando
2020-03-07 10:09:44 +00:00
Boris Zbarsky
00cd5d4380 Bug 1619112 part 5. Stop accepting nsAString in ErrorResult error-throwing. r=smaug
Callers should pass in UTF-8, since that's what the JS engine ends up with in the end anyway.

The various URL changes are because NS_NewURI converts incoming nsAString to
UTF-8 anyway.  So we might as well do that up-front and then use the UTF-8
string for both the NS_NewURI call and the error-reporting if it fails.

Differential Revision: https://phabricator.services.mozilla.com/D65543

--HG--
extra : moz-landing-system : lando
2020-03-06 21:08:02 +00:00
alwu
7eec59aab2 Bug 1617033 - part7 : modify tests to allow simulating media keys would always happen after controller's playback changes. r=chunmin
Whenever pressing the media control keys, it would not only change the media playback state, but also change the playback state of the media controller. Therefore, we want to ensure simulating events always happen after media controller changes its playback state.

In addition, for `play/pause` key, it would check controller's playback state to decide if we should file `play` event or `pause` event, so we definitely have to do that only after the controller changes its playback state.

Changing a file to non-autoplay to prevent missing the `main-media-controller-playback-changed` notification, because we can control when to start media and ensure we have already create a listener for that event.

For non-browser test, we have no way to listen to that notification, which could only be observed in the chrome process, so we do a hack to listen `timeupdate` several times to wait and hope the controller has been created and changed its state in the chrome process.

Differential Revision: https://phabricator.services.mozilla.com/D63926

--HG--
extra : moz-landing-system : lando
2020-03-06 17:51:48 +00:00
alwu
5d71e398e6 Bug 1592037 - part7 : add metadata test. r=MeFisto94
Differential Revision: https://phabricator.services.mozilla.com/D64850

--HG--
extra : moz-landing-system : lando
2020-03-04 16:53:11 +00:00
alwu
e0bf4b873c Bug 1592037 - part4 : update metadata to the event source. r=MeFisto94
Whenever the main controller updates its metadata, we should also notify the event source to update the metadata, because we don't want to show the wrong metadata on the virtual control interface.

In this patch, we add a new media event to notify this situation and create a new method `SetMediaMetadata()` on the `MediaControlKeysEventSource`. But we leave that function empty for now, and will have follow-up bugs to handle setting metadata on each different platforms.

Differential Revision: https://phabricator.services.mozilla.com/D64847

--HG--
extra : moz-landing-system : lando
2020-03-04 21:34:45 +00:00
alwu
1d40019c19 Bug 1592037 - part3 : notifty updating media session's metadata. r=MeFisto94
Whenever media session's metadata changes in the content process, we would like to propogate the updated metadata to the media controller in the parent process in order to show that in the virtual media control interface, which would only be set in the chrome process.

Differential Revision: https://phabricator.services.mozilla.com/D64846

--HG--
extra : moz-landing-system : lando
2020-03-05 20:58:54 +00:00
alwu
4b1adaf259 Bug 1592037 - part2 : use Put() to replace emplace() r=MeFisto94
`emplace` can only be used on an empty `Maybe`, but in our case, we can update the metadata anytime even if we have set the metadata before, so using `Put()` to directly update  `Maybe`'s value.

Differential Revision: https://phabricator.services.mozilla.com/D64845

--HG--
extra : moz-landing-system : lando
2020-03-05 00:20:49 +00:00
alwu
568289aac7 Bug 1592037 - part1 : do not update empty metadata to media session controller. r=MeFisto94
If new coming metadata is `null` (when setting `MediaSession.metadata=null`) or an empty metadata [1], then we would like to reset the `Maybe` in `MediaSessionController` in order to use the default metadata when someone asks for the current metadata.

[1] https://w3c.github.io/mediasession/#empty-metadata

Differential Revision: https://phabricator.services.mozilla.com/D64844

--HG--
extra : moz-landing-system : lando
2020-03-04 18:38:43 +00:00
Nika Layzell
476ad24af9 Bug 1615403 - Part 2: Use MaybeDiscarded for direct IPC arguments, r=farre
Differential Revision: https://phabricator.services.mozilla.com/D62833

--HG--
extra : moz-landing-system : lando
2020-02-20 23:30:35 +00:00
alwu
a985a8926b Bug 1611328 - part3 : generate a default metadata. r=bzbarsky
Metadata is used to be showed on the virtual controller interface during media is playing, which website can set from MediaSession API.

However, if website doesn't use media session, or the media session website uses doesn't have metadata, then we would like to generate a default one to tell user what website is playing media. If we're in private browsing mode, then we should not expose any website information in the default metadata.

Differential Revision: https://phabricator.services.mozilla.com/D62536

--HG--
extra : moz-landing-system : lando
2020-02-20 19:41:51 +00:00
alwu
1a104771e5 Bug 1611328 - part2 : let media session controller store top level session Id r=chunmin
As we would like to use `mTopLevelBCId` in `MediaSessionController` as well in order to get the corresponding browsing context, so move `mTopLevelBCId` to the `MediaSessionController`.

Differential Revision: https://phabricator.services.mozilla.com/D62535

--HG--
extra : moz-landing-system : lando
2020-02-20 19:04:36 +00:00
alwu
b8bfeff446 Bug 1611332 - part7 : add test for checking active session among tabs. r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D61372

--HG--
extra : moz-landing-system : lando
2020-02-11 18:46:05 +00:00
alwu
310a6313be Bug 1611332 - part6 : add test for active media session. r=chunmin
This test is for checking if we can select correct media session as an active media session within a tab.

Differential Revision: https://phabricator.services.mozilla.com/D61045

--HG--
extra : moz-landing-system : lando
2020-01-31 14:01:48 +00:00
alwu
9dd96c6545 Bug 1611332 - part5 : add test for triggering media session's action handlers. r=chunmin
This test is for checking if we can trigger media session's action handler via media control keys.

Differential Revision: https://phabricator.services.mozilla.com/D60938

--HG--
extra : moz-landing-system : lando
2020-01-30 10:42:31 +00:00