Commit Graph

3675 Commits

Author SHA1 Message Date
Chris Pearce
7fb3548c85 Bug 1471485 - Ensure autoplay permission promises disconnected if media starts playing. r=jya
We can start playing while we're awaiting a response to an autoplay-media
permission prompt, for example if the user clicks on a play button. In such
cases, it doesn't make sense to keep the autoplay permission request promise
connected in HTMLMediaElement, as since we're playing we'll be resolving the
play() promises and thus we won't be taking action on the autoplay request
promise's result. So we should just disconnect the autoplay permission request
promise if it's connected when we start playing.

MozReview-Commit-ID: 1aiCLXV7Ja9

--HG--
extra : rebase_source : c439e8f084ac8cc01db578d712e15d3174a08e71
2018-07-12 16:19:25 +12:00
Chris Pearce
848dee9a6f Bug 1472580 - Ensure we always get a allow/cancel response to an autoplay media permission request. r=smaug
The front end code can't always guarantee to give us an allow/cancel response
to a permission request. In particular in these cases:
* if we close a tab while showing a doorhanger, or
* if we navigate a tab while showing a doorhanger, or
* if the permission prompt requested in a background tab and never shown.

Handling all of these cases is problematic; we don't get events for all of
these where it's easy and cheap to determine that we should cancel the
permission request.

Canceling the permission request is important in the autoplay-media permission
request case as there's objects waiting on the resolution of the permission
request, and they leak in ASan builds while running chrome tests if the Gecko
size of the permission request doesn't get a notification telling it to stop
waiting.

But we can however rely on the doorhanger code to drop its reference to the
nsIContentPermissionRequest object that we pass to it when the doorhanger goes
away. So we can cancel the permission request in our
nsIContentPermissionRequest's implementation's destructor in order to easily
catch all the above cases.

In order to do that, we need to split AutoplayRequest into two; one part being
the implementation of nsIContentPermissionRequest (AutoplayPermissionRequest),
and the other part being the code to own the PromiseHolder and manage the
permission request (AutoplayPermissionManager).

AutoplayPermissionRequest keeps a weak reference to AutoplayPermissionManager,
so that it can tell the AutoplayPermissionManager to reject the request promise
when it's destroyed.

This fixes the ASan leak for which I got backed out from earlier in this bug,
and also fixes the cases above.

MozReview-Commit-ID: KoVkgIqDleW

--HG--
rename : dom/html/AutoplayRequest.cpp => dom/html/AutoplayPermissionManager.cpp
rename : dom/html/AutoplayRequest.h => dom/html/AutoplayPermissionManager.h
extra : rebase_source : dbca520a93d8c416f6d64c2da027630181bb5910
2018-07-06 21:15:20 +12:00
Masayuki Nakano
7581aff013 Bug 1450882 - part 4: Make C++ users of nsICommandParams use nsCommandParams directly r=Ehsan
nsICommandParams is implemented only by nsCommandParams.  So, all C++ users
can treat all instances of nsICommandParams as nsCommandParams.  Therefore,
this patch makes all set/get value calls use non-virtual methods and all
constructors directly create nsCommandParams instance.

MozReview-Commit-ID: CscgK0gKp5g

--HG--
extra : rebase_source : 62eb0f60aada795a44cf5496cdafbff6cba80013
2018-07-10 20:04:21 +09:00
Masayuki Nakano
5a2332692a Bug 1450882 - part 2: Make nsICommandParams::GetCStringValue() and nsICommandParams::SetCStringValue() treat nsACString instead of char r=Ehsan
nsICommandParams::GetCStringValue() and nsICommandParams::SetCStringValue()
treat char.  However, this makes their callers complicated.  So, they should
be rewritten as treating nsACString.

MozReview-Commit-ID: DWO9veSyzyG

--HG--
extra : rebase_source : fbea13f6d7116ea1887434c0842b7768a7dc59ec
2018-07-10 18:04:46 +09:00
Makoto Kato
16910a6e95 Bug 1443902 - Reinitilize selection after destroying nsIEditingSession. r=masayuki
When setting contenteditable to false, editing session destroys HTMLEditor.
Destroying HTMLEditor means that selection visibility is reset by
FinalizeSelection.

So after calling TearDownEditorOnWindow on nsHTMLDocument, we should initialize
selection visibility if current focus is text control that has editor.

MozReview-Commit-ID: 4V8kZtOtKO3

--HG--
extra : rebase_source : 9d90c12b3c93e4dfd95095ce29a26e5fdd83f952
2018-07-09 16:53:47 +09:00
Boris Zbarsky
e2156c39cb Bug 820891 part 3. Make scroll* properties for tables work with the table wrapper box, not the table box. r=dholbert
--HG--
rename : testing/web-platform/tests/css/cssom-view/table-client-props.html => testing/web-platform/tests/css/cssom-view/table-scroll-props.html
2018-07-10 09:28:11 -07:00
Boris Zbarsky
ebe5685319 Bug 820891 part 2. Make client* properties for tables work with the table wrapper box, not the table box. r=dholbert
--HG--
rename : testing/web-platform/tests/css/cssom-view/table-offset-props.html => testing/web-platform/tests/css/cssom-view/table-client-props.html
2018-07-10 09:28:09 -07:00
Boris Zbarsky
60de511092 Bug 820891 part 1. Make offset* properties for tables work with the table wrapper box, not the table box. r=dholbert 2018-07-10 09:28:07 -07:00
Andrea Marchesini
5fff1762ad Bug 1418236 - Correct EventTarget for CSP violation events, r=ckerschb 2018-07-10 17:40:21 +02:00
Andrea Marchesini
b57c0f116e Bug 1469993 - Grant storage access to a 3rd party, tracking resource if a opened document has user-interaction - part 8 - tests, r=ehsan 2018-07-10 10:09:59 +02:00
Margareta Eliza Balazs
c37b51f523 Backed out 9 changesets (bug 1469993) for causing bustage in build/srcdom/base/nsGlobalWindowInner.cpp on a CLOSED TREE
Backed out changeset e89192032fe2 (bug 1469993)
Backed out changeset 4b261595099d (bug 1469993)
Backed out changeset 37182cfe869c (bug 1469993)
Backed out changeset 5b9870995c73 (bug 1469993)
Backed out changeset 55499fcd9738 (bug 1469993)
Backed out changeset 8c1c838d54ba (bug 1469993)
Backed out changeset 12b9c8bfa41f (bug 1469993)
Backed out changeset 04ab7d6c169a (bug 1469993)
Backed out changeset 53885d61244e (bug 1469993)
2018-07-10 11:32:34 +03:00
Andrea Marchesini
47ab3f6055 Bug 1469993 - Grant storage access to a 3rd party, tracking resource if a opened document has user-interaction - part 8 - tests, r=ehsan 2018-07-10 10:09:59 +02:00
Boris Zbarsky
ce664a172d Bug 606528. Don't map the type attribute for inputs. r=emilio
The change to test_bug558726.html is because we always serialize mapped
attributes after non-mapped ones.  So this change is actually improving our
serialization in that test.
2018-07-06 11:43:14 -07:00
Margareta Eliza Balazs
fd5c37f1dd Merge inbound to mozila-central. a=merge 2018-07-06 12:47:20 +03:00
Masayuki Nakano
2b43129579 Bug 1473515 - Make AutoDisableUndo restores enabled state of undo/redo with previous number of maximum transactions r=m_kato
Calling EditorBase::EnableUndoRedo() without argument means that editor supports
unlimited undo/redo stack.  AutoDisableUndo class calls it without argument
when it needs to restore undo/redo feature.

However, <input type="text"> and <textarea> limits number of maximum
transactions up to 1,000, perhaps for footprint.  So, AutoDisableUndo should
store the last number of maximum transactions before disabling undo/redo from
the constructor.

MozReview-Commit-ID: CoI6ZXyTd3X

--HG--
extra : rebase_source : e2b9af17e5857dcc0a6781e254e45fdb790c9a9e
2018-07-05 19:44:23 +09:00
Neil Deakin
0d504e92c3 Bug 1437638, move frame loader property from XULElement to XULFrameElement, removing many checks that only apply to child frames instead of every XUL element. Since it is assumed that most frames/browsers will have frame loaders created for them, and that there aren't many of them, we can use a member field instead of slots, so remove the slot property, r=bz 2018-07-05 20:14:29 -04:00
Andrea Marchesini
14d462eeb3 Bug 1418246 - Return valid columnNumber value in CSP violation events, r=ckerschb 2018-07-05 08:21:04 +02:00
Olli Pettay
34620de771 bug 1472427, <img usemap> should work in shadow DOM, r=baku 2018-07-04 20:26:09 +03:00
Olli Pettay
f2f292c2c4 Bug 1472426, form submission should work in shadow DOM, r=baku
--HG--
extra : rebase_source : 3f11dfcfbfc808cf635945434adccb6f11accc07
2018-07-04 19:18:57 +03:00
Boris Zbarsky
96d0b4cc2e Bug 1472829. Add use counters for document.open. r=smaug
The idea is to count non-no-op document.open and to count how many times that's
done with the replace argument set to "replace".
2018-07-03 17:48:53 -04:00
Olli Pettay
a1288b6db5 Bug 1472428 - HTMLMediaElement should use IsInComposedDoc, r=cpearce 2018-07-03 18:13:17 +03:00
Chris Pearce
599f53cfd2 Bug 1463919 - Tests for prompting for permission to autoplay. r=jya,mconley
Test that a video which tries to autoplay via either a play() call or via
an autoplay attribute:
* Plays when it has a pre-existing "allow" autoplay-media permission.
* Is blocked when it has a pre-existing "block" autoplay-media permission.
* Plays when it doesn't have a pre-existing autoplay-media permission and
"allow" is pressed on the door hanger.
* Is blocked when it doesn't have a pre-existing autoplay-media permission and
"block" is pressed on the door hanger.

MozReview-Commit-ID: CpftV6RQbtU

--HG--
extra : rebase_source : a9c38a7e7071e3ebd34f10175f4f22cd84c4c303
2018-06-25 15:35:33 +12:00
Chris Pearce
f88fe2a683 Bug 1463919 - Check AutoplayPolicy before activating attribute based autoplay. r=jya
When autoplay is requested by setting the "autoplay" attribute, we should
check whether autoplay is allowed in HTMLMediaElement::CheckAutoplayDataReady()
and if not we should prompt for user consent.

This ensures that <video ... autoplay/> will prompt for consent when used on
a page without a pre-existing allow/block permission.


MozReview-Commit-ID: 77pJR2Ybn2i

--HG--
extra : rebase_source : 5cf26822c9e5f23a83d69f5f52c39be6ab6f9eb0
2018-06-29 15:10:14 +12:00
Chris Pearce
ea95e39bc9 Bug 1463919 - Move ask autoplay permission check into AutoplayPolicy. r=jya
MozReview-Commit-ID: KJcVI6gtGXw

--HG--
extra : rebase_source : a2ccd2da32d77708fdeb6ea6361975a7759cb18d
extra : source : 9b1c40f3e61ab351707f2d320ce8f87951e4868e
2018-06-26 14:16:13 +12:00
Chris Pearce
b309d364b6 Bug 1463919 - Have HTMLMediaElement ask for autoplay permission when playback otherwise blocked. r=jya
MozReview-Commit-ID: Ejv0UKBjSVf

--HG--
extra : rebase_source : f999b9a4a1ae7a5a7f1dd31efd3003e40d7fa102
2018-06-22 10:14:33 +12:00
Chris Pearce
bbbdebe6e1 Bug 1463919 - Add AutoplayRequest to encapsulate asking for autoplay permission. r=smaug
Add an implementation of nsIContentPermissionRequest to encapsulate requesting
permission from the user to autoplay audible media.

All documents in the tab request permission using the top level document's
origin, so the AutoplayRequest instance for a tab is stored on the top level
content window of the tab.

AutoplayRequest ensures that there's only a single prompt shown at once.

MozReview-Commit-ID: 2u3aLnEa21z

--HG--
extra : rebase_source : a3db3a1ef87a09442b47ae1b1034b4a0143289fb
extra : source : ae572bf618155a92b136fc5f12c1f8c9ab31f89c
2018-06-22 11:57:24 +12:00
shindli
d288e9cae7 Merge inbound to mozilla-central. a=merge 2018-06-29 00:53:32 +03:00
Chris Pearce
56d56555be Bug 1471800 - Ensure HTMLMediaElement doesn't play its MediaDecoder in a readyState update after it's OwnerDoc has been removed from its DocShell. r=jya
It's possible that if the HTMLMediaElement is loading while we're loading a new
document into a docshell, that the HTMLMediaElement can reach readyState
HAVE_FUTURE_DATA just after its OwnerDoc is removed from the docshell. If the
HTMLMediaElement wasn't paused, then it may start playing due to the readyState
change in HTMLMediaElement::ChangeReadyState().

For years we've had hard to reproduce issues where media started playing after
we've closed the tab; I bet this was the cause!

When we detect that the document has been removed from its DocShell,
HTMLMediaElement::NotifyOwnerDocumentActivityChanged() is called, and that
suspends the MediaDecoder just in case we need to resurrect the media element,
for example if the tab comes out of the BF cache. When we suspend we set
mPausedForInactiveDocumentOrChannel=true, and all other calls to
MediaDecoder::Play() are guarded by checks on
mPausedForInactiveDocumentOrChannel.

So we should also guard the MediaDecoder::Play() call in ChangeReadyState()
with a check on mPausedForInactiveDocumentOrChannel too.

MozReview-Commit-ID: GfmZasT9jdr

--HG--
extra : rebase_source : 5539503795868e9496fe34014b5c04d2ed48241b
extra : source : e94884022fa7df95adf90e44a44e4f168d60f01a
2018-06-28 15:54:36 +12:00
Cosmin Sabou
bc28a91735 Backed out changeset 97499b2f5612 (bug 1471800) as requested by cpearce. 2018-06-28 13:53:42 +03:00
Andrew Osmond
481ecf53ca Bug 1470430 - MediaDocumentStreamListener should allow off main thread OnDataAvailable calls. r=smaug
This patch makes MediaDocumentStreamListener implement the
nsIThreadRetargetableStreamListener interface. This allows callers to
redirect the OnDataAvailable calls to another thread if possible. Since
ImageDocument's use ImageListener which inherits from this class, and we
are often viewing large images this way, it would be nice to move the IO
to the image IO thread.
2018-06-28 14:07:27 -04:00
Boris Zbarsky
e2386da2d1 Bug 1209035. Fix incorrect "is this control focused?" checks in form code. r=smaug
For number controls, nsContentUtils::IsFocusedContent doesn't really do the
right thing, because the thing it thinks is focused is the anonymous text
element inside the number control.  As a result, we weren't properly updating
the state of the currently-focused number control when hitting enter in it to
submit the form.

The HTMLFormElement change is enough on its own to fix the bug.  The constraint
validation change is a just-in-case.

I haven't figured out a sane way to write a reftest for this, unfortunately:
the enter key press needs to look like a real user event to trigger the
submission behavior.
2018-06-27 12:04:26 -04:00
Emilio Cobos Álvarez
89fd549c61 Bug 1471013: Make MozAutoplayMediaBlocked chrome-only. r=smaug
Summary: MozReview-Commit-ID: JVLMpCeMkAs

Reviewers: smaug

Tags: #secure-revision

Bug #: 1471013

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

MozReview-Commit-ID: 2he7tHFbZ8t
2018-06-27 11:24:17 +02:00
Jeff Gilbert
5b753da289 Bug 1470325 - s/FooBinding/Foo_Binding/g - r=qdot
MozReview-Commit-ID: JtTcLL5OPF0
2018-06-26 17:05:01 -07:00
Emilio Cobos Álvarez
c7d35aa526 Bug 1470930: Use enums for passing arguments for event dispatch. r=smaug
MozReview-Commit-ID: DsNuF7GAflJ
2018-06-26 18:22:06 +02:00
Cosmin Sabou
f86643152d Merge mozilla-central to autoland. a=merge 2018-06-28 13:11:09 +03:00
Chris Pearce
dc1195caea Bug 1471800 - Ensure HTMLMediaElement doesn't play its MediaDecoder in a readyState update after it's OwnerDoc has been removed from its DocShell. r=jya
It's possible that if the HTMLMediaElement is loading while we're loading a new
document into a docshell, that the HTMLMediaElement can reach readyState
HAVE_FUTURE_DATA just after its OwnerDoc is removed from the docshell. If the
HTMLMediaElement wasn't paused, then it may start playing due to the readyState
change in HTMLMediaElement::ChangeReadyState().

For years we've had hard to reproduce issues where media started playing after
we've closed the tab; I bet this was the cause!

When we detect that the document has been removed from its DocShell,
HTMLMediaElement::NotifyOwnerDocumentActivityChanged() is called, and that
suspends the MediaDecoder just in case we need to resurrect the media element,
for example if the tab comes out of the BF cache. When we suspend we set
mPausedForInactiveDocumentOrChannel=true, and all other calls to
MediaDecoder::Play() are guarded by checks on
mPausedForInactiveDocumentOrChannel.

So we should also guard the MediaDecoder::Play() call in ChangeReadyState()
with a check on mPausedForInactiveDocumentOrChannel too.

MozReview-Commit-ID: GfmZasT9jdr

--HG--
extra : rebase_source : dba32e8341a3dd70355ccdd7fd8790911a92acc8
extra : source : e94884022fa7df95adf90e44a44e4f168d60f01a
2018-06-28 15:54:36 +12:00
Margareta Eliza Balazs
c866c30fcf Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-06-26 12:24:32 +03:00
Chris Peterson
2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Chris Pearce
63dbf9d6f7 Bug 1470346 - Gesture activate all documents in tab, even across origins, upon user interaction. r=smaug
Sometimes when video is playing, a preroll ad plays, and that may be in a cross
origin iframe. If autoplay media is disabled, we require a user gesture in a
document before playback in that document is permitted, and we require each
origin to be gesture activated separately. So in the cross origin preroll video
add case, then the user will have to click once to unblock playback for the
cross origin ad, and then once the preroll ad finishes, the user will have to
click again to activate playback of the same origin content video.

This is a bad user experience.

So we should instead make gesture activation propagate up the doc tree
irrespective of crossing origins.  This way, when the user clicks to activate,
all documents in that tab are also also effectively gesture activated, and so
can autoplay.

MozReview-Commit-ID: 1HZQ5zkubR

--HG--
extra : rebase_source : d6b75732548cb1d73b9f82dce60a5e6e97d1da14
2018-06-22 11:52:20 +12:00
Emilio Cobos Álvarez
47ebd819b3 Bug 1449806: Merge {Servo,Generic}SpecifiedValues into MappedDeclarations. r=xidorn
The idea would be that this header is only included in cpp files, thus it's ok
to include ServoBindings, etc.

MozReview-Commit-ID: EgQEsR0cZd4
2018-06-25 11:14:39 +02:00
Bryce Van Dyk
926f765909 Bug 1450845 - MediaDecoderStateMachine now ignores SeekToNextFrame if already seeking. r=jya
SeekToNextFrame is handled differently than other seeks by the
MediaDecoderStateMachine, and should not take place while other seeks already
are. Bug 1410225 implemented some changes in HTMLMediaElement to prevent this,
but it's still possible to move to a seeking state in the MDSM and accept
SeekToNextFrame (as in this bug).

This changeset changes the MDSM to reject SeekToNextFrame if a seek is already
happening. Since the MDSM now does this the changes from bug 1410225 can be
removed.

This has the functional change of the promise from SeekToNextFrame being
rejected if the seek in not performed due to another seek. Previously the
promise would succeed when the other seek completed. This seems sensible as the
next frame seek does not actually take place.

MozReview-Commit-ID: HD9WRFq3LZV

--HG--
extra : rebase_source : fb276010119038db4319b3b81bcbf51ef2cab1d9
2018-06-06 15:17:30 -04:00
Emilio Cobos Álvarez
c228998b4f Bug 1410578: Make <link rel="stylesheet"> work in shadow trees. r=heycam
Summary: Somewhat straight-forward, mostly removing special-casing.

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

MozReview-Commit-ID: 6f8duD4pGrl
2018-06-22 04:15:56 +02:00
Cosmin Sabou
4c18cd4036 Merge inbound to central. a=merge
--HG--
rename : servo/components/style/properties/longhand/box.mako.rs => servo/components/style/properties/longhands/box.mako.rs
2018-06-21 04:16:40 +03:00
Andrea Marchesini
5b9437cad2 Bug 1461921 - Block storage access for third-parties on the tracking protection list - part 5 - Cookies, r=ehsan 2018-06-20 13:38:22 -04:00
Valentin Gosu
a8e3a8c349 Bug 1448330 - Make nsIURI.clone a private method r=mayhemer
MozReview-Commit-ID: 1efpeaEPaXP

--HG--
extra : rebase_source : e660f1e5bcae9b7119bc5b37713691069272b375
2018-06-14 13:05:43 +02:00
catalin.badea392@gmail.com
9c36800bd7 Bug 1469385 - Remove InsertChildAt_Deprecated and RemoveChildAt_Deprecated, r=bz,smaug 2018-06-19 12:21:18 +03:00
Emilio Cobos Álvarez
99895a902b Bug 1469112: Use HTMLSlotElement::FromNode more consistently. r=smaug
MozReview-Commit-ID: 1k8lVazP0lR

--HG--
extra : rebase_source : fb505610b745dc414c2f28a0ba3130eec6160666
2018-06-15 20:14:02 -07:00
Ehsan Akhgari
4fbe444307 Bug 1462432 - Part 2: Override the dummy channel's tracking status if the document is coming from a tracking resource; r=baku 2018-06-13 16:18:39 -04:00
sotaro
967ea144d0 Bug 1465224 - Add Video rotation handling r=nical 2018-06-13 10:40:23 -07:00
Christoph Kerschbaumer
c26de76230 Bug 1467093 - Update the content type of the channel used within nsHTMLDocument::Open(). r=smaug 2018-06-07 14:01:25 +02:00