Open Bug 1544257 Opened 5 years ago Updated 2 years ago

Find out why attaching UAWidget binding causes pref-controlled WebIDL methods to not work in automation without SpecialPowers.wrap

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: mconley, Unassigned)

References

Details

In bug 1543128, I'm changing HTMLMediaElement::BindToTree so that we call NotifyUAWidgetSetupOrChange() every time we bind a media element to the DOM tree, rather than only when we've got a video or audio with controls. I need that in order to show the Picture-in-Picture toggle in the no controls state with a mostly empty video controls UA Widget.

Doing so causes failures in the following tests:

dom/media/tests/mochitest/test_setSinkId.html:

[task 2019-04-13T03:09:55.427Z] 03:09:55 INFO - TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_setSinkId.html | Initial value is empty string - got undefined, expected ""
[task 2019-04-13T03:09:55.428Z] 03:09:55 INFO - SimpleTest.is@SimpleTest/SimpleTest.js:320:16
[task 2019-04-13T03:09:55.429Z] 03:09:55 INFO - @dom/media/tests/mochitest/test_setSinkId.html:33:5
[task 2019-04-13T03:09:55.429Z] 03:09:55 INFO - asyncrunTestWhenReady/<@dom/media/tests/mochitest/head.js:473:41
[task 2019-04-13T03:09:55.430Z] 03:09:55 INFO - promise callback
runTestWhenReady@dom/media/tests/mochitest/head.js:473:25
[task 2019-04-13T03:09:55.431Z] 03:09:55 INFO - runTest/<@dom/media/tests/mochitest/mediaStreamPlayback.js:176:15
[task 2019-04-13T03:09:55.431Z] 03:09:55 INFO - promise callbackrunTest@dom/media/tests/mochitest/mediaStreamPlayback.js:176:4
[task 2019-04-13T03:09:55.432Z] 03:09:55 INFO - @dom/media/tests/mochitest/test_setSinkId.html:20:3
[task 2019-04-13T03:09:55.433Z] 03:09:55 INFO - Not taking screenshot here: see the one that was previously logged
[task 2019-04-13T03:09:55.436Z] 03:09:55 INFO - TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_setSinkId.html | Error executing test: TypeError: audio.setSinkId is not a function @http://mochi.test:8888/tests/dom/media/tests/mochitest/test_setSinkId.html:35:21 ... async
runTestWhenReady/<@http://mochi.test:8888/tests/dom/media/tests/mochitest/head.js:473:41 ... promise callbackrunTestWhenReady@http://mochi.test:8888/tests/dom/media/tests/mochitest/head.js:473:25 ... runTest/<@http://mochi.test:8888/tests/dom/media/tests/mochitest/mediaStreamPlayback.js:176:15 ... promise callbackrunTest@http://mochi.test:8888/tests/dom/media/tests/mochitest/mediaStreamPlayback.js:176:4 ... @http://mochi.test:8888/tests/dom/media/tests/mochitest/test_setSinkId.html:20:3 ...
[task 2019-04-13T03:09:55.437Z] 03:09:55 INFO - SimpleTest.ok@SimpleTest/SimpleTest.js:275:18
[task 2019-04-13T03:09:55.437Z] 03:09:55 INFO - runTestWhenReady/<@dom/media/tests/mochitest/head.js:475:7
[task 2019-04-13T03:09:55.438Z] 03:09:55 INFO - promise callbackrunTestWhenReady@dom/media/tests/mochitest/head.js:474:6
[task 2019-04-13T03:09:55.439Z] 03:09:55 INFO - runTest/<@dom/media/tests/mochitest/mediaStreamPlayback.js:176:15
[task 2019-04-13T03:09:55.439Z] 03:09:55 INFO - promise callback
runTest@dom/media/tests/mochitest/mediaStreamPlayback.js:176:4
[task 2019-04-13T03:09:55.440Z] 03:09:55 INFO - @dom/media/tests/mochitest/test_setSinkId.html:20:3
[task 2019-04-13T03:09:55.440Z] 03:09:55 INFO - GECKO(1081) | MEMORY STAT | vsize 542MB | residentFast 187MB | heapAllocated 18MB
[task 2019-04-13T03:09:55.441Z] 03:09:55 INFO - TEST-OK | dom/media/tests/mochitest/test_setSinkId.html | took 914ms
[task 2019-04-13T03:09:55.442Z] 03:09:55 INFO - GECKO(1081) | ++DOMWINDOW == 5 (0xdf546400) [pid = 1155] [serial = 149] [outer = 0xf7068450]
[task 2019-04-13T03:09:55.443Z] 03:09:55 INFO - GECKO(1081) | Assertion failure: rv, at /builds/worker/workspace/build/src/dom/media/MediaManager.cpp:3245
[task 2019-04-13T03:10:41.833Z] 03:10:41 INFO - GECKO(1081) | #01: mozilla::MediaManager::EnumerateDevices(nsPIDOMWindowInner*, mozilla::dom::CallerType)::$_44::operator()(bool) const [dom/media/MediaManager.cpp:3245]
[task 2019-04-13T03:10:41.833Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.835Z] 03:10:41 INFO - GECKO(1081) | #02: mozilla::MozPromise<bool, RefPtr<mozilla::MediaMgrError>, true>::ThenValue<mozilla::MediaManager::EnumerateDevices(nsPIDOMWindowInner*, mozilla::dom::CallerType)::$_44, mozilla::MediaManager::EnumerateDevices(nsPIDOMWindowInner*, mozilla::dom::CallerType)::$_45>::DoResolveOrRejectInternal(mozilla::MozPromise<bool, RefPtr<mozilla::MediaMgrError>, true>::ResolveOrRejectValue&) [xpcom/threads/MozPromise.h:717]
[task 2019-04-13T03:10:41.835Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.836Z] 03:10:41 INFO - GECKO(1081) | #03: mozilla::MozPromise<bool, RefPtr<mozilla::MediaMgrError>, true>::ThenValueBase::DoResolveOrReject(mozilla::MozPromise<bool, RefPtr<mozilla::MediaMgrError>, true>::ResolveOrRejectValue&) [xpcom/threads/MozPromise.h:481]
[task 2019-04-13T03:10:41.837Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.838Z] 03:10:41 INFO - GECKO(1081) | #04: mozilla::MozPromise<bool, RefPtr<mozilla::MediaMgrError>, true>::ThenValueBase::ResolveOrRejectRunnable::Run() [xpcom/threads/MozPromise.h:393]
[task 2019-04-13T03:10:41.838Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.839Z] 03:10:41 INFO - GECKO(1081) | #05: nsThread::ProcessNextEvent(bool, bool*) [xpcom/threads/nsThread.cpp:0]
[task 2019-04-13T03:10:41.840Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.841Z] 03:10:41 INFO - GECKO(1081) | #06: NS_ProcessNextEvent(nsIThread*, bool) [xpcom/threads/nsThreadUtils.cpp:486]
[task 2019-04-13T03:10:41.841Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.842Z] 03:10:41 INFO - GECKO(1081) | #07: mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) [ipc/glue/MessagePump.cpp:89]
[task 2019-04-13T03:10:41.843Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.844Z] 03:10:41 INFO - GECKO(1081) | #08: MessageLoop::RunInternal() [ipc/chromium/src/base/message_loop.cc:315]
[task 2019-04-13T03:10:41.845Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.846Z] 03:10:41 INFO - GECKO(1081) | #09: MessageLoop::Run() [ipc/chromium/src/base/message_loop.cc:291]
[task 2019-04-13T03:10:41.846Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.847Z] 03:10:41 INFO - GECKO(1081) | #10: nsBaseAppShell::Run() [widget/nsBaseAppShell.cpp:139]
[task 2019-04-13T03:10:41.848Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.849Z] 03:10:41 INFO - GECKO(1081) | #11: XRE_RunAppShell() [toolkit/xre/nsEmbedFunctions.cpp:919]
[task 2019-04-13T03:10:41.850Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.851Z] 03:10:41 INFO - GECKO(1081) | #12: mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) [ipc/glue/MessagePump.cpp:238]
[task 2019-04-13T03:10:41.852Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.853Z] 03:10:41 INFO - GECKO(1081) | #13: MessageLoop::RunInternal() [ipc/chromium/src/base/message_loop.cc:315]
[task 2019-04-13T03:10:41.854Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.855Z] 03:10:41 INFO - GECKO(1081) | #14: MessageLoop::Run() [ipc/chromium/src/base/message_loop.cc:291]
[task 2019-04-13T03:10:41.856Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.857Z] 03:10:41 INFO - GECKO(1081) | #15: XRE_InitChildProcess(int, char**, XREChildData const*) [toolkit/xre/nsEmbedFunctions.cpp:761]
[task 2019-04-13T03:10:41.859Z] 03:10:41 INFO -
[task 2019-04-13T03:10:41.860Z] 03:10:41 INFO - GECKO(1081) | #16: mozilla::BootstrapImpl::XRE_InitChildProcess(int, char**, XREChildData const*) [toolkit/xre/Bootstrap.cpp:67]
[task 2019-04-13T03:10:41.861Z] 03:10:41 INFO -
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO - GECKO(1081) | #17: main [browser/app/nsBrowserApp.cpp:263]
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO -
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO - GECKO(1081) | [Parent 1081, Gecko_IOThread] WARNING: pipe error (80): Connection reset by peer: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 358
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO - GECKO(1081) | ###!!! [Parent][MessageChannel] Error: (msgtype=0x1E0070,name=PBrowser::Msg_StopIMEStateManagement) Channel error: cannot send/recv
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO - GECKO(1081) | ###!!! [Parent][MessageChannel] Error: (msgtype=0x1E008B,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO - GECKO(1081) | ++DOCSHELL 0xdb75c800 == 5 [pid = 1081] [id = {1c1a8ef1-d4ad-4c91-8c31-3ea9dcaa8ece}]
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO - GECKO(1081) | ++DOMWINDOW == 9 (0xe0df8bc0) [pid = 1081] [serial = 65] [outer = (nil)]
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO - GECKO(1081) | ++DOMWINDOW == 10 (0xdb75f800) [pid = 1081] [serial = 66] [outer = 0xe0df8bc0]
[task 2019-04-13T03:10:42.082Z] 03:10:42 INFO - GECKO(1081) | A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down

dom/media/test/test_cloneElementVisually_no_suspend.html:
[task 2019-04-13T03:09:54.037Z] 03:09:54 INFO - TEST-UNEXPECTED-FAIL | dom/media/test/test_cloneElementVisually_no_suspend.html | TypeError: originalVideo.setVisible is not a function - Should not throw any errors
[task 2019-04-13T03:09:54.037Z] 03:09:54 INFO - @http://mochi.test:8888/tests/dom/media/test/test_cloneElementVisually_no_suspend.html:59:19
[task 2019-04-13T03:09:54.037Z] 03:09:54 INFO - asyncwithNewClone@https://example.com/tests/dom/media/test/cloneElementVisually_helpers.js:139:11
[task 2019-04-13T03:09:54.037Z] 03:09:54 INFO - @http://mochi.test:8888/tests/dom/media/test/test_cloneElementVisually_no_suspend.html:43:9
[task 2019-04-13T03:09:54.038Z] 03:09:54 INFO - async
nextTick/<@http://mochi.test:8888/tests/SimpleTest/AddTask.js:70:34
[task 2019-04-13T03:09:54.038Z] 03:09:54 INFO - nextTick@http://mochi.test:8888/tests/SimpleTest/AddTask.js:86:11
[task 2019-04-13T03:09:54.038Z] 03:09:54 INFO - setTimeout handler*SimpleTest_setTimeoutShim@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:684:43
[task 2019-04-13T03:09:54.039Z] 03:09:54 INFO - add_task@http://mochi.test:8888/tests/SimpleTest/AddTask.js:30:7
[task 2019-04-13T03:09:54.039Z] 03:09:54 INFO - @http://mochi.test:8888/tests/dom/media/test/test_cloneElementVisually_no_suspend.html:31:1

These two failures seem to be related - both tests are calling into HTMLMediaElement.webidl methods that are preffed off by default, but are being preffed on for the tests. It seems that in order to actually access these methods, we need to use SpecialPowers.wrap, although I'm not sure why.

At runtime, I've noticed that if I manually set these preferences, I can still access these media element methods in the DevTools console, so I'm a bit mystified as to why this is only failing in automation.

See Also: → 1544345
Component: DOM: Device Interfaces → DOM: Core & HTML
Type: defect → enhancement
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.