mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 21:28:55 +00:00
Merge from mozilla-central.
This commit is contained in:
commit
56597a8412
@ -513,7 +513,7 @@ nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr, PRInt32 *aUInt)
|
||||
nsAutoString value;
|
||||
aContent->GetAttr(kNameSpaceID_None, aAttr, value);
|
||||
if (!value.IsEmpty()) {
|
||||
PRInt32 error = NS_OK;
|
||||
nsresult error = NS_OK;
|
||||
PRInt32 integer = value.ToInteger(&error);
|
||||
if (NS_SUCCEEDED(error) && integer > 0) {
|
||||
*aUInt = integer;
|
||||
|
@ -3056,7 +3056,7 @@ Accessible::GetAttrValue(nsIAtom *aProperty, double *aValue)
|
||||
if (attrValue.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
nsresult error = NS_OK;
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aValue = value;
|
||||
|
@ -111,7 +111,7 @@ ProgressMeterAccessible<Max>::GetMaximumValue(double* aMaximumValue)
|
||||
|
||||
nsAutoString value;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, value)) {
|
||||
PRInt32 result = NS_OK;
|
||||
nsresult result = NS_OK;
|
||||
*aMaximumValue = value.ToDouble(&result);
|
||||
return result;
|
||||
}
|
||||
@ -159,7 +159,7 @@ ProgressMeterAccessible<Max>::GetCurrentValue(double* aCurrentValue)
|
||||
if (attrValue.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
nsresult error = NS_OK;
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_FAILED(error))
|
||||
return NS_OK; // Zero value because of wrong markup.
|
||||
|
@ -313,7 +313,7 @@ nsXFormsRangeAccessible::GetMaximumValue(double *aMaximumValue)
|
||||
nsresult rv = sXFormsService->GetRangeEnd(DOMNode, value);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
nsresult error = NS_OK;
|
||||
*aMaximumValue = value.ToDouble(&error);
|
||||
return error;
|
||||
}
|
||||
@ -328,7 +328,7 @@ nsXFormsRangeAccessible::GetMinimumValue(double *aMinimumValue)
|
||||
nsresult rv = sXFormsService->GetRangeStart(DOMNode, value);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
nsresult error = NS_OK;
|
||||
*aMinimumValue = value.ToDouble(&error);
|
||||
return error;
|
||||
}
|
||||
@ -343,7 +343,7 @@ nsXFormsRangeAccessible::GetMinimumIncrement(double *aMinimumIncrement)
|
||||
nsresult rv = sXFormsService->GetRangeStep(DOMNode, value);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
nsresult error = NS_OK;
|
||||
*aMinimumIncrement = value.ToDouble(&error);
|
||||
return error;
|
||||
}
|
||||
@ -358,7 +358,7 @@ nsXFormsRangeAccessible::GetCurrentValue(double *aCurrentValue)
|
||||
nsresult rv = sXFormsService->GetValue(DOMNode, value);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
nsresult error = NS_OK;
|
||||
*aCurrentValue = value.ToDouble(&error);
|
||||
return error;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ XULMenuitemAccessible::KeyboardShortcut() const
|
||||
if (keyStr.IsEmpty()) {
|
||||
nsAutoString keyCodeStr;
|
||||
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, keyCodeStr);
|
||||
PRUint32 errorCode;
|
||||
nsresult errorCode;
|
||||
key = keyStr.ToInteger(&errorCode, kAutoDetect);
|
||||
} else {
|
||||
key = keyStr[0];
|
||||
@ -538,7 +538,7 @@ XULMenupopupAccessible::ContainerWidget() const
|
||||
if (!menuPopup) // shouldn't be a real case
|
||||
return nullptr;
|
||||
|
||||
nsMenuFrame* menuFrame = menuPopupFrame->GetParentMenu();
|
||||
nsMenuFrame* menuFrame = do_QueryFrame(menuPopupFrame->GetParent());
|
||||
if (!menuFrame) // context menu or popups
|
||||
return nullptr;
|
||||
|
||||
|
@ -223,7 +223,7 @@ XULSliderAccessible::GetSliderAttr(nsIAtom* aName, double* aValue)
|
||||
if (attrValue.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
nsresult error = NS_OK;
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aValue = value;
|
||||
|
@ -125,6 +125,7 @@ if [ "$ENABLE_TESTS" ]; then
|
||||
config/makefiles/test/Makefile
|
||||
config/tests/makefiles/autodeps/Makefile
|
||||
config/tests/src-simple/Makefile
|
||||
mfbt/tests/Makefile
|
||||
"
|
||||
if [ ! "$LIBXUL_SDK" ]; then
|
||||
add_makefiles "
|
||||
|
@ -383,6 +383,12 @@ Services.obs.addObserver(function onSystemMessage(subject, topic, data) {
|
||||
});
|
||||
}, 'system-messages-open-app', false);
|
||||
|
||||
Services.obs.addObserver(function(aSubject, aTopic, aData) {
|
||||
shell.sendEvent(shell.contentBrowser.contentWindow,
|
||||
"mozChromeEvent", { type: "fullscreenoriginchange",
|
||||
fullscreenorigin: aData } );
|
||||
}, "fullscreen-origin-change", false);
|
||||
|
||||
(function Repl() {
|
||||
if (!Services.prefs.getBoolPref('b2g.remote-js.enabled')) {
|
||||
return;
|
||||
|
@ -165,6 +165,7 @@
|
||||
#ifdef MOZ_B2G_BT
|
||||
@BINPATH@/components/dom_bluetooth.xpt
|
||||
#endif
|
||||
@BINPATH@/components/dom_camera.xpt
|
||||
@BINPATH@/components/dom_canvas.xpt
|
||||
@BINPATH@/components/dom_contacts.xpt
|
||||
@BINPATH@/components/dom_alarm.xpt
|
||||
|
@ -648,12 +648,6 @@ const gFormSubmitObserver = {
|
||||
this.panel = document.getElementById('invalid-form-popup');
|
||||
},
|
||||
|
||||
panelIsOpen: function()
|
||||
{
|
||||
return this.panel && this.panel.state != "hiding" &&
|
||||
this.panel.state != "closed";
|
||||
},
|
||||
|
||||
notifyInvalidSubmit : function (aFormElement, aInvalidElements)
|
||||
{
|
||||
// We are going to handle invalid form submission attempt by focusing the
|
||||
@ -1251,7 +1245,8 @@ var gBrowserInit = {
|
||||
gDelayedStartupTimeoutId = null;
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
SafeBrowsing.init();
|
||||
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
|
||||
setTimeout(function() { SafeBrowsing.init(); }, 2000);
|
||||
#endif
|
||||
|
||||
Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
|
||||
@ -3949,7 +3944,7 @@ var XULBrowserWindow = {
|
||||
this._hostChanged = true;
|
||||
|
||||
// Hide the form invalid popup.
|
||||
if (gFormSubmitObserver.panelIsOpen()) {
|
||||
if (gFormSubmitObserver.panel) {
|
||||
gFormSubmitObserver.panel.hidePopup();
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,6 @@ PlacesViewBase.prototype = {
|
||||
|
||||
destroyContextMenu: function PVB_destroyContextMenu(aPopup) {
|
||||
this._contextMenuShown = false;
|
||||
if (window.content)
|
||||
window.content.focus();
|
||||
},
|
||||
|
||||
_cleanPopup: function PVB_cleanPopup(aPopup, aDelay) {
|
||||
|
14
browser/config/mozconfigs/macosx64/debug-asan
Normal file
14
browser/config/mozconfigs/macosx64/debug-asan
Normal file
@ -0,0 +1,14 @@
|
||||
. $topsrcdir/build/unix/mozconfig.asan
|
||||
|
||||
ac_add_options --enable-application=browser
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-optimize="-O1"
|
||||
ac_add_options --enable-accessibility
|
||||
|
||||
# Enable parallel compiling
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j12"
|
||||
|
||||
# Package js shell.
|
||||
export MOZ_PACKAGE_JSSHELL=1
|
||||
|
||||
ac_add_options --with-macbundlename-prefix=Firefox
|
@ -81,7 +81,9 @@ function ElementStyle(aElement, aStore)
|
||||
if (this.store.disabled) {
|
||||
this.store.disabled = aStore.disabled;
|
||||
} else {
|
||||
this.store.disabled = WeakMap();
|
||||
// FIXME: This should be a WeakMap once bug 753517 is fixed.
|
||||
// See Bug 777373 for details.
|
||||
this.store.disabled = new Map();
|
||||
}
|
||||
|
||||
let doc = aElement.ownerDocument;
|
||||
@ -487,7 +489,11 @@ Rule.prototype = {
|
||||
|
||||
// Store disabled properties in the disabled store.
|
||||
let disabled = this.elementStyle.store.disabled;
|
||||
disabled.set(this.style, disabledProps);
|
||||
if (disabledProps.length > 0) {
|
||||
disabled.set(this.style, disabledProps);
|
||||
} else {
|
||||
disabled.delete(this.style);
|
||||
}
|
||||
|
||||
this.elementStyle.markOverridden();
|
||||
},
|
||||
@ -2157,7 +2163,9 @@ function _getInplaceEditorForSpan(aSpan) { return aSpan.inplaceEditor; };
|
||||
*/
|
||||
function UserProperties()
|
||||
{
|
||||
this.weakMap = new WeakMap();
|
||||
// FIXME: This should be a WeakMap once bug 753517 is fixed.
|
||||
// See Bug 777373 for details.
|
||||
this.map = new Map();
|
||||
}
|
||||
|
||||
UserProperties.prototype = {
|
||||
@ -2177,7 +2185,7 @@ UserProperties.prototype = {
|
||||
* otherwise.
|
||||
*/
|
||||
getProperty: function UP_getProperty(aStyle, aName, aComputedValue) {
|
||||
let entry = this.weakMap.get(aStyle, null);
|
||||
let entry = this.map.get(aStyle, null);
|
||||
|
||||
if (entry && aName in entry) {
|
||||
let item = entry[aName];
|
||||
@ -2206,13 +2214,13 @@ UserProperties.prototype = {
|
||||
* The value of the property to set.
|
||||
*/
|
||||
setProperty: function UP_setProperty(aStyle, aName, aComputedValue, aUserValue) {
|
||||
let entry = this.weakMap.get(aStyle, null);
|
||||
let entry = this.map.get(aStyle, null);
|
||||
if (entry) {
|
||||
entry[aName] = { computed: aComputedValue, user: aUserValue };
|
||||
} else {
|
||||
let props = {};
|
||||
props[aName] = { computed: aComputedValue, user: aUserValue };
|
||||
this.weakMap.set(aStyle, props);
|
||||
this.map.set(aStyle, props);
|
||||
}
|
||||
},
|
||||
|
||||
@ -2225,7 +2233,7 @@ UserProperties.prototype = {
|
||||
* The name of the property to check.
|
||||
*/
|
||||
contains: function UP_contains(aStyle, aName) {
|
||||
let entry = this.weakMap.get(aStyle, null);
|
||||
let entry = this.map.get(aStyle, null);
|
||||
return !!entry && aName in entry;
|
||||
},
|
||||
};
|
||||
|
@ -174,6 +174,7 @@
|
||||
#ifdef MOZ_B2G_BT
|
||||
@BINPATH@/components/dom_bluetooth.xpt
|
||||
#endif
|
||||
@BINPATH@/components/dom_camera.xpt
|
||||
@BINPATH@/components/dom_canvas.xpt
|
||||
@BINPATH@/components/dom_contacts.xpt
|
||||
@BINPATH@/components/dom_alarm.xpt
|
||||
|
@ -8,13 +8,11 @@ import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.mozilla.SUTAgentAndroid.SUTAgentAndroid;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
@ -100,6 +98,8 @@ public class CmdWorkerThread extends Thread
|
||||
String inputLine, outputLine;
|
||||
DoCommand dc = new DoCommand(theParent.svc);
|
||||
|
||||
SUTAgentAndroid.logToFile(dc.GetTestRoot(), dc.GetSystemTime(), "CmdWorkerThread starts: "+getId());
|
||||
|
||||
int nAvail = cmdIn.available();
|
||||
cmdIn.skip(nAvail);
|
||||
|
||||
@ -134,30 +134,9 @@ public class CmdWorkerThread extends Thread
|
||||
|
||||
if ((inputLine += readLine(in)) != null)
|
||||
{
|
||||
String datestamp = dc.GetSystemTime();
|
||||
String message = String.format("%s : %s : %s",
|
||||
datestamp, socket.getInetAddress().getHostAddress(), inputLine);
|
||||
Log.i("SUTAgentAndroid", message);
|
||||
|
||||
String fileDateStr = "00";
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS");
|
||||
Date dateStr = sdf.parse(datestamp);
|
||||
SimpleDateFormat sdf_file = new SimpleDateFormat("yyyy-MM-dd");
|
||||
fileDateStr = sdf_file.format(dateStr);
|
||||
} catch (ParseException pe) {}
|
||||
String logFile = dc.GetTestRoot() + "/" + fileDateStr + "-sutcommands.txt";
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
pw = new PrintWriter(new FileWriter(logFile, true));
|
||||
if (message != null) {
|
||||
pw.println(message);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
Log.e("SUTAgentAndroid", "exception with file writer on: " + logFile);
|
||||
} finally {
|
||||
pw.close();
|
||||
}
|
||||
String message = String.format("%s : %s",
|
||||
socket.getInetAddress().getHostAddress(), inputLine);
|
||||
SUTAgentAndroid.logToFile(dc.GetTestRoot(), dc.GetSystemTime(), message);
|
||||
|
||||
outputLine = dc.processCommand(inputLine, out, in, cmdOut);
|
||||
if (outputLine.length() > 0)
|
||||
@ -187,6 +166,7 @@ public class CmdWorkerThread extends Thread
|
||||
in.close();
|
||||
in = null;
|
||||
socket.close();
|
||||
SUTAgentAndroid.logToFile(dc.GetTestRoot(), dc.GetSystemTime(), "CmdWorkerThread ends: "+getId());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
@ -5,6 +5,8 @@
|
||||
package com.mozilla.SUTAgentAndroid;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetAddress;
|
||||
import org.apache.http.conn.util.InetAddressUtils;
|
||||
@ -150,6 +152,8 @@ public class SUTAgentAndroid extends Activity
|
||||
|
||||
DoCommand dc = new DoCommand(getApplication());
|
||||
|
||||
logToFile(dc.GetTestRoot(), dc.GetSystemTime(), "onCreate");
|
||||
|
||||
// Get configuration settings from "ini" file
|
||||
File dir = getFilesDir();
|
||||
File iniFile = new File(dir, "SUTAgent.ini");
|
||||
@ -351,8 +355,10 @@ public class SUTAgentAndroid extends Activity
|
||||
public void onDestroy()
|
||||
{
|
||||
super.onDestroy();
|
||||
DoCommand dc = new DoCommand(getApplication());
|
||||
if (isFinishing())
|
||||
{
|
||||
logToFile(dc.GetTestRoot(), dc.GetSystemTime(), "onDestroy - finishing");
|
||||
Intent listenerSvc = new Intent(this, ASMozStub.class);
|
||||
listenerSvc.setAction("com.mozilla.SUTAgentAndroid.service.LISTENER_SERVICE");
|
||||
stopService(listenerSvc);
|
||||
@ -365,6 +371,10 @@ public class SUTAgentAndroid extends Activity
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
logToFile(dc.GetTestRoot(), dc.GetSystemTime(), "onDestroy - not finishing");
|
||||
}
|
||||
}
|
||||
|
||||
private void monitorBatteryState()
|
||||
@ -714,4 +724,41 @@ public class SUTAgentAndroid extends Activity
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void logToFile(String testRoot, String datestamp, String message)
|
||||
{
|
||||
if (testRoot == null ||
|
||||
datestamp == null ||
|
||||
message == null)
|
||||
{
|
||||
Log.e("SUTAgentAndroid", "bad arguments in logToFile()!");
|
||||
return;
|
||||
}
|
||||
Log.i("SUTAgentAndroid", message);
|
||||
String fileDateStr = "00";
|
||||
try
|
||||
{
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS");
|
||||
Date dateStr = sdf.parse(datestamp);
|
||||
SimpleDateFormat sdf_file = new SimpleDateFormat("yyyy-MM-dd");
|
||||
fileDateStr = sdf_file.format(dateStr);
|
||||
}
|
||||
catch (ParseException pe) {}
|
||||
String logFile = testRoot + "/" + fileDateStr + "-sutcommands.txt";
|
||||
PrintWriter pw = null;
|
||||
try
|
||||
{
|
||||
pw = new PrintWriter(new FileWriter(logFile, true));
|
||||
pw.println(datestamp + " : " + message);
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
Log.e("SUTAgentAndroid", "exception with file writer on: " + logFile);
|
||||
}
|
||||
finally
|
||||
{
|
||||
pw.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -273,6 +273,7 @@ MOZ_NATIVE_NSS = @MOZ_NATIVE_NSS@
|
||||
|
||||
MOZ_B2G_RIL = @MOZ_B2G_RIL@
|
||||
MOZ_B2G_BT = @MOZ_B2G_BT@
|
||||
MOZ_B2G_CAMERA = @MOZ_B2G_CAMERA@
|
||||
|
||||
MOZ_SYS_MSG = @MOZ_SYS_MSG@
|
||||
|
||||
|
@ -646,8 +646,10 @@ signal.h
|
||||
SimpleGameSound.h
|
||||
SIOUX.h
|
||||
size_t.h
|
||||
sndio.h
|
||||
someincludefile.h
|
||||
Sound.h
|
||||
soundcard.h
|
||||
sqlite3.h
|
||||
ssdef.h
|
||||
sslerr.h
|
||||
|
18
configure.in
18
configure.in
@ -192,7 +192,7 @@ if test -n "$gonkdir" ; then
|
||||
;;
|
||||
esac
|
||||
|
||||
CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice"
|
||||
CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera"
|
||||
CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
|
||||
CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
|
||||
LIBS="$LIBS $STLPORT_LIBS"
|
||||
@ -3621,6 +3621,7 @@ MOZ_TLS=
|
||||
if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
|
||||
# mips builds fail with TLS variables because of a binutils bug.
|
||||
# See bug 528687
|
||||
# OpenBSD doesn't have TLS support, and the test succeeds with clang++
|
||||
case "${target}" in
|
||||
mips*-*)
|
||||
:
|
||||
@ -3628,6 +3629,9 @@ if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
|
||||
*-android*|*-linuxandroid*)
|
||||
:
|
||||
;;
|
||||
*-openbsd*)
|
||||
:
|
||||
;;
|
||||
*)
|
||||
AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
|
||||
MOZ_TLS=1
|
||||
@ -7347,6 +7351,18 @@ if test -n "$MOZ_SYS_MSG"; then
|
||||
fi
|
||||
AC_SUBST(MOZ_SYS_MSG)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable Camera Interface for B2G (Gonk usually)
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(b2g-camera,
|
||||
[ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
|
||||
MOZ_B2G_CAMERA=1,
|
||||
MOZ_B2G_CAMERA= )
|
||||
if test -n "$MOZ_B2G_CAMERA"; then
|
||||
AC_DEFINE(MOZ_B2G_CAMERA)
|
||||
fi
|
||||
AC_SUBST(MOZ_B2G_CAMERA)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Support for demangling undefined symbols
|
||||
dnl ========================================================
|
||||
|
@ -92,8 +92,8 @@ class Element;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x8c6a1e62, 0xd5ad, 0x4297, \
|
||||
{ 0xb9, 0x41, 0x64, 0x49, 0x22, 0x2e, 0xc4, 0xf0 } }
|
||||
{ 0xbd70ee06, 0x2a7d, 0x4258, \
|
||||
{ 0x86, 0x4b, 0xbd, 0x28, 0xad, 0x9f, 0xd1, 0x41 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -723,6 +723,27 @@ public:
|
||||
*/
|
||||
virtual void AsyncRequestFullScreen(Element* aElement) = 0;
|
||||
|
||||
/**
|
||||
* Called when a frame in a child process has entered fullscreen or when a
|
||||
* fullscreen frame in a child process changes to another origin.
|
||||
* aFrameElement is the frame element which contains the child-process
|
||||
* fullscreen document, and aNewOrigin is the origin of the new fullscreen
|
||||
* document.
|
||||
*/
|
||||
virtual nsresult RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
|
||||
const nsAString& aNewOrigin) = 0;
|
||||
|
||||
/**
|
||||
* Called when a frame in a remote child document has rolled back fullscreen
|
||||
* so that all its fullscreen element stacks are empty; we must continue the
|
||||
* rollback in this parent process' doc tree branch which is fullscreen.
|
||||
* Note that only one branch of the document tree can have its documents in
|
||||
* fullscreen state at one time. We're in inconsistent state if the a
|
||||
* fullscreen document has a parent and that parent isn't fullscreen. We
|
||||
* preserve this property across process boundaries.
|
||||
*/
|
||||
virtual nsresult RemoteFrameFullscreenReverted() = 0;
|
||||
|
||||
/**
|
||||
* Restores the previous full-screen element to full-screen status. If there
|
||||
* is no former full-screen element, this exits full-screen, moving the
|
||||
|
@ -188,7 +188,7 @@ Link::SetHost(const nsAString &aHost)
|
||||
if (iter != end) {
|
||||
nsAutoString portStr(Substring(iter, end));
|
||||
nsresult rv;
|
||||
PRInt32 port = portStr.ToInteger((PRInt32 *)&rv);
|
||||
PRInt32 port = portStr.ToInteger(&rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
(void)uri->SetPort(port);
|
||||
}
|
||||
@ -254,7 +254,7 @@ Link::SetPort(const nsAString &aPort)
|
||||
|
||||
nsresult rv;
|
||||
nsAutoString portStr(aPort);
|
||||
PRInt32 port = portStr.ToInteger((PRInt32 *)&rv);
|
||||
PRInt32 port = portStr.ToInteger(&rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1462,7 +1462,7 @@ bool nsAttrValue::ParseDoubleValue(const nsAString& aString)
|
||||
{
|
||||
ResetIfSet();
|
||||
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
double val = PromiseFlatString(aString).ToDouble(&ec);
|
||||
if (NS_FAILED(ec)) {
|
||||
return false;
|
||||
|
@ -1261,8 +1261,8 @@ nsContentUtils::ParseIntMarginValue(const nsAString& aString, nsIntMargin& resul
|
||||
if (end <= 0)
|
||||
return false;
|
||||
|
||||
PRInt32 ec, val =
|
||||
nsString(Substring(marginStr, start, end)).ToInteger(&ec);
|
||||
nsresult ec;
|
||||
PRInt32 val = nsString(Substring(marginStr, start, end)).ToInteger(&ec);
|
||||
if (NS_FAILED(ec))
|
||||
return false;
|
||||
|
||||
@ -5020,11 +5020,10 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
|
||||
return ret;
|
||||
}
|
||||
|
||||
PRInt32 errorCode;
|
||||
|
||||
nsAutoString minScaleStr;
|
||||
aDocument->GetHeaderData(nsGkAtoms::minimum_scale, minScaleStr);
|
||||
|
||||
nsresult errorCode;
|
||||
float scaleMinFloat = minScaleStr.ToFloat(&errorCode);
|
||||
|
||||
if (errorCode) {
|
||||
@ -5039,7 +5038,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
|
||||
|
||||
// We define a special error code variable for the scale and max scale,
|
||||
// because they are used later (see the width calculations).
|
||||
PRInt32 scaleMaxErrorCode;
|
||||
nsresult scaleMaxErrorCode;
|
||||
float scaleMaxFloat = maxScaleStr.ToFloat(&scaleMaxErrorCode);
|
||||
|
||||
if (scaleMaxErrorCode) {
|
||||
@ -5052,7 +5051,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
|
||||
nsAutoString scaleStr;
|
||||
aDocument->GetHeaderData(nsGkAtoms::viewport_initial_scale, scaleStr);
|
||||
|
||||
PRInt32 scaleErrorCode;
|
||||
nsresult scaleErrorCode;
|
||||
float scaleFloat = scaleStr.ToFloat(&scaleErrorCode);
|
||||
scaleFloat = NS_MIN(scaleFloat, scaleMaxFloat);
|
||||
scaleFloat = NS_MAX(scaleFloat, scaleMinFloat);
|
||||
|
@ -8499,7 +8499,7 @@ nsDocument::MozCancelFullScreen()
|
||||
}
|
||||
|
||||
// Runnable to set window full-screen mode. Used as a script runner
|
||||
// to ensure we only call nsGlobalWindow::SetFullScreen() when it's safe to
|
||||
// to ensure we only call nsGlobalWindow::SetFullScreen() when it's safe to
|
||||
// run script. nsGlobalWindow::SetFullScreen() dispatches a synchronous event
|
||||
// (handled in chome code) which is unsafe to run if this is called in
|
||||
// nsGenericElement::UnbindFromTree().
|
||||
@ -8547,13 +8547,54 @@ nsIDocument::ExitFullScreen(bool aRunAsync)
|
||||
nsDocument::ExitFullScreen();
|
||||
}
|
||||
|
||||
// Returns true if the document is a direct child of a cross process parent
|
||||
// mozbrowser iframe. This is the case when the document has a null parent,
|
||||
// and its DocShell reports that it is a browser frame.
|
||||
static bool
|
||||
ResetFullScreen(nsIDocument* aDocument, void* aData) {
|
||||
HasCrossProcessParent(nsIDocument* aDocument)
|
||||
{
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Content) {
|
||||
return false;
|
||||
}
|
||||
if (aDocument->GetParentDocument() != nullptr) {
|
||||
return false;
|
||||
}
|
||||
nsPIDOMWindow* win = aDocument->GetWindow();
|
||||
if (!win) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsIDocShell> docShell = win->GetDocShell();
|
||||
if (!docShell) {
|
||||
return false;
|
||||
}
|
||||
bool isBrowserElement = false;
|
||||
docShell->GetIsBrowserElement(&isBrowserElement);
|
||||
return isBrowserElement;
|
||||
}
|
||||
|
||||
static bool
|
||||
ResetFullScreen(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
if (aDocument->IsFullScreenDoc()) {
|
||||
static_cast<nsDocument*>(aDocument)->CleanupFullscreenState();
|
||||
NS_ASSERTION(!aDocument->IsFullScreenDoc(), "Should reset full-screen");
|
||||
nsTArray<nsIDocument*>* changed = reinterpret_cast<nsTArray<nsIDocument*>*>(aData);
|
||||
changed->AppendElement(aDocument);
|
||||
|
||||
if (HasCrossProcessParent(aDocument)) {
|
||||
// We're at the top of the content-process side doc tree. Ask the parent
|
||||
// process to exit fullscreen.
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
os->NotifyObservers(aDocument, "ask-parent-to-exit-fullscreen", nullptr);
|
||||
}
|
||||
|
||||
// Dispatch a notification so that if this document has any
|
||||
// cross-process subdocuments, they'll be notified to exit fullscreen.
|
||||
// The BrowserElementParent listens for this event and performs the
|
||||
// cross process notification if it has a remote child process.
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
os->NotifyObservers(aDocument, "ask-children-to-exit-fullscreen", nullptr);
|
||||
|
||||
aDocument->EnumerateSubDocuments(ResetFullScreen, aData);
|
||||
}
|
||||
return true;
|
||||
@ -8623,8 +8664,15 @@ nsDocument::RestorePreviousFullScreenState()
|
||||
UnlockPointer();
|
||||
}
|
||||
|
||||
// Clear full-screen stacks in all descendant documents, bottom up.
|
||||
nsCOMPtr<nsIDocument> fullScreenDoc(do_QueryReferent(sFullScreenDoc));
|
||||
|
||||
// The fullscreen document may contain a <iframe mozbrowser> element which
|
||||
// has a cross process child. So send a notification so that its browser
|
||||
// parent will send a message to its child process to also exit fullscreen.
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
os->NotifyObservers(fullScreenDoc, "ask-children-to-exit-fullscreen", nullptr);
|
||||
|
||||
// Clear full-screen stacks in all descendant in process documents, bottom up.
|
||||
nsIDocument* doc = fullScreenDoc;
|
||||
while (doc != this) {
|
||||
NS_ASSERTION(doc->IsFullScreenDoc(), "Should be full-screen doc");
|
||||
@ -8641,6 +8689,12 @@ nsDocument::RestorePreviousFullScreenState()
|
||||
UnlockPointer();
|
||||
DispatchFullScreenChange(doc);
|
||||
if (static_cast<nsDocument*>(doc)->mFullScreenStack.IsEmpty()) {
|
||||
if (HasCrossProcessParent(doc)) {
|
||||
// Send notification to the parent process to tell it to rollback to
|
||||
// the previous fullscreen elements in its fullscreen element stacks.
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
os->NotifyObservers(doc, "ask-parent-to-rollback-fullscreen", nullptr);
|
||||
}
|
||||
// Full-screen stack in document is empty. Go back up to the parent
|
||||
// document. We'll pop the containing element off its stack, and use
|
||||
// its next full-screen element as the full-screen element.
|
||||
@ -8665,6 +8719,18 @@ nsDocument::RestorePreviousFullScreenState()
|
||||
e->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
||||
if (!nsContentUtils::HaveEqualPrincipals(doc, fullScreenDoc)) {
|
||||
// The origin which is fullscreen changed. Send a notification to
|
||||
// the root process so that a warning or approval UI can be shown
|
||||
// as necessary.
|
||||
nsAutoString origin;
|
||||
nsContentUtils::GetUTFOrigin(doc->NodePrincipal(), origin);
|
||||
nsIDocument* root = nsContentUtils::GetRootDocument(doc);
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
os->NotifyObservers(root, "fullscreen-origin-change", origin.get());
|
||||
}
|
||||
|
||||
sFullScreenDoc = do_GetWeakReference(doc);
|
||||
break;
|
||||
}
|
||||
@ -8700,7 +8766,9 @@ public:
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
nsDocument* doc = static_cast<nsDocument*>(mDoc.get());
|
||||
doc->RequestFullScreen(mElement, mWasCallerChrome);
|
||||
doc->RequestFullScreen(mElement,
|
||||
mWasCallerChrome,
|
||||
/* aNotifyOnOriginChange */ true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -8867,7 +8935,7 @@ IsInActiveTab(nsIDocument* aDoc)
|
||||
if (!isActive) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(container);
|
||||
if (!dsti) {
|
||||
return false;
|
||||
@ -8896,8 +8964,43 @@ IsInActiveTab(nsIDocument* aDoc)
|
||||
return activeWindow == rootWin;
|
||||
}
|
||||
|
||||
nsresult nsDocument::RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
|
||||
const nsAString& aOrigin)
|
||||
{
|
||||
// Ensure the frame element is the fullscreen element in this document.
|
||||
// If the frame element is already the fullscreen element in this document,
|
||||
// this has no effect.
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aFrameElement));
|
||||
RequestFullScreen(content->AsElement(),
|
||||
/* aWasCallerChrome */ false,
|
||||
/* aNotifyOnOriginChange */ false);
|
||||
|
||||
// Origin changed in child process, send notifiction, so that chrome can
|
||||
// update the UI to reflect the fullscreen origin change if necessary.
|
||||
// The BrowserElementChild listens on this, and forwards it over its
|
||||
// parent process, where it is redispatched. Chrome (in the root process,
|
||||
// which could be *this* process) listens for this notification so that
|
||||
// it can show a warning or approval UI.
|
||||
if (!aOrigin.IsEmpty()) {
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
os->NotifyObservers(nsContentUtils::GetRootDocument(this),
|
||||
"fullscreen-origin-change",
|
||||
PromiseFlatString(aOrigin).get());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsDocument::RemoteFrameFullscreenReverted()
|
||||
{
|
||||
RestorePreviousFullScreenState();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
|
||||
nsDocument::RequestFullScreen(Element* aElement,
|
||||
bool aWasCallerChrome,
|
||||
bool aNotifyOnOriginChange)
|
||||
{
|
||||
NS_ASSERTION(aElement,
|
||||
"Must pass non-null element to nsDocument::RequestFullScreen");
|
||||
@ -8922,7 +9025,7 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
|
||||
}
|
||||
if (GetFullScreenElement() &&
|
||||
!nsContentUtils::ContentIsDescendantOf(aElement, GetFullScreenElement())) {
|
||||
// If this document is full-screen, only grant full-screen requests from
|
||||
// If this document is full-screen, only grant full-screen requests from
|
||||
// a descendent of the current full-screen element.
|
||||
LogFullScreenDenied(true, "FullScreenDeniedNotDescendant", this);
|
||||
return;
|
||||
@ -8958,12 +9061,12 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
|
||||
|
||||
// Remember the root document, so that if a full-screen document is hidden
|
||||
// we can reset full-screen state in the remaining visible full-screen documents.
|
||||
nsIDocument* fullScreenDoc = nsContentUtils::GetRootDocument(this);
|
||||
sFullScreenRootDoc = do_GetWeakReference(fullScreenDoc);
|
||||
nsIDocument* fullScreenRootDoc = nsContentUtils::GetRootDocument(this);
|
||||
sFullScreenRootDoc = do_GetWeakReference(fullScreenRootDoc);
|
||||
|
||||
// If a document is already in fullscreen, then unlock the mouse pointer
|
||||
// before setting a new document to fullscreen
|
||||
if (fullScreenDoc) {
|
||||
if (sFullScreenDoc) {
|
||||
UnlockPointer();
|
||||
}
|
||||
|
||||
@ -8981,15 +9084,18 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
|
||||
DebugOnly<bool> x = FullScreenStackPush(aElement);
|
||||
NS_ASSERTION(x, "Full-screen state of requesting doc should always change!");
|
||||
changed.AppendElement(this);
|
||||
|
||||
|
||||
// Propagate up the document hierarchy, setting the full-screen element as
|
||||
// the element's container in ancestor documents. This also sets the
|
||||
// appropriate css styles as well. Note we don't propagate down the
|
||||
// document hierarchy, the full-screen element (or its container) is not
|
||||
// visible there.
|
||||
// visible there. Stop when we reach the root document.
|
||||
nsIDocument* child = this;
|
||||
nsIDocument* parent;
|
||||
while ((parent = child->GetParentDocument())) {
|
||||
while (true) {
|
||||
nsIDocument* parent = child->GetParentDocument();
|
||||
if (!parent) {
|
||||
break;
|
||||
}
|
||||
Element* element = parent->FindContentForSubDocument(child)->AsElement();
|
||||
if (static_cast<nsDocument*>(parent)->FullScreenStackPush(element)) {
|
||||
changed.AppendElement(parent);
|
||||
@ -9012,10 +9118,12 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
|
||||
|
||||
// If this document hasn't already been approved in this session,
|
||||
// check to see if the user has granted the fullscreen access
|
||||
// to the document's principal's host, if it has one.
|
||||
// to the document's principal's host, if it has one. Note that documents
|
||||
// in web apps which are the same origin as the web app are considered
|
||||
// trusted and so are automatically approved.
|
||||
if (!mIsApprovedForFullscreen) {
|
||||
mIsApprovedForFullscreen =
|
||||
GetWindow()->IsPartOfApp() ||
|
||||
GetWindow()->IsInAppOrigin() ||
|
||||
nsContentUtils::IsSitePermAllow(NodePrincipal(), "fullscreen");
|
||||
}
|
||||
|
||||
@ -9052,6 +9160,21 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
|
||||
"GetMozFullScreenElement should match GetFullScreenElement()");
|
||||
#endif
|
||||
|
||||
// The origin which is fullscreen changed, send a notifiction so that the
|
||||
// root document knows the origin of the document which requested fullscreen.
|
||||
// This is used for the fullscreen approval UI. If we're in a child
|
||||
// process, the root BrowserElementChild listens for this notification,
|
||||
// and forwards it across to its BrowserElementParent, which
|
||||
// re-broadcasts the message for the root document in its process.
|
||||
if (aNotifyOnOriginChange &&
|
||||
!nsContentUtils::HaveEqualPrincipals(previousFullscreenDoc, this)) {
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
nsIDocument* root = nsContentUtils::GetRootDocument(this);
|
||||
nsAutoString origin;
|
||||
nsContentUtils::GetUTFOrigin(NodePrincipal(), origin);
|
||||
os->NotifyObservers(root, "fullscreen-origin-change", origin.get());
|
||||
}
|
||||
|
||||
// Make the window full-screen. Note we must make the state changes above
|
||||
// before making the window full-screen, as then the document reports as
|
||||
// being in full-screen mode when the chrome "fullscreen" event fires,
|
||||
|
@ -937,14 +937,26 @@ public:
|
||||
virtual void RestorePreviousFullScreenState();
|
||||
virtual bool IsFullScreenDoc();
|
||||
virtual void SetApprovedForFullscreen(bool aIsApproved);
|
||||
virtual nsresult RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
|
||||
const nsAString& aNewOrigin);
|
||||
|
||||
virtual nsresult RemoteFrameFullscreenReverted();
|
||||
|
||||
static void ExitFullScreen();
|
||||
|
||||
// This is called asynchronously by nsIDocument::AsyncRequestFullScreen()
|
||||
// to move document into full-screen mode if allowed. aWasCallerChrome
|
||||
// to move this document into full-screen mode if allowed. aWasCallerChrome
|
||||
// should be true when nsIDocument::AsyncRequestFullScreen() was called
|
||||
// by chrome code.
|
||||
void RequestFullScreen(Element* aElement, bool aWasCallerChrome);
|
||||
// by chrome code. aNotifyOnOriginChange denotes whether we should send a
|
||||
// fullscreen-origin-change notification if requesting fullscreen in this
|
||||
// document causes the origin which is fullscreen to change. We may want to
|
||||
// *not* send this notification if we're calling RequestFullscreen() as part
|
||||
// of a continuation of a request in a subdocument, whereupon the caller will
|
||||
// need to send the notification with the origin of the document which
|
||||
// originally requested fullscreen, not *this* document's origin.
|
||||
void RequestFullScreen(Element* aElement,
|
||||
bool aWasCallerChrome,
|
||||
bool aNotifyOnOriginChange);
|
||||
|
||||
// Removes all elements from the full-screen stack, removing full-scren
|
||||
// styles from the top element in the stack.
|
||||
|
@ -2342,3 +2342,4 @@ nsFrameLoader::SetRemoteBrowser(nsITabParent* aTabParent)
|
||||
"remote-browser-frame-shown", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "Layers.h"
|
||||
#include "FrameMetrics.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsSubDocumentFrame;
|
||||
|
@ -4762,14 +4762,18 @@ static const char*
|
||||
GetFullScreenError(nsIDocument* aDoc)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = aDoc->GetWindow();
|
||||
if (win && win->IsPartOfApp()) {
|
||||
if (win && win->IsInAppOrigin()) {
|
||||
// Request is in a web app and in the same origin as the web app.
|
||||
// Don't enforce as strict security checks for web apps, the user
|
||||
// is supposed to have trust in them. However documents cross-origin
|
||||
// to the web app must still confirm to the normal security checks.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!nsContentUtils::IsRequestFullScreenAllowed()) {
|
||||
return "FullScreenDeniedNotInputDriven";
|
||||
}
|
||||
|
||||
|
||||
if (nsContentUtils::IsSitePermDeny(aDoc->NodePrincipal(), "fullscreen")) {
|
||||
return "FullScreenDeniedBlocked";
|
||||
}
|
||||
@ -4784,6 +4788,8 @@ nsresult nsGenericElement::MozRequestFullScreen()
|
||||
// This stops the full-screen from being abused similar to the popups of old,
|
||||
// and it also makes it harder for bad guys' script to go full-screen and
|
||||
// spoof the browser chrome/window and phish logins etc.
|
||||
// Note that requests for fullscreen inside a web app's origin are exempt
|
||||
// from this restriction.
|
||||
const char* error = GetFullScreenError(OwnerDoc());
|
||||
if (error) {
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
@ -4803,3 +4809,4 @@ nsresult nsGenericElement::MozRequestFullScreen()
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1021,7 +1021,10 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
|
||||
\
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it; \
|
||||
nsresult rv = it->Init(); \
|
||||
rv |= const_cast<_elementName*>(this)->CopyInnerTo(it); \
|
||||
nsresult rv2 = const_cast<_elementName*>(this)->CopyInnerTo(it); \
|
||||
if (NS_FAILED(rv2)) { \
|
||||
rv = rv2; \
|
||||
} \
|
||||
if (NS_SUCCEEDED(rv)) { \
|
||||
kungFuDeathGrip.swap(*aResult); \
|
||||
} \
|
||||
@ -1048,7 +1051,8 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
|
||||
NS_IMETHODIMP \
|
||||
_class::Get##_method(nsAString& aValue) \
|
||||
{ \
|
||||
return GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_method(const nsAString& aValue) \
|
||||
|
@ -1704,7 +1704,6 @@ GK_ATOM(legendFrame, "LegendFrame")
|
||||
GK_ATOM(letterFrame, "LetterFrame")
|
||||
GK_ATOM(lineFrame, "LineFrame")
|
||||
GK_ATOM(listControlFrame,"ListControlFrame")
|
||||
GK_ATOM(menuBarFrame,"MenuBarFrame")
|
||||
GK_ATOM(menuFrame,"MenuFrame")
|
||||
GK_ATOM(menuPopupFrame,"MenuPopupFrame")
|
||||
GK_ATOM(objectFrame, "ObjectFrame")
|
||||
|
@ -241,7 +241,7 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
|
||||
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
|
||||
if (!start.IsEmpty()){
|
||||
PRInt32 rv = 0;
|
||||
nsresult rv = NS_OK;
|
||||
startAttrVal = start.ToInteger(&rv);
|
||||
//If OL has "start" attribute, first LI element has to start with that value
|
||||
//Therefore subtracting 1 as all the LI elements are incrementing it before using it;
|
||||
|
@ -480,7 +480,7 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
|
||||
: style.Length() - widthOffset);
|
||||
nsAutoString widthstr;
|
||||
style.Mid(widthstr, widthOffset+6, length);
|
||||
PRInt32 err;
|
||||
nsresult err;
|
||||
PRInt32 col = widthstr.ToInteger(&err);
|
||||
|
||||
if (NS_SUCCEEDED(err)) {
|
||||
@ -563,7 +563,7 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
|
||||
nsAutoString startAttr;
|
||||
PRInt32 startVal = 1;
|
||||
if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::start, startAttr))) {
|
||||
PRInt32 rv = 0;
|
||||
nsresult rv = NS_OK;
|
||||
startVal = startAttr.ToInteger(&rv);
|
||||
if (NS_FAILED(rv))
|
||||
startVal = 1;
|
||||
@ -581,7 +581,7 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
|
||||
if (mOLStackIndex > 0) {
|
||||
nsAutoString valueAttr;
|
||||
if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::value, valueAttr))) {
|
||||
PRInt32 rv = 0;
|
||||
nsresult rv = NS_OK;
|
||||
PRInt32 valueAttrVal = valueAttr.ToInteger(&rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mOLStack[mOLStackIndex-1] = valueAttrVal;
|
||||
|
@ -254,7 +254,7 @@ nsXHTMLContentSerializer::SerializeAttributes(nsIContent* aContent,
|
||||
PRInt32 startAttrVal = 0;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
|
||||
if (!start.IsEmpty()) {
|
||||
PRInt32 rv = 0;
|
||||
nsresult rv = NS_OK;
|
||||
startAttrVal = start.ToInteger(&rv);
|
||||
//If OL has "start" attribute, first LI element has to start with that value
|
||||
//Therefore subtracting 1 as all the LI elements are incrementing it before using it;
|
||||
@ -920,7 +920,7 @@ nsXHTMLContentSerializer::SerializeLIValueAttribute(nsIContent* aElement,
|
||||
offset++;
|
||||
else {
|
||||
found = true;
|
||||
PRInt32 rv = 0;
|
||||
nsresult rv = NS_OK;
|
||||
startVal = valueStr.ToInteger(&rv);
|
||||
}
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ nsXMLNameSpaceMap::Create(bool aForXML)
|
||||
NS_ENSURE_TRUE(map, nullptr);
|
||||
|
||||
if (aForXML) {
|
||||
nsresult rv = map->AddPrefix(nsGkAtoms::xmlns,
|
||||
kNameSpaceID_XMLNS);
|
||||
rv |= map->AddPrefix(nsGkAtoms::xml, kNameSpaceID_XML);
|
||||
nsresult rv1 = map->AddPrefix(nsGkAtoms::xmlns,
|
||||
kNameSpaceID_XMLNS);
|
||||
nsresult rv2 = map->AddPrefix(nsGkAtoms::xml, kNameSpaceID_XML);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
if (NS_FAILED(rv1) || NS_FAILED(rv2)) {
|
||||
delete map;
|
||||
map = nullptr;
|
||||
}
|
||||
|
@ -32,11 +32,17 @@ function resolveURL(relative) {
|
||||
return a.href;
|
||||
}
|
||||
|
||||
var resolvedURL = resolveURL(tests[0]);
|
||||
|
||||
var expectedErrors = [
|
||||
'[JavaScript Warning: "A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element." {file: "' + resolveURL(tests[0]) + '" line: 1}]'
|
||||
'[JavaScript Warning: "A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element." {file: "' + resolvedURL + '" line: 1}]'
|
||||
];
|
||||
|
||||
function consoleError(msg) {
|
||||
function consoleError(msg, fileName) {
|
||||
// Ignore messages not generated by the test
|
||||
if (fileName !== resolvedURL) {
|
||||
return;
|
||||
}
|
||||
var expected = expectedErrors.shift();
|
||||
is(msg, expected, "Not the right error message");
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ typedef NS_STDCALL_FUNCPROTO(nsresult, CanvasStyleGetterType, nsIDOMCanvasRender
|
||||
GetStrokeStyle_multi, (nsAString &, nsISupports **, PRInt32 *));
|
||||
|
||||
static JSBool
|
||||
Canvas2D_SetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
Canvas2D_SetStyleHelper(JSContext *cx, JSObject *obj, jsid id, JSMutableHandleValue vp,
|
||||
CanvasStyleSetterType setfunc)
|
||||
{
|
||||
XPC_QS_ASSERT_CONTEXT_OK(cx);
|
||||
@ -29,8 +29,8 @@ Canvas2D_SetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
return JS_FALSE;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_STRING(*vp)) {
|
||||
xpc_qsDOMString arg0(cx, *vp, vp,
|
||||
if (JSVAL_IS_STRING(vp)) {
|
||||
xpc_qsDOMString arg0(cx, vp, vp.address(),
|
||||
xpc_qsDOMString::eDefaultNullBehavior,
|
||||
xpc_qsDOMString::eDefaultUndefinedBehavior);
|
||||
if (!arg0.IsValid())
|
||||
@ -40,7 +40,7 @@ Canvas2D_SetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
} else {
|
||||
nsISupports *arg0;
|
||||
xpc_qsSelfRef arg0ref;
|
||||
rv = xpc_qsUnwrapArg<nsISupports>(cx, *vp, &arg0, &arg0ref.ptr, vp);
|
||||
rv = xpc_qsUnwrapArg<nsISupports>(cx, vp, &arg0, &arg0ref.ptr, vp.address());
|
||||
if (NS_FAILED(rv)) {
|
||||
xpc_qsThrowBadSetterValue(cx, rv, JSVAL_TO_OBJECT(*tvr.jsval_addr()), id);
|
||||
return JS_FALSE;
|
||||
@ -56,14 +56,14 @@ Canvas2D_SetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
}
|
||||
|
||||
static JSBool
|
||||
Canvas2D_GetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
Canvas2D_GetStyleHelper(JSContext *cx, JSObject *obj, jsid id, JSMutableHandleValue vp,
|
||||
CanvasStyleGetterType getfunc)
|
||||
{
|
||||
XPC_QS_ASSERT_CONTEXT_OK(cx);
|
||||
nsIDOMCanvasRenderingContext2D *self;
|
||||
xpc_qsSelfRef selfref;
|
||||
XPCLazyCallContext lccx(JS_CALLER, cx, obj);
|
||||
if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, vp, &lccx))
|
||||
if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, vp.address(), &lccx))
|
||||
return JS_FALSE;
|
||||
nsresult rv;
|
||||
|
||||
@ -72,11 +72,11 @@ Canvas2D_GetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
PRInt32 resultType;
|
||||
rv = (self->*getfunc)(resultString, getter_AddRefs(resultInterface), &resultType);
|
||||
if (NS_FAILED(rv))
|
||||
return xpc_qsThrowGetterSetterFailed(cx, rv, JSVAL_TO_OBJECT(*vp), id);
|
||||
return xpc_qsThrowGetterSetterFailed(cx, rv, JSVAL_TO_OBJECT(vp), id);
|
||||
|
||||
switch (resultType) {
|
||||
case nsIDOMCanvasRenderingContext2D::CMG_STYLE_STRING:
|
||||
return xpc::StringToJsval(cx, resultString, vp);
|
||||
return xpc::StringToJsval(cx, resultString, vp.address());
|
||||
|
||||
case nsIDOMCanvasRenderingContext2D::CMG_STYLE_PATTERN:
|
||||
{
|
||||
@ -84,7 +84,7 @@ Canvas2D_GetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
xpc_qsGetWrapperCache(resultInterface));
|
||||
return xpc_qsXPCOMObjectToJsval(lccx, helper,
|
||||
&NS_GET_IID(nsIDOMCanvasPattern),
|
||||
&interfaces[k_nsIDOMCanvasPattern], vp);
|
||||
&interfaces[k_nsIDOMCanvasPattern], vp.address());
|
||||
}
|
||||
case nsIDOMCanvasRenderingContext2D::CMG_STYLE_GRADIENT:
|
||||
{
|
||||
@ -92,33 +92,33 @@ Canvas2D_GetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
xpc_qsGetWrapperCache(resultInterface));
|
||||
return xpc_qsXPCOMObjectToJsval(lccx, helper,
|
||||
&NS_GET_IID(nsIDOMCanvasGradient),
|
||||
&interfaces[k_nsIDOMCanvasGradient], vp);
|
||||
&interfaces[k_nsIDOMCanvasGradient], vp.address());
|
||||
}
|
||||
default:
|
||||
return xpc_qsThrowGetterSetterFailed(cx, NS_ERROR_FAILURE, JSVAL_TO_OBJECT(*vp), id);
|
||||
return xpc_qsThrowGetterSetterFailed(cx, NS_ERROR_FAILURE, JSVAL_TO_OBJECT(vp), id);
|
||||
}
|
||||
}
|
||||
|
||||
static JSBool
|
||||
nsIDOMCanvasRenderingContext2D_SetStrokeStyle(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, jsval *vp)
|
||||
nsIDOMCanvasRenderingContext2D_SetStrokeStyle(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp)
|
||||
{
|
||||
return Canvas2D_SetStyleHelper(cx, obj, id, vp, &nsIDOMCanvasRenderingContext2D::SetStrokeStyle_multi);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
nsIDOMCanvasRenderingContext2D_GetStrokeStyle(JSContext *cx, JSHandleObject obj, JSHandleId id, jsval *vp)
|
||||
nsIDOMCanvasRenderingContext2D_GetStrokeStyle(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
|
||||
{
|
||||
return Canvas2D_GetStyleHelper(cx, obj, id, vp, &nsIDOMCanvasRenderingContext2D::GetStrokeStyle_multi);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
nsIDOMCanvasRenderingContext2D_SetFillStyle(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, jsval *vp)
|
||||
nsIDOMCanvasRenderingContext2D_SetFillStyle(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp)
|
||||
{
|
||||
return Canvas2D_SetStyleHelper(cx, obj, id, vp, &nsIDOMCanvasRenderingContext2D::SetFillStyle_multi);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
nsIDOMCanvasRenderingContext2D_GetFillStyle(JSContext *cx, JSHandleObject obj, JSHandleId id, jsval *vp)
|
||||
nsIDOMCanvasRenderingContext2D_GetFillStyle(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
|
||||
{
|
||||
return Canvas2D_GetStyleHelper(cx, obj, id, vp, &nsIDOMCanvasRenderingContext2D::GetFillStyle_multi);
|
||||
}
|
||||
|
@ -17,12 +17,17 @@
|
||||
#include "nsICanvasElementExternal.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "Layers.h"
|
||||
|
||||
class nsICanvasRenderingContextInternal;
|
||||
class nsIDOMFile;
|
||||
class nsIPropertyBag;
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
class CanvasLayer;
|
||||
class LayerManager;
|
||||
}
|
||||
}
|
||||
|
||||
class nsHTMLCanvasElement : public nsGenericHTMLElement,
|
||||
public nsICanvasElementExternal,
|
||||
public nsIDOMHTMLCanvasElement
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsAudioStream.h"
|
||||
#include "VideoFrameContainer.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
@ -43,6 +44,8 @@ public:
|
||||
typedef mozilla::MediaStream MediaStream;
|
||||
typedef mozilla::MediaResource MediaResource;
|
||||
|
||||
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
|
||||
|
||||
enum CanPlayStatus {
|
||||
CANPLAY_NO,
|
||||
CANPLAY_MAYBE,
|
||||
@ -109,7 +112,10 @@ public:
|
||||
// Called by the video decoder object, on the main thread,
|
||||
// when it has read the metadata containing video dimensions,
|
||||
// etc.
|
||||
void MetadataLoaded(PRUint32 aChannels, PRUint32 aRate, bool aHasAudio);
|
||||
void MetadataLoaded(PRUint32 aChannels,
|
||||
PRUint32 aRate,
|
||||
bool aHasAudio,
|
||||
const MetadataTags* aTags);
|
||||
|
||||
// Called by the video decoder object, on the main thread,
|
||||
// when it has read the first frame of the video
|
||||
@ -700,6 +706,13 @@ protected:
|
||||
// Current audio sample rate.
|
||||
PRUint32 mRate;
|
||||
|
||||
// Helper function to iterate over a hash table
|
||||
// and convert it to a JSObject.
|
||||
static PLDHashOperator BuildObjectFromTags(nsCStringHashKey::KeyType aKey,
|
||||
nsCString aValue,
|
||||
void* aUserArg);
|
||||
nsAutoPtr<const MetadataTags> mTags;
|
||||
|
||||
// URI of the resource we're attempting to load. This stores the value we
|
||||
// return in the currentSrc attribute. Use GetCurrentSrc() to access the
|
||||
// currentSrc attribute.
|
||||
|
@ -123,7 +123,7 @@ nsHTMLAudioElement::MozSetup(PRUint32 aChannels, PRUint32 aRate)
|
||||
return rv;
|
||||
}
|
||||
|
||||
MetadataLoaded(aChannels, aRate, true);
|
||||
MetadataLoaded(aChannels, aRate, true, nullptr);
|
||||
mAudioStream->SetVolume(mVolume);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -185,11 +185,15 @@ nsHTMLAudioElement::MozCurrentSampleOffset(PRUint64 *aRetVal)
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
*aRetVal = mAudioStream->GetPositionInFrames() * mChannels;
|
||||
PRInt64 position = mAudioStream->GetPositionInFrames();
|
||||
if (position < 0) {
|
||||
*aRetVal = 0;
|
||||
} else {
|
||||
*aRetVal = mAudioStream->GetPositionInFrames() * mChannels;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsHTMLAudioElement::SetAcceptHeader(nsIHttpChannel* aChannel)
|
||||
{
|
||||
nsCAutoString value(
|
||||
|
@ -1794,7 +1794,7 @@ NS_IMETHODIMP
|
||||
nsHTMLFormElement::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRUint32 aStateFlags,
|
||||
PRUint32 aStatus)
|
||||
nsresult aStatus)
|
||||
{
|
||||
// If STATE_STOP is never fired for any reason (redirect? Failed state
|
||||
// change?) the form element will leak. It will be kept around by the
|
||||
|
@ -275,7 +275,7 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
|
||||
}
|
||||
else {
|
||||
// Otherwise just convert to integer.
|
||||
PRInt32 err;
|
||||
nsresult err;
|
||||
specs[i].mValue = token.ToInteger(&err);
|
||||
if (err) {
|
||||
specs[i].mValue = 0;
|
||||
|
@ -1005,7 +1005,7 @@ nsHTMLInputElement::GetValueAsDouble() const
|
||||
{
|
||||
double doubleValue;
|
||||
nsAutoString stringValue;
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
|
||||
GetValueInternal(stringValue);
|
||||
doubleValue = stringValue.ToDouble(&ec);
|
||||
@ -1107,7 +1107,7 @@ nsHTMLInputElement::GetMinAsDouble() const
|
||||
nsAutoString minStr;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
|
||||
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
double min = minStr.ToDouble(&ec);
|
||||
return NS_SUCCEEDED(ec) ? min : MOZ_DOUBLE_NaN();
|
||||
}
|
||||
@ -1125,7 +1125,7 @@ nsHTMLInputElement::GetMaxAsDouble() const
|
||||
nsAutoString maxStr;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
|
||||
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
double max = maxStr.ToDouble(&ec);
|
||||
return NS_SUCCEEDED(ec) ? max : MOZ_DOUBLE_NaN();
|
||||
}
|
||||
@ -2661,7 +2661,7 @@ nsHTMLInputElement::SanitizeValue(nsAString& aValue)
|
||||
break;
|
||||
case NS_FORM_INPUT_NUMBER:
|
||||
{
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
PromiseFlatString(aValue).ToDouble(&ec);
|
||||
if (NS_FAILED(ec)) {
|
||||
aValue.Truncate();
|
||||
@ -3327,7 +3327,10 @@ nsHTMLInputElement::SaveState()
|
||||
}
|
||||
|
||||
if (mDisabledChanged) {
|
||||
rv |= GetPrimaryPresState(this, &state);
|
||||
nsresult tmp = GetPrimaryPresState(this, &state);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (state) {
|
||||
// We do not want to save the real disabled state but the disabled
|
||||
// attribute.
|
||||
@ -3860,7 +3863,7 @@ nsHTMLInputElement::GetStep() const
|
||||
return kStepAny;
|
||||
}
|
||||
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
// NOTE: should be multiplied by defaultStepScaleFactor,
|
||||
// which is 1 for type=number.
|
||||
step = stepStr.ToDouble(&ec);
|
||||
|
@ -599,7 +599,9 @@ void nsHTMLMediaElement::AbortExistingLoads()
|
||||
mDownloadSuspendedByCache = false;
|
||||
mSourcePointer = nullptr;
|
||||
|
||||
// TODO: The playback rate must be set to the default playback rate.
|
||||
mChannels = 0;
|
||||
mRate = 0;
|
||||
mTags = nullptr;
|
||||
|
||||
if (mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
|
||||
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_EMPTY;
|
||||
@ -1425,6 +1427,49 @@ nsHTMLMediaElement::GetMozSampleRate(PRUint32 *aMozSampleRate)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Helper struct with arguments for our hash iterator.
|
||||
typedef struct {
|
||||
JSContext* cx;
|
||||
JSObject* tags;
|
||||
} MetadataIterCx;
|
||||
|
||||
PLDHashOperator
|
||||
nsHTMLMediaElement::BuildObjectFromTags(nsCStringHashKey::KeyType aKey,
|
||||
nsCString aValue,
|
||||
void* aUserArg)
|
||||
{
|
||||
MetadataIterCx* args = static_cast<MetadataIterCx*>(aUserArg);
|
||||
|
||||
nsString wideValue = NS_ConvertUTF8toUTF16(aValue);
|
||||
JSString* string = JS_NewUCStringCopyZ(args->cx, wideValue.Data());
|
||||
JS::Value value = STRING_TO_JSVAL(string);
|
||||
if (!JS_SetProperty(args->cx, args->tags, aKey.Data(), &value)) {
|
||||
NS_WARNING("Failed to set metadata property");
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLMediaElement::MozGetMetadata(JSContext* cx, JS::Value* aValue)
|
||||
{
|
||||
if (mReadyState < nsIDOMHTMLMediaElement::HAVE_METADATA) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
JSObject* tags = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
if (!tags) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (mTags) {
|
||||
MetadataIterCx iter = {cx, tags};
|
||||
mTags->EnumerateRead(BuildObjectFromTags, static_cast<void*>(&iter));
|
||||
}
|
||||
*aValue = OBJECT_TO_JSVAL(tags);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLMediaElement::GetMozFrameBufferLength(PRUint32 *aMozFrameBufferLength)
|
||||
{
|
||||
@ -2638,11 +2683,15 @@ void nsHTMLMediaElement::ProcessMediaFragmentURI()
|
||||
}
|
||||
}
|
||||
|
||||
void nsHTMLMediaElement::MetadataLoaded(PRUint32 aChannels, PRUint32 aRate, bool aHasAudio)
|
||||
void nsHTMLMediaElement::MetadataLoaded(PRUint32 aChannels,
|
||||
PRUint32 aRate,
|
||||
bool aHasAudio,
|
||||
const MetadataTags* aTags)
|
||||
{
|
||||
mChannels = aChannels;
|
||||
mRate = aRate;
|
||||
mHasAudio = aHasAudio;
|
||||
mTags = aTags;
|
||||
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("durationchange"));
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("loadedmetadata"));
|
||||
|
@ -106,7 +106,7 @@ bool nsMediaFragmentURIParser::ParseNPTSec(nsDependentSubstring& aString, double
|
||||
}
|
||||
|
||||
nsDependentSubstring n(aString, 0, index);
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
PRInt32 s = PromiseFlatString(n).ToInteger(&ec);
|
||||
if (NS_FAILED(ec)) {
|
||||
return false;
|
||||
@ -162,7 +162,7 @@ bool nsMediaFragmentURIParser::ParseNPTFraction(nsDependentSubstring& aString, d
|
||||
|
||||
if (index > 1) {
|
||||
nsDependentSubstring number(aString, 0, index);
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
fraction = PromiseFlatString(number).ToDouble(&ec);
|
||||
if (NS_FAILED(ec)) {
|
||||
return false;
|
||||
@ -211,7 +211,7 @@ bool nsMediaFragmentURIParser::ParseNPTHH(nsDependentSubstring& aString, PRUint3
|
||||
}
|
||||
|
||||
nsDependentSubstring n(aString, 0, index);
|
||||
PRInt32 ec;
|
||||
nsresult ec;
|
||||
PRInt32 u = PromiseFlatString(n).ToInteger(&ec);
|
||||
if (NS_FAILED(ec)) {
|
||||
return false;
|
||||
@ -235,8 +235,7 @@ bool nsMediaFragmentURIParser::ParseNPTSS(nsDependentSubstring& aString, PRUint3
|
||||
|
||||
if (IsDigit(aString[0]) && IsDigit(aString[1])) {
|
||||
nsDependentSubstring n(aString, 0, 2);
|
||||
PRInt32 ec;
|
||||
|
||||
nsresult ec;
|
||||
PRInt32 u = PromiseFlatString(n).ToInteger(&ec);
|
||||
if (NS_FAILED(ec)) {
|
||||
return false;
|
||||
|
@ -334,7 +334,7 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
|
||||
}
|
||||
|
||||
// Convert number to floating point
|
||||
PRInt32 errorCode;
|
||||
nsresult errorCode;
|
||||
float floatValue = number.ToFloat(&errorCode);
|
||||
if (NS_FAILED(errorCode))
|
||||
return false;
|
||||
@ -397,7 +397,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
str.CompressWhitespace();
|
||||
// MathML numbers can't have leading '+'
|
||||
if (str.Length() > 0 && str.CharAt(0) != '+') {
|
||||
PRInt32 errorCode;
|
||||
nsresult errorCode;
|
||||
float floatValue = str.ToFloat(&errorCode);
|
||||
// Negative scriptsizemultipliers are not parsed
|
||||
if (NS_SUCCEEDED(errorCode) && floatValue >= 0.0f) {
|
||||
@ -443,7 +443,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
nsAutoString str(value->GetStringValue());
|
||||
str.CompressWhitespace();
|
||||
if (str.Length() > 0) {
|
||||
PRInt32 errorCode;
|
||||
nsresult errorCode;
|
||||
PRInt32 intValue = str.ToInteger(&errorCode);
|
||||
if (NS_SUCCEEDED(errorCode)) {
|
||||
// This is kind of cheesy ... if the scriptlevel has a sign,
|
||||
|
@ -180,7 +180,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
|
||||
// 4) X-Content-Duration.
|
||||
// 5) Perform a seek in the decoder to find the value.
|
||||
nsCAutoString durationText;
|
||||
PRInt32 ec = 0;
|
||||
nsresult ec = NS_OK;
|
||||
rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("Content-Duration"), durationText);
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("X-AMZ-Meta-Content-Duration"), durationText);
|
||||
|
@ -132,10 +132,18 @@ nsresult nsGStreamerReader::Init(nsBuiltinDecoderReader* aCloneDonor)
|
||||
mAudioSink = gst_parse_bin_from_description("capsfilter name=filter ! "
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
"appsink name=audiosink sync=true caps=audio/x-raw-float,"
|
||||
#ifdef IS_LITTLE_ENDIAN
|
||||
"channels={1,2},rate=44100,width=32,endianness=1234", TRUE, NULL);
|
||||
#else
|
||||
"channels={1,2},rate=44100,width=32,endianness=4321", TRUE, NULL);
|
||||
#endif
|
||||
#else
|
||||
"appsink name=audiosink sync=true caps=audio/x-raw-int,"
|
||||
#ifdef IS_LITTLE_ENDIAN
|
||||
"channels={1,2},rate=48000,width=16,endianness=1234", TRUE, NULL);
|
||||
#else
|
||||
"channels={1,2},rate=48000,width=16,endianness=4321", TRUE, NULL);
|
||||
#endif
|
||||
#endif
|
||||
mAudioAppSink = GST_APP_SINK(gst_bin_get_by_name(GST_BIN(mAudioSink),
|
||||
"audiosink"));
|
||||
@ -186,7 +194,8 @@ void nsGStreamerReader::PlayBinSourceSetup(GstAppSrc *aSource)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsGStreamerReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
nsresult nsGStreamerReader::ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||
nsresult ret = NS_OK;
|
||||
@ -296,6 +305,8 @@ nsresult nsGStreamerReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
|
||||
*aInfo = mInfo;
|
||||
|
||||
*aTags = nullptr;
|
||||
|
||||
/* set the pipeline to PLAYING so that it starts decoding and queueing data in
|
||||
* the appsinks */
|
||||
gst_element_set_state(mPlayBin, GST_STATE_PLAYING);
|
||||
|
@ -27,7 +27,8 @@ public:
|
||||
virtual bool DecodeAudioData();
|
||||
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
PRInt64 aTimeThreshold);
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags);
|
||||
virtual nsresult Seek(PRInt64 aTime,
|
||||
PRInt64 aStartTime,
|
||||
PRInt64 aEndTime,
|
||||
|
@ -880,13 +880,13 @@ private:
|
||||
return static_cast<nsBufferedAudioStream*>(aThis)->DataCallback(aBuffer, aFrames);
|
||||
}
|
||||
|
||||
static int StateCallback_S(cubeb_stream*, void* aThis, cubeb_state aState)
|
||||
static void StateCallback_S(cubeb_stream*, void* aThis, cubeb_state aState)
|
||||
{
|
||||
return static_cast<nsBufferedAudioStream*>(aThis)->StateCallback(aState);
|
||||
static_cast<nsBufferedAudioStream*>(aThis)->StateCallback(aState);
|
||||
}
|
||||
|
||||
long DataCallback(void* aBuffer, long aFrames);
|
||||
int StateCallback(cubeb_state aState);
|
||||
void StateCallback(cubeb_state aState);
|
||||
|
||||
// Shared implementation of underflow adjusted position calculation.
|
||||
// Caller must own the monitor.
|
||||
@ -1147,12 +1147,19 @@ nsBufferedAudioStream::GetPosition()
|
||||
return -1;
|
||||
}
|
||||
|
||||
// This function is miscompiled by PGO with MSVC 2010. See bug 768333.
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
PRInt64
|
||||
nsBufferedAudioStream::GetPositionInFrames()
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
return GetPositionInFramesUnlocked();
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
PRInt64
|
||||
nsBufferedAudioStream::GetPositionInFramesUnlocked()
|
||||
@ -1173,11 +1180,11 @@ nsBufferedAudioStream::GetPositionInFramesUnlocked()
|
||||
|
||||
// Adjust the reported position by the number of silent frames written
|
||||
// during stream underruns.
|
||||
PRInt64 adjustedPosition = 0;
|
||||
PRUint64 adjustedPosition = 0;
|
||||
if (position >= mLostFrames) {
|
||||
adjustedPosition = position - mLostFrames;
|
||||
}
|
||||
return adjustedPosition;
|
||||
return NS_MIN<PRUint64>(adjustedPosition, PR_INT64_MAX);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1261,7 +1268,7 @@ nsBufferedAudioStream::DataCallback(void* aBuffer, long aFrames)
|
||||
return aFrames - (bytesWanted / mBytesPerFrame);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
nsBufferedAudioStream::StateCallback(cubeb_state aState)
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
@ -1271,7 +1278,6 @@ nsBufferedAudioStream::StateCallback(cubeb_state aState)
|
||||
mState = ERRORED;
|
||||
}
|
||||
mon.NotifyAll();
|
||||
return CUBEB_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -406,7 +406,8 @@ void nsBuiltinDecoder::AudioAvailable(float* aFrameBuffer,
|
||||
|
||||
void nsBuiltinDecoder::MetadataLoaded(PRUint32 aChannels,
|
||||
PRUint32 aRate,
|
||||
bool aHasAudio)
|
||||
bool aHasAudio,
|
||||
const nsHTMLMediaElement::MetadataTags* aTags)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
if (mShuttingDown) {
|
||||
@ -428,7 +429,7 @@ void nsBuiltinDecoder::MetadataLoaded(PRUint32 aChannels,
|
||||
// Make sure the element and the frame (if any) are told about
|
||||
// our new size.
|
||||
Invalidate();
|
||||
mElement->MetadataLoaded(aChannels, aRate, aHasAudio);
|
||||
mElement->MetadataLoaded(aChannels, aRate, aHasAudio, aTags);
|
||||
}
|
||||
|
||||
if (!mResourceLoaded) {
|
||||
|
@ -579,7 +579,8 @@ public:
|
||||
// Call on the main thread only.
|
||||
void MetadataLoaded(PRUint32 aChannels,
|
||||
PRUint32 aRate,
|
||||
bool aHasAudio);
|
||||
bool aHasAudio,
|
||||
const nsHTMLMediaElement::MetadataTags* aTags);
|
||||
|
||||
// Called when the first frame has been loaded.
|
||||
// Call on the main thread only.
|
||||
|
@ -415,10 +415,12 @@ public:
|
||||
virtual bool HasAudio() = 0;
|
||||
virtual bool HasVideo() = 0;
|
||||
|
||||
// Read header data for all bitstreams in the file. Fills mInfo with
|
||||
// the data required to present the media. Returns NS_OK on success,
|
||||
// or NS_ERROR_FAILURE on failure.
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo) = 0;
|
||||
// Read header data for all bitstreams in the file. Fills aInfo with
|
||||
// the data required to present the media, and optionally fills *aTags
|
||||
// with tag metadata from the file.
|
||||
// Returns NS_OK on success, or NS_ERROR_FAILURE on failure.
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags) = 0;
|
||||
|
||||
// Stores the presentation time of the first frame we'd be able to play if
|
||||
// we started playback at the current position. Returns the first video
|
||||
|
@ -121,23 +121,26 @@ private:
|
||||
nsCOMPtr<nsBuiltinDecoder> mDecoder;
|
||||
public:
|
||||
nsAudioMetadataEventRunner(nsBuiltinDecoder* aDecoder, PRUint32 aChannels,
|
||||
PRUint32 aRate, bool aHasAudio) :
|
||||
PRUint32 aRate, bool aHasAudio,
|
||||
nsHTMLMediaElement::MetadataTags* aTags) :
|
||||
mDecoder(aDecoder),
|
||||
mChannels(aChannels),
|
||||
mRate(aRate),
|
||||
mHasAudio(aHasAudio)
|
||||
mHasAudio(aHasAudio),
|
||||
mTags(aTags)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mDecoder->MetadataLoaded(mChannels, mRate, mHasAudio);
|
||||
mDecoder->MetadataLoaded(mChannels, mRate, mHasAudio, mTags);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const PRUint32 mChannels;
|
||||
const PRUint32 mRate;
|
||||
const bool mHasAudio;
|
||||
nsHTMLMediaElement::MetadataTags* mTags;
|
||||
};
|
||||
|
||||
// Owns the global state machine thread and counts of
|
||||
@ -1744,9 +1747,10 @@ nsresult nsBuiltinDecoderStateMachine::DecodeMetadata()
|
||||
LOG(PR_LOG_DEBUG, ("%p Decoding Media Headers", mDecoder.get()));
|
||||
nsresult res;
|
||||
nsVideoInfo info;
|
||||
nsHTMLMediaElement::MetadataTags* tags;
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
res = mReader->ReadMetadata(&info);
|
||||
res = mReader->ReadMetadata(&info, &tags);
|
||||
}
|
||||
mInfo = info;
|
||||
|
||||
@ -1800,7 +1804,11 @@ nsresult nsBuiltinDecoderStateMachine::DecodeMetadata()
|
||||
mDecoder->RequestFrameBufferLength(frameBufferLength);
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> metadataLoadedEvent =
|
||||
new nsAudioMetadataEventRunner(mDecoder, mInfo.mAudioChannels, mInfo.mAudioRate, HasAudio());
|
||||
new nsAudioMetadataEventRunner(mDecoder,
|
||||
mInfo.mAudioChannels,
|
||||
mInfo.mAudioRate,
|
||||
HasAudio(),
|
||||
tags);
|
||||
NS_DispatchToMainThread(metadataLoadedEvent, NS_DISPATCH_NORMAL);
|
||||
|
||||
if (mState == DECODER_STATE_DECODING_METADATA) {
|
||||
|
@ -151,7 +151,34 @@ void nsOggReader::BuildSerialList(nsTArray<PRUint32>& aTracks)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
static
|
||||
nsHTMLMediaElement::MetadataTags* TagsFromVorbisComment(vorbis_comment *vc)
|
||||
{
|
||||
nsHTMLMediaElement::MetadataTags* tags;
|
||||
int i;
|
||||
|
||||
tags = new nsHTMLMediaElement::MetadataTags;
|
||||
tags->Init();
|
||||
for (i = 0; i < vc->comments; i++) {
|
||||
char *comment = vc->user_comments[i];
|
||||
char *div = (char*)memchr(comment, '=', vc->comment_lengths[i]);
|
||||
if (!div) {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid vorbis comment: no separator"));
|
||||
continue;
|
||||
}
|
||||
// This should be ASCII.
|
||||
nsCString key = nsCString(comment, div-comment);
|
||||
PRUint32 value_length = vc->comment_lengths[i] - (div-comment);
|
||||
// This should be utf-8.
|
||||
nsCString value = nsCString(div + 1, value_length);
|
||||
tags->Put(key, value);
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
|
||||
nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||
|
||||
@ -159,6 +186,9 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
// We record the offset of the first non-header page so that we know
|
||||
// what page to seek to when seeking to the media start.
|
||||
|
||||
NS_ASSERTION(aTags, "Called with null MetadataTags**.");
|
||||
*aTags = nullptr;
|
||||
|
||||
ogg_page page;
|
||||
nsAutoTArray<nsOggCodecState*,4> bitstreams;
|
||||
bool readAllBOS = false;
|
||||
@ -283,6 +313,7 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
memcpy(&mVorbisInfo, &mVorbisState->mInfo, sizeof(mVorbisInfo));
|
||||
mVorbisInfo.codec_setup = NULL;
|
||||
mVorbisSerial = mVorbisState->mSerial;
|
||||
*aTags = TagsFromVorbisComment(&mVorbisState->mComment);
|
||||
} else {
|
||||
memset(&mVorbisInfo, 0, sizeof(mVorbisInfo));
|
||||
}
|
||||
@ -1623,7 +1654,10 @@ nsresult nsOggReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
|
||||
else {
|
||||
// Page is for a stream we don't know about (possibly a chained
|
||||
// ogg), return an error.
|
||||
return PAGE_SYNC_ERROR;
|
||||
//
|
||||
// XXX Invalid cast of PageSyncResult to nsresult -- this has numeric
|
||||
// value 1 and will pass an NS_SUCCEEDED() check (bug 778105)
|
||||
return (nsresult)PAGE_SYNC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,8 @@ public:
|
||||
return mTheoraState != 0 && mTheoraState->mActive;
|
||||
}
|
||||
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags);
|
||||
virtual nsresult Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime);
|
||||
virtual nsresult GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime);
|
||||
|
||||
|
@ -35,7 +35,8 @@ nsresult nsMediaPluginReader::Init(nsBuiltinDecoderReader* aCloneDonor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMediaPluginReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
nsresult nsMediaPluginReader::ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||
|
||||
@ -89,6 +90,7 @@ nsresult nsMediaPluginReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
}
|
||||
|
||||
*aInfo = mInfo;
|
||||
*aTags = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,8 @@ public:
|
||||
return mHasVideo;
|
||||
}
|
||||
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags);
|
||||
virtual nsresult Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime);
|
||||
virtual nsresult GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime);
|
||||
virtual bool IsSeekableInBufferedRanges() {
|
||||
|
@ -32,7 +32,8 @@ nsresult nsRawReader::ResetDecode()
|
||||
return nsBuiltinDecoderReader::ResetDecode();
|
||||
}
|
||||
|
||||
nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(),
|
||||
"Should be on decode thread.");
|
||||
@ -103,6 +104,8 @@ nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
|
||||
*aInfo = mInfo;
|
||||
|
||||
*aTags = nullptr;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags);
|
||||
virtual nsresult Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime);
|
||||
virtual nsresult GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime);
|
||||
|
||||
|
@ -87,6 +87,7 @@ MOCHITEST_FILES = \
|
||||
test_load_same_resource.html \
|
||||
test_load_source.html \
|
||||
test_loop.html \
|
||||
test_metadata.html \
|
||||
test_mozLoadFrom.html \
|
||||
test_no_load_event.html \
|
||||
test_networkState.html \
|
||||
|
@ -303,6 +303,37 @@ var gFragmentTests = [
|
||||
];
|
||||
|
||||
|
||||
// These are files with non-trivial tag sets.
|
||||
// Used by test_metadata.html.
|
||||
var gMetadataTests = [
|
||||
// Ogg Vorbis files
|
||||
{ name:"short-video.ogv", tags: {
|
||||
TITLE:"Lepidoptera",
|
||||
ARTIST:"Epoq",
|
||||
ALBUM:"Kahvi Collective",
|
||||
DATE:"2002",
|
||||
COMMENT:"http://www.kahvi.org",
|
||||
}
|
||||
},
|
||||
{ name:"bug516323.ogv", tags: {
|
||||
GENRE:"Open Movie",
|
||||
ENCODER:"Audacity",
|
||||
TITLE:"Elephants Dream",
|
||||
ARTIST:"Silvia Pfeiffer",
|
||||
COMMENTS:"Audio Description"
|
||||
}
|
||||
},
|
||||
{ name:"bug516323.indexed.ogv", tags: {
|
||||
GENRE:"Open Movie",
|
||||
ENCODER:"Audacity",
|
||||
TITLE:"Elephants Dream",
|
||||
ARTIST:"Silvia Pfeiffer",
|
||||
COMMENTS:"Audio Description"
|
||||
}
|
||||
},
|
||||
{ name:"sound.ogg", tags: { } }
|
||||
];
|
||||
|
||||
function checkMetadata(msg, e, test) {
|
||||
if (test.width) {
|
||||
is(e.videoWidth, test.width, msg + " video width");
|
||||
|
79
content/media/test/test_metadata.html
Normal file
79
content/media/test/test_metadata.html
Normal file
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test returning metadata from media files with mozGetMetadata()</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<div id="output"></div>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var manager = new MediaTestManager;
|
||||
|
||||
function startTest(test, token) {
|
||||
var a = document.createElement('audio');
|
||||
a.token = token;
|
||||
manager.started(token);
|
||||
|
||||
a.src = test.name;
|
||||
a.name = test.name;
|
||||
|
||||
// Tags should not be available immediately.
|
||||
var exception_fired = false;
|
||||
try {
|
||||
var m = a.mozGetMetadata();
|
||||
} catch (e) {
|
||||
is(e.name, 'InvalidStateError',
|
||||
"early mozGetMetadata() threw incorrect exception");
|
||||
exception_fired = true;
|
||||
}
|
||||
ok(exception_fired,
|
||||
"mozGetMetadata() should throw an exception before HAVE_METADATA");
|
||||
|
||||
// Wait until metadata has loaded.
|
||||
a.addEventListener('loadedmetadata', function() {
|
||||
// read decoded tags
|
||||
tags = a.mozGetMetadata();
|
||||
ok(tags, "mozGetMetadata() failed");
|
||||
// Dump them out.
|
||||
var d = document.getElementById('output');
|
||||
var html = '<table>\n';
|
||||
html += '<caption><p>Called getMozMetadata()'
|
||||
html += ' on '+test.name+'</p></caption>\n';
|
||||
html += '<tr><th>tag</th>';
|
||||
html += '<th>decoded value</th><th>expected value</th></tr>\n';
|
||||
for (tag in tags) {
|
||||
html += '<tr><td>'+tag+'</td>';
|
||||
html += '<td>'+tags[tag]+'</td>';
|
||||
html += '<td>'+test.tags[tag]+'</td>';
|
||||
html += '</tr>\n';
|
||||
}
|
||||
if (!Object.keys(tags).length) {
|
||||
html += '<tr><td colspan=3 align=center><em>no tags</em></td></tr>\n';
|
||||
}
|
||||
html += '</table>\n';
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = html;
|
||||
d.appendChild(div);
|
||||
// Verify decoded tag values.
|
||||
for (tag in tags) {
|
||||
is(tags[tag], test.tags[tag], "Tag '"+tag+"' doesn't match");
|
||||
}
|
||||
// Verify expected tag values
|
||||
for (tag in test.tags) {
|
||||
is(tags[tag], test.tags[tag], "Tag '"+tag+"' doesn't match");
|
||||
}
|
||||
manager.finished(token);
|
||||
}, false);
|
||||
}
|
||||
|
||||
manager.runTests(gMetadataTests, startTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -119,7 +119,8 @@ nsresult nsWaveReader::Init(nsBuiltinDecoderReader* aCloneDonor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||
|
||||
@ -135,6 +136,8 @@ nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
|
||||
*aInfo = mInfo;
|
||||
|
||||
*aTags = nullptr;
|
||||
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
mDecoder->GetStateMachine()->SetDuration(
|
||||
|
@ -32,7 +32,8 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags);
|
||||
virtual nsresult Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime);
|
||||
virtual nsresult GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime);
|
||||
|
||||
|
@ -178,7 +178,8 @@ void nsWebMReader::Cleanup()
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags)
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||
|
||||
@ -338,6 +339,8 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
|
||||
*aInfo = mInfo;
|
||||
|
||||
*aTags = nullptr;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,8 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo,
|
||||
nsHTMLMediaElement::MetadataTags** aTags);
|
||||
virtual nsresult Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime);
|
||||
virtual nsresult GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime);
|
||||
virtual void NotifyDataArrived(const char* aBuffer, PRUint32 aLength, PRInt64 aOffset);
|
||||
|
@ -25,6 +25,14 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(MediaEngineDefaultVideoSource, nsITimerCallback)
|
||||
/**
|
||||
* Default video source.
|
||||
*/
|
||||
|
||||
MediaEngineDefaultVideoSource::MediaEngineDefaultVideoSource()
|
||||
: mTimer(nsnull), mState(kReleased)
|
||||
{}
|
||||
|
||||
MediaEngineDefaultVideoSource::~MediaEngineDefaultVideoSource()
|
||||
{}
|
||||
|
||||
void
|
||||
MediaEngineDefaultVideoSource::GetName(nsAString& aName)
|
||||
{
|
||||
|
@ -12,10 +12,8 @@
|
||||
#include "nsDOMMediaStream.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
#include "Layers.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "MediaEngine.h"
|
||||
#include "ImageLayers.h"
|
||||
#include "VideoSegment.h"
|
||||
#include "AudioSegment.h"
|
||||
#include "StreamBuffer.h"
|
||||
@ -23,6 +21,11 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace layers {
|
||||
class ImageContainer;
|
||||
class PlanarYCbCrImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default implementation of the MediaEngine interface.
|
||||
*/
|
||||
@ -38,8 +41,8 @@ class MediaEngineDefaultVideoSource : public nsITimerCallback,
|
||||
public MediaEngineVideoSource
|
||||
{
|
||||
public:
|
||||
MediaEngineDefaultVideoSource() : mTimer(nullptr), mState(kReleased) {}
|
||||
~MediaEngineDefaultVideoSource(){};
|
||||
MediaEngineDefaultVideoSource();
|
||||
~MediaEngineDefaultVideoSource();
|
||||
|
||||
virtual void GetName(nsAString&);
|
||||
virtual void GetUUID(nsAString&);
|
||||
|
@ -18,10 +18,8 @@
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
#include "Layers.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "MediaEngine.h"
|
||||
#include "ImageLayers.h"
|
||||
#include "VideoSegment.h"
|
||||
#include "AudioSegment.h"
|
||||
#include "StreamBuffer.h"
|
||||
|
@ -63,7 +63,7 @@ SVGNumberList::SetValueFromString(const nsAString& aValue)
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
CopyUTF16toUTF8(tokenizer.nextToken(), str); // NS_ConvertUTF16toUTF8
|
||||
const char *token = str.get();
|
||||
if (token == '\0') {
|
||||
if (*token == '\0') {
|
||||
return NS_ERROR_DOM_SYNTAX_ERR; // nothing between commas
|
||||
}
|
||||
char *end;
|
||||
|
@ -187,13 +187,13 @@ nsSVGSVGElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
nsSVGSVGElement *it = new nsSVGSVGElement(ni.forget(), NOT_FROM_PARSER);
|
||||
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it;
|
||||
nsresult rv = it->Init();
|
||||
rv |= const_cast<nsSVGSVGElement*>(this)->CopyInnerTo(it);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsresult rv1 = it->Init();
|
||||
nsresult rv2 = const_cast<nsSVGSVGElement*>(this)->CopyInnerTo(it);
|
||||
if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2)) {
|
||||
kungFuDeathGrip.swap(*aResult);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_FAILED(rv1) ? rv1 : rv2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,9 +128,10 @@ nsSVGScriptElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
nsSVGScriptElement* it = new nsSVGScriptElement(ni.forget(), NOT_FROM_PARSER);
|
||||
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it;
|
||||
nsresult rv = it->Init();
|
||||
rv |= const_cast<nsSVGScriptElement*>(this)->CopyInnerTo(it);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv1 = it->Init();
|
||||
nsresult rv2 = const_cast<nsSVGScriptElement*>(this)->CopyInnerTo(it);
|
||||
NS_ENSURE_SUCCESS(rv1, rv1);
|
||||
NS_ENSURE_SUCCESS(rv2, rv2);
|
||||
|
||||
// The clone should be marked evaluated if we are.
|
||||
it->mAlreadyStarted = mAlreadyStarted;
|
||||
|
@ -107,17 +107,17 @@ nsSVGUseElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip(it);
|
||||
nsresult rv = it->Init();
|
||||
rv |= const_cast<nsSVGUseElement*>(this)->CopyInnerTo(it);
|
||||
nsresult rv1 = it->Init();
|
||||
nsresult rv2 = const_cast<nsSVGUseElement*>(this)->CopyInnerTo(it);
|
||||
|
||||
// nsSVGUseElement specific portion - record who we cloned from
|
||||
it->mOriginal = const_cast<nsSVGUseElement*>(this);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2)) {
|
||||
kungFuDeathGrip.swap(*aResult);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_FAILED(rv1) ? rv1 : rv2;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -61,6 +61,10 @@ function run_tests()
|
||||
lengths[0].valueAsString = "10";
|
||||
lengths[0].convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER);
|
||||
lengths[0].newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, 10);
|
||||
// -- Invalid attribute
|
||||
eventChecker.expect("modify");
|
||||
text.setAttribute("x", ",20");
|
||||
is(lengths.numberOfItems, 0, 'Checking that parsing stops at invalid token');
|
||||
// -- Attribute removal
|
||||
eventChecker.expect("remove");
|
||||
text.removeAttribute("x");
|
||||
|
@ -50,6 +50,10 @@ function run_tests()
|
||||
numbers[0].value = 17;
|
||||
numbers[1].value = 20;
|
||||
text.setAttribute("rotate", "17 20 30");
|
||||
// -- Invalid attribute
|
||||
eventChecker.expect("modify");
|
||||
text.setAttribute("rotate", ",20");
|
||||
is(numbers.numberOfItems, 0, 'Checking that parsing stops at invalid token');
|
||||
// -- Attribute removal
|
||||
eventChecker.expect("remove");
|
||||
text.removeAttribute("rotate");
|
||||
|
@ -50,6 +50,10 @@ function run_tests()
|
||||
points[0].x = 30;
|
||||
points[1].y = 380;
|
||||
polyline.setAttribute("points", "30,375 150,380");
|
||||
// -- Invalid attribute
|
||||
eventChecker.expect("modify");
|
||||
polyline.setAttribute("points", ",30,375");
|
||||
is(points.numberOfItems, 0, 'Checking that parsing stops at invalid token');
|
||||
// -- Attribute removal
|
||||
eventChecker.expect("remove");
|
||||
polyline.removeAttribute("points");
|
||||
|
@ -230,7 +230,7 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args)
|
||||
}
|
||||
|
||||
if (!installed) {
|
||||
args.rval() = JS::UndefinedValue();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args)
|
||||
if (!JS_GetPropertyById(cx, thisObj, id, v.address())) {
|
||||
return false;
|
||||
}
|
||||
args.rval() = v;
|
||||
args.rval().set(v);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JSObject *obj, jsid id, PRUin
|
||||
|
||||
static JSBool
|
||||
nsXBLDocGlobalObject_getProperty(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, jsval *vp)
|
||||
JSHandleId id, JSMutableHandleValue vp)
|
||||
{
|
||||
return nsXBLDocGlobalObject::
|
||||
doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
|
||||
@ -120,7 +120,7 @@ nsXBLDocGlobalObject_getProperty(JSContext *cx, JSHandleObject obj,
|
||||
|
||||
static JSBool
|
||||
nsXBLDocGlobalObject_setProperty(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, JSBool strict, jsval *vp)
|
||||
JSHandleId id, JSBool strict, JSMutableHandleValue vp)
|
||||
{
|
||||
return nsXBLDocGlobalObject::
|
||||
doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_SET_PROPERTY);
|
||||
|
@ -20,20 +20,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=427060
|
||||
/** Test for Bug 427060 **/
|
||||
|
||||
var xmldoc, xsltdoc;
|
||||
[ xmldoc, xsltdoc ] = [ new DOMParser().parseFromString(String(xml), "text/xml") for each (xml in [
|
||||
[ xmldoc, xsltdoc ] = [ new DOMParser().parseFromString(xml, "text/xml") for each (xml in [
|
||||
|
||||
<opml version="1.0"><body></body></opml> ,
|
||||
'<opml version="1.0"><body></body></opml>' ,
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template match="/opml">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<base target="_blank"></base>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
|
||||
<xsl:template match="/opml">\n\
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n\
|
||||
<head>\n\
|
||||
<base target="_blank"></base>\n\
|
||||
</head>\n\
|
||||
<body></body>\n\
|
||||
</html>\n\
|
||||
</xsl:template>\n\
|
||||
</xsl:stylesheet>'
|
||||
|
||||
]) ];
|
||||
|
||||
|
@ -26,14 +26,14 @@ function isTxResult(node)
|
||||
}
|
||||
|
||||
var xmldoc, xsltdoc;
|
||||
[ xmldoc, xsltdoc ] = [ new DOMParser().parseFromString(String(xml), "text/xml") for each (xml in [
|
||||
[ xmldoc, xsltdoc ] = [ new DOMParser().parseFromString(xml, "text/xml") for each (xml in [
|
||||
|
||||
<items><item><id>1</id></item><item><id>2</id></item><item><id>3</id></item></items> ,
|
||||
'<items><item><id>1</id></item><item><id>2</id></item><item><id>3</id></item></items>' ,
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="xml" />
|
||||
<xsl:template match="item"><foo id="{id}"/></xsl:template>
|
||||
</xsl:stylesheet>
|
||||
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
|
||||
<xsl:output method="xml" />\n\
|
||||
<xsl:template match="item"><foo id="{id}"/></xsl:template>\n\
|
||||
</xsl:stylesheet>'
|
||||
|
||||
]) ];
|
||||
var processor = new XSLTProcessor;
|
||||
|
@ -23,7 +23,7 @@ function tryImportStylesheet(xml, valid)
|
||||
{
|
||||
var processor = new XSLTProcessor;
|
||||
|
||||
var xsltdoc = new DOMParser().parseFromString(String(xml), "text/xml");
|
||||
var xsltdoc = new DOMParser().parseFromString(xml, "text/xml");
|
||||
try
|
||||
{
|
||||
processor.importStylesheet(xsltdoc);
|
||||
@ -36,19 +36,19 @@ function tryImportStylesheet(xml, valid)
|
||||
}
|
||||
|
||||
tryImportStylesheet(
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xsl:version="1.0" />
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
|
||||
<xsl:template match="/">\n\
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xsl:version="1.0" />\n\
|
||||
</xsl:template>\n\
|
||||
</xsl:stylesheet>'
|
||||
, true);
|
||||
|
||||
tryImportStylesheet(
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
|
||||
'<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
|
||||
, false);
|
||||
|
||||
tryImportStylesheet(
|
||||
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
|
||||
'<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
|
||||
, false);
|
||||
|
||||
</script>
|
||||
|
@ -19,13 +19,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=468208
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 468208 **/
|
||||
|
||||
var xslt =
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:strip-space elements="color"/>
|
||||
</xsl:stylesheet>
|
||||
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
|
||||
<xsl:strip-space elements="color"/>\n\
|
||||
</xsl:stylesheet>'
|
||||
;
|
||||
var xsltdoc = new DOMParser().parseFromString(String(xslt), "text/xml");
|
||||
var xsltdoc = new DOMParser().parseFromString(xslt, "text/xml");
|
||||
|
||||
var processor = new XSLTProcessor;
|
||||
processor.importStylesheet(xsltdoc);
|
||||
|
@ -38,7 +38,9 @@ LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../../../xml/content/src \
|
||||
-I$(srcdir)/../../../base/src \
|
||||
-I$(srcdir)/../../../xml/document/src \
|
||||
-I$(srcdir)/../../../../layout/generic \
|
||||
-I$(srcdir)/../../../../layout/style \
|
||||
-I$(srcdir)/../../../../layout/xul/base/src \
|
||||
-I$(srcdir)/../../../html/content/src \
|
||||
-I$(srcdir)/../../../events/src \
|
||||
-I$(srcdir)/../../../xbl/src \
|
||||
|
@ -196,7 +196,7 @@ nsXULContextMenuBuilder::Init(nsIDOMDocumentFragment* aDocumentFragment,
|
||||
NS_IMETHODIMP
|
||||
nsXULContextMenuBuilder::Click(const nsAString& aGeneratedItemId)
|
||||
{
|
||||
PRInt32 rv;
|
||||
nsresult rv;
|
||||
PRInt32 idx = nsString(aGeneratedItemId).ToInteger(&rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIDOMHTMLElement> element = mElements.SafeObjectAt(idx);
|
||||
|
@ -1935,10 +1935,16 @@ nsXULPrototypeElement::Serialize(nsIObjectOutputStream* aStream,
|
||||
// Write Node Info
|
||||
PRInt32 index = aNodeInfos->IndexOf(mNodeInfo);
|
||||
NS_ASSERTION(index >= 0, "unknown nsINodeInfo index");
|
||||
rv |= aStream->Write32(index);
|
||||
nsresult tmp = aStream->Write32(index);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
// Write Attributes
|
||||
rv |= aStream->Write32(mNumAttributes);
|
||||
tmp = aStream->Write32(mNumAttributes);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
nsAutoString attributeValue;
|
||||
PRUint32 i;
|
||||
@ -1957,33 +1963,57 @@ nsXULPrototypeElement::Serialize(nsIObjectOutputStream* aStream,
|
||||
|
||||
index = aNodeInfos->IndexOf(ni);
|
||||
NS_ASSERTION(index >= 0, "unknown nsINodeInfo index");
|
||||
rv |= aStream->Write32(index);
|
||||
tmp = aStream->Write32(index);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
mAttributes[i].mValue.ToString(attributeValue);
|
||||
rv |= aStream->WriteWStringZ(attributeValue.get());
|
||||
tmp = aStream->WriteWStringZ(attributeValue.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// Now write children
|
||||
rv |= aStream->Write32(PRUint32(mChildren.Length()));
|
||||
tmp = aStream->Write32(PRUint32(mChildren.Length()));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
for (i = 0; i < mChildren.Length(); i++) {
|
||||
nsXULPrototypeNode* child = mChildren[i].get();
|
||||
switch (child->mType) {
|
||||
case eType_Element:
|
||||
case eType_Text:
|
||||
case eType_PI:
|
||||
rv |= child->Serialize(aStream, aGlobal, aNodeInfos);
|
||||
tmp = child->Serialize(aStream, aGlobal, aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
case eType_Script:
|
||||
rv |= aStream->Write32(child->mType);
|
||||
tmp = aStream->Write32(child->mType);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
nsXULPrototypeScript* script = static_cast<nsXULPrototypeScript*>(child);
|
||||
|
||||
rv |= aStream->Write8(script->mOutOfLine);
|
||||
tmp = aStream->Write8(script->mOutOfLine);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (! script->mOutOfLine) {
|
||||
rv |= script->Serialize(aStream, aGlobal, aNodeInfos);
|
||||
tmp = script->Serialize(aStream, aGlobal, aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
} else {
|
||||
rv |= aStream->WriteCompoundObject(script->mSrcURI,
|
||||
tmp = aStream->WriteCompoundObject(script->mSrcURI,
|
||||
NS_GET_IID(nsIURI),
|
||||
true);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
if (script->mScriptObject.mObject) {
|
||||
// This may return NS_OK without muxing script->mSrcURI's
|
||||
@ -1991,7 +2021,10 @@ nsXULPrototypeElement::Serialize(nsIObjectOutputStream* aStream,
|
||||
// muxed document is already there (written by a prior
|
||||
// session, or by an earlier cache episode during this
|
||||
// session).
|
||||
rv |= script->SerializeOutOfLine(aStream, aGlobal);
|
||||
tmp = script->SerializeOutOfLine(aStream, aGlobal);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2017,7 +2050,10 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// Read Attributes
|
||||
rv |= aStream->Read32(&number);
|
||||
nsresult tmp = aStream->Read32(&number);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
mNumAttributes = PRInt32(number);
|
||||
|
||||
PRUint32 i;
|
||||
@ -2028,19 +2064,31 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
|
||||
nsAutoString attributeValue;
|
||||
for (i = 0; i < mNumAttributes; ++i) {
|
||||
rv |= aStream->Read32(&number);
|
||||
tmp = aStream->Read32(&number);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
nsINodeInfo* ni = aNodeInfos->SafeObjectAt(number);
|
||||
if (!ni)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
mAttributes[i].mName.SetTo(ni);
|
||||
|
||||
rv |= aStream->ReadString(attributeValue);
|
||||
rv |= SetAttrAt(i, attributeValue, aDocumentURI);
|
||||
tmp = aStream->ReadString(attributeValue);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = SetAttrAt(i, attributeValue, aDocumentURI);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rv |= aStream->Read32(&number);
|
||||
tmp = aStream->Read32(&number);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
PRUint32 numChildren = PRInt32(number);
|
||||
|
||||
if (numChildren > 0) {
|
||||
@ -2048,7 +2096,10 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
for (i = 0; i < numChildren; i++) {
|
||||
rv |= aStream->Read32(&number);
|
||||
tmp = aStream->Read32(&number);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
Type childType = (Type)number;
|
||||
|
||||
nsRefPtr<nsXULPrototypeNode> child;
|
||||
@ -2060,8 +2111,11 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
child->mType = childType;
|
||||
|
||||
rv |= child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
tmp = child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
case eType_Text:
|
||||
child = new nsXULPrototypeText();
|
||||
@ -2069,8 +2123,11 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
child->mType = childType;
|
||||
|
||||
rv |= child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
tmp = child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
case eType_PI:
|
||||
child = new nsXULPrototypePI();
|
||||
@ -2078,8 +2135,11 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
child->mType = childType;
|
||||
|
||||
rv |= child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
tmp = child->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
case eType_Script: {
|
||||
// language version/options obtained during deserialization.
|
||||
@ -2089,14 +2149,26 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
||||
child = script;
|
||||
child->mType = childType;
|
||||
|
||||
rv |= aStream->ReadBoolean(&script->mOutOfLine);
|
||||
tmp = aStream->ReadBoolean(&script->mOutOfLine);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (! script->mOutOfLine) {
|
||||
rv |= script->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
tmp = script->Deserialize(aStream, aGlobal, aDocumentURI,
|
||||
aNodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
} else {
|
||||
rv |= aStream->ReadObject(true, getter_AddRefs(script->mSrcURI));
|
||||
tmp = aStream->ReadObject(true, getter_AddRefs(script->mSrcURI));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
rv |= script->DeserializeOutOfLine(aStream, aGlobal);
|
||||
tmp = script->DeserializeOutOfLine(aStream, aGlobal);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
// If we failed to deserialize, consider deleting 'script'?
|
||||
break;
|
||||
@ -2272,8 +2344,14 @@ nsXULPrototypeScript::SerializeOutOfLine(nsIObjectOutputStream* aStream,
|
||||
rv = cache->GetOutputStream(mSrcURI, getter_AddRefs(oos));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv |= Serialize(oos, aGlobal, nullptr);
|
||||
rv |= cache->FinishOutputStream(mSrcURI);
|
||||
nsresult tmp = Serialize(oos, aGlobal, nullptr);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = cache->FinishOutputStream(mSrcURI);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
cache->AbortCaching();
|
||||
@ -2490,7 +2568,10 @@ nsXULPrototypeText::Serialize(nsIObjectOutputStream* aStream,
|
||||
// Write basic prototype data
|
||||
rv = aStream->Write32(mType);
|
||||
|
||||
rv |= aStream->WriteWStringZ(mValue.get());
|
||||
nsresult tmp = aStream->WriteWStringZ(mValue.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -2523,8 +2604,14 @@ nsXULPrototypePI::Serialize(nsIObjectOutputStream* aStream,
|
||||
// Write basic prototype data
|
||||
rv = aStream->Write32(mType);
|
||||
|
||||
rv |= aStream->WriteWStringZ(mTarget.get());
|
||||
rv |= aStream->WriteWStringZ(mData.get());
|
||||
nsresult tmp = aStream->WriteWStringZ(mTarget.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = aStream->WriteWStringZ(mData.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -2538,7 +2625,10 @@ nsXULPrototypePI::Deserialize(nsIObjectInputStream* aStream,
|
||||
nsresult rv;
|
||||
|
||||
rv = aStream->ReadString(mTarget);
|
||||
rv |= aStream->ReadString(mData);
|
||||
nsresult tmp = aStream->ReadString(mData);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsMenuFrame.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -387,8 +388,8 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
||||
nsCOMPtr<nsIContent> popup = do_QueryInterface(popupElement);
|
||||
nsIContent* parent = popup->GetParent();
|
||||
if (parent) {
|
||||
nsIFrame* frame = parent->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::menuFrame)
|
||||
nsMenuFrame* menu = do_QueryFrame(parent->GetPrimaryFrame());
|
||||
if (menu)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4422,7 +4422,7 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild,
|
||||
if (!posStr.IsEmpty()) {
|
||||
nsresult rv;
|
||||
// Positions are one-indexed.
|
||||
PRInt32 pos = posStr.ToInteger(reinterpret_cast<PRInt32*>(&rv));
|
||||
PRInt32 pos = posStr.ToInteger(&rv);
|
||||
// Note: if the insertion index (which is |pos - 1|) would be less
|
||||
// than 0 or greater than the number of children aParent has, then
|
||||
// don't insert, since the position is bogus. Just skip on to
|
||||
|
@ -533,7 +533,7 @@ CachePrefChangedCallback(const char* aPref, void* aClosure)
|
||||
nsresult
|
||||
nsXULPrototypeCache::BeginCaching(nsIURI* aURI)
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv, tmp;
|
||||
|
||||
nsCAutoString path;
|
||||
aURI->GetPath(path);
|
||||
@ -606,7 +606,10 @@ nsXULPrototypeCache::BeginCaching(nsIURI* aURI)
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
buf.forget();
|
||||
rv = objectInput->ReadCString(fileLocale);
|
||||
rv |= objectInput->ReadCString(fileChromePath);
|
||||
tmp = objectInput->ReadCString(fileChromePath);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (NS_FAILED(rv) ||
|
||||
(!fileChromePath.Equals(chromePath) ||
|
||||
!fileLocale.Equals(locale))) {
|
||||
@ -630,9 +633,18 @@ nsXULPrototypeCache::BeginCaching(nsIURI* aURI)
|
||||
false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = objectOutput->WriteStringZ(locale.get());
|
||||
rv |= objectOutput->WriteStringZ(chromePath.get());
|
||||
rv |= objectOutput->Close();
|
||||
rv |= storageStream->NewInputStream(0, getter_AddRefs(inputStream));
|
||||
tmp = objectOutput->WriteStringZ(chromePath.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = objectOutput->Close();
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = storageStream->NewInputStream(0, getter_AddRefs(inputStream));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = inputStream->Available(&len);
|
||||
|
@ -251,18 +251,29 @@ nsXULPrototypeDocument::Read(nsIObjectInputStream* aStream)
|
||||
PRUint32 count, i;
|
||||
nsCOMPtr<nsIURI> styleOverlayURI;
|
||||
|
||||
rv |= aStream->Read32(&count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsresult tmp = aStream->Read32(&count);
|
||||
if (NS_FAILED(tmp)) {
|
||||
return tmp;
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
rv |= aStream->ReadObject(true, getter_AddRefs(styleOverlayURI));
|
||||
tmp = aStream->ReadObject(true, getter_AddRefs(styleOverlayURI));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
mStyleSheetReferences.AppendObject(styleOverlayURI);
|
||||
}
|
||||
|
||||
|
||||
// nsIPrincipal mNodeInfoManager->mPrincipal
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv |= aStream->ReadObject(true, getter_AddRefs(principal));
|
||||
tmp = aStream->ReadObject(true, getter_AddRefs(principal));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
// Better safe than sorry....
|
||||
mNodeInfoManager->SetDocumentPrincipal(principal);
|
||||
|
||||
@ -279,56 +290,89 @@ nsXULPrototypeDocument::Read(nsIObjectInputStream* aStream)
|
||||
// nsINodeInfo table
|
||||
nsCOMArray<nsINodeInfo> nodeInfos;
|
||||
|
||||
rv |= aStream->Read32(&count);
|
||||
tmp = aStream->Read32(&count);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
nsAutoString namespaceURI, prefixStr, localName;
|
||||
bool prefixIsNull;
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
for (i = 0; i < count; ++i) {
|
||||
rv |= aStream->ReadString(namespaceURI);
|
||||
rv |= aStream->ReadBoolean(&prefixIsNull);
|
||||
tmp = aStream->ReadString(namespaceURI);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = aStream->ReadBoolean(&prefixIsNull);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (prefixIsNull) {
|
||||
prefix = nullptr;
|
||||
} else {
|
||||
rv |= aStream->ReadString(prefixStr);
|
||||
tmp = aStream->ReadString(prefixStr);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
prefix = do_GetAtom(prefixStr);
|
||||
}
|
||||
rv |= aStream->ReadString(localName);
|
||||
tmp = aStream->ReadString(localName);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
// Using PR_UINT16_MAX here as we don't know which nodeinfos will be
|
||||
// used for attributes and which for elements. And that doesn't really
|
||||
// matter.
|
||||
rv |= mNodeInfoManager->GetNodeInfo(localName, prefix, namespaceURI,
|
||||
tmp = mNodeInfoManager->GetNodeInfo(localName, prefix, namespaceURI,
|
||||
PR_UINT16_MAX,
|
||||
getter_AddRefs(nodeInfo));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (!nodeInfos.AppendObject(nodeInfo))
|
||||
rv |= NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Document contents
|
||||
PRUint32 type;
|
||||
while (NS_SUCCEEDED(rv)) {
|
||||
rv |= aStream->Read32(&type);
|
||||
tmp = aStream->Read32(&type);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
if ((nsXULPrototypeNode::Type)type == nsXULPrototypeNode::eType_PI) {
|
||||
nsRefPtr<nsXULPrototypePI> pi = new nsXULPrototypePI();
|
||||
if (! pi) {
|
||||
rv |= NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
rv |= pi->Deserialize(aStream, mGlobalObject, mURI, &nodeInfos);
|
||||
rv |= AddProcessingInstruction(pi);
|
||||
tmp = pi->Deserialize(aStream, mGlobalObject, mURI, &nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = AddProcessingInstruction(pi);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
} else if ((nsXULPrototypeNode::Type)type == nsXULPrototypeNode::eType_Element) {
|
||||
rv |= mRoot->Deserialize(aStream, mGlobalObject, mURI, &nodeInfos);
|
||||
tmp = mRoot->Deserialize(aStream, mGlobalObject, mURI, &nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
NS_NOTREACHED("Unexpected prototype node type");
|
||||
rv |= NS_ERROR_FAILURE;
|
||||
rv = NS_ERROR_FAILURE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rv |= NotifyLoadDone();
|
||||
tmp = NotifyLoadDone();
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -389,17 +433,26 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
|
||||
PRUint32 count;
|
||||
|
||||
count = mStyleSheetReferences.Count();
|
||||
rv |= aStream->Write32(count);
|
||||
nsresult tmp = aStream->Write32(count);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
PRUint32 i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
rv |= aStream->WriteCompoundObject(mStyleSheetReferences[i],
|
||||
tmp = aStream->WriteCompoundObject(mStyleSheetReferences[i],
|
||||
NS_GET_IID(nsIURI), true);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// nsIPrincipal mNodeInfoManager->mPrincipal
|
||||
rv |= aStream->WriteObject(mNodeInfoManager->DocumentPrincipal(),
|
||||
tmp = aStream->WriteObject(mNodeInfoManager->DocumentPrincipal(),
|
||||
true);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// XXX Worrisome if we're caching things without system principal.
|
||||
@ -410,30 +463,52 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
|
||||
|
||||
// nsINodeInfo table
|
||||
nsCOMArray<nsINodeInfo> nodeInfos;
|
||||
if (mRoot)
|
||||
rv |= GetNodeInfos(mRoot, nodeInfos);
|
||||
if (mRoot) {
|
||||
tmp = GetNodeInfos(mRoot, nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 nodeInfoCount = nodeInfos.Count();
|
||||
rv |= aStream->Write32(nodeInfoCount);
|
||||
tmp = aStream->Write32(nodeInfoCount);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
for (i = 0; i < nodeInfoCount; ++i) {
|
||||
nsINodeInfo *nodeInfo = nodeInfos[i];
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoString namespaceURI;
|
||||
rv |= nodeInfo->GetNamespaceURI(namespaceURI);
|
||||
rv |= aStream->WriteWStringZ(namespaceURI.get());
|
||||
tmp = nodeInfo->GetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
tmp = aStream->WriteWStringZ(namespaceURI.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
nsAutoString prefix;
|
||||
nodeInfo->GetPrefix(prefix);
|
||||
bool nullPrefix = DOMStringIsNull(prefix);
|
||||
rv |= aStream->WriteBoolean(nullPrefix);
|
||||
tmp = aStream->WriteBoolean(nullPrefix);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
if (!nullPrefix) {
|
||||
rv |= aStream->WriteWStringZ(prefix.get());
|
||||
tmp = aStream->WriteWStringZ(prefix.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString localName;
|
||||
nodeInfo->GetName(localName);
|
||||
rv |= aStream->WriteWStringZ(localName.get());
|
||||
tmp = aStream->WriteWStringZ(localName.get());
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// Now serialize the document contents
|
||||
@ -443,11 +518,18 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
|
||||
count = mProcessingInstructions.Length();
|
||||
for (i = 0; i < count; ++i) {
|
||||
nsXULPrototypePI* pi = mProcessingInstructions[i];
|
||||
rv |= pi->Serialize(aStream, globalObject, &nodeInfos);
|
||||
tmp = pi->Serialize(aStream, globalObject, &nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (mRoot)
|
||||
rv |= mRoot->Serialize(aStream, globalObject, &nodeInfos);
|
||||
if (mRoot) {
|
||||
tmp = mRoot->Serialize(aStream, globalObject, &nodeInfos);
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ nsTemplateCondition::CheckMatchStrings(const nsAString& aLeftString,
|
||||
case eGreater:
|
||||
{
|
||||
// non-numbers always compare false
|
||||
PRInt32 err;
|
||||
nsresult err;
|
||||
PRInt32 leftint = PromiseFlatString(aLeftString).ToInteger(&err);
|
||||
if (NS_SUCCEEDED(err)) {
|
||||
PRInt32 rightint = PromiseFlatString(aRightString).ToInteger(&err);
|
||||
|
@ -1889,7 +1889,7 @@ nsXULContentBuilder::InsertSortedNode(nsIContent* aContainer,
|
||||
if (!staticValue.IsEmpty())
|
||||
{
|
||||
// found "static" XUL element count hint
|
||||
PRInt32 strErr = 0;
|
||||
nsresult strErr = NS_OK;
|
||||
staticCount = staticValue.ToInteger(&strErr);
|
||||
if (strErr)
|
||||
staticCount = 0;
|
||||
|
@ -453,7 +453,7 @@ XULSortServiceImpl::CompareValues(const nsAString& aLeft,
|
||||
PRUint32 aSortHints)
|
||||
{
|
||||
if (aSortHints & SORT_INTEGER) {
|
||||
PRInt32 err;
|
||||
nsresult err;
|
||||
PRInt32 leftint = PromiseFlatString(aLeft).ToInteger(&err);
|
||||
if (NS_SUCCEEDED(err)) {
|
||||
PRInt32 rightint = PromiseFlatString(aRight).ToInteger(&err);
|
||||
|
@ -1321,7 +1321,7 @@ nsXULTemplateQueryProcessorRDF::ParseLiteral(const nsString& aParseType,
|
||||
|
||||
if (aParseType.EqualsLiteral(PARSE_TYPE_INTEGER)) {
|
||||
nsCOMPtr<nsIRDFInt> intLiteral;
|
||||
PRInt32 errorCode;
|
||||
nsresult errorCode;
|
||||
PRInt32 intValue = aValue.ToInteger(&errorCode);
|
||||
if (NS_FAILED(errorCode))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -4140,6 +4140,8 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||
// Broken Content Detected. e.g. Content-MD5 check failure.
|
||||
error.AssignLiteral("corruptedContentError");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4270,7 +4272,8 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
|
||||
if (aURI)
|
||||
{
|
||||
nsresult rv = aURI->GetSpec(url);
|
||||
rv |= aURI->GetOriginCharset(charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aURI->GetOriginCharset(charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else if (aURL)
|
||||
|
@ -37,7 +37,7 @@ interface nsIContentViewer : nsISupports
|
||||
attribute nsISupports container;
|
||||
|
||||
void loadStart(in nsISupports aDoc);
|
||||
void loadComplete(in unsigned long aStatus);
|
||||
void loadComplete(in nsresult aStatus);
|
||||
|
||||
/**
|
||||
* Checks if the document wants to prevent unloading by firing beforeunload on
|
||||
|
@ -70,6 +70,7 @@ DIRS += \
|
||||
ipc \
|
||||
identity \
|
||||
workers \
|
||||
camera \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_B2G_RIL
|
||||
|
@ -47,7 +47,7 @@ let AlarmService = {
|
||||
}.bind(this));
|
||||
|
||||
// set the indexeddb database
|
||||
let idbManager = Components.classes["@mozilla.org/dom/indexeddb/manager;1"].getService(Ci.nsIIndexedDatabaseManager);
|
||||
let idbManager = Cc["@mozilla.org/dom/indexeddb/manager;1"].getService(Ci.nsIIndexedDatabaseManager);
|
||||
idbManager.initWindowless(myGlobal);
|
||||
this._db = new AlarmDB(myGlobal);
|
||||
this._db.init(myGlobal);
|
||||
@ -100,20 +100,20 @@ let AlarmService = {
|
||||
manifestURL: json.manifestURL
|
||||
};
|
||||
|
||||
let newAlarmTime = this._getAlarmTime(newAlarm);
|
||||
if (newAlarmTime <= Date.now()) {
|
||||
debug("Adding a alarm that has past time. Return DOMError.");
|
||||
this._debugCurrentAlarm();
|
||||
this._sendAsyncMessage(mm, "Add", false, json.requestId, "InvalidStateError");
|
||||
break;
|
||||
}
|
||||
|
||||
this._db.add(
|
||||
newAlarm,
|
||||
function addSuccessCb(aNewId) {
|
||||
debug("Callback after adding alarm in database.");
|
||||
|
||||
newAlarm['id'] = aNewId;
|
||||
let newAlarmTime = this._getAlarmTime(newAlarm);
|
||||
|
||||
if (newAlarmTime <= Date.now()) {
|
||||
debug("Adding a alarm that has past time. Don't set it in system.");
|
||||
this._debugCurrentAlarm();
|
||||
this._sendAsyncMessage(mm, "Add", true, json.requestId, aNewId);
|
||||
return;
|
||||
}
|
||||
|
||||
// if there is no alarm being set in system, set the new alarm
|
||||
if (this._currentAlarm == null) {
|
||||
@ -148,7 +148,7 @@ let AlarmService = {
|
||||
break;
|
||||
|
||||
case "AlarmsManager:Remove":
|
||||
this._db.remove(
|
||||
this._removeAlarmFromDb(
|
||||
json.id,
|
||||
function removeSuccessCb() {
|
||||
debug("Callback after removing alarm from database.");
|
||||
@ -183,10 +183,7 @@ let AlarmService = {
|
||||
// no alarm waiting to be set in the queue
|
||||
this._currentAlarm = null;
|
||||
this._debugCurrentAlarm();
|
||||
}.bind(this),
|
||||
function removeErrorCb(aErrorMsg) {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
break;
|
||||
|
||||
@ -227,29 +224,52 @@ let AlarmService = {
|
||||
aMessageManager.sendAsyncMessage("AlarmsManager:" + aMessageName + ":Return:" + (aSuccess ? "OK" : "KO"), json);
|
||||
},
|
||||
|
||||
_removeAlarmFromDb: function _removeAlarmFromDb(aId, aRemoveSuccessCb) {
|
||||
debug("_removeAlarmFromDb()");
|
||||
|
||||
// If the aRemoveSuccessCb is undefined or null, set a
|
||||
// dummy callback for it which is needed for _db.remove()
|
||||
if (!aRemoveSuccessCb) {
|
||||
aRemoveSuccessCb = function removeSuccessCb() {
|
||||
debug("Remove alarm from DB successfully.");
|
||||
};
|
||||
}
|
||||
|
||||
this._db.remove(
|
||||
aId,
|
||||
aRemoveSuccessCb,
|
||||
function removeErrorCb(aErrorMsg) {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
_fireSystemMessage: function _fireSystemMessage(aAlarm) {
|
||||
debug("Fire system message: " + JSON.stringify(aAlarm));
|
||||
let manifestURI = Services.io.newURI(aAlarm.manifestURL, null, null);
|
||||
messenger.sendMessage("alarm", aAlarm, manifestURI);
|
||||
},
|
||||
|
||||
_onAlarmFired: function _onAlarmFired() {
|
||||
debug("_onAlarmFired()");
|
||||
|
||||
if (this._currentAlarm) {
|
||||
debug("Fire system intent: " + JSON.stringify(this._currentAlarm));
|
||||
let manifestURI = Services.io.newURI(this._currentAlarm.manifestURL, null, null);
|
||||
messenger.sendMessage("alarm", this._currentAlarm, manifestURI);
|
||||
this._fireSystemMessage(this._currentAlarm);
|
||||
this._removeAlarmFromDb(this._currentAlarm.id);
|
||||
this._currentAlarm = null;
|
||||
}
|
||||
|
||||
// reset the next alarm from the queue
|
||||
let nowTime = Date.now();
|
||||
// Reset the next alarm from the queue.
|
||||
let alarmQueue = this._alarmQueue;
|
||||
while (alarmQueue.length > 0) {
|
||||
let nextAlarm = alarmQueue.shift();
|
||||
let nextAlarmTime = this._getAlarmTime(nextAlarm);
|
||||
|
||||
// if the next alarm has been expired, directly
|
||||
// fire system intent for it instead of setting it
|
||||
if (nextAlarmTime <= nowTime) {
|
||||
debug("Fire system intent: " + JSON.stringify(nextAlarm));
|
||||
let manifestURI = Services.io.newURI(nextAlarm.manifestURL, null, null);
|
||||
messenger.sendMessage("alarm", nextAlarm, manifestURI);
|
||||
// If the next alarm has been expired, directly
|
||||
// fire system message for it instead of setting it.
|
||||
if (nextAlarmTime <= Date.now()) {
|
||||
this._fireSystemMessage(nextAlarm);
|
||||
this._removeAlarmFromDb(nextAlarm.id);
|
||||
} else {
|
||||
this._currentAlarm = nextAlarm;
|
||||
break;
|
||||
|
@ -50,6 +50,8 @@
|
||||
#include "nsIDOMBluetoothManager.h"
|
||||
#include "BluetoothManager.h"
|
||||
#endif
|
||||
#include "nsIDOMCameraManager.h"
|
||||
#include "DOMCameraManager.h"
|
||||
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
|
||||
@ -112,6 +114,7 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
|
||||
#ifdef MOZ_B2G_BT
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorBluetooth)
|
||||
#endif
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorCamera)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorSystemMessages)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Navigator)
|
||||
NS_INTERFACE_MAP_END
|
||||
@ -181,6 +184,8 @@ Navigator::Invalidate()
|
||||
}
|
||||
#endif
|
||||
|
||||
mCameraManager = nullptr;
|
||||
|
||||
#ifdef MOZ_SYS_MSG
|
||||
if (mMessagesManager) {
|
||||
mMessagesManager = nullptr;
|
||||
@ -1320,6 +1325,30 @@ Navigator::MozSetMessageHandler(const nsAString& aType,
|
||||
#endif
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsNavigator::nsIDOMNavigatorCamera
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
Navigator::GetMozCameras(nsIDOMCameraManager** aCameraManager)
|
||||
{
|
||||
if (!mCameraManager) {
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
|
||||
|
||||
if (!win->GetOuterWindow() || win->GetOuterWindow()->GetCurrentInnerWindow() != win) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
mCameraManager = nsDOMCameraManager::Create(win->WindowID());
|
||||
}
|
||||
|
||||
nsRefPtr<nsDOMCameraManager> cameraManager = mCameraManager;
|
||||
cameraManager.forget(aCameraManager);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
size_t
|
||||
Navigator::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
@ -1344,12 +1373,19 @@ Navigator::SetWindow(nsPIDOMWindow *aInnerWindow)
|
||||
void
|
||||
Navigator::OnNavigation()
|
||||
{
|
||||
// Inform MediaManager in case there are live streams or pending callbacks.
|
||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
||||
MediaManager *manager = MediaManager::Get();
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
return manager->OnNavigation(win->WindowID());
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
||||
// Inform MediaManager in case there are live streams or pending callbacks.
|
||||
MediaManager *manager = MediaManager::Get();
|
||||
manager->OnNavigation(win->WindowID());
|
||||
#endif
|
||||
if (mCameraManager) {
|
||||
mCameraManager->OnNavigation(win->WindowID());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
@ -41,6 +41,9 @@ class nsIDOMMozVoicemail;
|
||||
|
||||
#include "nsIDOMNavigatorSystemMessages.h"
|
||||
|
||||
#include "nsIDOMNavigatorCamera.h"
|
||||
#include "DOMCameraManager.h"
|
||||
|
||||
//*****************************************************************************
|
||||
// Navigator: Script "navigator" object
|
||||
//*****************************************************************************
|
||||
@ -82,6 +85,7 @@ class Navigator : public nsIDOMNavigator
|
||||
#ifdef MOZ_B2G_BT
|
||||
, public nsIDOMNavigatorBluetooth
|
||||
#endif
|
||||
, public nsIDOMNavigatorCamera
|
||||
, public nsIDOMNavigatorSystemMessages
|
||||
{
|
||||
public:
|
||||
@ -134,6 +138,7 @@ public:
|
||||
// Helper to initialize mMessagesManager.
|
||||
nsresult EnsureMessagesManager();
|
||||
#endif
|
||||
NS_DECL_NSIDOMNAVIGATORCAMERA
|
||||
|
||||
private:
|
||||
bool IsSmsAllowed() const;
|
||||
@ -155,6 +160,7 @@ private:
|
||||
#ifdef MOZ_B2G_BT
|
||||
nsCOMPtr<nsIDOMBluetoothManager> mBluetooth;
|
||||
#endif
|
||||
nsRefPtr<nsDOMCameraManager> mCameraManager;
|
||||
nsCOMPtr<nsIDOMNavigatorSystemMessages> mMessagesManager;
|
||||
nsWeakPtr mWindow;
|
||||
};
|
||||
|
@ -522,6 +522,10 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
|
||||
|
||||
#include "mozilla/dom/Activity.h"
|
||||
|
||||
#include "DOMCameraManager.h"
|
||||
#include "CameraControl.h"
|
||||
#include "CameraCapabilities.h"
|
||||
|
||||
#include "DOMError.h"
|
||||
#include "DOMRequest.h"
|
||||
#include "nsIOpenWindowEventDetail.h"
|
||||
@ -1668,6 +1672,13 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(CameraManager, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CameraControl, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CameraCapabilities, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DOMError, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
@ -2466,6 +2477,7 @@ nsDOMClassInfo::Init()
|
||||
#ifdef MOZ_B2G_BT
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorBluetooth)
|
||||
#endif
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorCamera)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorSystemMessages)
|
||||
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -4457,6 +4469,18 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CameraManager, nsIDOMCameraManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCameraManager)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CameraControl, nsICameraControl)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsICameraControl)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CameraCapabilities, nsICameraCapabilities)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsICameraCapabilities)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DOMError, nsIDOMDOMError)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMError)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -5282,7 +5306,7 @@ static JSClass sGlobalScopePolluterClass = {
|
||||
// static
|
||||
JSBool
|
||||
nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, jsval *vp)
|
||||
JSHandleId id, JSMutableHandleValue vp)
|
||||
{
|
||||
// Someone is accessing a element by referencing its name/id in the
|
||||
// global scope, do a security check to make sure that's ok.
|
||||
@ -5305,7 +5329,7 @@ nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj,
|
||||
// static
|
||||
JSBool
|
||||
nsWindowSH::SecurityCheckOnAddDelProp(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
jsval *vp)
|
||||
JSMutableHandleValue vp)
|
||||
{
|
||||
// Someone is accessing a element by referencing its name/id in the
|
||||
// global scope, do a security check to make sure that's ok.
|
||||
@ -5323,7 +5347,7 @@ nsWindowSH::SecurityCheckOnAddDelProp(JSContext *cx, JSHandleObject obj, JSHandl
|
||||
// static
|
||||
JSBool
|
||||
nsWindowSH::SecurityCheckOnSetProp(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
|
||||
jsval *vp)
|
||||
JSMutableHandleValue vp)
|
||||
{
|
||||
return SecurityCheckOnAddDelProp(cx, obj, id, vp);
|
||||
}
|
||||
@ -5869,7 +5893,7 @@ static const IDBConstant sIDBConstants[] = {
|
||||
};
|
||||
|
||||
static JSBool
|
||||
IDBConstantGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, jsval* vp)
|
||||
IDBConstantGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
|
||||
{
|
||||
JSString *idstr = JSID_TO_STRING(id);
|
||||
unsigned index;
|
||||
@ -5943,7 +5967,7 @@ IDBConstantGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, jsval* vp)
|
||||
}
|
||||
|
||||
// Return value
|
||||
*vp = value;
|
||||
vp.set(value);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@ -7004,9 +7028,9 @@ LocationSetterGuts(JSContext *cx, JSObject *obj, jsval *vp)
|
||||
template<class Interface>
|
||||
static JSBool
|
||||
LocationSetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
|
||||
jsval *vp)
|
||||
JSMutableHandleValue vp)
|
||||
{
|
||||
nsresult rv = LocationSetterGuts<Interface>(cx, obj, vp);
|
||||
nsresult rv = LocationSetterGuts<Interface>(cx, obj, vp.address());
|
||||
if (NS_FAILED(rv)) {
|
||||
xpc::Throw(cx, rv);
|
||||
return JS_FALSE;
|
||||
@ -7017,7 +7041,7 @@ LocationSetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
|
||||
|
||||
static JSBool
|
||||
LocationSetterUnwrapper(JSContext *cx, JSHandleObject obj_, JSHandleId id, JSBool strict,
|
||||
jsval *vp)
|
||||
JSMutableHandleValue vp)
|
||||
{
|
||||
JS::RootedObject obj(cx, obj_);
|
||||
|
||||
@ -7679,9 +7703,9 @@ nsNavigatorSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
|
||||
template<nsresult (*func)(JSContext *cx, JSObject *obj, jsval *vp)>
|
||||
static JSBool
|
||||
GetterShim(JSContext *cx, JSHandleObject obj, JSHandleId /* unused */, jsval *vp)
|
||||
GetterShim(JSContext *cx, JSHandleObject obj, JSHandleId /* unused */, JSMutableHandleValue vp)
|
||||
{
|
||||
nsresult rv = (*func)(cx, obj, vp);
|
||||
nsresult rv = (*func)(cx, obj, vp.address());
|
||||
if (NS_FAILED(rv)) {
|
||||
xpc::Throw(cx, rv);
|
||||
return JS_FALSE;
|
||||
@ -8796,13 +8820,16 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx, JSObject *obj,
|
||||
nsRefPtr<nsContentList> list =
|
||||
domdoc->GetElementsByTagName(NS_LITERAL_STRING("*"));
|
||||
if (!list) {
|
||||
rv |= NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
rv |= WrapNative(cx, JS_GetGlobalForScopeChain(cx),
|
||||
static_cast<nsINodeList*>(list), list, false,
|
||||
&collection, getter_AddRefs(holder));
|
||||
nsresult tmp = WrapNative(cx, JS_GetGlobalForScopeChain(cx),
|
||||
static_cast<nsINodeList*>(list), list, false,
|
||||
&collection, getter_AddRefs(holder));
|
||||
if (NS_FAILED(tmp)) {
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
list.forget(nodeList);
|
||||
|
||||
@ -8821,7 +8848,7 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx, JSObject *obj,
|
||||
|
||||
JSBool
|
||||
nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_,
|
||||
JSHandleId id, jsval *vp)
|
||||
JSHandleId id, JSMutableHandleValue vp)
|
||||
{
|
||||
JSObject *obj = obj_;
|
||||
|
||||
@ -8868,7 +8895,7 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_,
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*vp = INT_TO_JSVAL(length);
|
||||
vp.set(INT_TO_JSVAL(length));
|
||||
|
||||
return JS_TRUE;
|
||||
} else if (sTags_id != id) {
|
||||
@ -8905,14 +8932,14 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_,
|
||||
}
|
||||
|
||||
if (result) {
|
||||
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), result, cache, true, vp);
|
||||
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), result, cache, true, vp.address());
|
||||
if (NS_FAILED(rv)) {
|
||||
xpc::Throw(cx, rv);
|
||||
|
||||
return JS_FALSE;
|
||||
}
|
||||
} else {
|
||||
*vp = JSVAL_VOID;
|
||||
vp.setUndefined();
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
@ -8928,7 +8955,7 @@ nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHan
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
jsval v = JSVAL_VOID;
|
||||
JS::RootedValue v(cx);
|
||||
|
||||
if (sItem_id == id || sNamedItem_id == id) {
|
||||
// Define the item() or namedItem() method.
|
||||
@ -8970,7 +8997,7 @@ nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHan
|
||||
|
||||
JSBool ok = JS_TRUE;
|
||||
|
||||
if (v != JSVAL_VOID) {
|
||||
if (v.get() != JSVAL_VOID) {
|
||||
ok = ::JS_DefinePropertyById(cx, obj, id, v, nullptr, nullptr, 0);
|
||||
objp.set(obj);
|
||||
}
|
||||
@ -9059,7 +9086,7 @@ PrivateToFlags(void *priv)
|
||||
|
||||
JSBool
|
||||
nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, JS::Value *vp)
|
||||
JSHandleId id, JSMutableHandleValue vp)
|
||||
{
|
||||
if (nsDOMClassInfo::sAll_id != id) {
|
||||
return JS_TRUE;
|
||||
@ -9082,12 +9109,12 @@ nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSHandleObject obj
|
||||
// or it was not being resolved with a qualified name. Claim that
|
||||
// document.all is undefined.
|
||||
|
||||
vp->setUndefined();
|
||||
vp.setUndefined();
|
||||
} else {
|
||||
// document.all is not being detected, and it resolved with a
|
||||
// qualified name. Expose the document.all collection.
|
||||
|
||||
if (!vp->isObjectOrNull()) {
|
||||
if (!vp.isObjectOrNull()) {
|
||||
// First time through, create the collection, and set the
|
||||
// document as its private nsISupports data.
|
||||
nsresult rv;
|
||||
@ -9109,7 +9136,7 @@ nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSHandleObject obj
|
||||
|
||||
doc.forget();
|
||||
|
||||
vp->setObject(*all);
|
||||
vp.setObject(*all);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10289,7 +10316,7 @@ nsStorage2SH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
|
||||
JSString *jsstr = IdToString(cx, id);
|
||||
if (!jsstr) {
|
||||
return JS_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSObject *proto = ::JS_GetPrototype(realObj);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user