Merge remote-tracking branch 'origin/master' into kmeleon76

This commit is contained in:
2024-09-20 11:28:31 +08:00
1782 changed files with 68503 additions and 52092 deletions
+64
View File
@@ -0,0 +1,64 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
XPCOMUtils.defineLazyServiceGetter(this, "contentSecManager",
"@mozilla.org/contentsecuritymanager;1",
"nsIContentSecurityManager");
this.EXPORTED_SYMBOLS = ["ActivityChannel"];
this.ActivityChannel = function(aURI, aLoadInfo, aName, aDetails) {
this._activityName = aName;
this._activityDetails = aDetails;
this.originalURI = aURI;
this.URI = aURI;
this.loadInfo = aLoadInfo;
}
this.ActivityChannel.prototype = {
originalURI: null,
URI: null,
owner: null,
notificationCallbacks: null,
securityInfo: null,
contentType: null,
contentCharset: null,
contentLength: 0,
contentDisposition: Ci.nsIChannel.DISPOSITION_INLINE,
contentDispositionFilename: null,
contentDispositionHeader: null,
loadInfo: null,
open: function() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
open2: function() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
asyncOpen: function(aListener, aContext) {
cpmm.sendAsyncMessage(this._activityName, this._activityDetails);
// Let the listener cleanup.
aListener.onStopRequest(this, aContext, Cr.NS_OK);
},
asyncOpen2: function(aListener) {
// throws an error if security checks fail
var outListener = contentSecManager.performSecurityCheck(this, aListener);
this.asyncOpen(outListener, null);
},
QueryInterface2: XPCOMUtils.generateQI([Ci.nsIChannel])
}
+9 -9
View File
@@ -7,10 +7,7 @@
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
Cu.import('resource://gre/modules/ActivityChannel.jsm');
function MailtoProtocolHandler() {
}
@@ -31,12 +28,15 @@ MailtoProtocolHandler.prototype = {
return uri;
},
newChannel: function Proto_newChannel(aURI) {
cpmm.sendAsyncMessage("mail-handler", {
URI: aURI.spec,
type: "mail" });
newChannel2: function Proto_newChannel2(aURI, aLoadInfo) {
return new ActivityChannel(aURI, aLoadInfo,
"mail-handler",
{ URI: aURI.spec,
type: "mail" });
},
throw Components.results.NS_ERROR_ILLEGAL_VALUE;
newChannel: function Proto_newChannel(aURI) {
return this.newChannel2(aURI, null);
},
classID: Components.ID("{50777e53-0331-4366-a191-900999be386c}"),
+11 -9
View File
@@ -16,10 +16,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import("resource:///modules/TelURIParser.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
Cu.import('resource://gre/modules/ActivityChannel.jsm');
function SmsProtocolHandler() {
}
@@ -40,7 +37,7 @@ SmsProtocolHandler.prototype = {
return uri;
},
newChannel: function Proto_newChannel(aURI) {
newChannel2: function Proto_newChannel2(aURI, aLoadInfo) {
let number = TelURIParser.parseURI('sms', aURI.spec);
let body = "";
let query = aURI.spec.split("?")[1];
@@ -56,15 +53,20 @@ SmsProtocolHandler.prototype = {
}
if (number || body) {
cpmm.sendAsyncMessage("sms-handler", {
number: number || "",
type: "websms/sms",
body: body });
return new ActivityChannel(aURI, aLoadInfo,
"sms-handler",
{ number: number || "",
type: "websms/sms",
body: body });
}
throw Components.results.NS_ERROR_ILLEGAL_VALUE;
},
newChannel: function Proto_newChannel(aURI) {
return this.newChannel2(aURI, null);
},
classID: Components.ID("{81ca20cb-0dad-4e32-8566-979c8998bd73}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
};
+10 -8
View File
@@ -15,10 +15,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import("resource:///modules/TelURIParser.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
Cu.import('resource://gre/modules/ActivityChannel.jsm');
function TelProtocolHandler() {
}
@@ -39,18 +36,23 @@ TelProtocolHandler.prototype = {
return uri;
},
newChannel: function Proto_newChannel(aURI) {
newChannel2: function Proto_newChannel(aURI, aLoadInfo) {
let number = TelURIParser.parseURI('tel', aURI.spec);
if (number) {
cpmm.sendAsyncMessage("dial-handler", {
number: number,
type: "webtelephony/number" });
return new ActivityChannel(aURI, aLoadInfo,
"dial-handler",
{ number: number,
type: "webtelephony/number" });
}
throw Components.results.NS_ERROR_ILLEGAL_VALUE;
},
newChannel: function Proto_newChannel(aURI) {
return this.newChannel2(aURI, null);
},
classID: Components.ID("{782775dd-7351-45ea-aff1-0ffa872cfdd2}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
};
+1
View File
@@ -56,6 +56,7 @@ if CONFIG['MOZ_UPDATER']:
EXTRA_JS_MODULES += [
'AboutServiceWorkers.jsm',
'ActivityChannel.jsm',
'AlertsHelper.jsm',
'Bootstraper.jsm',
'ContentRequestHelper.jsm',
+73
View File
@@ -0,0 +1,73 @@
@ECHO OFF
REM read config file
setlocal ENABLEDELAYEDEXPANSION
set loop=0
for /F "tokens=*" %%A in (.config) do (
SET /A loop=!loop! + 1
set %%A
)
set DEVICE_FOUND=0
REM nexus has device instead of product name
IF [%PRODUCT_NAME%]==[] (
set PRODUCT_NAME=%DEVICE%
)
REM if nexus 4 assume you are in fastboot mode, can't seem to find drivers
IF [%DEVICE%]==[mako] (
call :flash
)
REM push device from adb to fastboot mode
win_adb kill-server
win_adb devices
win_adb get-state > devicestate.txt
set /p DEVICE_STATE= < devicestate.txt
IF NOT "%DEVICE_STATE%"=="device" (
ECHO Please check :
ECHO 1. to make sure that only one device is connected to the computer
ECHO 2. the device is turned on with the screen showing
ECHO 3. the device is set to debugging via USB : ADB Only or ADB and Devtools
ECHO 4. the device drivers are installed on the computer.
Del devicestate.txt
PAUSE
EXIT /b
)
Del devicestate.txt
win_adb reboot bootloader
TIMEOUT 5
:flash
win_fastboot devices 2> fastboot_state.txt
set /p FASTBOOT_STATE= < fastboot_state.txt
IF NOT [%FASTBOOT_STATE%]==[] (
ECHO Please check :
ECHO 1. to make sure that only one device is connected to the computer
ECHO 2. the device is turned on with an indication that the device is in fastboot mode
ECHO 3. the fastboot drivers are installed on the computer.
Del fastboot_state.txt
PAUSE
EXIT /b
)
Del fastboot_state.txt
ECHO "Flashing build. If nothing mentions that it flashed anything and it looks stuck, make sure you have the drivers installed."
win_fastboot flash boot out/target/product/%PRODUCT_NAME%/boot.img
win_fastboot flash system out/target/product/%PRODUCT_NAME%/system.img
win_fastboot flash persist out/target/product/%PRODUCT_NAME%/persist.img
win_fastboot flash recovery out/target/product/%PRODUCT_NAME%/recovery.img
win_fastboot flash cache out/target/product/%PRODUCT_NAME%/cache.img
win_fastboot flash userdata out/target/product/%PRODUCT_NAME%/userdata.img
ECHO "Done..."
win_fastboot reboot
echo "Just close the windows as you wish."
TIMEOUT 5
+5 -1
View File
@@ -726,9 +726,13 @@
@RESPATH@/components/nsUrlClassifierHashCompleter.js
@RESPATH@/components/nsUrlClassifierListManager.js
@RESPATH@/components/nsUrlClassifierLib.js
@RESPATH@/components/PrivateBrowsingTrackingProtectionWhitelist.js
@RESPATH@/components/url-classifier.xpt
; Private Browsing
@RESPATH@/components/privatebrowsing.xpt
@RESPATH@/components/PrivateBrowsing.manifest
@RESPATH@/components/PrivateBrowsingTrackingProtectionWhitelist.js
; ANGLE on Win32
#ifdef XP_WIN32
#ifndef HAVE_64BIT_BUILD
+1
View File
@@ -34,6 +34,7 @@ ostream
set
stack
string
type_traits
utility
vector
cassert
+1
View File
@@ -1114,6 +1114,7 @@ ToolUtils.h
tr1/functional
trace.h
Traps.h
type_traits
typeinfo
types.h
Types.h
+25
View File
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--
user_pref("browser.send_pings", true);
-->
<script>
function boom() {
var aLink = document.createElement('a');
document.body.appendChild(aLink);
aLink.ping = "ping";
aLink.href = "href";
aLink.click();
var baseElement = document.createElement('base');
baseElement.setAttribute("href", "javascript:void 0");
document.head.appendChild(baseElement);
}
</script>
</head>
<body onload="boom();"></body>
</html>
+1
View File
@@ -12,3 +12,4 @@ load 514779-1.xhtml
load 614499-1.html
load 678872-1.html
skip-if(Android||B2G) pref(dom.disable_open_during_load,false) load 914521.html
pref(browser.send_pings,true) load 1257730-1.html
+1
View File
@@ -42,6 +42,7 @@ interface nsIContentViewer : nsISupports
[noscript,notxpcom,nostdcall] void loadStart(in nsIDocument aDoc);
void loadComplete(in nsresult aStatus);
[noscript] readonly attribute boolean loadCompleted;
/**
* Checks if the document wants to prevent unloading by firing beforeunload on
+1 -1
View File
@@ -18,7 +18,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
this.EXPORTED_SYMBOLS = ["Langpacks"];
let debug;
var debug;
function debugPrefObserver() {
debug = Services.prefs.getBoolPref("dom.mozApps.debug")
? (aMsg) => {
+36
View File
@@ -0,0 +1,36 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<script>
<![CDATA[
function boom()
{
var d = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
d.setAttributeNS(null, "contenteditable", "true");
var s = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
d.appendChild(s);
document.documentElement.appendChild(d);
var textarea = document.createElementNS("http://www.w3.org/1999/xhtml", "textarea");
var t1 = document.createTextNode("A");
textarea.appendChild(t1);
var t2 = document.createTextNode("B");
textarea.appendChild(t2);
document.documentElement.appendChild(textarea);
document.documentElement.offsetHeight;
d.removeChild(s);
textarea.removeChild(t2);
document.documentElement.appendChild(document.createTextNode(" C "));
document.documentElement.appendChild(t2);
}
window.addEventListener("load", boom, false);
]]>
</script>
<!-- no body -->
</html>
+1
View File
@@ -148,6 +148,7 @@ load 709954.html
load 713417-1.html
load 713417-2.html
load 715056.html
load 729431-1.xhtml
load 741163-1.html
load 745495.html
load 752226-1.html
+2 -2
View File
@@ -172,7 +172,7 @@ var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix
}
});
let check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
info("checking " + file + " as image with histogram " + use_counter_middlefix);
let newTab = gBrowser.addTab("about:blank");
@@ -230,7 +230,7 @@ let check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
"document counts " + use_counter_middlefix + " after are correct");
});
let check_use_counter_direct = Task.async(function* (file, use_counter_middlefix, xfail=false) {
var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix, xfail=false) {
info("checking " + file + " with histogram " + use_counter_middlefix);
let newTab = gBrowser.addTab( "about:blank");
-1
View File
@@ -46,7 +46,6 @@ support-files =
[test_bug574596.html]
[test_bug1098074_throw_from_ReceiveMessage.xul]
skip-if = buildapp == 'mulet'
[test_bug599295.html]
[test_bug616841.xul]
[test_bug635835.xul]
[test_bug650776.html]
+1
View File
@@ -603,6 +603,7 @@ skip-if = toolkit == 'android' #bug 687032
[test_bug592366.html]
[test_bug592829.html]
[test_bug597345.html]
[test_bug599295.html]
[test_bug599588.html]
[test_bug601803.html]
[test_bug602838.html]
+47
View File
@@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=599295
-->
<head>
<title>Test for Bug 599295</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=599295">Mozilla Bug 599295</a>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 599295 **/
/* Do not allow a response to a CONNECT method, used to establish an
SSL tunnel over an HTTP proxy, to contain a redirect */
function runTest() {
/* Previously, necko would allow a 302 as part of a CONNECT response
if the LOAD_DOCUMENT_URI flag was set and the original document
URI had not yet been changed. */
SpecialPowers.loadChannelAndReturnStatus("https://redirproxy.example.com/test",
true)
.then(function({status, httpStatus}) {
/* testing here that the redirect was not followed. If it was followed
we would see a http status of 200 and status of NS_OK */
is(httpStatus, 302, "http status 302");
is(status, SpecialPowers.Cr.NS_ERROR_CONNECTION_REFUSED,
"raised refused");
SimpleTest.finish();
});
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTest);
</script>
</pre>
</body>
</html>
@@ -7,7 +7,7 @@
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.filter = 'drop-shadow(0 10px black)';
ctx.filter = 'drop-shadow(0 10px #000)';
ctx.globalAlpha = 0.5;
ctx.fillStyle = '#0f0';
ctx.fillRect(25, 25, 50, 40);
+1 -1
View File
@@ -3,7 +3,7 @@ default-preferences pref(canvas.filters.enabled,true)
== default-color.html ref.html
== drop-shadow.html ref.html
== drop-shadow-transformed.html ref.html
== global-alpha.html global-alpha-ref.html
fuzzy-if(azureSkia,1,1500) == global-alpha.html global-alpha-ref.html
== global-composite-operation.html global-composite-operation-ref.html
== liveness.html ref.html
== multiple-drop-shadows.html shadow-ref.html
@@ -10,8 +10,12 @@ var ctx = canvas.getContext('2d');
ctx.font = '20px sans-serif';
ctx.filter = 'drop-shadow(0 .5em black)';
ctx.fillStyle = '#0f0';
ctx.fillRect(25, 25, 25, 40);
ctx.fillRect(25, 25, 50, 40);
canvas.style.fontSize = '5px';
ctx.font = '4em sans-serif';
ctx.filter = 'drop-shadow(0 .5em black)';
</script>
</body>
</html>
+75 -73
View File
@@ -20,16 +20,15 @@ pref(webgl.force-layers-readback,true) == webgl-clear-test.html?readback wrappe
== webgl-resize-test.html wrapper.html?green.png
# Check that captureStream() displays in a local video element
skip-if(winWidget&&layersGPUAccelerated&&d2d) == webgl-capturestream-test.html?preserve wrapper.html?green.png
== webgl-capturestream-test.html?preserve wrapper.html?green.png
# Some of the failure conditions are a little crazy. I'm (jgilbert) setting these based on
# failures encountered when running on Try, and then targetting the Try config by
# differences in the `sandbox` contents. That is, I'm labeling based on symptoms rather
# than cause.
# Lin-R-e10s: gtkWidget && browserIsRemote
# WinXP-R: winWidget && layersGPUAccelerated && !d2d
# Win7+-R: winWidget && layersGPUAccelerated && d2d
# Win7+-Ru: winWidget && !layersGPUAccelerated
# WinXP R: winWidget && layersGPUAccelerated && !d3d11
# Win7+ R: winWidget && layersGPUAccelerated && d3d11
# Win7+ Ru: winWidget && !layersGPUAccelerated && d3d11
# (Note that we have to remove spaces when used below)
# IMPORTANT: Expected outcomes are evaluated left-to-right, and they replace eachother.
@@ -42,73 +41,73 @@ skip-if(winWidget&&layersGPUAccelerated&&d2d) == webgl-capturestream-test.html?p
# Does we draw the correct colors in the correct places?
# Combinations: PowerSet([readback, aa, preserve, premult, alpha]) x [frame=1,frame=6]
# This is 2^6 = 64 combinations.
== webgl-color-test.html?frame=1&__&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
== webgl-color-test.html?frame=1&__&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&aa&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&__&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&aa&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&__&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
== webgl-color-test.html?frame=1&__&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&aa&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&__&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&aa&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&__&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d3d11)) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
== webgl-color-test.html?frame=6&__&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&aa&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&__&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&aa&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&__&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
== webgl-color-test.html?frame=6&__&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&aa&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&__&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&aa&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d3d11)) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
# Check for hanging bindings/state settings:
== webgl-hanging-fb-test.html?__&________ wrapper.html?green.png
@@ -153,10 +152,13 @@ skip-if(!winWidget) pref(webgl.disable-angle,true) == webgl-color-test.html?nat
== stroketext-shadow.html stroketext-shadow-ref.html
# focus rings
pref(canvas.focusring.enabled,true) skip-if(B2G) skip-if(Android&&AndroidVersion<15,8,500) skip-if(winWidget) needs-focus == drawFocusIfNeeded.html drawFocusIfNeeded-ref.html
pref(canvas.customfocusring.enabled,true) skip-if(B2G) skip-if(Android&&AndroidVersion<15,8,500) skip-if(winWidget) needs-focus == drawCustomFocusRing.html drawCustomFocusRing-ref.html
pref(canvas.focusring.enabled,true) skip-if(B2G) skip-if(cocoaWidget) skip-if(winWidget) needs-focus == drawFocusIfNeeded.html drawFocusIfNeeded-ref.html
pref(canvas.customfocusring.enabled,true) skip-if(B2G) skip-if(cocoaWidget) skip-if(Android) skip-if(winWidget) fuzzy-if(gtkWidget,64,410) needs-focus == drawCustomFocusRing.html drawCustomFocusRing-ref.html
# Check that captureStream() displays in a local video element
skip-if(winWidget&&layersGPUAccelerated&&d2d) == capturestream.html wrapper.html?green.png
== capturestream.html wrapper.html?green.png
fuzzy-if(Android,3,40) == 1177726-text-stroke-bounds.html 1177726-text-stroke-bounds-ref.html
fuzzy-if(azureSkia,16,2) fuzzy-if(Android,3,40) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),1,1) == 1177726-text-stroke-bounds.html 1177726-text-stroke-bounds-ref.html
# Canvas Filter Reftests
include filters/reftest.list
+2 -10
View File
@@ -14366,11 +14366,7 @@ ctx.lineTo(50, 25);
ctx.closePath();
ctx.stroke();
if (IsAzureSkia()) {
isPixel(ctx, 50,25, 0,255,0,255, 0);
} else {
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
}
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
}
</script>
@@ -14507,11 +14503,7 @@ ctx.stroke();
ctx.strokeRect(50, 25, 0, 0);
if (IsAzureSkia()) {
isPixel(ctx, 50,25, 0,255,0,255, 0);
} else {
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
}
todo_isPixel(ctx, 50,25, 0,255,0,255, 0);
}
</script>
+3 -3
View File
@@ -5,9 +5,9 @@
*/
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
let imports = {};
var imports = {};
Cu.import("resource://gre/modules/ContactDB.jsm", imports);
Cu.import("resource://gre/modules/ContactService.jsm", imports);
@@ -28,7 +28,7 @@ Object.defineProperty(this, "Promise", {
value: imports.Promise, writable: false, configurable: false
});
let DEBUG = false;
var DEBUG = false;
function debug(str) {
if (DEBUG){
dump("-*- TestMigrationChromeScript: " + str + "\n");
+1 -1
View File
@@ -1,5 +1,5 @@
[DEFAULT]
skip-if = (buildapp == 'b2g' || buildapp == 'mulet')
skip-if = (buildapp == 'b2g' || os == 'android')
[test_app_permissions.html]
[test_fs_app_permissions.html]
-2
View File
@@ -1,5 +1,4 @@
[DEFAULT]
skip-if = (toolkit == 'android' && processor == 'x86') # Android: bug 781789 & bug 782275
support-files = devicestorage_common.js
remove_testing_directory.js
@@ -10,7 +9,6 @@ support-files = devicestorage_common.js
[test_available.html]
[test_basic.html]
[test_dirs.html]
skip-if = e10s # Bug 1063569.
# [test_diskSpace.html]
# Possible race between the time we write a file, and the
# time it takes to be reflected by statfs(). Bug # 791287
+1 -1
View File
@@ -161,7 +161,7 @@ function testNextRemove() {
ok(navigator.getDeviceStorage, "Should have getDeviceStorage.");
let gStorage = navigator.getDeviceStorage("pictures");
gStorage = navigator.getDeviceStorage("pictures");
ok(gStorage, "Should have gotten a storage.");
// Test "removeDeep" first.
+2 -2
View File
@@ -1,5 +1,5 @@
== bug863728-1.html bug863728-1-ref.html
== bug863728-2.html bug863728-2-ref.html
fuzzy-if(skiaContent,1,10) == bug863728-2.html bug863728-2-ref.html
== bug863728-3.html bug863728-3-ref.html
== bug945215-1.html bug945215-1-ref.html
== bug945215-2.html bug945215-2-ref.html
fuzzy-if(skiaContent,1,10) == bug945215-2.html bug945215-2-ref.html
+1 -1
View File
@@ -79,7 +79,7 @@ function assert_throws(ex, func) {
Components.stack.caller, false);
}
let tests = [];
var tests = [];
function test(func, msg) {
tests.push({msg: msg, func: func,
+7
View File
@@ -0,0 +1,7 @@
<html hidden>
<script>
function a(){document.getElementById('id1').click();}
window.onload = a;
</script>
<applet <ol onclick='' contenteditable='true' onended='' oncanplay=''>
<article id='id1'></article>
+1
View File
@@ -5,6 +5,7 @@ load 422009-1.xhtml
load 457776-1.html
load 496308-1.html
load 682637-1.html
load 938341.html
load 1033343.html
load 1035654-1.html
load 1035654-2.html
+1 -1
View File
@@ -1,7 +1,7 @@
SimpleTest.waitForExplicitFinish();
// The main testing function.
let test = function (isContent) {
var test = function (isContent) {
// Each definition is [eventType, prefSetting]
// Where we are setting the "privacy.resistFingerprinting" pref.
let eventDefs = [["mousedown", true],
+1 -1
View File
@@ -1,6 +1,6 @@
// This test is useful because mochitest-browser runs as an addon, so we test
// addon-scope paths here.
let ifr;
var ifr;
function test() {
ifr = document.createElement('iframe');
document.getElementById('main-window').appendChild(ifr);
+2 -2
View File
@@ -4,8 +4,8 @@
var testPath = "http://mochi.test:8888/browser/dom/html/test/";
var popup;
let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", null);
let {Services} = Cu.import("resource://gre/modules/Services.jsm", null);
var {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", null);
var {Services} = Cu.import("resource://gre/modules/Services.jsm", null);
function checkCache(url, inMemory, shouldExist, cb)
{
+1 -1
View File
@@ -1,4 +1,4 @@
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.importGlobalProperties(["File"]);
addMessageListener("files.open", function (message) {
+3 -3
View File
@@ -3,10 +3,10 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
let testGenerator = testSteps();
var testGenerator = testSteps();
let testResult;
let testException;
var testResult;
var testException;
function testFinishedCallback(result, exception)
{
+3 -3
View File
@@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let gTestRoot = getRootDirectory(gTestPath);
let gBugWindow = null;
let gIterations = 5;
var gTestRoot = getRootDirectory(gTestPath);
var gBugWindow = null;
var gIterations = 5;
function onLoad() {
gBugWindow.close();
+2 -2
View File
@@ -3,9 +3,9 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const { 'classes': Cc, 'interfaces': Ci, 'utils': Cu } = Components;
var { 'classes': Cc, 'interfaces': Ci, 'utils': Cu } = Components;
let testGenerator = testSteps();
var testGenerator = testSteps();
if (!window.runTest) {
window.runTest = function()
+1 -1
View File
@@ -3,7 +3,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
let gActiveListeners = {};
var gActiveListeners = {};
function registerPopupEventHandler(eventName, callback) {
gActiveListeners[eventName] = function (event) {
+2 -3
View File
@@ -9,8 +9,7 @@
interface nsIPushErrorReporter : nsISupports
{
/**
* Ack status codes, reported when the Push service acknowledges an incoming
* message.
* Ack types, reported when the Push service acknowledges an incoming message.
*
* Acks are sent before the message is dispatched to the service worker,
* since the server delays new messages until all outstanding ones have been
@@ -39,7 +38,7 @@ interface nsIPushErrorReporter : nsISupports
/**
* Reports a `push` event handler error to the Push service. |messageId| is
* an opaque string passed to `nsIPushNotifier.notifyPush{WithData}`.
* |status| is a delivery error reason.
* |reason| is a delivery error reason.
*/
void reportDeliveryError(in DOMString messageId,
[optional] in uint16_t reason);
+62 -5
View File
@@ -5,23 +5,53 @@
#include "nsISupports.idl"
%{C++
#include "nsTArray.h"
#include "mozilla/Maybe.h"
#define PUSHNOTIFIER_CONTRACTID \
"@mozilla.org/push/Notifier;1"
// These constants are duplicated in `PushComponents.js`.
#define OBSERVER_TOPIC_PUSH "push-message"
#define OBSERVER_TOPIC_SUBSCRIPTION_CHANGE "push-subscription-change"
#define OBSERVER_TOPIC_SUBSCRIPTION_LOST "push-subscription-lost"
%}
interface nsIPrincipal;
[ref] native MaybeData(const mozilla::Maybe<nsTArray<uint8_t>>);
/**
* Fires service worker events for push messages sent to content subscriptions,
* and XPCOM observer notifications for system subscriptions.
* Fires XPCOM observer notifications and service worker events for
* messages sent to push subscriptions.
*/
[scriptable, builtinclass, uuid(b00dfdeb-14e5-425b-adc7-b531442e3216)]
interface nsIPushNotifier : nsISupports
{
/**
* Fires a `push-message` observer notification, and sends a `push` event to
* the service worker registered for the |scope|. |messageId| is an opaque ID
* used to report errors if the worker fails to handle the message.
*/
void notifyPush(in ACString scope, in nsIPrincipal principal,
in DOMString messageId);
/**
* Same as `notifyPush`, except the subject of the observer notification
* receives an `nsIPushMessage` instance containing the |data|. Service
* workers can access the |data| via the `PushMessageData` WebIDL interface.
*/
void notifyPushWithData(in ACString scope, in nsIPrincipal principal,
in DOMString messageId,
[optional] in uint32_t dataLen,
[array, size_is(dataLen)] in uint8_t data);
/**
* Fires a `push-subscription-change` observer notification, and sends a
* `pushsubscriptionchange` event to the service worker registered for the
* |scope|.
*/
void notifySubscriptionChange(in ACString scope, in nsIPrincipal principal);
/**
@@ -41,12 +71,39 @@ interface nsIPushNotifier : nsISupports
void notifyError(in ACString scope, in nsIPrincipal principal,
in DOMString message, in uint32_t flags);
/**
* Internal methods used to fire service worker events and observer
* notifications. These are not exposed to JavaScript.
*/
[noscript, nostdcall]
void notifyPushWorkers(in ACString scope,
in nsIPrincipal principal,
in DOMString messageId,
in MaybeData data);
[noscript, nostdcall]
void notifyPushObservers(in ACString scope, in MaybeData data);
[noscript, nostdcall]
void notifySubscriptionChangeWorkers(in ACString scope,
in nsIPrincipal principal);
[noscript, nostdcall]
void notifySubscriptionChangeObservers(in ACString scope);
[noscript, nostdcall]
void notifySubscriptionLostObservers(in ACString scope, in uint16_t reason);
[noscript, nostdcall, notxpcom]
void notifyErrorWorkers(in ACString scope, in DOMString message,
in uint32_t flags);
};
/**
* A push message sent to a system subscription, used as the subject of a
* `push-message` observer notification. System subscriptions are created by
* the system principal, and do not use worker events.
* A push message sent to a subscription, used as the subject of a
* `push-message` observer notification.
*
* This interface resembles the `PushMessageData` WebIDL interface.
*/
+1
View File
@@ -18,6 +18,7 @@ interface nsIPushSubscription : nsISupports
readonly attribute long long pushCount;
readonly attribute long long lastPush;
readonly attribute long quota;
readonly attribute bool isSystemSubscription;
bool quotaApplies();
bool isExpired();
+9 -17
View File
@@ -166,7 +166,7 @@
#endif
#ifndef MOZ_SIMPLEPUSH
#include "mozilla/dom/PushNotifier.h"
#include "nsIPushNotifier.h"
#endif
#include "mozilla/dom/File.h"
@@ -3196,13 +3196,11 @@ ContentChild::RecvPush(const nsCString& aScope,
const nsString& aMessageId)
{
#ifndef MOZ_SIMPLEPUSH
nsCOMPtr<nsIPushNotifier> pushNotifierIface =
nsCOMPtr<nsIPushNotifier> pushNotifier =
do_GetService("@mozilla.org/push/Notifier;1");
if (NS_WARN_IF(!pushNotifierIface)) {
if (NS_WARN_IF(!pushNotifier)) {
return true;
}
PushNotifier* pushNotifier =
static_cast<PushNotifier*>(pushNotifierIface.get());
nsresult rv = pushNotifier->NotifyPushObservers(aScope, Nothing());
Unused << NS_WARN_IF(NS_FAILED(rv));
@@ -3221,13 +3219,11 @@ ContentChild::RecvPushWithData(const nsCString& aScope,
InfallibleTArray<uint8_t>&& aData)
{
#ifndef MOZ_SIMPLEPUSH
nsCOMPtr<nsIPushNotifier> pushNotifierIface =
nsCOMPtr<nsIPushNotifier> pushNotifier =
do_GetService("@mozilla.org/push/Notifier;1");
if (NS_WARN_IF(!pushNotifierIface)) {
if (NS_WARN_IF(!pushNotifier)) {
return true;
}
PushNotifier* pushNotifier =
static_cast<PushNotifier*>(pushNotifierIface.get());
nsresult rv = pushNotifier->NotifyPushObservers(aScope, Some(aData));
Unused << NS_WARN_IF(NS_FAILED(rv));
@@ -3244,13 +3240,11 @@ ContentChild::RecvPushSubscriptionChange(const nsCString& aScope,
const IPC::Principal& aPrincipal)
{
#ifndef MOZ_SIMPLEPUSH
nsCOMPtr<nsIPushNotifier> pushNotifierIface =
nsCOMPtr<nsIPushNotifier> pushNotifier =
do_GetService("@mozilla.org/push/Notifier;1");
if (NS_WARN_IF(!pushNotifierIface)) {
if (NS_WARN_IF(!pushNotifier)) {
return true;
}
PushNotifier* pushNotifier =
static_cast<PushNotifier*>(pushNotifierIface.get());
nsresult rv = pushNotifier->NotifySubscriptionChangeObservers(aScope);
Unused << NS_WARN_IF(NS_FAILED(rv));
@@ -3266,13 +3260,11 @@ ContentChild::RecvPushError(const nsCString& aScope, const nsString& aMessage,
const uint32_t& aFlags)
{
#ifndef MOZ_SIMPLEPUSH
nsCOMPtr<nsIPushNotifier> pushNotifierIface =
nsCOMPtr<nsIPushNotifier> pushNotifier =
do_GetService("@mozilla.org/push/Notifier;1");
if (NS_WARN_IF(!pushNotifierIface)) {
if (NS_WARN_IF(!pushNotifier)) {
return true;
}
PushNotifier* pushNotifier =
static_cast<PushNotifier*>(pushNotifierIface.get());
pushNotifier->NotifyErrorWorkers(aScope, aMessage, aFlags);
#endif
return true;
+9 -17
View File
@@ -260,7 +260,7 @@ using namespace mozilla::system;
#endif
#ifndef MOZ_SIMPLEPUSH
#include "mozilla/dom/PushNotifier.h"
#include "nsIPushNotifier.h"
#endif
#ifdef XP_WIN
@@ -5832,13 +5832,11 @@ ContentParent::RecvNotifyPushObservers(const nsCString& aScope,
const nsString& aMessageId)
{
#ifndef MOZ_SIMPLEPUSH
nsCOMPtr<nsIPushNotifier> pushNotifierIface =
nsCOMPtr<nsIPushNotifier> pushNotifier =
do_GetService("@mozilla.org/push/Notifier;1");
if (NS_WARN_IF(!pushNotifierIface)) {
if (NS_WARN_IF(!pushNotifier)) {
return true;
}
PushNotifier* pushNotifier =
static_cast<PushNotifier*>(pushNotifierIface.get());
nsresult rv = pushNotifier->NotifyPushObservers(aScope, Nothing());
Unused << NS_WARN_IF(NS_FAILED(rv));
@@ -5852,13 +5850,11 @@ ContentParent::RecvNotifyPushObserversWithData(const nsCString& aScope,
InfallibleTArray<uint8_t>&& aData)
{
#ifndef MOZ_SIMPLEPUSH
nsCOMPtr<nsIPushNotifier> pushNotifierIface =
nsCOMPtr<nsIPushNotifier> pushNotifier =
do_GetService("@mozilla.org/push/Notifier;1");
if (NS_WARN_IF(!pushNotifierIface)) {
if (NS_WARN_IF(!pushNotifier)) {
return true;
}
PushNotifier* pushNotifier =
static_cast<PushNotifier*>(pushNotifierIface.get());
nsresult rv = pushNotifier->NotifyPushObservers(aScope, Some(aData));
Unused << NS_WARN_IF(NS_FAILED(rv));
@@ -5870,13 +5866,11 @@ bool
ContentParent::RecvNotifyPushSubscriptionChangeObservers(const nsCString& aScope)
{
#ifndef MOZ_SIMPLEPUSH
nsCOMPtr<nsIPushNotifier> pushNotifierIface =
nsCOMPtr<nsIPushNotifier> pushNotifier =
do_GetService("@mozilla.org/push/Notifier;1");
if (NS_WARN_IF(!pushNotifierIface)) {
if (NS_WARN_IF(!pushNotifier)) {
return true;
}
PushNotifier* pushNotifier =
static_cast<PushNotifier*>(pushNotifierIface.get());
nsresult rv = pushNotifier->NotifySubscriptionChangeObservers(aScope);
Unused << NS_WARN_IF(NS_FAILED(rv));
@@ -5889,13 +5883,11 @@ ContentParent::RecvNotifyPushSubscriptionLostObservers(const nsCString& aScope,
const uint16_t& aReason)
{
#ifndef MOZ_SIMPLEPUSH
nsCOMPtr<nsIPushNotifier> pushNotifierIface =
nsCOMPtr<nsIPushNotifier> pushNotifier =
do_GetService("@mozilla.org/push/Notifier;1");
if (NS_WARN_IF(!pushNotifierIface)) {
if (NS_WARN_IF(!pushNotifier)) {
return true;
}
PushNotifier* pushNotifier =
static_cast<PushNotifier*>(pushNotifierIface.get());
nsresult rv = pushNotifier->NotifySubscriptionLostObservers(aScope, aReason);
Unused << NS_WARN_IF(NS_FAILED(rv));
@@ -35,10 +35,10 @@ ignoringDuplicateSrc = Ignoring duplicate source %1$S
# LOCALIZATION NOTE (ignoringSrcFromMetaCSP):
# %1$S defines the ignored src
ignoringSrcFromMetaCSP = Ignoring source '%1$S' (Not supported when delivered via meta element).
# LOCALIZATION NOTE (ignoringSrcWithinScriptSrc):
# LOCALIZATION NOTE (ignoringSrcWithinScriptStyleSrc):
# %1$S is the ignored src
# script-src is a directive name and should not be localized
ignoringSrcWithinScriptSrc = Ignoring "%1$S" within script-src: nonce-source or hash-source specified
# script-src and style-src are directive names and should not be localized
ignoringSrcWithinScriptStyleSrc = Ignoring "%1$S" within script-src or style-src: nonce-source or hash-source specified
# LOCALIZATION NOTE (reportURInotHttpsOrHttp2):
# %1$S is the ETLD of the report URI that is not HTTP or HTTPS
reportURInotHttpsOrHttp2 = The report URI (%1$S) should be an HTTP or HTTPS URI.
+3 -1
View File
@@ -1,5 +1,4 @@
[DEFAULT]
support-files =
common.js
resource.sjs
@@ -7,6 +6,7 @@ support-files =
[test_ImageObjectProcessor_sizes.html]
[test_ImageObjectProcessor_src.html]
[test_ImageObjectProcessor_type.html]
[test_ManifestProcessor_background_color.html]
[test_ManifestProcessor_dir.html]
[test_ManifestProcessor_display.html]
[test_ManifestProcessor_icons.html]
@@ -16,3 +16,5 @@ support-files =
[test_ManifestProcessor_orientation.html]
[test_ManifestProcessor_scope.html]
[test_ManifestProcessor_start_url.html]
[test_ManifestProcessor_theme_color.html]
[test_ManifestProcessor_warnings.html]
@@ -35,7 +35,7 @@ var noSrc = {
var expected = `Expect icons without a src prop to be filtered out.`;
data.jsonText = JSON.stringify(noSrc);
var result = processor.process(data);
ise(result.icons.length, 0, expected);
is(result.icons.length, 0, expected);
var invalidSrc = {
icons: [{
@@ -56,7 +56,7 @@ var invalidSrc = {
var expected = `Expect icons with invalid src prop to be filtered out.`;
data.jsonText = JSON.stringify(noSrc);
var result = processor.process(data);
ise(result.icons.length, 0, expected);
is(result.icons.length, 0, expected);
var expected = `Expect icon's src to be a string.`;
var withSrc = {
@@ -66,7 +66,7 @@ var withSrc = {
};
data.jsonText = JSON.stringify(withSrc);
var result = processor.process(data);
ise(typeof result.icons[0].src, "string", expected);
is(typeof result.icons[0].src, "string", expected);
var expected = `Expect only icons with a src prop to be kept.`;
var withSrc = {
@@ -80,12 +80,12 @@ var withSrc = {
};
data.jsonText = JSON.stringify(withSrc);
var result = processor.process(data);
ise(result.icons.length, 2, expected);
is(result.icons.length, 2, expected);
var expectedURL = new URL('pass', manifestURL);
for (var icon of result.icons) {
var expected = `Expect src prop to be ${expectedURL.toString()}`;
ise(icon.src.toString(), expectedURL.toString(), expected);
is(icon.src.toString(), expectedURL.toString(), expected);
}
//Resolve URLs relative to manfiest
@@ -100,7 +100,7 @@ URLs.forEach((url) => {
});
var absURL = new URL(url, manifestURL).toString();
var result = processor.process(data);
ise(result.icons[0].src.toString(), absURL, expected);
is(result.icons[0].src.toString(), absURL, expected);
});
</script>
</head>
@@ -35,7 +35,7 @@ invalidMimeTypes.forEach((invalidMime) => {
testIcon.icons[0].type = invalidMime;
data.jsonText = JSON.stringify(testIcon);
var result = processor.process(data);
ise(result.icons[0].type, undefined, expected);
is(result.icons[0].type, undefined, expected);
});
var validTypes = [
@@ -51,7 +51,7 @@ validTypes.forEach((validMime) => {
testIcon.icons[0].type = validMime;
data.jsonText = JSON.stringify(testIcon);
var result = processor.process(data);
ise(result.icons[0].type, 'image/jpeg', expected);
is(result.icons[0].type, 'image/jpeg', expected);
});
</script>
</head>
@@ -0,0 +1,94 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1195018
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1195018</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="common.js"></script>
<script>
/**
* background_color member
* https://w3c.github.io/manifest/#background_color-member
**/
'use strict';
typeTests.forEach(type => {
data.jsonText = JSON.stringify({
background_color: type
});
var result = processor.process(data);
is(result.background_color, undefined, `Expect non-string background_color to be undefined: ${typeof type}.`);
});
var validThemeColors = [
'maroon',
'#f00',
'#ff0000',
'rgb(255,0,0)',
'rgb(100%, 0%, 0%)',
'rgb(255,0,0)',
'rgb(300,0,0)',
'rgb(255,-10,0)',
'rgb(110%, 0%, 0%)',
'rgb(255,0,0)',
'rgba(255,0,0,1)',
'rgb(100%,0%,0%)',
'rgba(100%,0%,0%,1)',
'rgba(0,0,255,0.5)',
'rgba(100%, 50%, 0%, 0.1)',
'hsl(120, 100%, 50%)',
'hsla(120, 100%, 50%, 1)',
];
validThemeColors.forEach(background_color => {
data.jsonText = JSON.stringify({
background_color: background_color
});
var result = processor.process(data);
is(result.background_color, background_color, `Expect background_color to be returned: ${background_color}.`);
});
var invalidThemeColors = [
'marooon',
'f000000',
'#ff00000',
'rgb(255 0 0)',
'rgb(100, 0%, 0%)',
'rgb(255,0)',
'rgb(300 0 0)',
'rbg(255,-10,0)',
'rgb(110, 0%, 0%)',
'(255,0,0) }',
'rgba(255)',
' rgb(100%,0%,0%) }',
'hsl 120, 100%, 50%',
'hsla{120, 100%, 50%, 1}',
]
invalidThemeColors.forEach(background_color => {
data.jsonText = JSON.stringify({
background_color: background_color
});
var result = processor.process(data);
is(result.background_color, undefined, `Expect background_color to be undefined: ${background_color}.`);
});
// Trim tests
validThemeColors.forEach(background_color => {
var expandedThemeColor = `${seperators}${lineTerminators}${background_color}${lineTerminators}${seperators}`;
data.jsonText = JSON.stringify({
background_color: expandedThemeColor
});
var result = processor.process(data);
is(result.background_color, background_color, `Expect trimmed background_color to be returned.`);
});
</script>
</head>
@@ -0,0 +1,94 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1195018
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1195018</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="common.js"></script>
<script>
/**
* theme_color member
* https://w3c.github.io/manifest/#theme_color-member
**/
'use strict';
typeTests.forEach(type => {
data.jsonText = JSON.stringify({
theme_color: type
});
var result = processor.process(data);
is(result.theme_color, undefined, `Expect non-string theme_color to be undefined: ${typeof type}.`);
});
var validThemeColors = [
'maroon',
'#f00',
'#ff0000',
'rgb(255,0,0)',
'rgb(100%, 0%, 0%)',
'rgb(255,0,0)',
'rgb(300,0,0)',
'rgb(255,-10,0)',
'rgb(110%, 0%, 0%)',
'rgb(255,0,0)',
'rgba(255,0,0,1)',
'rgb(100%,0%,0%)',
'rgba(100%,0%,0%,1)',
'rgba(0,0,255,0.5)',
'rgba(100%, 50%, 0%, 0.1)',
'hsl(120, 100%, 50%)',
'hsla(120, 100%, 50%, 1)',
];
validThemeColors.forEach(theme_color => {
data.jsonText = JSON.stringify({
theme_color: theme_color
});
var result = processor.process(data);
is(result.theme_color, theme_color, `Expect theme_color to be returned: ${theme_color}.`);
});
var invalidThemeColors = [
'marooon',
'f000000',
'#ff00000',
'rgb(255 0 0)',
'rgb(100, 0%, 0%)',
'rgb(255,0)',
'rgb(300 0 0)',
'rbg(255,-10,0)',
'rgb(110, 0%, 0%)',
'(255,0,0) }',
'rgba(255)',
' rgb(100%,0%,0%) }',
'hsl 120, 100%, 50%',
'hsla{120, 100%, 50%, 1}',
]
invalidThemeColors.forEach(theme_color => {
data.jsonText = JSON.stringify({
theme_color: theme_color
});
var result = processor.process(data);
is(result.theme_color, undefined, `Expect theme_color to be undefined: ${theme_color}.`);
});
// Trim tests
validThemeColors.forEach(theme_color => {
var expandedThemeColor = `${seperators}${lineTerminators}${theme_color}${lineTerminators}${seperators}`;
data.jsonText = JSON.stringify({
theme_color: expandedThemeColor
});
var result = processor.process(data);
is(result.theme_color, theme_color, `Expect trimmed theme_color to be returned.`);
});
</script>
</head>
@@ -0,0 +1,90 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1086997
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1086997</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="common.js"></script>
<script>
'use strict';
const {
ConsoleAPI
} = SpecialPowers.Cu.import('resource://gre/modules/Console.jsm');
var warning = null;
var originalWarn = ConsoleAPI.prototype.warn;
ConsoleAPI.prototype.warn = function(aWarning) {
warning = aWarning;
};
[
{
func: () => data.jsonText = JSON.stringify(1),
warning: 'Manifest should be an object.',
},
{
func: () => data.jsonText = JSON.stringify(null),
warning: 'Manifest should be an object.',
},
{
func: () => data.jsonText = JSON.stringify('a string'),
warning: 'Manifest should be an object.',
},
{
func: () => data.jsonText = JSON.stringify({
scope: 'https://www.mozilla.org',
}),
warning: 'The scope URL must be same origin as document.',
},
{
func: () => data.jsonText = JSON.stringify({
scope: 'foo',
start_url: 'bar',
}),
warning: 'The start URL is outside the scope, so the scope is invalid.',
},
{
func: () => data.jsonText = JSON.stringify({
start_url: 'https://www.mozilla.org',
}),
warning: 'The start URL must be same origin as document.',
},
{
func: () => data.jsonText = JSON.stringify({
start_url: 42,
}),
warning: 'Expected the manifest\u2019s start_url member to be a string.',
},
{
func: () => data.jsonText = JSON.stringify({
theme_color: '42',
}),
warning: 'theme_color: 42 is not a valid CSS color.',
},
{
func: () => data.jsonText = JSON.stringify({
background_color: '42',
}),
warning: 'background_color: 42 is not a valid CSS color.',
},
].forEach(function(test) {
test.func();
processor.process(data);
is(warning, test.warning, 'Correct warning.');
warning = null;
data.manifestURL = manifestURL;
data.docURL = docURL;
});
ConsoleAPI.prototype.warn = originalWarn;
</script>
</head>
+14 -7
View File
@@ -303,14 +303,21 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
mMetadataPromise.Reject(ReadMetadataFailureReason::METADATA_ERROR, __func__);
return;
}
mInfo.mAudio = *mAudio.mTrackDemuxer->GetInfo()->GetAsAudioInfo();
UniquePtr<TrackInfo> info(mAudio.mTrackDemuxer->GetInfo());
for (const MetadataTag& tag : info->mTags) {
tags->Put(tag.mKey, tag.mValue);
UniquePtr<TrackInfo> audioInfo = mAudio.mTrackDemuxer->GetInfo();
// We actively ignore audio tracks that we know we can't play.
audioActive = audioInfo && audioInfo->IsValid();
if (audioActive) {
mInfo.mAudio = *audioInfo->GetAsAudioInfo();
for (const MetadataTag& tag : audioInfo->mTags) {
tags->Put(tag.mKey, tag.mValue);
}
mAudio.mCallback = new DecoderCallback(this, TrackInfo::kAudioTrack);
mAudio.mTimeRanges = mAudio.mTrackDemuxer->GetBuffered();
mTrackDemuxersMayBlock |= mAudio.mTrackDemuxer->GetSamplesMayBlock();
} else {
mAudio.mTrackDemuxer->BreakCycles();
mAudio.mTrackDemuxer = nullptr;
}
mAudio.mCallback = new DecoderCallback(this, TrackInfo::kAudioTrack);
mAudio.mTimeRanges = mAudio.mTrackDemuxer->GetBuffered();
mTrackDemuxersMayBlock |= mAudio.mTrackDemuxer->GetSamplesMayBlock();
}
UniquePtr<EncryptionInfo> crypto = mDemuxer->GetCrypto();
+9 -4
View File
@@ -34,6 +34,9 @@ public:
nsCString mValue;
};
// Maximum channel number we can currently handle (7.1)
#define MAX_AUDIO_CHANNELS 8
class TrackInfo {
public:
enum TrackType {
@@ -331,7 +334,7 @@ public:
bool IsValid() const override
{
return mChannels > 0 && mRate > 0;
return mChannels > 0 && mChannels <= MAX_AUDIO_CHANNELS && mRate > 0;
}
AudioInfo* GetAsAudioInfo() override
@@ -543,9 +546,6 @@ public:
const nsCString& mMimeType;
};
// Maximum channel number we can currently handle (7.1)
#define MAX_AUDIO_CHANNELS 8
class AudioConfig {
public:
enum Channel {
@@ -685,6 +685,11 @@ public:
return !(*this == aOther);
}
bool IsValid() const
{
return mChannelLayout.IsValid() && Format() != FORMAT_NONE && Rate() > 0;
}
static const char* FormatToString(SampleFormat aFormat);
static uint32_t SampleSize(SampleFormat aFormat);
static uint32_t FormatToBits(SampleFormat aFormat);
+3 -2
View File
@@ -72,10 +72,11 @@ public:
base::ProcessId otherProcess;
nsCString displayName;
uint32_t pluginId;
nsresult rv;
bool ok = aGMPServiceChild->SendLoadGMP(mNodeId, mAPI, mTags,
alreadyBridgedTo, &otherProcess,
&displayName, &pluginId);
if (!ok) {
&displayName, &pluginId, &rv);
if (!ok || rv == NS_ERROR_ILLEGAL_DURING_SHUTDOWN) {
mCallback->Done(nullptr);
return;
}
+15 -1
View File
@@ -685,6 +685,13 @@ GeckoMediaPluginServiceParent::NotifySyncShutdownComplete()
mWaitingForPluginsSyncShutdown = false;
}
bool
GeckoMediaPluginServiceParent::IsShuttingDown()
{
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
return mShuttingDownOnGMPThread;
}
void
GeckoMediaPluginServiceParent::UnloadPlugins()
{
@@ -1785,8 +1792,15 @@ GMPServiceParent::RecvLoadGMP(const nsCString& aNodeId,
nsTArray<ProcessId>&& aAlreadyBridgedTo,
ProcessId* aId,
nsCString* aDisplayName,
uint32_t* aPluginId)
uint32_t* aPluginId,
nsresult* aRv)
{
*aRv = NS_OK;
if (mService->IsShuttingDown()) {
*aRv = NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
return true;
}
RefPtr<GMPParent> gmp = mService->SelectPluginForAPI(aNodeId, aAPI, aTags);
nsCString api = aTags[0];
+5 -1
View File
@@ -59,6 +59,9 @@ public:
RefPtr<GenericPromise> EnsureInitialized();
RefPtr<GenericPromise> AsyncAddPluginDirectory(const nsAString& aDirectory);
// GMP thread access only
bool IsShuttingDown();
private:
friend class GMPServiceParent;
@@ -221,7 +224,8 @@ public:
nsTArray<ProcessId>&& aAlreadyBridgedTo,
base::ProcessId* aID,
nsCString* aDisplayName,
uint32_t* aPluginId) override;
uint32_t* aPluginId,
nsresult* aRv) override;
bool RecvGetGMPNodeId(const nsString& aOrigin,
const nsString& aTopLevelOrigin,
const nsString& aGMPName,
-2
View File
@@ -14,8 +14,6 @@
#include "GMPCallbackBase.h"
#include "GMPUtils.h"
class nsCString;
class GMPVideoDecoderCallbackProxy : public GMPCallbackBase,
public GMPVideoDecoderCallback
{
+2 -1
View File
@@ -17,7 +17,8 @@ sync protocol PGMPService
parent:
sync LoadGMP(nsCString nodeId, nsCString api, nsCString[] tags,
ProcessId[] alreadyBridgedTo)
returns (ProcessId id, nsCString displayName, uint32_t pluginId);
returns (ProcessId id, nsCString displayName, uint32_t pluginId,
nsresult aResult);
sync GetGMPNodeId(nsString origin, nsString topLevelOrigin,
nsString gmpName,
bool inPrivateBrowsing)
+8
View File
@@ -0,0 +1,8 @@
#include <stdint.h>
extern "C" uint8_t* test_rust();
TEST(rust, CallFromCpp) {
auto greeting = test_rust();
EXPECT_STREQ(reinterpret_cast<char*>(greeting), "hello from rust.");
}
+6
View File
@@ -0,0 +1,6 @@
#[no_mangle]
pub extern fn test_rust() -> *const u8 {
// NB: rust &str aren't null terminated.
let greeting = "hello from rust.\0";
greeting.as_ptr()
}
+5
View File
@@ -29,6 +29,11 @@ if CONFIG['MOZ_WEBM_ENCODER']:
'TestWebMWriter.cpp',
]
if CONFIG['MOZ_RUST']:
SOURCES += ['hello.rs',]
UNIFIED_SOURCES += ['TestRust.cpp',]
TEST_HARNESS_FILES.gtest += [
'../test/gizmo-frag.mp4',
'../test/gizmo.mp4',
+12 -2
View File
@@ -283,7 +283,7 @@ MediaSourceDecoder::NextFrameBufferedStatus()
TimeInterval interval(currentPosition,
currentPosition + media::TimeUnit::FromMicroseconds(DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED),
MediaSourceDemuxer::EOS_FUZZ);
return GetBuffered().Contains(interval)
return GetBuffered().Contains(ClampIntervalToEnd(interval))
? MediaDecoderOwner::NEXT_FRAME_AVAILABLE
: MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
}
@@ -313,7 +313,17 @@ MediaSourceDecoder::CanPlayThrough()
TimeInterval interval(currentPosition,
timeAhead,
MediaSourceDemuxer::EOS_FUZZ);
return GetBuffered().Contains(interval);
return GetBuffered().Contains(ClampIntervalToEnd(interval));
}
TimeInterval
MediaSourceDecoder::ClampIntervalToEnd(const TimeInterval& aInterval)
{
if (!mEnded) {
return aInterval;
}
TimeInterval interval(TimeUnit(), TimeUnit::FromSeconds(GetDuration()));
return aInterval.Intersection(interval);
}
#undef MSE_DEBUG
@@ -83,6 +83,7 @@ public:
private:
void DoSetMediaSourceDuration(double aDuration);
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
// The owning MediaSource holds a strong reference to this decoder, and
// calls Attach/DetachMediaSource on this decoder to set and clear
-2
View File
@@ -14,5 +14,3 @@ LOCAL_INCLUDES += [
]
FINAL_LIBRARY = 'xul-gtest'
FAIL_ON_WARNINGS = True
+3
View File
@@ -38,4 +38,7 @@ TEST_DIRS += [
'gtest',
]
if CONFIG['MOZ_GONK_MEDIACODEC']:
DEFINES['MOZ_GONK_MEDIACODEC'] = True
FINAL_LIBRARY = 'xul'
@@ -0,0 +1 @@
Cache-Control: no-store
@@ -0,0 +1 @@
Cache-Control: no-store
@@ -0,0 +1 @@
Cache-Control: no-store
+16 -3
View File
@@ -54,8 +54,8 @@ function range(start, end) {
function once(target, name, cb) {
var p = new Promise(function(resolve, reject) {
target.addEventListener(name, function() {
target.removeEventListener(name, arguments.callee);
target.addEventListener(name, function onceEvent() {
target.removeEventListener(name, onceEvent);
resolve();
});
});
@@ -115,4 +115,17 @@ SimpleTest.registerTimeoutFunction(function() {
for (var a of document.getElementsByTagName("audio")) {
a.mozDumpDebugInfo();
}
});
});
function waitUntilTime(target, targetTime) {
return new Promise(function(resolve, reject) {
target.addEventListener("waiting", function onwaiting() {
info("Got a waiting event at " + target.currentTime);
if (target.currentTime >= targetTime) {
ok(true, "Reached target time of: " + targetTime);
target.removeEventListener("waiting", onwaiting);
resolve();
}
});
});
}
+60 -41
View File
@@ -1,5 +1,6 @@
[DEFAULT]
skip-if = e10s || buildapp == 'b2g' # b2g( ReferenceError: MediaSource is not defined)
skip-if = buildapp == 'b2g' # b2g( ReferenceError: MediaSource is not defined)
subsuite = media
support-files =
mediasource.js
seek.webm seek.webm^headers^
@@ -19,89 +20,107 @@ support-files =
bipbop/bipbop11.m4s bipbop/bipbop_audio11.m4s bipbop/bipbop_video11.m4s
bipbop/bipbop12.m4s bipbop/bipbop_video12.m4s
bipbop/bipbop13.m4s bipbop/bipbop_video13.m4s
bipbop/bipbopinit.mp4^headers^ bipbop/bipbop_audioinit.mp4^headers^ bipbop/bipbop_videoinit.mp4^headers^
bipbop/bipbop1.m4s^headers^ bipbop/bipbop_audio1.m4s^headers^ bipbop/bipbop_video1.m4s^headers^
bipbop/bipbop2.m4s^headers^ bipbop/bipbop_audio2.m4s^headers^ bipbop/bipbop_video2.m4s^headers^
bipbop/bipbop3.m4s^headers^ bipbop/bipbop_audio3.m4s^headers^ bipbop/bipbop_video3.m4s^headers^
bipbop/bipbop4.m4s^headers^ bipbop/bipbop_audio4.m4s^headers^ bipbop/bipbop_video4.m4s^headers^
bipbop/bipbop5.m4s^headers^ bipbop/bipbop_audio5.m4s^headers^ bipbop/bipbop_video5.m4s^headers^
bipbop/bipbop6.m4s^headers^ bipbop/bipbop_audio6.m4s^headers^ bipbop/bipbop_video6.m4s^headers^
bipbop/bipbop7.m4s^headers^ bipbop/bipbop_audio7.m4s^headers^ bipbop/bipbop_video7.m4s^headers^
bipbop/bipbop8.m4s^headers^ bipbop/bipbop_audio8.m4s^headers^ bipbop/bipbop_video8.m4s^headers^
bipbop/bipbop9.m4s^headers^ bipbop/bipbop_audio9.m4s^headers^ bipbop/bipbop_video9.m4s^headers^
bipbop/bipbop10.m4s^headers^ bipbop/bipbop_audio10.m4s^headers^ bipbop/bipbop_video10.m4s^headers^
bipbop/bipbop11.m4s^headers^ bipbop/bipbop_audio11.m4s^headers^ bipbop/bipbop_video11.m4s^headers^
bipbop/bipbop12.m4s^headers^ bipbop/bipbop_video12.m4s^headers^
bipbop/bipbop13.m4s^headers^ bipbop/bipbop_video13.m4s^headers^
aac20-48000-64000-init.mp4 aac20-48000-64000-init.mp4^headers^
aac20-48000-64000-1.m4s aac20-48000-64000-1.m4s^headers^
aac20-48000-64000-2.m4s aac20-48000-64000-2.m4s^headers^
aac51-48000-128000-init.mp4 aac51-48000-128000-init.mp4^headers^
aac51-48000-128000-1.m4s aac51-48000-128000-1.m4s^headers^
aac51-48000-128000-2.m4s aac51-48000-128000-2.m4s^headers^
bipbop/bipbop_480_624kbps-videoinit.mp4 bipbop/bipbop_480_624kbps-videoinit.mp4^headers^
bipbop/bipbop_480_624kbps-video1.m4s bipbop/bipbop_480_624kbps-video1.m4s^headers^
bipbop/bipbop_480_624kbps-video2.m4s bipbop/bipbop_480_624kbps-video2.m4s^headers^
[test_AudioChange_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_BufferedSeek.html]
skip-if = true # bug 1182946
[test_BufferedSeek_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_BufferingWait.html]
skip-if = true # bug 1182946
skip-if = toolkit == 'android' #timeout android bug 1199531
[test_BufferingWait_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_DrainOnMissingData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_EndOfStream.html]
skip-if = (true || toolkit == 'android' || buildapp == 'mulet') #timeout android/mulet only bug 1101187 and bug 1182946
[test_EndOfStream_mp4.html]
skip-if = (toolkit == 'android' || buildapp == 'mulet') || ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android' || buildapp == 'mulet')) # Not supported on xp and android 2.3
[test_DurationUpdated.html]
skip-if = true # bug 1182946
[test_DurationUpdated_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_FrameSelection.html]
skip-if = true # bug 1182946
[test_FrameSelection_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_HaveMetadataUnbufferedSeek.html]
skip-if = true # bug 1182946
[test_HaveMetadataUnbufferedSeek_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_LoadedDataFired_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_LiveSeekable.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_LoadedMetadataFired.html]
skip-if = true # bug 1182946
[test_LoadedMetadataFired_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_MediaSource.html]
skip-if = true # bug 1182946
[test_MediaSource_memory_reporting.html]
[test_MediaSource_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_MediaSource_disabled.html]
[test_OnEvents.html]
[test_MultipleInitSegments.html]
[test_MultipleInitSegments_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_PlayEvents.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_ResumeAfterClearing_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SeekableAfterEndOfStream.html]
skip-if = true # bug 1182946
[test_SeekableAfterEndOfStream_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SeekableAfterEndOfStreamSplit.html]
skip-if = true # bug 1182946
[test_SeekableAfterEndOfStreamSplit_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SeekableBeforeEndOfStream.html]
skip-if = true # bug 1182946
[test_SeekableBeforeEndOfStream_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SeekableBeforeEndOfStreamSplit.html]
skip-if = true # bug 1182946
[test_SeekableBeforeEndOfStreamSplit_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SeekNoData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SeekedEvent_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SeekTwice_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_Sequence_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SetModeThrows.html]
skip-if = true # bug 1182946
[test_SplitAppendDelay.html]
skip-if = true # bug 1182946
[test_SplitAppendDelay_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_SplitAppend.html]
skip-if = true # bug 1182946
[test_SplitAppend_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_TimestampOffset_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_TruncatedDuration.html]
skip-if = true # bug 1182946
[test_TruncatedDuration_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_WaitingOnMissingData.html]
skip-if = true # Disabled due to bug 1124493 and friends. WebM MSE is deprioritized.
[test_WaitingOnMissingData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_WaitingToEndedTransition_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
@@ -0,0 +1,72 @@
<!DOCTYPE HTML>
<html>
<head>
<title>MSE: basic functionality</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
// This test checks loading a stereo segment, followed by a 5.1 segment plays without error.
runWithMSE(function(ms, el) {
el.controls = true;
once(ms, 'sourceopen').then(function() {
// Log events for debugging.
var events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
"loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
"waiting", "pause", "durationchange", "seeking", "seeked"];
function logEvent(e) {
var v = e.target;
info("got " + e.type + " event");
}
events.forEach(function(e) {
el.addEventListener(e, logEvent, false);
});
ok(true, "Receive a sourceopen event");
var audiosb = ms.addSourceBuffer("audio/mp4");
el.addEventListener("error", function(e) {
ok(false, "should not fire '" + e.type + "' event");
SimpleTest.finish();
});
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
fetchAndLoad(audiosb, 'aac20-48000-64000-', ['init'], '.mp4')
.then(once.bind(null, el, 'loadedmetadata'))
.then(function() {
ok(true, "got loadedmetadata event");
var promises = [];
promises.push(once(el, 'loadeddata'));
promises.push(once(el, 'canplay'));
promises.push(fetchAndLoad(audiosb, 'aac20-48000-64000-', ['1'], '.m4s'));
return Promise.all(promises);
})
.then(function() {
ok(true, "got canplay event");
el.play();
return fetchAndLoad(audiosb, 'aac51-48000-128000-', ['init'], '.mp4');
})
.then(fetchAndLoad.bind(null, audiosb, 'aac51-48000-128000-', ['2'], '.m4s'))
.then(function() {
var promises = [];
ms.endOfStream();
promises.push(once(el, 'ended'));
promises.push(once(audiosb, 'updateend'));
return Promise.all(promises);
})
.then(function() {
ok(el.currentTime >= 6, "played to the end");
SimpleTest.finish();
})
});
});
</script>
</pre>
</body>
</html>
@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>MSE: Don't get stuck buffering for too long when we have frames to show</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
// This test loads partial video, plays and waits until playback stalls.
// It then loads only 3 frames of a video at higher resolution.
var receivedSourceOpen = false;
runWithMSE(function(ms, v) {
ms.addEventListener("sourceopen", function() {
ok(true, "Receive a sourceopen event");
ok(!receivedSourceOpen, "Should only receive one sourceopen for this test");
receivedSourceOpen = true;
var sb = ms.addSourceBuffer("video/mp4");
ok(sb, "Create a SourceBuffer");
// Log events for debugging.
var events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
"loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
"waiting", "pause", "durationchange", "seeking", "seeked"];
function logEvent(e) {
var v = e.target;
info("got " + e.type + " event");
}
events.forEach(function(e) {
v.addEventListener(e, logEvent, false);
});
sb.addEventListener('error', (e) => { ok(false, "Got Error: " + e); SimpleTest.finish(); });
fetchAndLoad(sb, 'bipbop/bipbop', ['init'], '.mp4')
.then(function() {
var promises = [];
promises.push(fetchAndLoad(sb, 'bipbop/bipbop', range(1,3), '.m4s'));
promises.push(once(v, "loadeddata"));
return Promise.all(promises);
}).then(function() {
is(sb.buffered.length, 1, "continuous range");
v.play();
// We have nothing to play, waiting will be fired.
return waitUntilTime(v, 1.5);
}).then(function() {
return fetchAndLoad(sb, 'bipbop/bipbop_480_624kbps-video', ['init'], '.mp4');
}).then(function() {
sb.timestampOffset = 1.601666; // End of the video track buffered - time of first video sample (0.095).
sb.appendWindowEnd = 1.796677; // Only allow room for three extra video frames (we need 3 as this video has b-frames).
return fetchAndLoad(sb, 'bipbop/bipbop_480_624kbps-video', ['1'], '.m4s');
}).then(function() {
ms.endOfStream();
var promises = [];
promises.push(once(ms, "sourceended"));
promises.push(once(v, "playing"));
promises.push(once(v, "ended"));
return Promise.all(promises);
}).then(function() {
if(v.width, 640, "has proper width");
if(v.height, 480, "has proper height");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>
@@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>MSE: Append buffer with multiple init segments</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(function (ms, v) {
ms.addEventListener("sourceopen", function () {
var sb = ms.addSourceBuffer("video/webm");
fetchWithXHR("seek_lowres.webm", function (seek_lowres) {
fetchWithXHR("seek.webm", function (seek) {
var data = [
[seek_lowres, 0, 438], // lowres init segment
[seek_lowres, 438, 25950], // lowres media segment 0-1
[seek, 0, 318], // init segment
[seek, 46712, 67833] // media segment 0.8-1.201
];
var length = data.map(d => d[2] - d[1]).reduce((a, b) => a + b);
var arrayBuffer = new Uint8Array(length);
var pos = 0;
data.forEach(function(d) {
var buffer = new Uint8Array(d[0], d[1], d[2]-d[1]);
arrayBuffer.set(buffer, pos);
pos += buffer.byteLength;
});
loadSegment.bind(null, sb, arrayBuffer)().then(function() {
// Since we are passing multiple segments in one buffer,
// the first durationchange event from parsing the init
// segment will be fired before updateend.
v.addEventListener("durationchange", function () {
ok(v.duration, 1.201);
SimpleTest.finish();
});
ms.endOfStream();
});
});
});
});
});
</script>
</pre>
</body>
</html>
@@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>MSE: Append buffer with multiple init segments</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(function (ms, v) {
ms.addEventListener("sourceopen", function () {
var sb = ms.addSourceBuffer("video/mp4");
fetchWithXHR("bipbop/bipbop_videoinit.mp4", function (init) {
init = new Uint8Array(init);
fetchWithXHR("bipbop/bipbop_video1.m4s", function (segment1) {
segment1 = new Uint8Array(segment1);
fetchWithXHR("bipbop/bipbop_video2.m4s", function (segment2) {
segment2 = new Uint8Array(segment2);
var data = [init, segment1, init, segment2];
var length = data.map(d => d.byteLength).reduce((a, b) => a + b);
var arrayBuffer = new Uint8Array(length);
var pos = 0;
data.forEach(function(buffer) {
arrayBuffer.set(buffer, pos);
pos += buffer.byteLength;
});
loadSegment.bind(null, sb, arrayBuffer)().then(function() {
// Since we are passing multiple segments in one buffer,
// the first durationchange event from parsing the init
// segment will be fired before updateend.
v.addEventListener("durationchange", function () {
ok(v.duration, 1.601666);
SimpleTest.finish();
});
ms.endOfStream();
});
});
});
});
});
});
</script>
</pre>
</body>
</html>
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>MSE: Don't get stuck buffering for too long when we have frames to show</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var receivedSourceOpen = false;
runWithMSE(function(ms, v) {
ms.addEventListener("sourceopen", function() {
ok(true, "Receive a sourceopen event");
ok(!receivedSourceOpen, "Should only receive one sourceopen for this test");
receivedSourceOpen = true;
var sb = ms.addSourceBuffer("video/mp4");
ok(sb, "Create a SourceBuffer");
sb.addEventListener('error', (e) => { ok(false, "Got Error: " + e); SimpleTest.finish(); });
fetchAndLoad(sb, 'bipbop/bipbop', ['init'], '.mp4')
.then(function() {
var promises = [];
promises.push(fetchAndLoad(sb, 'bipbop/bipbop', range(1,3), '.m4s'));
promises.push(once(v, "loadeddata"));
return Promise.all(promises);
}).then(function() {
// clear the entire sourcebuffer.
sb.remove(0, 5);
return once(sb, "updateend");
}).then(function() {
v.play();
// We have nothing to play, waiting will be fired.
return once(v, "waiting");
}).then(function() {
var promises = [];
promises.push(once(v, "playing"));
promises.push(fetchAndLoad(sb, 'bipbop/bipbop', range(1,3), '.m4s'));
return Promise.all(promises);
}).then(function() {
ms.endOfStream();
var promises = [];
promises.push(once(ms, "sourceended"));
promises.push(once(v, "ended"));
return Promise.all(promises);
}).then(SimpleTest.finish.bind(SimpleTest));
});
});
</script>
</pre>
</body>
</html>
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>MSE: Don't get stuck buffering for too long when we have frames to show</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var receivedSourceOpen = false;
runWithMSE(function(ms, v) {
ms.addEventListener("sourceopen", function() {
ok(true, "Receive a sourceopen event");
ok(!receivedSourceOpen, "Should only receive one sourceopen for this test");
receivedSourceOpen = true;
var sb = ms.addSourceBuffer("video/mp4");
ok(sb, "Create a SourceBuffer");
sb.addEventListener('error', (e) => { ok(false, "Got Error: " + e); SimpleTest.finish(); });
sb.mode = 'sequence';
fetchAndLoad(sb, 'bipbop/bipbop', ['init'], '.mp4')
.then(fetchAndLoad.bind(null, sb, 'bipbop/bipbop', ['2'], '.m4s'))
.then(fetchAndLoad.bind(null, sb, 'bipbop/bipbop', ['5'], '.m4s'))
.then(function() {
is(v.buffered.length, 1, "Continuous buffered range");
is(v.buffered.start(0), 0, "Buffered range starts at 0");
ok(sb.timestampOffset < 0, "SourceBuffer.timestampOffset set to allow continuous range");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>
+2 -4
View File
@@ -346,7 +346,7 @@ status_t AudioOffloadPlayer::DoSeek()
CHECK(mAudioSink.get());
AUDIO_OFFLOAD_LOG(LogLevel::Debug,
"DoSeek ( %lld )", mSeekTarget.GetTime().ToMicroseconds());
("DoSeek ( %lld )", mSeekTarget.GetTime().ToMicroseconds()));
mReachedEOS = false;
mPositionTimeMediaUs = -1;
@@ -502,7 +502,6 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize)
while (sizeRemaining > 0) {
MediaSource::ReadOptions options;
bool refreshSeekTime = false;
{
android::Mutex::Autolock autoLock(mLock);
@@ -519,7 +518,6 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize)
}
if (!mInputBuffer) {
status_t err;
err = mSource->read(&mInputBuffer, &options);
@@ -573,7 +571,7 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize)
AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("seek is updated during unlocking mLock"));
}
if (refreshSeekTime) {
if (refreshSeekTime) {
NotifyPositionChanged();
// need to adjust the mStartPosUs for offload decoding since parser
+11 -23
View File
@@ -90,10 +90,10 @@ MediaCodecProxy::MediaCodecProxy(sp<ALooper> aLooper,
: mCodecLooper(aLooper)
, mCodecMime(aMime)
, mCodecEncoder(aEncoder)
, mMediaCodecLock("MediaCodecProxy::mMediaCodecLock")
, mPendingRequestMediaResource(false)
, mPromiseMonitor("MediaCodecProxy::mPromiseMonitor")
{
MOZ_ASSERT(mCodecLooper != nullptr, "ALooper should not be nullptr.");
mCodecPromise.SetMonitor(&mPromiseMonitor);
}
MediaCodecProxy::~MediaCodecProxy()
@@ -134,6 +134,7 @@ MediaCodecProxy::AsyncAllocateVideoMediaCodec()
mResourceClient->SetListener(this);
mResourceClient->Acquire();
mozilla::MonitorAutoLock lock(mPromiseMonitor);
RefPtr<CodecPromise> p = mCodecPromise.Ensure(__func__);
return p.forget();
}
@@ -141,23 +142,16 @@ MediaCodecProxy::AsyncAllocateVideoMediaCodec()
void
MediaCodecProxy::ReleaseMediaCodec()
{
mCodecPromise.RejectIfExists(true, __func__);
releaseCodec();
if (!mResourceClient) {
return;
}
mozilla::MonitorAutoLock mon(mMediaCodecLock);
if (mPendingRequestMediaResource) {
mPendingRequestMediaResource = false;
mon.NotifyAll();
}
// At first, release mResourceClient's resource to prevent a conflict with
// mResourceClient's callback.
if (mResourceClient) {
mResourceClient->ReleaseResource();
mResourceClient = nullptr;
}
mozilla::MonitorAutoLock lock(mPromiseMonitor);
mCodecPromise.RejectIfExists(true, __func__);
releaseCodec();
}
bool
@@ -473,18 +467,12 @@ void
MediaCodecProxy::ResourceReserved()
{
MCP_LOG("resourceReserved");
mozilla::MonitorAutoLock lock(mPromiseMonitor);
// Create MediaCodec
if (!allocateCodec()) {
ReleaseMediaCodec();
mCodecPromise.RejectIfExists(true, __func__);
return;
}
// Notify initialization waiting.
mozilla::MonitorAutoLock mon(mMediaCodecLock);
mPendingRequestMediaResource = false;
mon.NotifyAll();
mCodecPromise.ResolveIfExists(true, __func__);
}
@@ -492,7 +480,7 @@ MediaCodecProxy::ResourceReserved()
void
MediaCodecProxy::ResourceReserveFailed()
{
ReleaseMediaCodec();
mozilla::MonitorAutoLock lock(mPromiseMonitor);
mCodecPromise.RejectIfExists(true, __func__);
}
+2 -3
View File
@@ -163,6 +163,8 @@ private:
bool mCodecEncoder;
mozilla::MozPromiseHolder<CodecPromise> mCodecPromise;
// When mPromiseMonitor is held, mResourceClient's functions should not be called.
mozilla::Monitor mPromiseMonitor;
// Media Resource Management
RefPtr<mozilla::MediaSystemResourceClient> mResourceClient;
@@ -174,9 +176,6 @@ private:
//MediaCodec buffers to hold input/output data.
Vector<sp<ABuffer> > mInputBuffers;
Vector<sp<ABuffer> > mOutputBuffers;
mozilla::Monitor mMediaCodecLock;
bool mPendingRequestMediaResource;
};
} // namespace android
+2 -9
View File
@@ -107,7 +107,6 @@ MediaOmxCommonDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
DisableStateMachineAudioOffloading();
return;
}
PauseStateMachine();
if (mLogicallySeeking) {
SeekTarget target = SeekTarget(mLogicalPosition,
@@ -128,13 +127,7 @@ MediaOmxCommonDecoder::PauseStateMachine()
MOZ_ASSERT(NS_IsMainThread());
DECODER_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__));
if (mShuttingDown) {
return;
}
if (!GetStateMachine()) {
return;
}
MOZ_ASSERT(GetStateMachine());
// enter dormant state
GetStateMachine()->DispatchSetDormant(true);
}
@@ -232,7 +225,7 @@ MediaOmxCommonDecoder::ChangeState(PlayState aState)
}
void
MediaOmxCommonDecoder::CallSeek(SeekTarget aTarget)
MediaOmxCommonDecoder::CallSeek(const SeekTarget& aTarget)
{
if (!mAudioOffloadPlayer) {
MediaDecoder::CallSeek(aTarget);
+1 -1
View File
@@ -26,7 +26,7 @@ public:
void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
MediaDecoderEventVisibility aEventVisibility) override;
void ChangeState(PlayState aState) override;
void CallSeek(SeekTarget aTarget) override;
void CallSeek(const SeekTarget& aTarget) override;
void SetVolume(double aVolume) override;
int64_t CurrentPosition() override;
MediaDecoderOwner::NextFrameStatus NextFrameStatus() override;
+5 -8
View File
@@ -266,8 +266,7 @@ void MediaOmxReader::HandleResourceAllocated()
if (mLastParserDuration >= 0) {
// Prefer the parser duration if we have it.
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(mLastParserDuration);
mInfo.mMetadataDuration = Some(TimeUnit::FromMicroseconds(mLastParserDuration));
} else {
// MP3 parser failed to find a duration.
// Set the total duration (the max of the audio and video track).
@@ -381,9 +380,8 @@ bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
picture.height = (frame.Y.mHeight * mPicture.height) / mInitialFrame.height;
}
MOZ_ASSERT(mStreamSource);
// This is the approximate byte position in the stream.
int64_t pos = mStreamSource->Tell();
int64_t pos = mStreamSource ? mStreamSource->Tell() : 0;
RefPtr<VideoData> v;
if (!frame.mGraphicBuffer) {
@@ -496,9 +494,8 @@ bool MediaOmxReader::DecodeAudioData()
MOZ_ASSERT(OnTaskQueue());
EnsureActive();
MOZ_ASSERT(mStreamSource);
// This is the approximate byte position in the stream.
int64_t pos = mStreamSource->Tell();
int64_t pos = mStreamSource ? mStreamSource->Tell() : 0;
// Read next frame
MPAPI::AudioFrame source;
@@ -542,7 +539,7 @@ MediaOmxReader::Seek(SeekTarget aTarget, int64_t aEndTime)
// stream to the preceeding keyframe first, get the stream time, and then
// seek the audio stream to match the video stream's time. Otherwise, the
// audio and video streams won't be in sync after the seek.
mVideoSeekTimeUs = aTarget.mTime;
mVideoSeekTimeUs = aTarget.GetTime().ToMicroseconds();
RefPtr<MediaOmxReader> self = this;
mSeekRequest.Begin(DecodeToFirstVideoData()->Then(OwnerThread(), __func__, [self] (MediaData* v) {
@@ -555,7 +552,7 @@ MediaOmxReader::Seek(SeekTarget aTarget, int64_t aEndTime)
self->mSeekPromise.Resolve(aTarget.GetTime(), __func__);
}));
} else {
mAudioSeekTimeUs = mVideoSeekTimeUs = GetTime().ToMicroseconds();
mAudioSeekTimeUs = mVideoSeekTimeUs = aTarget.GetTime().ToMicroseconds();
mSeekPromise.Resolve(aTarget.GetTime(), __func__);
}
+7 -5
View File
@@ -64,6 +64,13 @@ OMXCodecProxy::OMXCodecProxy(
OMXCodecProxy::~OMXCodecProxy()
{
// At first, release mResourceClient's resource to prevent a conflict with
// mResourceClient's callback.
if (mResourceClient) {
mResourceClient->ReleaseResource();
mResourceClient = nullptr;
}
mState = ResourceState::END;
mCodecPromise.RejectIfExists(true, __func__);
@@ -78,11 +85,6 @@ OMXCodecProxy::~OMXCodecProxy()
// Complete all pending Binder ipc transactions
IPCThreadState::self()->flushCommands();
if (mResourceClient) {
mResourceClient->ReleaseResource();
mResourceClient = nullptr;
}
mSource.clear();
free(mComponentName);
mComponentName = nullptr;
+75 -3
View File
@@ -17,7 +17,10 @@
#include "AudioChannelFormat.h"
#include "GrallocImages.h"
#include "LayersLogging.h"
#include "libyuv.h"
#include "mozilla/Monitor.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/layers/GrallocTextureClient.h"
using namespace mozilla;
@@ -407,6 +410,67 @@ ConvertGrallocImageToNV12(GrallocImage* aSource, uint8_t* aDestination)
graphicBuffer->unlock();
}
static nsresult
ConvertSourceSurfaceToNV12(const RefPtr<SourceSurface>& aSurface, uint8_t* aDestination)
{
uint32_t width = aSurface->GetSize().width;
uint32_t height = aSurface->GetSize().height;
uint8_t* y = aDestination;
int yStride = width;
uint8_t* uv = y + (yStride * height);
int uvStride = width / 2;
SurfaceFormat format = aSurface->GetFormat();
if (!aSurface) {
CODEC_ERROR("Getting surface %s from image failed", Stringify(format).c_str());
return NS_ERROR_FAILURE;
}
RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();
if (!data) {
CODEC_ERROR("Getting data surface from %s image with %s (%s) surface failed",
Stringify(format).c_str(), Stringify(aSurface->GetType()).c_str(),
Stringify(aSurface->GetFormat()).c_str());
return NS_ERROR_FAILURE;
}
DataSourceSurface::ScopedMap map(data, DataSourceSurface::READ);
if (!map.IsMapped()) {
CODEC_ERROR("Reading DataSourceSurface from %s image with %s (%s) surface failed",
Stringify(format).c_str(), Stringify(aSurface->GetType()).c_str(),
Stringify(aSurface->GetFormat()).c_str());
return NS_ERROR_FAILURE;
}
int rv;
switch (aSurface->GetFormat()) {
case SurfaceFormat::B8G8R8A8:
case SurfaceFormat::B8G8R8X8:
rv = libyuv::ARGBToNV12(static_cast<uint8*>(map.GetData()),
map.GetStride(),
y, yStride,
uv, uvStride,
width, height);
break;
default:
CODEC_ERROR("Unsupported SourceSurface format %s",
Stringify(aSurface->GetFormat()).c_str());
NS_ASSERTION(false, "Unsupported SourceSurface format");
return NS_ERROR_NOT_IMPLEMENTED;
}
if (rv != 0) {
CODEC_ERROR("%s to I420 conversion failed",
Stringify(aSurface->GetFormat()).c_str());
return NS_ERROR_FAILURE;
}
return NS_OK;
}
nsresult
OMXVideoEncoder::Encode(const Image* aImage, int aWidth, int aHeight,
int64_t aTimestamp, int aInputFlags, bool* aSendEOS)
@@ -437,9 +501,10 @@ OMXVideoEncoder::Encode(const Image* aImage, int aWidth, int aHeight,
halFormat == GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS,
NS_ERROR_INVALID_ARG);
} else {
// TODO: support RGB to YUV color conversion.
NS_ERROR("Unsupported input image type.");
return NS_ERROR_INVALID_ARG;
RefPtr<SourceSurface> surface = img->GetAsSourceSurface();
NS_ENSURE_TRUE(surface->GetFormat() == SurfaceFormat::B8G8R8A8 ||
surface->GetFormat() == SurfaceFormat::B8G8R8X8,
NS_ERROR_INVALID_ARG);
}
}
@@ -477,6 +542,13 @@ OMXVideoEncoder::Encode(const Image* aImage, int aWidth, int aHeight,
} else if (format == ImageFormat::PLANAR_YCBCR) {
ConvertPlanarYCbCrToNV12(static_cast<PlanarYCbCrImage*>(img)->GetData(),
dst);
} else {
RefPtr<SourceSurface> surface = img->GetAsSourceSurface();
nsresult rv = ConvertSourceSurfaceToNV12(surface, dst);
if (rv != NS_OK) {
return NS_ERROR_FAILURE;
}
}
}
-1
View File
@@ -283,7 +283,6 @@ private:
*/
class OMXVideoEncoder final : public OMXCodecWrapper
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(OMXVideoEncoder)
public:
// Types of output blob format.
enum BlobFormat {
+9 -3
View File
@@ -19,6 +19,12 @@
#include <ui/Fence.h>
#endif
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
#include <gui/Surface.h>
#else
#include <gui/SurfaceTextureClient.h>
#endif
#include "mozilla/layers/GrallocTextureClient.h"
#include "mozilla/layers/TextureClient.h"
#include "mozilla/Preferences.h"
@@ -230,11 +236,11 @@ OmxDecoder::AllocateMediaResources()
#endif
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
mNativeWindowClient = new GonkNativeWindowClient(producer);
mNativeWindowClient = new Surface(producer);
#elif defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
mNativeWindowClient = new GonkNativeWindowClient(mNativeWindow->getBufferQueue());
mNativeWindowClient = new Surface(mNativeWindow->getBufferQueue());
#else
mNativeWindowClient = new GonkNativeWindowClient(mNativeWindow);
mNativeWindowClient = new SurfaceTextureClient(mNativeWindow);
#endif
// Experience with OMX codecs is that only the HW decoders are
+2 -2
View File
@@ -6,7 +6,6 @@
#include <stagefright/MediaExtractor.h>
#include "GonkNativeWindow.h"
#include "GonkNativeWindowClient.h"
#include "mozilla/layers/FenceUtils.h"
#include "MP3FrameParser.h"
#include "MPAPI.h"
@@ -42,7 +41,8 @@ class OmxDecoder : public RefBase {
AbstractMediaDecoder *mDecoder;
sp<GonkNativeWindow> mNativeWindow;
sp<GonkNativeWindowClient> mNativeWindowClient;
sp<ANativeWindow> mNativeWindowClient;
sp<MediaSource> mVideoTrack;
sp<OMXCodecProxy> mVideoSource;
sp<MediaSource> mAudioOffloadTrack;
-56
View File
@@ -1,56 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RtspMediaCodecDecoder.h"
#include "MediaDecoderStateMachine.h"
#include "RtspMediaResource.h"
#include "RtspMediaCodecReader.h"
namespace mozilla {
MediaDecoder*
RtspMediaCodecDecoder::Clone(MediaDecoderOwner* aOwner)
{
return new RtspMediaCodecDecoder(aOwner);
}
MediaOmxCommonReader*
RtspMediaCodecDecoder::CreateReader()
{
return new RtspMediaCodecReader(this);
}
MediaDecoderStateMachine*
RtspMediaCodecDecoder::CreateStateMachineFromReader(MediaOmxCommonReader* aReader)
{
return new MediaDecoderStateMachine(this, aReader,
mResource->IsRealTime());
}
void
RtspMediaCodecDecoder::ChangeState(PlayState aState)
{
MOZ_ASSERT(NS_IsMainThread());
MediaDecoder::ChangeState(aState);
// Notify RTSP controller if the play state is ended.
// This is necessary for RTSP controller to transit its own state.
if (mPlayState == PLAY_STATE_ENDED) {
RefPtr<RtspMediaResource> resource = mResource->GetRtspPointer();
if (resource) {
nsIStreamingProtocolController* controller =
resource->GetMediaStreamController();
if (controller) {
controller->PlaybackEnded();
}
}
}
}
} // namespace mozilla
-31
View File
@@ -1,31 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#if !defined(RtspMediaCodecDecoder_h_)
#define RtspMediaCodecDecoder_h_
#include "MediaOmxCommonDecoder.h"
namespace mozilla {
class RtspMediaCodecDecoder final : public MediaOmxCommonDecoder
{
public:
explicit RtspMediaCodecDecoder(MediaDecoderOwner* aOwner)
: MediaOmxCommonDecoder(aOwner) {}
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override;
MediaOmxCommonReader* CreateReader() override;
MediaDecoderStateMachine* CreateStateMachineFromReader(MediaOmxCommonReader* aReader) override;
void ChangeState(PlayState aState) override;
};
} // namespace mozilla
#endif
+3 -1
View File
@@ -41,6 +41,7 @@ if CONFIG['MOZ_OMX_ENCODER']:
'OMXCodecDescriptorUtil.cpp',
'OMXCodecWrapper.cpp',
]
LOCAL_INCLUDES += ['/media/libyuv/include']
if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
EXPORTS += [
@@ -70,10 +71,11 @@ include('/ipc/chromium/chromium-config.mozbuild')
# - about attributes on forward declarations for types that are already
# defined, which complains about an important MOZ_EXPORT for android::AString
# - about multi-character constants which are used in codec-related code
# and are part of Android's libstagefright API style.
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-error=attributes',
'-Wno-error=multichar'
'-Wno-multichar'
]
FINAL_LIBRARY = 'xul'
+4 -4
View File
@@ -103,10 +103,10 @@ OpusDataDecoder::DecodeHeader(const unsigned char* aData, size_t aLength)
return NS_ERROR_FAILURE;
}
int channels = mOpusParser->mChannels;
// No channel mapping for more than 8 channels.
if (channels > 8) {
OPUS_DEBUG("No channel mapping for more than 8 channels. Source is %d channels",
channels);
AudioConfig::ChannelLayout layout(channels);
if (!layout.IsValid()) {
OPUS_DEBUG("Invalid channel mapping. Source is %d channels", channels);
return NS_ERROR_FAILURE;
}
@@ -105,6 +105,11 @@ VorbisDataDecoder::Init()
("Invalid Vorbis header: container and codec channels do not match!"));
}
AudioConfig::ChannelLayout layout(mVorbisDsp.vi->channels);
if (!layout.IsValid()) {
return InitPromise::CreateAndReject(DecoderFailureReason::INIT_ERROR, __func__);
}
return InitPromise::CreateAndResolve(TrackInfo::kAudioTrack, __func__);
}
@@ -223,6 +228,9 @@ VorbisDataDecoder::DoDecode(MediaRawData* aSample)
AudioConfig in(AudioConfig::ChannelLayout(channels, VorbisLayout(channels)),
rate);
AudioConfig out(channels, rate);
if (!in.IsValid() || !out.IsValid()) {
return -1;
}
mAudioConverter = MakeUnique<AudioConverter>(in, out);
}
MOZ_ASSERT(mAudioConverter->CanWorkInPlace());
@@ -4,12 +4,8 @@
#include "AndroidDecoderModule.h"
#include "AndroidBridge.h"
#include "GLBlitHelper.h"
#include "GLContext.h"
#include "GLContextEGL.h"
#include "GLContextProvider.h"
#include "AndroidSurfaceTexture.h"
#include "GLImages.h"
#include "GLLibraryEGL.h"
#include "MediaData.h"
#include "MediaInfo.h"
@@ -121,7 +117,6 @@ public:
void Cleanup() override
{
mGLContext = nullptr;
}
nsresult Input(MediaRawData* aSample) override
@@ -129,79 +124,13 @@ public:
return MediaCodecDataDecoder::Input(aSample);
}
bool WantCopy() const
{
// Allocating a texture is incredibly slow on PowerVR and may fail on
// emulators, see bug 1190379.
return mGLContext->Vendor() != GLVendor::Imagination &&
mGLContext->Renderer() != GLRenderer::AndroidEmulator;
}
EGLImage CopySurface(layers::Image* img)
{
mGLContext->MakeCurrent();
GLuint tex = CreateTextureForOffscreen(mGLContext, mGLContext->GetGLFormats(),
img->GetSize());
auto helper = mGLContext->BlitHelper();
const gl::OriginPos destOrigin = gl::OriginPos::TopLeft;
if (!helper->BlitImageToTexture(img, img->GetSize(), tex,
LOCAL_GL_TEXTURE_2D, destOrigin))
{
mGLContext->fDeleteTextures(1, &tex);
return nullptr;
}
EGLint attribs[] = {
LOCAL_EGL_IMAGE_PRESERVED_KHR, LOCAL_EGL_TRUE,
LOCAL_EGL_NONE, LOCAL_EGL_NONE
};
EGLContext eglContext = static_cast<GLContextEGL*>(mGLContext.get())->GetEGLContext();
EGLImage eglImage = sEGLLibrary.fCreateImage(
EGL_DISPLAY(), eglContext, LOCAL_EGL_GL_TEXTURE_2D_KHR,
reinterpret_cast<EGLClientBuffer>(tex), attribs);
mGLContext->fDeleteTextures(1, &tex);
return eglImage;
}
nsresult PostOutput(BufferInfo::Param aInfo, MediaFormat::Param aFormat,
const TimeUnit& aDuration) override
{
if (!EnsureGLContext()) {
return NS_ERROR_FAILURE;
}
RefPtr<layers::Image> img =
new SurfaceTextureImage(mSurfaceTexture.get(), mConfig.mDisplay,
gl::OriginPos::BottomLeft);
if (WantCopy()) {
EGLImage eglImage = CopySurface(img);
if (!eglImage) {
return NS_ERROR_FAILURE;
}
EGLSync eglSync = nullptr;
if (sEGLLibrary.IsExtensionSupported(GLLibraryEGL::KHR_fence_sync) &&
mGLContext->IsExtensionSupported(GLContext::OES_EGL_sync))
{
MOZ_ASSERT(mGLContext->IsCurrent());
eglSync = sEGLLibrary.fCreateSync(EGL_DISPLAY(),
LOCAL_EGL_SYNC_FENCE,
nullptr);
MOZ_ASSERT(eglSync);
mGLContext->fFlush();
} else {
NS_WARNING("No EGL fence support detected, rendering artifacts may occur!");
}
img = new layers::EGLImageImage(eglImage, eglSync, mConfig.mDisplay,
gl::OriginPos::TopLeft, true /* owns */);
}
nsresult rv;
int32_t flags;
NS_ENSURE_SUCCESS(rv = aInfo->Flags(&flags), rv);
@@ -231,20 +160,9 @@ public:
}
protected:
bool EnsureGLContext()
{
if (mGLContext) {
return true;
}
mGLContext = GLContextProvider::CreateHeadless(CreateContextFlags::NONE);
return mGLContext;
}
layers::ImageContainer* mImageContainer;
const VideoInfo& mConfig;
RefPtr<AndroidSurfaceTexture> mSurfaceTexture;
RefPtr<GLContext> mGLContext;
};
class AudioDataDecoder : public MediaCodecDataDecoder
@@ -283,6 +201,10 @@ public:
int32_t numChannels;
NS_ENSURE_SUCCESS(rv =
aFormat->GetInteger(NS_LITERAL_STRING("channel-count"), &numChannels), rv);
AudioConfig::ChannelLayout layout(numChannels);
if (!layout.IsValid()) {
return NS_ERROR_FAILURE;
}
int32_t sampleRate;
NS_ENSURE_SUCCESS(rv =
@@ -391,9 +313,12 @@ AndroidDecoderModule::CreateAudioDecoder(
MediaFormat::LocalRef format;
LOG("CreateAudioFormat with mimeType=%s, mRate=%d, channels=%d",
aConfig.mMimeType.Data(), aConfig.mRate, aConfig.mChannels);
NS_ENSURE_SUCCESS(MediaFormat::CreateAudioFormat(
aConfig.mMimeType,
aConfig.mBitDepth,
aConfig.mRate,
aConfig.mChannels,
&format), nullptr);
@@ -464,10 +389,11 @@ MediaCodecDataDecoder::InitDecoder(Surface::Param aSurface)
NS_ENSURE_SUCCESS(rv = ResetInputBuffers(), rv);
NS_ENSURE_SUCCESS(rv = ResetOutputBuffers(), rv);
NS_NewNamedThread("MC Decoder", getter_AddRefs(mThread),
NS_NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop));
rv = NS_NewNamedThread(
"MC Decoder", getter_AddRefs(mThread),
NS_NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop));
return NS_OK;
return rv;
}
// This is in usec, so that's 10ms.
@@ -522,7 +448,7 @@ MediaCodecDataDecoder::WaitForInput()
}
MediaRawData*
already_AddRefed<MediaRawData>
MediaCodecDataDecoder::PeekNextSample()
{
MonitorAutoLock lock(mMonitor);
@@ -543,7 +469,7 @@ MediaCodecDataDecoder::PeekNextSample()
}
// We're not stopping or flushing, so try to get a sample.
return mQueue.front();
return RefPtr<MediaRawData>(mQueue.front()).forget();
}
nsresult
@@ -584,7 +510,7 @@ MediaCodecDataDecoder::QueueSample(const MediaRawData* aSample)
return res;
}
mDurations.push(TimeUnit::FromMicroseconds(aSample->mDuration));
mDurations.push_back(TimeUnit::FromMicroseconds(aSample->mDuration));
return NS_OK;
}
@@ -629,7 +555,7 @@ MediaCodecDataDecoder::GetOutputDuration()
{
MOZ_ASSERT(!mDurations.empty(), "Should have had a duration queued");
const TimeUnit duration = mDurations.front();
mDurations.pop();
mDurations.pop_front();
return duration;
}
@@ -661,12 +587,11 @@ MediaCodecDataDecoder::DecoderLoop()
{
bool isOutputDone = false;
AutoLocalJNIFrame frame(jni::GetEnvForThread(), 1);
RefPtr<MediaRawData> sample;
MediaFormat::LocalRef outputFormat(frame.GetEnv());
nsresult res = NS_OK;
while (WaitForInput()) {
sample = PeekNextSample();
RefPtr<MediaRawData> sample = PeekNextSample();
{
MonitorAutoLock lock(mMonitor);
@@ -682,7 +607,8 @@ MediaCodecDataDecoder::DecoderLoop()
if (NS_SUCCEEDED(res)) {
// We've fed this into the decoder, so remove it from the queue.
MonitorAutoLock lock(mMonitor);
mQueue.pop();
MOZ_RELEASE_ASSERT(mQueue.size(), "Queue may not be empty");
mQueue.pop_front();
isOutputDone = false;
}
}
@@ -757,18 +683,27 @@ MediaCodecDataDecoder::State() const
return mState;
}
void
bool
MediaCodecDataDecoder::State(ModuleState aState)
{
LOG("%s -> %s", ModuleStateStr(mState), ModuleStateStr(aState));
bool ok = true;
if (aState == kDrainDecoder) {
MOZ_ASSERT(mState == kDrainQueue);
if (mState == kShutdown) {
ok = false;
} else if (mState == kStopping) {
ok = aState == kShutdown;
} else if (aState == kDrainDecoder) {
ok = mState == kDrainQueue;
} else if (aState == kDrainWaitEOS) {
MOZ_ASSERT(mState == kDrainDecoder);
ok = mState == kDrainDecoder;
}
mState = aState;
if (ok) {
LOG("%s -> %s", ModuleStateStr(mState), ModuleStateStr(aState));
mState = aState;
}
return ok;
}
void
@@ -776,19 +711,15 @@ MediaCodecDataDecoder::ClearQueue()
{
mMonitor.AssertCurrentThreadOwns();
while (!mQueue.empty()) {
mQueue.pop();
}
while (!mDurations.empty()) {
mDurations.pop();
}
mQueue.clear();
mDurations.clear();
}
nsresult
MediaCodecDataDecoder::Input(MediaRawData* aSample)
{
MonitorAutoLock lock(mMonitor);
mQueue.push(aSample);
mQueue.push_back(aSample);
lock.NotifyAll();
return NS_OK;
@@ -810,7 +741,9 @@ nsresult
MediaCodecDataDecoder::Flush()
{
MonitorAutoLock lock(mMonitor);
State(kFlushing);
if (!State(kFlushing)) {
return NS_OK;
}
lock.Notify();
while (State() == kFlushing) {
@@ -840,23 +773,23 @@ MediaCodecDataDecoder::Shutdown()
{
MonitorAutoLock lock(mMonitor);
if (!mThread || State() == kStopping) {
// Already shutdown or in the process of doing so
return NS_OK;
}
State(kStopping);
lock.Notify();
while (State() == kStopping) {
while (mThread && State() != kShutdown) {
lock.Wait();
}
mThread->Shutdown();
mThread = nullptr;
if (mThread) {
mThread->Shutdown();
mThread = nullptr;
}
mDecoder->Stop();
mDecoder->Release();
if (mDecoder) {
mDecoder->Stop();
mDecoder->Release();
mDecoder = nullptr;
}
return NS_OK;
}
@@ -6,17 +6,17 @@
#define AndroidDecoderModule_h_
#include "PlatformDecoderModule.h"
#include "AndroidSurfaceTexture.h"
#include "MediaCodec.h"
#include "SurfaceTexture.h"
#include "TimeUnits.h"
#include "mozilla/Monitor.h"
#include <queue>
#include <deque>
namespace mozilla {
typedef std::queue<RefPtr<MediaRawData>> SampleQueue;
typedef std::deque<RefPtr<MediaRawData>> SampleQueue;
class AndroidDecoderModule : public PlatformDecoderModule {
public:
@@ -101,7 +101,7 @@ protected:
nsresult GetInputBuffer(JNIEnv* env, int index, jni::Object::LocalRef* buffer);
bool WaitForInput();
MediaRawData* PeekNextSample();
already_AddRefed<MediaRawData> PeekNextSample();
nsresult QueueSample(const MediaRawData* aSample);
nsresult QueueEOS();
void HandleEOS(int32_t aOutputStatus);
@@ -110,7 +110,8 @@ protected:
widget::sdk::MediaFormat::Param aFormat,
int32_t aStatus);
ModuleState State() const;
void State(ModuleState aState);
// Sets decoder state and returns whether the new state has become effective.
bool State(ModuleState aState);
void DecoderLoop();
virtual void ClearQueue();
@@ -136,7 +137,7 @@ protected:
SampleQueue mQueue;
// Durations are stored in microseconds.
std::queue<media::TimeUnit> mDurations;
std::deque<media::TimeUnit> mDurations;
};
} // namespace mozilla
@@ -283,6 +283,9 @@ AppleATDecoder::DecodeSample(MediaRawData* aSample)
if (mChannelLayout && !mAudioConverter) {
AudioConfig in(*mChannelLayout.get(), rate);
AudioConfig out(channels, rate);
if (!in.IsValid() || !out.IsValid()) {
return NS_ERROR_FAILURE;
}
mAudioConverter = MakeUnique<AudioConverter>(in, out);
}
if (mAudioConverter) {
@@ -185,6 +185,12 @@ FFmpegAudioDecoder<LIBAV_VER>::DecodePacket(MediaRawData* aSample)
if (decoded) {
uint32_t numChannels = mCodecContext->channels;
AudioConfig::ChannelLayout layout(numChannels);
if (!layout.IsValid()) {
mCallback->Error();
return;
}
uint32_t samplingRate = mCodecContext->sample_rate;
AlignedAudioBuffer audio =

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