merge autoland to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2017-03-22 14:24:35 +01:00
commit 4db6c8f1f4
320 changed files with 2758 additions and 1023 deletions

View File

@ -5,16 +5,16 @@ project pages with documentation can be found at:
For information on how to build Mozilla from the source code, see:
http://developer.mozilla.org/en/docs/Build_Documentation
https://developer.mozilla.org/en/docs/Build_Documentation
To have your bug fix / feature added to Mozilla, you should create a patch and
submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at:
http://developer.mozilla.org/en/docs/Creating_a_patch
http://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree
https://developer.mozilla.org/en/docs/Creating_a_patch
https://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree
If you have a question about developing Mozilla, and can't find the solution
on http://developer.mozilla.org, you can try asking your question in a
on https://developer.mozilla.org, you can try asking your question in a
mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups
are accessible on Google Groups, or news.mozilla.org with a NNTP reader.]
@ -24,4 +24,4 @@ testing, may be buggy. Firefox nightlies, for example, can be found at:
https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
- or -
http://nightly.mozilla.org/
https://nightly.mozilla.org/

View File

@ -2,7 +2,7 @@
module.exports = { // eslint-disable-line no-undef
"extends": [
"../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
],
// All globals made available in the test environment.
"globals": {

View File

@ -2,11 +2,14 @@
module.exports = {
"extends": [
"../toolkit/.eslintrc.js"
"plugin:mozilla/recommended"
],
"rules": {
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
"complexity": ["error", {"max": 40}],
"no-shadow": "error",
"no-undef": "error"
}
};

View File

@ -804,38 +804,41 @@ addMessageListener("ContextMenu:SaveVideoFrameAsImage", (message) => {
});
addMessageListener("ContextMenu:MediaCommand", (message) => {
let media = message.objects.element;
switch (message.data.command) {
case "play":
media.play();
break;
case "pause":
media.pause();
break;
case "loop":
media.loop = !media.loop;
break;
case "mute":
media.muted = true;
break;
case "unmute":
media.muted = false;
break;
case "playbackRate":
media.playbackRate = message.data.data;
break;
case "hidecontrols":
media.removeAttribute("controls");
break;
case "showcontrols":
media.setAttribute("controls", "true");
break;
case "fullscreen":
if (content.document.fullscreenEnabled)
media.requestFullscreen();
break;
}
E10SUtils.wrapHandlingUserInput(
content, message.data.handlingUserInput,
() => {
let media = message.objects.element;
switch (message.data.command) {
case "play":
media.play();
break;
case "pause":
media.pause();
break;
case "loop":
media.loop = !media.loop;
break;
case "mute":
media.muted = true;
break;
case "unmute":
media.muted = false;
break;
case "playbackRate":
media.playbackRate = message.data.data;
break;
case "hidecontrols":
media.removeAttribute("controls");
break;
case "showcontrols":
media.setAttribute("controls", "true");
break;
case "fullscreen":
if (content.document.fullscreenEnabled)
media.requestFullscreen();
break;
}
});
});
addMessageListener("ContextMenu:Canvas:ToBlobURL", (message) => {

View File

@ -1741,8 +1741,13 @@ nsContextMenu.prototype = {
mediaCommand : function CM_mediaCommand(command, data) {
let mm = this.browser.messageManager;
let win = this.browser.ownerGlobal;
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
mm.sendAsyncMessage("ContextMenu:MediaCommand",
{command: command, data: data},
{command: command,
data: data,
handlingUserInput: windowUtils.isHandlingUserInput},
{element: this.target});
},

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/chrome.eslintrc.js"
"plugin:mozilla/chrome-test"
]
};

View File

@ -60,6 +60,13 @@ const TRANSLUCENT_SELECT_BECOMES_OPAQUE =
' <option value="Two" selected="true">{"end": "true"}</option>' +
"</select></body></html>";
const TRANSLUCENT_SELECT_APPLIES_ON_BASE_COLOR =
"<html><head>" +
"<body><select id='one' style='background-color: rgba(255,0,0,.55);'>" +
' <option value="One">{"color": "rgb(0, 0, 0)", "backgroundColor": "rgba(0, 0, 0, 0)"}</option>' +
' <option value="Two" selected="true">{"end": "true"}</option>' +
"</select></body></html>";
const DISABLED_OPTGROUP_AND_OPTIONS =
"<html><head>" +
"<body><select id='one'>" +
@ -140,8 +147,33 @@ function* testSelectColors(select, itemCount, options) {
if (!options.skipSelectColorTest) {
is(getComputedStyle(selectPopup).color, options.selectColor,
"popup has expected foreground color");
is(getComputedStyle(selectPopup).backgroundColor, options.selectBgColor,
"popup has expected background color");
// Combine the select popup's backgroundColor and the
// backgroundImage color to get the color that is seen by
// the user.
let base = getComputedStyle(selectPopup).backgroundColor;
let [/* unused */, bR, bG, bB] =
base.match(/rgb\((\d+), (\d+), (\d+)\)/);
bR = parseInt(bR, 10);
bG = parseInt(bG, 10);
bB = parseInt(bB, 10);
let topCoat = getComputedStyle(selectPopup).backgroundImage;
if (topCoat == "none") {
is(`rgb(${bR}, ${bG}, ${bB})`, options.selectBgColor,
"popup has expected background color");
} else {
let [/* unused */, /* unused */, tR, tG, tB, tA] =
topCoat.match(/(rgba?\((\d+), (\d+), (\d+)(?:, (0\.\d+))?\)), \1/);
tR = parseInt(tR, 10);
tG = parseInt(tG, 10);
tB = parseInt(tB, 10);
tA = parseFloat(tA) || 1;
let actualR = Math.round(tR * tA + bR * (1 - tA));
let actualG = Math.round(tG * tA + bG * (1 - tA));
let actualB = Math.round(tB * tA + bB * (1 - tA));
is(`rgb(${actualR}, ${actualG}, ${actualB})`, options.selectBgColor,
"popup has expected background color");
}
}
ok(!child.selected, "The first child should not be selected");
@ -217,7 +249,7 @@ add_task(function* test_select_background_using_important() {
// background color has been changed.
add_task(function* test_translucent_select_becomes_opaque() {
// The popup is requested to show a translucent background
// but we force the alpha channel to 1 on the popup.
// but we apply the requested background color on the system's base color.
let options = {
selectColor: "rgb(0, 0, 0)",
selectBgColor: "rgb(255, 255, 255)"
@ -225,6 +257,19 @@ add_task(function* test_translucent_select_becomes_opaque() {
yield testSelectColors(TRANSLUCENT_SELECT_BECOMES_OPAQUE, 2, options);
});
// This test checks when a popup has a translucent background color,
// and that the color painted to the screen of the translucent background
// matches what the user expects.
add_task(function* test_translucent_select_applies_on_base_color() {
// The popup is requested to show a translucent background
// but we apply the requested background color on the system's base color.
let options = {
selectColor: "rgb(0, 0, 0)",
selectBgColor: "rgb(255, 115, 115)"
};
yield testSelectColors(TRANSLUCENT_SELECT_APPLIES_ON_BASE_COLOR, 2, options);
});
add_task(function* test_disabled_optgroup_and_options() {
// The colors used by this test are platform-specific.
if (AppConstants.platform != "win") {

View File

@ -2,7 +2,7 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js",
"../../../../../testing/mochitest/mochitest.eslintrc.js",
"plugin:mozilla/browser-test",
"plugin:mozilla/mochitest-test",
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -3,7 +3,7 @@
module.exports = {
rules: {
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
// be removed & synced with the toolkit/.eslintrc.js value.
// be removed & synced with the mozilla/recommended value.
"complexity": ["error", {"max": 69}],
}
};

View File

@ -2,7 +2,7 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
],
"rules": {

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -1,7 +1,7 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
"extends": "../../../../../testing/mochitest/browser.eslintrc.js",
module.exports = {
"extends": "plugin:mozilla/browser-test",
"env": {
"webextensions": true,

View File

@ -1,7 +1,7 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
"extends": "../../../../../testing/xpcshell/xpcshell.eslintrc.js",
module.exports = {
"extends": "plugin:mozilla/xpcshell-test",
"globals": {
"browser": false,

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/mochitest.eslintrc.js"
"plugin:mozilla/mochitest-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/chrome.eslintrc.js"
"plugin:mozilla/chrome-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,8 +2,8 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js",
"../../../../../testing/mochitest/mochitest.eslintrc.js",
"plugin:mozilla/browser-test",
"plugin:mozilla/mochitest-test",
]
};

View File

@ -1,7 +1,7 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/chrome.eslintrc.js"
"plugin:mozilla/chrome-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,7 +2,7 @@
module.exports = {
"extends": [
"../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
],
"rules": {

View File

@ -1,7 +1,7 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js",
"plugin:mozilla/browser-test",
],
};

View File

@ -1,7 +1,7 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
module.exports = {
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js",
"plugin:mozilla/xpcshell-test",
],
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
]
};

View File

@ -2,6 +2,6 @@
module.exports = {
"extends": [
"../../../../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
]
};

View File

@ -1,8 +1,8 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
module.exports = {
"extends": [
"../../../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
],
"rules": {

View File

@ -1,7 +1,7 @@
// Parent config file for all devtools browser mochitest files.
module.exports = {
"extends": [
"../testing/mochitest/browser.eslintrc.js"
"plugin:mozilla/browser-test"
],
// All globals made available in the test environment.
"globals": {

View File

@ -1,19 +1,19 @@
// Parent config file for all devtools xpcshell files.
module.exports = {
"extends": [
"../testing/xpcshell/xpcshell.eslintrc.js"
"plugin:mozilla/xpcshell-test"
],
"rules": {
// Allow non-camelcase so that run_test doesn't produce a warning.
"camelcase": 0,
"camelcase": "off",
// Allow using undefined variables so that tests can refer to functions
// and variables defined in head.js files, without having to maintain a
// list of globals in each .eslintrc file.
// Note that bug 1168340 will eventually help auto-registering globals
// from head.js files.
"no-undef": 0,
"block-scoped-var": 0,
"no-undef": "off",
"block-scoped-var": "off",
// Tests can always import anything.
"mozilla/reject-some-requires": 0,
"mozilla/reject-some-requires": "off",
}
};

View File

@ -1,11 +1,11 @@
"use strict";
module.exports = {
"env": {
"browser": true,
},
"globals": {
"d3": true,
"dagreD3": true,
}
};
"use strict";
module.exports = {
"env": {
"browser": true,
},
"globals": {
"d3": true,
"dagreD3": true,
}
};

View File

@ -2,5 +2,5 @@
module.exports = {
// Extend from the shared list of defined globals for mochitests.
"extends": "../../../../../testing/mochitest/chrome.eslintrc.js"
"extends": "plugin:mozilla/chrome-test"
};

View File

@ -2,5 +2,5 @@
module.exports = {
// Extend from the shared list of defined globals for mochitests.
"extends": "../../../../testing/mochitest/chrome.eslintrc.js"
"extends": "plugin:mozilla/chrome-test"
};

View File

@ -2071,6 +2071,12 @@ FragmentOrElement::TextIsOnlyWhitespace()
return false;
}
bool
FragmentOrElement::ThreadSafeTextIsOnlyWhitespace() const
{
return false;
}
bool
FragmentOrElement::HasTextForTranslation()
{

View File

@ -143,6 +143,7 @@ public:
virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) override;
virtual bool TextIsOnlyWhitespace() override;
virtual bool ThreadSafeTextIsOnlyWhitespace() const override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_MUST_USE

View File

@ -9631,8 +9631,8 @@ nsDocument::ForgetImagePreload(nsIURI* aURI)
}
}
EventStates
nsDocument::GetDocumentState()
void
nsDocument::UpdatePossiblyStaleDocumentState()
{
if (!mGotDocumentState.HasState(NS_DOCUMENT_STATE_RTL_LOCALE)) {
if (IsDocumentRightToLeft()) {
@ -9648,9 +9648,21 @@ nsDocument::GetDocumentState()
}
mGotDocumentState |= NS_DOCUMENT_STATE_WINDOW_INACTIVE;
}
}
EventStates
nsDocument::ThreadSafeGetDocumentState() const
{
return mDocumentState;
}
EventStates
nsDocument::GetDocumentState()
{
UpdatePossiblyStaleDocumentState();
return ThreadSafeGetDocumentState();
}
namespace {
/**

View File

@ -980,7 +980,12 @@ public:
virtual nsISupports* GetCurrentContentSink() override;
virtual mozilla::EventStates GetDocumentState() override;
virtual mozilla::EventStates GetDocumentState() final;
// GetDocumentState() mutates the state due to lazy resolution;
// and can't be used during parallel traversal. Use this instead,
// and ensure GetDocumentState() has been called first.
// This will assert if the state is stale.
virtual mozilla::EventStates ThreadSafeGetDocumentState() const final;
// Only BlockOnload should call this!
void AsyncBlockOnload();
@ -1391,6 +1396,7 @@ protected:
// caches its result here.
mozilla::Maybe<bool> mIsThirdParty;
private:
void UpdatePossiblyStaleDocumentState();
static bool CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp);
/**

View File

@ -982,6 +982,21 @@ nsGenericDOMDataNode::AppendText(const char16_t* aBuffer,
bool
nsGenericDOMDataNode::TextIsOnlyWhitespace()
{
MOZ_ASSERT(NS_IsMainThread());
if (!ThreadSafeTextIsOnlyWhitespace()) {
UnsetFlags(NS_TEXT_IS_ONLY_WHITESPACE);
SetFlags(NS_CACHED_TEXT_IS_ONLY_WHITESPACE);
return false;
}
SetFlags(NS_CACHED_TEXT_IS_ONLY_WHITESPACE | NS_TEXT_IS_ONLY_WHITESPACE);
return true;
}
bool
nsGenericDOMDataNode::ThreadSafeTextIsOnlyWhitespace() const
{
// FIXME: should this method take content language into account?
if (mText.Is2b()) {
@ -1001,15 +1016,12 @@ nsGenericDOMDataNode::TextIsOnlyWhitespace()
char ch = *cp;
if (!dom::IsSpaceCharacter(ch)) {
UnsetFlags(NS_TEXT_IS_ONLY_WHITESPACE);
SetFlags(NS_CACHED_TEXT_IS_ONLY_WHITESPACE);
return false;
}
++cp;
}
SetFlags(NS_CACHED_TEXT_IS_ONLY_WHITESPACE | NS_TEXT_IS_ONLY_WHITESPACE);
return true;
}

View File

@ -136,6 +136,7 @@ public:
virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) override;
virtual bool TextIsOnlyWhitespace() override;
virtual bool ThreadSafeTextIsOnlyWhitespace() const final;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_MUST_USE

View File

@ -558,6 +558,11 @@ public:
*/
virtual bool TextIsOnlyWhitespace() = 0;
/**
* Thread-safe version of TextIsOnlyWhitespace.
*/
virtual bool ThreadSafeTextIsOnlyWhitespace() const = 0;
/**
* Method to see if the text node contains data that is useful
* for a translation: i.e., it consists of more than just whitespace,

View File

@ -2381,6 +2381,7 @@ public:
* nsIDocument.h.
*/
virtual mozilla::EventStates GetDocumentState() = 0;
virtual mozilla::EventStates ThreadSafeGetDocumentState() const = 0;
virtual nsISupports* GetCurrentContentSink() = 0;

View File

@ -827,15 +827,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLVideoElement& aVideoEl
}
// Create ImageBitmap.
ImageContainer *container = aVideoEl.GetImageContainer();
if (!container) {
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
AutoLockImage lockImage(container);
layers::Image* data = lockImage.GetImage();
RefPtr<layers::Image> data = aVideoEl.GetCurrentImage();
if (!data) {
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;

View File

@ -1030,6 +1030,11 @@ private:
return false;
}
// We should consider any bfcached page or inactive document as non-playing.
if (!mOwner->IsActive()) {
return false;
}
// It might be resumed from remote, we should keep the audio channel agent.
if (IsSuspended()) {
return true;
@ -1040,11 +1045,6 @@ private:
return false;
}
// We should consider any bfcached page or inactive document as non-playing.
if (!mOwner->IsActive()) {
return false;
}
// A loop always is playing
if (mOwner->HasAttr(kNameSpaceID_None, nsGkAtoms::loop)) {
return true;
@ -1532,12 +1532,7 @@ HTMLMediaElement::SetVisible(bool aVisible)
already_AddRefed<layers::Image>
HTMLMediaElement::GetCurrentImage()
{
// Mark the decoder owned by the element as tainted so that the
// suspend-video-decoder is disabled.
mHasSuspendTaint = true;
if (mDecoder) {
mDecoder->SetSuspendTaint(true);
}
MarkAsTainted();
// TODO: In bug 1345404, handle case when video decoder is already suspended.
ImageContainer* container = GetImageContainer();
@ -3334,7 +3329,8 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded,
{
MOZ_RELEASE_ASSERT(aGraph);
MarkAsContentSource(CallerAPI::CAPTURE_STREAM);
MarkAsContentSource(CallerAPI::CAPTURE_STREAM);
MarkAsTainted();
nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow();
if (!window) {
@ -3723,7 +3719,6 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
mDefaultPlaybackStartPosition(0.0),
mIsAudioTrackAudible(false),
mHasSuspendTaint(false),
mMediaTracksConstructed(false),
mVisibilityState(Visibility::UNTRACKED),
mErrorSink(new ErrorSink(this)),
mAudioChannelWrapper(new AudioChannelAgentCallback(this, mAudioChannel))
@ -7423,11 +7418,7 @@ HTMLMediaElement::GetDocument() const
void
HTMLMediaElement::ConstructMediaTracks(const MediaInfo* aInfo)
{
if (mMediaTracksConstructed || !aInfo) {
return;
}
mMediaTracksConstructed = true;
MOZ_ASSERT(aInfo);
AudioTrackList* audioList = AudioTracks();
if (audioList && aInfo->HasAudio()) {
@ -7461,8 +7452,6 @@ HTMLMediaElement::RemoveMediaTracks()
if (videoList) {
videoList->RemoveTracks();
}
mMediaTracksConstructed = false;
}
class MediaElementGMPCrashHelper : public GMPCrashHelper
@ -7491,6 +7480,16 @@ HTMLMediaElement::CreateGMPCrashHelper()
return MakeAndAddRef<MediaElementGMPCrashHelper>(this);
}
void
HTMLMediaElement::MarkAsTainted()
{
mHasSuspendTaint = true;
if (mDecoder) {
mDecoder->SetSuspendTaint(true);
}
}
bool HasDebuggerPrivilege(JSContext* aCx, JSObject* aObj)
{
return nsContentUtils::CallerHasPermission(aCx,

View File

@ -1310,6 +1310,10 @@ protected:
// Pass information for deciding the video decode mode to decoder.
void NotifyDecoderActivityChanges() const;
// Mark the decoder owned by the element as tainted so that the
// suspend-video-decoder is disabled.
void MarkAsTainted();
// The current decoder. Load() has been called on this decoder.
// At most one of mDecoder and mSrcStream can be non-null.
RefPtr<MediaDecoder> mDecoder;
@ -1741,10 +1745,6 @@ private:
// participate in video decoder suspending.
bool mHasSuspendTaint;
// True if audio tracks and video tracks are constructed and added into the
// track list, false if all tracks are removed from the track list.
bool mMediaTracksConstructed;
Visibility mVisibilityState;
UniquePtr<ErrorSink> mErrorSink;

View File

@ -393,6 +393,7 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
, mPlaybackStatistics(new MediaChannelStatistics())
, mPinnedForSeek(false)
, mMinimizePreroll(false)
, mMediaTracksConstructed(false)
, mFiredMetadataLoaded(false)
, mIsDocumentVisible(false)
, mElementVisibility(Visibility::UNTRACKED)
@ -806,7 +807,7 @@ void
MediaDecoder::OnMetadataUpdate(TimedMetadata&& aMetadata)
{
MOZ_ASSERT(NS_IsMainThread());
GetOwner()->RemoveMediaTracks();
RemoveMediaTracks();
MetadataLoaded(nsAutoPtr<MediaInfo>(new MediaInfo(*aMetadata.mInfo)),
Move(aMetadata.mTags),
MediaDecoderEventVisibility::Observable);
@ -829,7 +830,7 @@ MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
mMediaSeekable = aInfo->mMediaSeekable;
mMediaSeekableOnlyInBufferedRanges = aInfo->mMediaSeekableOnlyInBufferedRanges;
mInfo = aInfo.forget();
GetOwner()->ConstructMediaTracks(mInfo);
ConstructMediaTracks();
// Make sure the element and the frame (if any) are told about
// our new size.
@ -1194,9 +1195,9 @@ MediaDecoder::ChangeState(PlayState aState)
mPlayState = aState;
if (mPlayState == PLAY_STATE_PLAYING) {
GetOwner()->ConstructMediaTracks(mInfo);
ConstructMediaTracks();
} else if (IsEnded()) {
GetOwner()->RemoveMediaTracks();
RemoveMediaTracks();
}
}
@ -1763,6 +1764,32 @@ MediaDecoder::GetOwner() const
return mOwner;
}
void
MediaDecoder::ConstructMediaTracks()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
if (mMediaTracksConstructed || !mInfo) {
return;
}
GetOwner()->ConstructMediaTracks(mInfo);
mMediaTracksConstructed = true;
}
void
MediaDecoder::RemoveMediaTracks()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
GetOwner()->RemoveMediaTracks();
mMediaTracksConstructed = false;
}
MediaDecoderOwner::NextFrameStatus
MediaDecoder::NextFrameBufferedStatus()
{

View File

@ -400,6 +400,17 @@ private:
// change. Call on the main thread only.
virtual void ChangeState(PlayState aState);
// Called from MetadataLoaded(). Ask its owner to create audio/video tracks
// and adds them to its owner's audio/video track list.
// Call on the main thread only.
void ConstructMediaTracks();
// Ask its owner to remove all audio tracks and video tracks that are
// previously added into the track list.
// Call on the main thread only.
void RemoveMediaTracks();
// Called when the video has completed playing.
// Call on the main thread only.
void PlaybackEnded();
@ -694,6 +705,11 @@ protected:
// or play the media again.
bool mMinimizePreroll;
// True if audio tracks and video tracks are constructed and added into the
// owenr's track list, false if all tracks are removed from the owner's track
// list.
bool mMediaTracksConstructed;
// True if we've already fired metadataloaded.
bool mFiredMetadataLoaded;

View File

@ -7,6 +7,7 @@
#include "mozilla/dom/TextTrackListBinding.h"
#include "mozilla/dom/TrackEvent.h"
#include "nsThreadUtils.h"
#include "nsGlobalWindow.h"
#include "mozilla/dom/TextTrackCue.h"
#include "mozilla/dom/TextTrackManager.h"
@ -174,6 +175,11 @@ TextTrackList::CreateAndDispatchChangeEvent()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mPendingTextTrackChange) {
nsPIDOMWindowInner* win = GetOwner();
if (!win) {
return;
}
mPendingTextTrackChange = true;
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
@ -181,7 +187,9 @@ TextTrackList::CreateAndDispatchChangeEvent()
event->SetTrusted(true);
nsCOMPtr<nsIRunnable> eventRunner = new ChangeEventRunner(this, event);
NS_DispatchToMainThread(eventRunner);
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackList::CreateAndDispatchChangeEvent", TaskCategory::Other,
eventRunner.forget());
}
}

View File

@ -16,6 +16,7 @@
#include "nsThreadUtils.h"
#include "runnable_utils.h"
#include "GMPUtils.h"
#include "mozilla/SystemGroup.h"
namespace mozilla {

View File

@ -10,18 +10,20 @@ using namespace mozilla;
TEST(BlankVideoDataCreator, ShouldNotOverflow)
{
RefPtr<MediaRawData> mrd = new MediaRawData();
const uint32_t width = 1;
const uint32_t height = 1;
BlankVideoDataCreator creater(width, height, nullptr);
RefPtr<MediaData> data = creater.Create(new MediaRawData());
RefPtr<MediaData> data = creater.Create(mrd);
EXPECT_NE(data.get(), nullptr);
}
TEST(BlankVideoDataCreator, ShouldOverflow)
{
RefPtr<MediaRawData> mrd = new MediaRawData();
const uint32_t width = UINT_MAX;
const uint32_t height = UINT_MAX;
BlankVideoDataCreator creater(width, height, nullptr);
RefPtr<MediaData> data = creater.Create(new MediaRawData());
RefPtr<MediaData> data = creater.Create(mrd);
EXPECT_EQ(data.get(), nullptr);
}

View File

@ -1149,6 +1149,12 @@ tags = suspend
[test_background_video_suspend_ends.html]
skip-if = toolkit == 'android' # bug 1295884, android(bug 1304480, bug 1232305)
tags = suspend
[test_background_video_tainted_by_capturestream.html]
skip-if = toolkit == 'android' # bug 1346705
tags = suspend
[test_background_video_tainted_by_createimagebitmap.html]
skip-if = toolkit == 'android' # bug 1346705
tags = suspend
[test_background_video_tainted_by_drawimage.html]
skip-if = toolkit == 'android' # bug 1346705
tags = suspend

View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test Background Video Is Tainted By captureStream</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="manifest.js"></script>
<script src="background_video.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript">
"use strict";
var manager = new MediaTestManager;
function captureVideoAsStream(v) {
let stream = v.mozCaptureStream();
}
startTest({
desc: 'Test Background Video Is Tainted By captureStream',
prefs: [
[ "media.test.video-suspend", true ],
[ "media.suspend-bkgnd-video.enabled", true ],
[ "media.suspend-bkgnd-video.delay-ms", 1000 ]
],
tests: gDecodeSuspendTests,
runTest: (test, token) => {
ok(true, `${test.name}`);
let v = appendVideoToDoc(test.name, token);
manager.started(token);
waitUntilPlaying(v)
.then(() => {
captureVideoAsStream(v);
ok(v.hasSuspendTaint(), "Video is tainted after captured");
return checkVideoDoesntSuspend(v);
})
.then(() => {
ok(true, 'Video ended before decode was suspended');
manager.finished(token);
})
.catch((e) => {
ok(false, 'Test failed: ' + e.toString());
manager.finished(token);
});
}
});
</script>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test Background Video Is Tainted By createImageBitmap</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="manifest.js"></script>
<script src="background_video.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript">
"use strict";
var manager = new MediaTestManager;
startTest({
desc: 'Test Background Video Is Tainted By createImageBitmap',
prefs: [
[ "media.test.video-suspend", true ],
[ "media.suspend-bkgnd-video.enabled", true ],
[ "media.suspend-bkgnd-video.delay-ms", 1000 ]
],
tests: gDecodeSuspendTests,
runTest: (test, token) => {
ok(true, `${test.name}`);
let v = appendVideoToDoc(test.name, token);
manager.started(token);
waitUntilPlaying(v)
.then(() => createImageBitmap(v))
.then(() => {
ok(v.hasSuspendTaint(), "Video is tainted after drawing to canvas");
return checkVideoDoesntSuspend(v);
})
.then(() => {
ok(true, 'Video ended before decode was suspended');
manager.finished(token);
})
.catch((e) => {
ok(false, 'Test failed: ' + e.toString());
manager.finished(token);
});
}
});
</script>

View File

@ -83,7 +83,11 @@ function initTest(test, token) {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{"set": [["logging.MediaDecoder", "Debug"]]},
{"set": [
["logging.MediaDecoder", "Debug"],
["logging.nsMediaElement", "Debug"],
["logging.MediaCache", "Debug"],
]},
manager.runTests.bind(manager, gCloneTests, initTest));
</script>

View File

@ -787,16 +787,6 @@ EditorBase::GetTransactionManager(nsITransactionManager** aTxnManager)
return NS_OK;
}
NS_IMETHODIMP
EditorBase::SetTransactionManager(nsITransactionManager* aTxnManager)
{
NS_ENSURE_TRUE(aTxnManager, NS_ERROR_FAILURE);
// nsITransactionManager is builtinclass, so this is safe
mTxnMgr = static_cast<nsTransactionManager*>(aTxnManager);
return NS_OK;
}
NS_IMETHODIMP
EditorBase::Undo(uint32_t aCount)
{

View File

@ -172,7 +172,7 @@ interface nsIEditor : nsISupports
/** transactionManager Get the transaction manager the editor is using.
*/
attribute nsITransactionManager transactionManager;
readonly attribute nsITransactionManager transactionManager;
/** doTransaction() fires a transaction.
* It is provided here so clients can create their own transactions.

View File

@ -50,7 +50,7 @@ parent:
async ResetSensor(uint32_t aDisplayID);
sync GetSensorState(uint32_t aDisplayID) returns(VRHMDSensorState aState);
sync SetHaveEventListener(bool aHaveEventListener);
async SetHaveEventListener(bool aHaveEventListener);
async ControllerListenerAdded();
async ControllerListenerRemoved();

View File

@ -9,12 +9,12 @@
#include "nsIAtom.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Services.h"
#include "mozilla/intl/LocaleService.h"
#include "mozilla/intl/OSPreferences.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/dom/EncodingUtils.h"
using namespace mozilla;
using mozilla::intl::LocaleService;
using mozilla::intl::OSPreferences;
static constexpr nsUConvProp kLangGroups[] = {
#include "langGroups.properties.h"
@ -51,7 +51,7 @@ nsLanguageAtomService::GetLocaleLanguage()
do {
if (!mLocaleLanguage) {
nsAutoCString locale;
LocaleService::GetInstance()->GetAppLocaleAsLangTag(locale);
OSPreferences::GetInstance()->GetSystemLocale(locale);
ToLowerCase(locale); // use lowercase for all language atoms
mLocaleLanguage = NS_Atomize(locale);

View File

@ -947,8 +947,6 @@ description =
description =
[PVRManager::GetSensorState]
description =
[PVRManager::SetHaveEventListener]
description =
[PHal::GetCurrentBatteryInformation]
description =
[PHal::GetCurrentNetworkInformation]

View File

@ -2,7 +2,7 @@
module.exports = {
"extends": [
"../../../toolkit/.eslintrc.js"
"plugin:mozilla/recommended"
],
"plugins": [

View File

@ -543,6 +543,12 @@ js::NukeCrossCompartmentWrappers(JSContext* cx,
AutoWrapperRooter wobj(cx, WrapperValue(e));
JSObject* wrapped = UncheckedUnwrap(wobj);
// We never nuke script source objects, since only ever used internally by the JS
// engine, and are expected to remain valid throughout a scripts lifetime.
if (MOZ_UNLIKELY(wrapped->is<ScriptSourceObject>())) {
continue;
}
// We only skip nuking window references that point to a target
// compartment, not the ones that belong to it.
if (nukeReferencesToWindow == DontNukeWindowReferences &&

View File

@ -2,7 +2,7 @@
module.exports = {
"extends": [
"../../../toolkit/.eslintrc.js"
"plugin:mozilla/recommended"
],
"rules": {

Some files were not shown because too many files have changed in this diff Show More