Merge latest green fx-team changeset and mozilla-central; a=merge

This commit is contained in:
Ed Morley 2014-08-08 17:11:32 +01:00
commit b9b1f1be05
399 changed files with 2788 additions and 1627 deletions

View File

@ -328,7 +328,8 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
toolkit/library/target: widget/gtk/mozgtk/gtk3/target
endif
ifdef MOZ_LDAP_XPCOM
toolkit/library/target: ../ldap/target
ldap/target: config/external/nss/target mozglue/build/target
toolkit/library/target: ldap/target
endif
ifndef MOZ_FOLD_LIBS
ifndef MOZ_NATIVE_SQLITE

View File

@ -37,7 +37,7 @@ using namespace mozilla::dom;
////////////////////////////////////////////////////////////////////////////////
DocManager::DocManager()
: mDocAccessibleCache(4)
: mDocAccessibleCache(2)
{
}

View File

@ -78,8 +78,8 @@ DocAccessible::
nsIPresShell* aPresShell) :
HyperTextAccessibleWrap(aRootContent, this),
// XXX aaronl should we use an algorithm for the initial cache size?
mAccessibleCache(kDefaultCacheSize),
mNodeToAccessibleMap(kDefaultCacheSize),
mAccessibleCache(kDefaultCacheLength),
mNodeToAccessibleMap(kDefaultCacheLength),
mDocumentNode(aDocument),
mScrollPositionChangedTicks(0),
mLoadState(eTreeConstructionPending), mDocFlags(0), mLoadEventType(0),

View File

@ -26,7 +26,7 @@ class nsAccessiblePivot;
class nsIScrollableView;
const uint32_t kDefaultCacheSize = 256;
const uint32_t kDefaultCacheLength = 128;
namespace mozilla {
namespace a11y {

View File

@ -1546,7 +1546,9 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
int16_t hPercent = offsetPointX * 100 / size.width;
int16_t vPercent = offsetPointY * 100 / size.height;
nsresult rv = nsCoreUtils::ScrollSubstringTo(frame, range, vPercent, hPercent);
nsresult rv = nsCoreUtils::ScrollSubstringTo(frame, range,
nsIPresShell::ScrollAxis(vPercent),
nsIPresShell::ScrollAxis(hPercent));
if (NS_FAILED(rv))
return;

View File

@ -61,7 +61,7 @@ nsWinUtils::MaybeStartWindowEmulation()
Compatibility::IsDolphin() ||
XRE_GetProcessType() == GeckoProcessType_Content) {
RegisterNativeWindow(kClassNameTabContent);
sHWNDCache = new nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>(4);
sHWNDCache = new nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>(2);
return true;
}

View File

@ -42,7 +42,7 @@ XULTreeAccessible::
XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc,
nsTreeBodyFrame* aTreeFrame) :
AccessibleWrap(aContent, aDoc),
mAccessibleCache(kDefaultTreeCacheSize)
mAccessibleCache(kDefaultTreeCacheLength)
{
mType = eXULTreeType;
mGenericTypes |= eSelect;

View File

@ -20,7 +20,7 @@ namespace a11y {
* A class the represents the XUL Tree widget.
*/
const uint32_t kMaxTreeColumns = 100;
const uint32_t kDefaultTreeCacheSize = 256;
const uint32_t kDefaultTreeCacheLength = 128;
/**
* Accessible class for XUL tree element.

View File

@ -261,7 +261,7 @@ XULTreeGridRowAccessible::
Accessible* aTreeAcc, nsITreeBoxObject* aTree,
nsITreeView* aTreeView, int32_t aRow) :
XULTreeItemAccessibleBase(aContent, aDoc, aTreeAcc, aTree, aTreeView, aRow),
mAccessibleCache(kDefaultTreeCacheSize)
mAccessibleCache(kDefaultTreeCacheLength)
{
mGenericTypes |= eTableRow;
}

View File

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="227354333a185180b85471f2cc6abfb029e44718"/>

View File

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
@ -133,7 +133,7 @@
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="683623c76338dccd65e698bfb5c4cfee8808d799"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="02104803f873a4d5cf9fb611a211b83450e9dfba"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="a7141c4799ac2eb09ac3fe9476bfd066b21285e1"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>
</manifest>

View File

@ -15,9 +15,9 @@
<project name="platform_build" path="build" remote="b2g" revision="7945ca73e687be5edbc7b928dc7fe3a208242144">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>

View File

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="227354333a185180b85471f2cc6abfb029e44718"/>

View File

@ -17,8 +17,8 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
@ -145,7 +145,7 @@
<project name="platform/hardware/ril" path="hardware/ril" revision="c4e2ac95907a5519a0e09f01a0d8e27fec101af0"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="e1eb226fa3ad3874ea7b63c56a9dc7012d7ff3c2"/>
<project name="platform/system/core" path="system/core" revision="b33c9a7b8eefbeaf480f0b8f9af2c6a8a35b0aee"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="02104803f873a4d5cf9fb611a211b83450e9dfba"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="a7141c4799ac2eb09ac3fe9476bfd066b21285e1"/>
<project name="platform/system/qcom" path="system/qcom" revision="1cdab258b15258b7f9657da70e6f06ebd5a2fc25"/>
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4ae5df252123591d5b941191790e7abed1bce5a4"/>
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="ce18b47b4a4f93a581d672bbd5cb6d12fe796ca9"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "41b3413a893fef684b380bb344f9d4a5f491f858",
"revision": "716b4db65f6425fa3c66fa11bdd7d27a373d596a",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

View File

@ -15,8 +15,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

View File

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
@ -129,7 +129,7 @@
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="02104803f873a4d5cf9fb611a211b83450e9dfba"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="a7141c4799ac2eb09ac3fe9476bfd066b21285e1"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>

View File

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c45627132ae7f00026e361a14d5d084a1236af24"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="b0b5df8c194be48fc8a2f8d1c4310c36388eec9e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c97d1b6c3094e854377b6affa5f46b8d4b7316ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

View File

@ -1046,14 +1046,14 @@ toolbarpaletteitem[dragover] {
#customization-palette:not([hidden]) {
display: block;
flex: 1 1 auto;
flex: 1 1 main-size;
overflow: auto;
min-height: 3em;
}
#customization-footer-spacer,
#customization-spacer {
flex: 1 1 auto;
flex: 1 1 main-size;
}
#customization-footer {

View File

@ -211,7 +211,7 @@ loop.panel = (function(_, mozL10n) {
_generateMailTo: function() {
return encodeURI([
"mailto:?subject=" + __("share_email_subject") + "&",
"mailto:?subject=" + __("share_email_subject2") + "&",
"body=" + __("share_email_body", {callUrl: this.state.callUrl})
].join(""));
},

View File

@ -211,7 +211,7 @@ loop.panel = (function(_, mozL10n) {
_generateMailTo: function() {
return encodeURI([
"mailto:?subject=" + __("share_email_subject") + "&",
"mailto:?subject=" + __("share_email_subject2") + "&",
"body=" + __("share_email_body", {callUrl: this.state.callUrl})
].join(""));
},

View File

@ -253,7 +253,7 @@ describe("loop.panel", function() {
getStrings: function(key) {
var text;
if (key === "share_email_subject")
if (key === "share_email_subject2")
text = "email-subject";
else if (key === "share_email_body")
text = "{{callUrl}}";

View File

@ -35,7 +35,7 @@
.html-editor-inner {
border: solid .1px;
flex: 1 1 auto;
flex: 1 1 main-size;
}
.html-editor iframe {

View File

@ -729,7 +729,7 @@ var ApplicationFactory = {
};
#include ../../../toolkit/components/exthelper/extApplication.js
#include ../../toolkit/components/exthelper/extApplication.js
//=================================================
// Application constructor

View File

@ -4,5 +4,18 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['public', 'src']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
XPIDL_SOURCES += [
'fuelIApplication.idl',
]
XPIDL_MODULE = 'fuel'
EXTRA_COMPONENTS += [
'fuelApplication.manifest',
]
EXTRA_PP_COMPONENTS += [
'fuelApplication.js',
]

View File

@ -1,12 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'fuelIApplication.idl',
]
XPIDL_MODULE = 'fuel'

View File

@ -1,13 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXTRA_COMPONENTS += [
'fuelApplication.manifest',
]
EXTRA_PP_COMPONENTS += [
'fuelApplication.js',
]

View File

@ -57,9 +57,9 @@ feedback_back_button=Back
## translate the part between {{..}}
feedback_window_will_close_in=This window will close in {{countdown}} seconds
share_email_subject2=Invitation to chat
## LOCALIZATION NOTE (share_email_body): In this item, don't translate the
## part between {{..}} and let the \r\n\r\n part
share_email_subject=Loop invitation to chat
share_email_body=Please click that link to call me back:\r\n\r\n{{callUrl}}
share_button=Email
copy_url_button=Copy

View File

@ -57,7 +57,7 @@ body {
min-width: 0;
color: #000000;
opacity: 1;
flex: 1 1 auto;
flex: 1 1 main-size;
}
#filter-input:-moz-placeholder {
@ -193,7 +193,7 @@ li {
.pref-value {
color: rgba(0,0,0,0.5);
flex: 1 1 auto;
flex: 1 1 main-size;
border: none;
-moz-appearance: none;
background-image: none;
@ -227,7 +227,7 @@ li {
}
#new-pref-value-boolean {
flex: 1 1 auto;
flex: 1 1 main-size;
}
/* Disable newPref dialog spinbuttons, use custom version from Android */
@ -239,7 +239,7 @@ li {
#new-pref-container .pref-button.toggle {
display: inline-block;
opacity: 1;
flex: 0 1 auto;
flex: 0 1 main-size;
float: right;
}
@ -247,7 +247,7 @@ li {
#new-pref-container .pref-button.create {
display: inline-block;
opacity: 1;
flex: 1 1 auto;
flex: 1 1 main-size;
}
.pref-item-line {

View File

@ -58,7 +58,8 @@ this.TabCrashReporter = {
if (!dumpID)
return
if (CrashSubmit.submit(dumpID)) {
let contentProcessType = Services.crashmanager.PROCESS_TYPE_CONTENT;
if (CrashSubmit.submit(dumpID, { processType: contentProcessType })) {
this.childMap.set(childID, null); // Avoid resubmission.
}
},

View File

@ -250,7 +250,7 @@ panelview:not([mainview]) .toolbarbutton-text,
#PanelUI-contents {
display: block;
flex: 1 0 auto;
flex: 1 0 main-size;
margin-left: auto;
margin-right: auto;
padding: .5em 0;

View File

@ -17,24 +17,24 @@ a {
.message {
display: flex;
flex: 0 0 auto;
flex: 0 0 main-size;
padding: 0 7px;
width: 100%;
box-sizing: border-box;
}
.message > .timestamp {
flex: 0 0 auto;
flex: 0 0 main-size;
color: GrayText;
margin: 4px 6px 0 0;
}
.message > .indent {
flex: 0 0 auto;
flex: 0 0 main-size;
}
.message > .icon {
flex: 0 0 auto;
flex: 0 0 main-size;
margin: 3px 6px 0 0;
padding: 0 4px;
height: 1em;
@ -66,7 +66,7 @@ a {
/* The red bubble that shows the number of times a message is repeated */
.message-repeats {
-moz-user-select: none;
flex: 0 0 auto;
flex: 0 0 main-size;
margin: 2px 6px;
padding: 0 6px;
height: 1.25em;
@ -84,7 +84,7 @@ a {
.message-location {
display: flex;
flex: 0 0 auto;
flex: 0 0 main-size;
align-self: flex-start;
justify-content: flex-end;
width: 10em;
@ -106,7 +106,7 @@ a {
}
.message-location > .line-number {
flex: 0 0 auto;
flex: 0 0 main-size;
}
.message-flex-body {
@ -120,7 +120,7 @@ a {
.message-flex-body > .message-body {
display: block;
flex: 1 1 auto;
flex: 1 1 main-size;
vertical-align: middle;
}
@ -236,11 +236,11 @@ a {
}
.message[category=network] .method {
flex: 0 0 auto;
flex: 0 0 main-size;
}
.message[category=network]:not(.navigation-marker) .url {
flex: 1 1 auto;
flex: 1 1 main-size;
/* Make sure the URL is very small initially, let flex change width as needed. */
width: 100px;
min-width: 5em;
@ -250,7 +250,7 @@ a {
}
.message[category=network] .status {
flex: 0 0 auto;
flex: 0 0 main-size;
-moz-margin-start: 6px;
}
@ -454,7 +454,7 @@ a {
.stacktrace .function {
display: block;
flex: 1 1 auto;
flex: 1 1 main-size;
}
.cm-s-mozilla a[class] {

View File

@ -124,8 +124,7 @@ nsChromeRegistryChrome::Init()
mSelectedLocale = NS_LITERAL_CSTRING("en-US");
mSelectedSkin = NS_LITERAL_CSTRING("classic/1.0");
PL_DHashTableInit(&mPackagesHash, &kTableOps,
nullptr, sizeof(PackageEntry), 16);
PL_DHashTableInit(&mPackagesHash, &kTableOps, nullptr, sizeof(PackageEntry));
bool safeMode = false;
nsCOMPtr<nsIXULRuntime> xulrun (do_GetService(XULAPPINFO_SERVICE_CONTRACTID));

View File

@ -2524,10 +2524,10 @@ if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
*)
case $GCC_VERSION in
4.4*|4.6*)
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden_dso_handle.h'
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h'
;;
*)
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
;;
esac
WRAP_SYSTEM_INCLUDES=1
@ -4579,6 +4579,8 @@ fi
if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
. "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
. "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
fi
AC_SUBST(MOZ_BRANDING_DIRECTORY)
@ -9034,10 +9036,13 @@ unset CONFIG_FILES
# Run all configure scripts specified by a subconfigure
if test -n "$_subconfigure_subdir"; then
_save_srcdir="$srcdir"
srcdir="$srcdir/.."
_save_ac_configure_args="$ac_configure_args"
ac_configure_args="$_subconfigure_config_args"
AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
ac_configure_args="$_save_ac_configure_args"
srcdir="$_save_srcdir"
fi
# No need to run subconfigures when building with LIBXUL_SDK_DIR

View File

@ -133,8 +133,8 @@ typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
} // namespace mozilla
#define NS_IDOCUMENT_IID \
{ 0xa45ef8f0, 0x7c5b, 0x425d, \
{ 0xa5, 0xe7, 0x11, 0x41, 0x5c, 0x41, 0x0c, 0x7a } }
{ 0x613ea294, 0x0288, 0x48b4, \
{ 0x9e, 0x7b, 0x0f, 0xe9, 0x3f, 0x8c, 0xf8, 0x95 } }
// Enum for requesting a particular type of document when creating a doc
enum DocumentFlavor {
@ -532,6 +532,38 @@ public:
mHasMixedDisplayContentBlocked = aHasMixedDisplayContentBlocked;
}
/**
* Get tracking content blocked flag for this document.
*/
bool GetHasTrackingContentBlocked()
{
return mHasTrackingContentBlocked;
}
/**
* Set the tracking content blocked flag for this document.
*/
void SetHasTrackingContentBlocked(bool aHasTrackingContentBlocked)
{
mHasTrackingContentBlocked = aHasTrackingContentBlocked;
}
/**
* Get tracking content loaded flag for this document.
*/
bool GetHasTrackingContentLoaded()
{
return mHasTrackingContentLoaded;
}
/**
* Set the tracking content loaded flag for this document.
*/
void SetHasTrackingContentLoaded(bool aHasTrackingContentLoaded)
{
mHasTrackingContentLoaded = aHasTrackingContentLoaded;
}
/**
* Get the sandbox flags for this document.
* @see nsSandboxFlags.h for the possible flags
@ -2531,6 +2563,12 @@ protected:
// True if a document has blocked Mixed Display/Passive Content (see nsMixedContentBlocker.cpp)
bool mHasMixedDisplayContentBlocked;
// True if a document has blocked Tracking Content
bool mHasTrackingContentBlocked;
// True if a document has loaded Tracking Content
bool mHasTrackingContentLoaded;
// True if DisallowBFCaching has been called on this document.
bool mBFCacheDisallowed;

View File

@ -596,9 +596,10 @@ Link::SetSearchParams(URLSearchParams& aSearchParams)
}
void
Link::URLSearchParamsUpdated()
Link::URLSearchParamsUpdated(URLSearchParams* aSearchParams)
{
MOZ_ASSERT(mSearchParams);
MOZ_ASSERT(mSearchParams == aSearchParams);
nsString search;
mSearchParams->Serialize(search);

View File

@ -115,7 +115,7 @@ public:
bool ElementHasHref() const;
// URLSearchParamsObserver
void URLSearchParamsUpdated() MOZ_OVERRIDE;
void URLSearchParamsUpdated(URLSearchParams* aSearchParams) MOZ_OVERRIDE;
protected:
virtual ~Link();

View File

@ -219,10 +219,8 @@ NS_GetContentList(nsINode* aRootNode,
// Initialize the hashtable if needed.
if (!gContentListHashTable.ops) {
PL_DHashTableInit(&gContentListHashTable,
&hash_table_ops, nullptr,
sizeof(ContentListHashEntry),
16);
PL_DHashTableInit(&gContentListHashTable, &hash_table_ops, nullptr,
sizeof(ContentListHashEntry));
}
ContentListHashEntry *entry = nullptr;
@ -336,10 +334,8 @@ GetFuncStringContentList(nsINode* aRootNode,
// Initialize the hashtable if needed.
if (!gFuncStringContentListHashTable.ops) {
PL_DHashTableInit(&gFuncStringContentListHashTable,
&hash_table_ops, nullptr,
sizeof(FuncStringContentListHashEntry),
16);
PL_DHashTableInit(&gFuncStringContentListHashTable, &hash_table_ops,
nullptr, sizeof(FuncStringContentListHashEntry));
}
FuncStringContentListHashEntry *entry = nullptr;

View File

@ -486,7 +486,7 @@ nsContentUtils::Init()
};
PL_DHashTableInit(&sEventListenerManagersHash, &hash_table_ops,
nullptr, sizeof(EventListenerManagerMapEntry), 16);
nullptr, sizeof(EventListenerManagerMapEntry));
RegisterStrongMemoryReporter(new DOMEventListenerManagersHashReporter());
}
@ -637,9 +637,9 @@ nsContentUtils::InitializeEventTable() {
};
sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>(
int(ArrayLength(eventArray) / 0.75) + 1);
ArrayLength(eventArray));
sStringEventTable = new nsDataHashtable<nsStringHashKey, EventNameMapping>(
int(ArrayLength(eventArray) / 0.75) + 1);
ArrayLength(eventArray));
sUserDefinedEvents = new nsCOMArray<nsIAtom>(64);
// Subtract one from the length because of the trailing null

View File

@ -3741,7 +3741,7 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
};
mSubDocuments = PL_NewDHashTable(&hash_table_ops, nullptr,
sizeof(SubDocMapEntry), 16);
sizeof(SubDocMapEntry));
if (!mSubDocuments) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -6818,7 +6818,7 @@ nsDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
}
if (!mBoxObjectTable) {
mBoxObjectTable = new nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject>(12);
mBoxObjectTable = new nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject>(6);
} else {
nsCOMPtr<nsPIBoxObject> boxObject = mBoxObjectTable->Get(aElement);
if (boxObject) {

View File

@ -169,9 +169,8 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
aRequest->GetImageErrorCode(&errorCode);
/* Handle image not loading error because source was a tracking URL.
* (Safebrowinsg) We make a note of this image node by including it
* in a dedicated array of blocked tracking nodes under its parent
* document.
* We make a note of this image node by including it in a dedicated
* array of blocked tracking nodes under its parent document.
*/
if (errorCode == NS_ERROR_TRACKING_URI) {
nsCOMPtr<nsIContent> thisNode

View File

@ -294,7 +294,7 @@ nsPropertyTable::PropertyList::PropertyList(nsIAtom *aName,
mNext(nullptr)
{
PL_DHashTableInit(&mObjectValueMap, PL_DHashGetStubOps(), this,
sizeof(PropertyListMapEntry), 16);
sizeof(PropertyListMapEntry));
}
nsPropertyTable::PropertyList::~PropertyList()

View File

@ -1411,9 +1411,8 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
if (NS_FAILED(rv)) {
/*
* Handle script not loading error because source was a tracking URL.
* (Safebrowinsg) We make a note of this script node by including it
* in a dedicated array of blocked tracking nodes under its parent
* document.
* We make a note of this script node by including it in a dedicated
* array of blocked tracking nodes under its parent document.
*/
if (rv == NS_ERROR_TRACKING_URI) {
nsCOMPtr<nsIContent> cont = do_QueryInterface(request->mElement);

View File

@ -74,7 +74,7 @@ HTMLFormControlsCollection::HTMLFormControlsCollection(HTMLFormElement* aForm)
// Initialize the elements list to have an initial capacity
// of 8 to reduce allocations on small forms.
, mElements(8)
, mNameLookupTable(HTMLFormElement::FORM_CONTROL_LIST_HASHTABLE_SIZE)
, mNameLookupTable(HTMLFormElement::FORM_CONTROL_LIST_HASHTABLE_LENGTH)
{
SetIsDOMBinding();
}

View File

@ -86,9 +86,9 @@ bool HTMLFormElement::gPasswordManagerInitialized = false;
HTMLFormElement::HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo),
mControls(new HTMLFormControlsCollection(MOZ_THIS_IN_INITIALIZER_LIST())),
mSelectedRadioButtons(4),
mRequiredRadioButtonCounts(4),
mValueMissingRadioGroups(4),
mSelectedRadioButtons(2),
mRequiredRadioButtonCounts(2),
mValueMissingRadioGroups(2),
mGeneratingSubmit(false),
mGeneratingReset(false),
mIsSubmitting(false),
@ -102,8 +102,8 @@ HTMLFormElement::HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNode
mDefaultSubmitElement(nullptr),
mFirstSubmitInElements(nullptr),
mFirstSubmitNotInElements(nullptr),
mImageNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_SIZE),
mPastNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_SIZE),
mImageNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_LENGTH),
mPastNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_LENGTH),
mInvalidElementsCount(0),
mEverTriedInvalidSubmit(false)
{

View File

@ -45,7 +45,7 @@ public:
HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
enum {
FORM_CONTROL_LIST_HASHTABLE_SIZE = 16
FORM_CONTROL_LIST_HASHTABLE_LENGTH = 8
};
// nsISupports

View File

@ -2653,9 +2653,11 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
mDecoder->SetPreservesPitch(mPreservesPitch);
mDecoder->SetPlaybackRate(mPlaybackRate);
#ifdef MOZ_EME
if (mMediaKeys) {
mDecoder->SetCDMProxy(mMediaKeys->GetCDMProxy());
}
#endif
if (mPreloadAction == HTMLMediaElement::PRELOAD_METADATA) {
mDecoder->SetMinimizePrerollUntilPlaybackStarts();
}

View File

@ -3,9 +3,7 @@
<head>
<meta charset="utf-8">
<title>Test for Bug 341604</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<script type="application/javascript">
function doTest() {

View File

@ -3,8 +3,6 @@
<head>
<meta charset="utf-8">
<title>Test for Bug 341604</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onLoad="doStuff()">

View File

@ -25,7 +25,9 @@ class ReentrantMonitor;
class VideoFrameContainer;
class TimedMetadata;
class MediaDecoderOwner;
#ifdef MOZ_EME
class CDMProxy;
#endif
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
@ -139,8 +141,10 @@ public:
uint32_t& mDecoded;
};
#ifdef MOZ_EME
virtual nsresult SetCDMProxy(CDMProxy* aProxy) { return NS_ERROR_NOT_IMPLEMENTED; }
virtual CDMProxy* GetCDMProxy() { return nullptr; }
#endif
};
class MetadataEventRunner : public nsRunnable

View File

@ -1666,6 +1666,7 @@ bool MediaDecoder::CanPlayThrough()
stats.mDownloadPosition > stats.mPlaybackPosition + readAheadMargin;
}
#ifdef MOZ_EME
nsresult
MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
{
@ -1684,6 +1685,7 @@ MediaDecoder::GetCDMProxy()
MOZ_ASSERT(OnDecodeThread() || NS_IsMainThread());
return mProxy;
}
#endif
#ifdef MOZ_RAW
bool

View File

@ -190,7 +190,9 @@ destroying the MediaDecoder object.
#include "MediaStreamGraph.h"
#include "AbstractMediaDecoder.h"
#include "necko-config.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
class nsIStreamListener;
class nsIPrincipal;
@ -850,11 +852,13 @@ public:
// The decoder monitor must be held.
bool IsLogicallyPlaying();
#ifdef MOZ_EME
// This takes the decoder monitor.
virtual nsresult SetCDMProxy(CDMProxy* aProxy) MOZ_OVERRIDE;
// Decoder monitor must be held.
virtual CDMProxy* GetCDMProxy() MOZ_OVERRIDE;
#endif
#ifdef MOZ_RAW
static bool IsRawEnabled();
@ -1107,7 +1111,9 @@ private:
// The |RestrictedAccessMonitor| member object.
RestrictedAccessMonitor mReentrantMonitor;
#ifdef MOZ_EME
nsRefPtr<CDMProxy> mProxy;
#endif
protected:
// Data about MediaStreams that are being fed by this decoder.

View File

@ -138,11 +138,13 @@ public:
// when the connection between Rtsp server and client gets lost.
virtual void ResetConnectionState() = 0;
#ifdef MOZ_EME
// Dispatches a "needkey" event to the HTMLMediaElement, with the
// provided init data.
// Main thread only.
virtual void DispatchNeedKey(const nsTArray<uint8_t>& aInitData,
const nsAString& aInitDataType) = 0;
#endif
};
}

View File

@ -302,6 +302,19 @@ CDMProxy::Shutdown()
{
MOZ_ASSERT(NS_IsMainThread());
mKeys.Clear();
// Note: This may end up being the last owning reference to the CDMProxy.
nsRefPtr<nsIRunnable> task(NS_NewRunnableMethod(this, &CDMProxy::gmp_Shutdown));
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
}
void
CDMProxy::gmp_Shutdown()
{
MOZ_ASSERT(IsOnGMPThread());
if (mCDM) {
mCDM->Close();
mCDM = nullptr;
}
}
void
@ -485,10 +498,7 @@ CDMProxy::gmp_Terminated()
{
MOZ_ASSERT(IsOnGMPThread());
EME_LOG("CDM terminated");
if (mCDM) {
mCDM->Close();
mCDM = nullptr;
}
gmp_Shutdown();
}
} // namespace mozilla

View File

@ -167,6 +167,9 @@ private:
// GMP thread only.
void gmp_Init(uint32_t aPromiseId);
// GMP thread only.
void gmp_Shutdown();
// Main thread only.
void OnCDMCreated(uint32_t aPromiseId);

View File

@ -44,12 +44,24 @@ MediaKeys::MediaKeys(nsPIDOMWindow* aParent, const nsAString& aKeySystem)
SetIsDOMBinding();
}
static PLDHashOperator
RejectPromises(const uint32_t& aKey,
nsRefPtr<dom::Promise>& aPromise,
void* aClosure)
{
aPromise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
return PL_DHASH_NEXT;
}
MediaKeys::~MediaKeys()
{
if (mProxy) {
mProxy->Shutdown();
mProxy = nullptr;
}
mPromises.Enumerate(&RejectPromises, nullptr);
mPromises.Clear();
}
nsPIDOMWindow*

View File

@ -8,7 +8,9 @@
#include "MP4Reader.h"
#include "MediaDecoderStateMachine.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
#include "prlog.h"
#ifdef XP_WIN
@ -29,6 +31,7 @@ MediaDecoderStateMachine* MP4Decoder::CreateStateMachine()
return new MediaDecoderStateMachine(this, new MP4Reader(this));
}
#ifdef MOZ_EME
nsresult
MP4Decoder::SetCDMProxy(CDMProxy* aProxy)
{
@ -45,6 +48,7 @@ MP4Decoder::SetCDMProxy(CDMProxy* aProxy)
}
return NS_OK;
}
#endif
bool
MP4Decoder::GetSupportedCodecs(const nsACString& aType,

View File

@ -24,7 +24,9 @@ public:
virtual MediaDecoderStateMachine* CreateStateMachine();
#ifdef MOZ_EME
virtual nsresult SetCDMProxy(CDMProxy* aProxy) MOZ_OVERRIDE;
#endif
// Returns true if aType is a MIME type that we can render with the
// a MP4 platform decoder backend. If aCodecList is non null,

View File

@ -15,6 +15,10 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/TimeRanges.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
using mozilla::layers::Image;
using mozilla::layers::LayerManager;
using mozilla::layers::LayersBackend;
@ -204,6 +208,7 @@ MP4Reader::Init(MediaDecoderReader* aCloneDonor)
return NS_OK;
}
#ifdef MOZ_EME
class DispatchKeyNeededEvent : public nsRunnable {
public:
DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder,
@ -229,9 +234,11 @@ private:
nsTArray<uint8_t> mInitData;
nsString mInitDataType;
};
#endif
bool MP4Reader::IsWaitingMediaResources()
{
#ifdef MOZ_EME
nsRefPtr<CDMProxy> proxy;
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
@ -251,6 +258,9 @@ bool MP4Reader::IsWaitingMediaResources()
LOG("MP4Reader::IsWaitingMediaResources() capsKnown=%d", caps.AreCapsKnown());
return !caps.AreCapsKnown();
}
#else
return false;
#endif
}
void
@ -296,6 +306,7 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
mDemuxerInitialized = true;
}
if (mDemuxer->Crypto().valid) {
#ifdef MOZ_EME
if (!sIsEMEEnabled) {
// TODO: Need to signal DRM/EME required somehow...
return NS_ERROR_FAILURE;
@ -330,6 +341,10 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
HasVideo(),
GetTaskQueue());
NS_ENSURE_TRUE(mPlatform, NS_ERROR_FAILURE);
#else
// EME not supported.
return NS_ERROR_FAILURE;
#endif
} else {
mPlatform = PlatformDecoderModule::Create();
NS_ENSURE_TRUE(mPlatform, NS_ERROR_FAILURE);

View File

@ -12,7 +12,6 @@
#include "PlatformDecoderModule.h"
#include "mp4_demuxer/mp4_demuxer.h"
#include "MediaTaskQueue.h"
#include "mozilla/CDMProxy.h"
#include <deque>
#include "mozilla/Monitor.h"

View File

@ -15,8 +15,10 @@
#include "AppleDecoderModule.h"
#endif
#include "mozilla/Preferences.h"
#ifdef MOZ_EME
#include "EMEDecoderModule.h"
#include "mozilla/CDMProxy.h"
#endif
#include "SharedThreadPool.h"
#include "MediaTaskQueue.h"
@ -70,6 +72,7 @@ CreateTaskQueue()
return t->mTaskQueue.forget();
}
#ifdef MOZ_EME
/* static */
PlatformDecoderModule*
PlatformDecoderModule::CreateCDMWrapper(CDMProxy* aProxy,
@ -101,6 +104,7 @@ PlatformDecoderModule::CreateCDMWrapper(CDMProxy* aProxy,
cdmDecodesVideo,
CreateTaskQueue());
}
#endif
/* static */
PlatformDecoderModule*

View File

@ -66,6 +66,7 @@ public:
// This is called on the decode task queue.
static PlatformDecoderModule* Create();
#ifdef MOZ_EME
// Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or
// decrypt-and-decode EME encrypted content. If the CDM only decrypts and
// does not decode, we create a PDM and use that to create MediaDataDecoders
@ -75,6 +76,7 @@ public:
bool aHasAudio,
bool aHasVideo,
MediaTaskQueue* aTaskQueue);
#endif
// Called to shutdown the decoder module and cleanup state. The PDM
// is deleted immediately after Shutdown() is called. Shutdown() is

View File

@ -127,11 +127,20 @@ EMEAACDecoder::Shutdown()
void
EMEAACDecoder::Decoded(const nsTArray<int16_t>& aPCM,
uint64_t aTimeStamp)
uint64_t aTimeStamp,
uint32_t aChannels,
uint32_t aRate)
{
MOZ_ASSERT(IsOnGMPThread());
size_t numFrames = aPCM.Length() / mAudioChannels;
if (aRate == 0 || aChannels == 0) {
NS_WARNING("Invalid rate or num channels returned on GMP audio samples");
mCallback->Error();
return;
}
size_t numFrames = aPCM.Length() / aChannels;
MOZ_ASSERT((aPCM.Length() % aChannels) == 0);
nsAutoArrayPtr<AudioDataValue> audioData(new AudioDataValue[aPCM.Length()]);
for (size_t i = 0; i < aPCM.Length(); ++i) {
@ -140,7 +149,7 @@ EMEAACDecoder::Decoded(const nsTArray<int16_t>& aPCM,
if (mMustRecaptureAudioPosition) {
mAudioFrameSum = 0;
auto timestamp = UsecsToFrames(aTimeStamp, mAudioRate);
auto timestamp = UsecsToFrames(aTimeStamp, aRate);
if (!timestamp.isValid()) {
NS_WARNING("Invalid timestamp");
mCallback->Error();
@ -151,7 +160,7 @@ EMEAACDecoder::Decoded(const nsTArray<int16_t>& aPCM,
mMustRecaptureAudioPosition = false;
}
auto timestamp = FramesToUsecs(mAudioFrameOffset + mAudioFrameSum, mAudioRate);
auto timestamp = FramesToUsecs(mAudioFrameOffset + mAudioFrameSum, aRate);
if (!timestamp.isValid()) {
NS_WARNING("Invalid timestamp on audio samples");
mCallback->Error();
@ -159,7 +168,7 @@ EMEAACDecoder::Decoded(const nsTArray<int16_t>& aPCM,
}
mAudioFrameSum += numFrames;
auto duration = FramesToUsecs(numFrames, mAudioRate);
auto duration = FramesToUsecs(numFrames, aRate);
if (!duration.isValid()) {
NS_WARNING("Invalid duration on audio samples");
mCallback->Error();
@ -171,7 +180,7 @@ EMEAACDecoder::Decoded(const nsTArray<int16_t>& aPCM,
duration.value(),
numFrames,
audioData.forget(),
mAudioChannels));
aChannels));
#ifdef LOG_SAMPLE_DECODE
LOG("Decoded audio sample! timestamp=%lld duration=%lld currentLength=%u",
@ -211,6 +220,7 @@ void
EMEAACDecoder::Error(GMPErr aErr)
{
MOZ_ASSERT(IsOnGMPThread());
EME_LOG("EMEAACDecoder::Error");
mCallback->Error();
GmpShutdown();
}
@ -276,7 +286,7 @@ EMEAACDecoder::GmpInput(MP4Sample* aSample)
}
}
gmp::GMPAudioSamplesImpl samples(sample);
gmp::GMPAudioSamplesImpl samples(sample, mAudioChannels, mAudioRate);
mGMP->Decode(samples);
mStreamOffset = sample->byte_offset;

View File

@ -38,7 +38,9 @@ public:
// GMPAudioDecoderProxyCallback implementation.
virtual void Decoded(const nsTArray<int16_t>& aPCM,
uint64_t aTimeStamp) MOZ_OVERRIDE;
uint64_t aTimeStamp,
uint32_t aChannels,
uint32_t aRate) MOZ_OVERRIDE;
virtual void InputDataExhausted() MOZ_OVERRIDE;
virtual void DrainComplete() MOZ_OVERRIDE;
virtual void ResetComplete() MOZ_OVERRIDE;

View File

@ -15,6 +15,7 @@
#include "nsServiceManagerUtils.h"
#include "prsystem.h"
#include "gfx2DGlue.h"
#include "mozilla/EMELog.h"
namespace mozilla {
@ -208,6 +209,7 @@ void
EMEH264Decoder::Error(GMPErr aErr)
{
MOZ_ASSERT(IsOnGMPThread());
EME_LOG("EMEH264Decoder::Error");
mCallback->Error();
GmpShutdown();
}

View File

@ -1,26 +1,30 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
UNIFIED_SOURCES += [
'nsPrefBranch.cpp',
'nsPrefsFactory.cpp',
'Preferences.cpp',
'prefread.cpp',
]
# prefapi.cpp cannot be built in unified mode because it uses plarena.h
SOURCES += [
'prefapi.cpp',
]
MSVC_ENABLE_PGO = True
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS += [
'EMEAACDecoder.h',
'EMEDecoderModule.h',
'EMEH264Decoder.h',
]
UNIFIED_SOURCES += [
'EMEAACDecoder.cpp',
'EMEDecoderModule.cpp',
'EMEH264Decoder.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'../base',
]
FINAL_LIBRARY = 'xul'
FAIL_ON_WARNINGS = True
if CONFIG['OS_ARCH'] == 'WINNT':
DEFINES['NOMINMAX'] = True

View File

@ -5,9 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS += [
'eme/EMEAACDecoder.h',
'eme/EMEDecoderModule.h',
'eme/EMEH264Decoder.h',
'MP4Decoder.h',
'MP4Reader.h',
'PlatformDecoderModule.h',
@ -15,9 +12,6 @@ EXPORTS += [
UNIFIED_SOURCES += [
'BlankDecoderModule.cpp',
'eme/EMEAACDecoder.cpp',
'eme/EMEDecoderModule.cpp',
'eme/EMEH264Decoder.cpp',
'PlatformDecoderModule.cpp',
]
@ -29,6 +23,9 @@ SOURCES += [
if CONFIG['MOZ_WMF']:
DIRS += [ 'wmf' ];
if CONFIG['MOZ_EME']:
DIRS += ['eme']
if CONFIG['MOZ_FFMPEG']:
EXPORTS += [
'ffmpeg/FFmpegRuntimeLinker.h',

View File

@ -49,6 +49,8 @@ GMPAudioDecoderChild::Decoded(GMPAudioSamples* aDecodedSamples)
samples.mData().AppendElements((int16_t*)aDecodedSamples->Buffer(),
aDecodedSamples->Size() / sizeof(int16_t));
samples.mTimeStamp() = aDecodedSamples->TimeStamp();
samples.mChannelCount() = aDecodedSamples->Channels();
samples.mSamplesPerSecond() = aDecodedSamples->Rate();
unused << SendDecoded(samples);

View File

@ -200,7 +200,10 @@ GMPAudioDecoderParent::RecvDecoded(const GMPAudioDecodedSampleData& aDecoded)
return false;
}
mCallback->Decoded(aDecoded.mData(), aDecoded.mTimeStamp());
mCallback->Decoded(aDecoded.mData(),
aDecoded.mTimeStamp(),
aDecoded.mChannelCount(),
aDecoded.mSamplesPerSecond());
return true;
}

View File

@ -15,7 +15,12 @@
class GMPAudioDecoderProxyCallback : public GMPCallbackBase {
public:
virtual ~GMPAudioDecoderProxyCallback() {}
virtual void Decoded(const nsTArray<int16_t>& aPCM, uint64_t aTimeStamp) = 0;
// Note: aChannelCount and aSamplesPerSecond may not be consistent from
// one invocation to the next.
virtual void Decoded(const nsTArray<int16_t>& aPCM,
uint64_t aTimeStamp,
uint32_t aChannelCount,
uint32_t aSamplesPerSecond) = 0;
virtual void InputDataExhausted() = 0;
virtual void DrainComplete() = 0;
virtual void ResetComplete() = 0;

View File

@ -14,6 +14,8 @@ namespace gmp {
GMPAudioSamplesImpl::GMPAudioSamplesImpl(GMPAudioFormat aFormat)
: mFormat(aFormat)
, mTimeStamp(0)
, mChannels(0)
, mRate(0)
{
}
@ -21,15 +23,21 @@ GMPAudioSamplesImpl::GMPAudioSamplesImpl(const GMPAudioEncodedSampleData& aData)
: mFormat(kGMPAudioEncodedSamples)
, mBuffer(aData.mData())
, mTimeStamp(aData.mTimeStamp())
, mChannels(aData.mChannelCount())
, mRate(aData.mSamplesPerSecond())
{
if (aData.mDecryptionData().mKeyId().Length() > 0) {
mCrypto = new GMPEncryptedBufferDataImpl(aData.mDecryptionData());
}
}
GMPAudioSamplesImpl::GMPAudioSamplesImpl(mp4_demuxer::MP4Sample* aSample)
GMPAudioSamplesImpl::GMPAudioSamplesImpl(mp4_demuxer::MP4Sample* aSample,
uint32_t aChannels,
uint32_t aRate)
: mFormat(kGMPAudioEncodedSamples)
, mTimeStamp(aSample->composition_timestamp)
, mChannels(aChannels)
, mRate(aRate)
{
mBuffer.AppendElements(aSample->data, aSample->size);
if (aSample->crypto.valid) {
@ -115,6 +123,31 @@ GMPAudioSamplesImpl::RelinquishData(GMPAudioEncodedSampleData& aData)
}
}
uint32_t
GMPAudioSamplesImpl::Channels() const
{
return mChannels;
}
void
GMPAudioSamplesImpl::SetChannels(uint32_t aChannels)
{
mChannels = aChannels;
}
uint32_t
GMPAudioSamplesImpl::Rate() const
{
return mRate;
}
void
GMPAudioSamplesImpl::SetRate(uint32_t aRate)
{
mRate = aRate;
}
GMPErr
GMPAudioHostImpl::CreateSamples(GMPAudioFormat aFormat,
GMPAudioSamples** aSamples)

View File

@ -22,7 +22,9 @@ class GMPAudioSamplesImpl : public GMPAudioSamples {
public:
GMPAudioSamplesImpl(GMPAudioFormat aFormat);
GMPAudioSamplesImpl(const GMPAudioEncodedSampleData& aData);
GMPAudioSamplesImpl(mp4_demuxer::MP4Sample* aSample);
GMPAudioSamplesImpl(mp4_demuxer::MP4Sample* aSample,
uint32_t aChannels,
uint32_t aRate);
virtual ~GMPAudioSamplesImpl();
virtual GMPAudioFormat GetFormat() MOZ_OVERRIDE;
@ -39,11 +41,18 @@ public:
void RelinquishData(GMPAudioEncodedSampleData& aData);
virtual uint32_t Channels() const MOZ_OVERRIDE;
virtual void SetChannels(uint32_t aChannels) MOZ_OVERRIDE;
virtual uint32_t Rate() const MOZ_OVERRIDE;
virtual void SetRate(uint32_t aRate) MOZ_OVERRIDE;
private:
GMPAudioFormat mFormat;
nsTArray<uint8_t> mBuffer;
int64_t mTimeStamp;
nsAutoPtr<GMPEncryptedBufferDataImpl> mCrypto;
uint32_t mChannels;
uint32_t mRate;
};
class GMPAudioHostImpl : public GMPAudioHost

View File

@ -63,12 +63,16 @@ struct GMPAudioEncodedSampleData
uint8_t[] mData;
uint64_t mTimeStamp; // microseconds.
GMPDecryptionData mDecryptionData;
uint32_t mChannelCount;
uint32_t mSamplesPerSecond;
};
struct GMPAudioDecodedSampleData
{
int16_t[] mData;
uint64_t mTimeStamp; // microseconds.
uint32_t mChannelCount;
uint32_t mSamplesPerSecond;
};
}

View File

@ -52,6 +52,23 @@ public:
// Get metadata describing how this frame is encrypted, or nullptr if the
// buffer is not encrypted.
virtual const GMPEncryptedBufferMetadata* GetDecryptionData() const = 0;
virtual uint32_t Channels() const = 0;
virtual void SetChannels(uint32_t aChannels) = 0;
// Rate; the number of frames per second, where a "frame" is one sample for
// each channel.
//
// For IS16 samples, the number of samples should be:
// Size() / (Channels() * sizeof(int16_t)).
//
// Note: Channels() and Rate() may not be constant across a decoding
// session. For example the rate for decoded samples may be different
// than the rate advertised by the MP4 container for encoded samples
// for HE-AAC streams with SBR/PS, and an EME-GMP may need to downsample
// to satisfy DRM requirements.
virtual uint32_t Rate() const = 0;
virtual void SetRate(uint32_t aRate) = 0;
};
#endif // GMP_AUDIO_FRAME_h_

View File

@ -797,8 +797,7 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
if (! mBroadcasterMap) {
mBroadcasterMap =
PL_NewDHashTable(&gOps, nullptr, sizeof(BroadcasterMapEntry),
PL_DHASH_MIN_SIZE);
PL_NewDHashTable(&gOps, nullptr, sizeof(BroadcasterMapEntry));
if (! mBroadcasterMap) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);

View File

@ -9,8 +9,7 @@
void
nsContentSupportMap::Init()
{
PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr,
sizeof(Entry), PL_DHASH_MIN_SIZE);
PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr, sizeof(Entry));
}
void
@ -26,7 +25,7 @@ nsContentSupportMap::Remove(nsIContent* aElement)
if (!mMap.ops)
return NS_ERROR_NOT_INITIALIZED;
nsIContent* child = aElement;
nsIContent* child = aElement;
do {
PL_DHashTableOperate(&mMap, child, PL_DHASH_REMOVE);
child = child->GetNextNode(aElement);

View File

@ -20,7 +20,11 @@ protected:
PLDHashTable mTable;
void
Init() { PL_DHashTableInit(&mTable, PL_DHashGetStubOps(), nullptr, sizeof(Entry), PL_DHASH_MIN_SIZE); }
Init()
{
PL_DHashTableInit(&mTable, PL_DHashGetStubOps(), nullptr,
sizeof(Entry));
}
void
Finish() { PL_DHashTableFinish(&mTable); }

View File

@ -192,6 +192,7 @@
#include "nsIWidget.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/URLSearchParams.h"
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
@ -1932,6 +1933,24 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
mLSHE->GetIsSubFrame(&isSubFrame);
}
// nsDocShell owns a URLSearchParams that is used by
// window.location.searchParams to be in sync with the current location.
if (!mURLSearchParams) {
mURLSearchParams = new URLSearchParams();
}
nsAutoCString search;
nsCOMPtr<nsIURL> url(do_QueryInterface(mCurrentURI));
if (url) {
nsresult rv = url->GetQuery(search);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to get the query from a nsIURL.");
}
}
mURLSearchParams->ParseInput(search, nullptr);
if (!isSubFrame && !isRoot) {
/*
* We don't want to send OnLocationChange notifications when
@ -2133,6 +2152,22 @@ nsDocShell::GetHasMixedDisplayContentBlocked(bool* aHasMixedDisplayContentBlocke
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasTrackingContentBlocked(bool* aHasTrackingContentBlocked)
{
nsCOMPtr<nsIDocument> doc(GetDocument());
*aHasTrackingContentBlocked = doc && doc->GetHasTrackingContentBlocked();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasTrackingContentLoaded(bool* aHasTrackingContentLoaded)
{
nsCOMPtr<nsIDocument> doc(GetDocument());
*aHasTrackingContentLoaded = doc && doc->GetHasTrackingContentLoaded();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetAllowPlugins(bool * aAllowPlugins)
{
@ -5348,6 +5383,11 @@ nsDocShell::Destroy()
mParentWidget = nullptr;
mCurrentURI = nullptr;
if (mURLSearchParams) {
mURLSearchParams->RemoveObservers();
mURLSearchParams = nullptr;
}
if (mScriptGlobal) {
mScriptGlobal->DetachFromDocShell();
mScriptGlobal = nullptr;
@ -7099,10 +7139,9 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
}
// Handle iframe document not loading error because source was
// a tracking URL. (Safebrowsing) We make a note of this iframe
// node by including it in a dedicated array of blocked tracking
// nodes under its parent document. (document of parent window of
// blocked document)
// a tracking URL. We make a note of this iframe node by including
// it in a dedicated array of blocked tracking nodes under its parent
// document. (document of parent window of blocked document)
if (isTopFrame == false && aStatus == NS_ERROR_TRACKING_URI) {
// frameElement is our nsIContent to be annotated
nsCOMPtr<nsIDOMElement> frameElement;
@ -13187,3 +13226,9 @@ nsDocShell::GetOpenedRemote()
nsCOMPtr<nsITabParent> openedRemote(do_QueryReferent(mOpenedRemote));
return openedRemote;
}
URLSearchParams*
nsDocShell::GetURLSearchParams()
{
return mURLSearchParams;
}

View File

@ -50,6 +50,7 @@
namespace mozilla {
namespace dom {
class EventTarget;
class URLSearchParams;
}
}
@ -763,6 +764,9 @@ protected:
nsCOMPtr<nsIChannel> mFailedChannel;
uint32_t mFailedLoadType;
// window.location.searchParams is updated in sync with this object.
nsRefPtr<mozilla::dom::URLSearchParams> mURLSearchParams;
// Set in DoURILoad when either the LOAD_RELOAD_ALLOW_MIXED_CONTENT flag or
// the LOAD_NORMAL_ALLOW_MIXED_CONTENT flag is set.
// Checked in nsMixedContentBlocker, to see if the channels match.

View File

@ -11,6 +11,13 @@
#include "js/TypeDecls.h"
class nsPresContext;
class nsIPresShell;
namespace mozilla {
namespace dom {
class URLSearchParams;
}
}
%}
/**
@ -19,6 +26,7 @@ class nsIPresShell;
[ptr] native nsPresContext(nsPresContext);
[ptr] native nsIPresShell(nsIPresShell);
[ptr] native URLSearchParams(mozilla::dom::URLSearchParams);
interface nsIURI;
interface nsIChannel;
@ -46,7 +54,7 @@ interface nsITabParent;
typedef unsigned long nsLoadFlags;
[scriptable, builtinclass, uuid(e5fe5c76-e511-4da3-9709-f8294b8dc5ce)]
[scriptable, builtinclass, uuid(3646c915-df79-4500-8b57-c65ab9c3b39f)]
interface nsIDocShell : nsIDocShellTreeItem
{
/**
@ -561,6 +569,19 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
[infallible] readonly attribute boolean hasMixedDisplayContentBlocked;
/**
* This attribute determines whether a document has Tracking Content
* that has been blocked from loading.
*/
[infallible] readonly attribute boolean hasTrackingContentBlocked;
/**
* This attribute determines whether Tracking Content is loaded on the
* document. When it is true, tracking content was not blocked and has
* loaded (or is about to load) on the page.
*/
[infallible] readonly attribute boolean hasTrackingContentLoaded;
/**
* Disconnects this docshell's editor from its window, and stores the
* editor data in the open document's session history entry. This
@ -982,4 +1003,7 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
[noscript,notxpcom,nostdcall] void setOpenedRemote(in nsITabParent aOpenedRemote);
[noscript,notxpcom,nostdcall] nsITabParent getOpenedRemote();
// URLSearchParams for the window.location is owned by the docShell.
[noscript,notxpcom] URLSearchParams getURLSearchParams();
};

View File

@ -341,9 +341,10 @@ URL::SetHost(const nsAString& aHost, ErrorResult& aRv)
}
void
URL::URLSearchParamsUpdated()
URL::URLSearchParamsUpdated(URLSearchParams* aSearchParams)
{
MOZ_ASSERT(mSearchParams);
MOZ_ASSERT(mSearchParams == aSearchParams);
nsAutoString search;
mSearchParams->Serialize(search);

View File

@ -121,7 +121,7 @@ public:
}
// URLSearchParamsObserver
void URLSearchParamsUpdated() MOZ_OVERRIDE;
void URLSearchParamsUpdated(URLSearchParams* aSearchParams) MOZ_OVERRIDE;
private:
nsIURI* GetURI() const

View File

@ -5,6 +5,7 @@
#include "URLSearchParams.h"
#include "mozilla/dom/URLSearchParamsBinding.h"
#include "mozilla/dom/EncodingUtils.h"
namespace mozilla {
namespace dom {
@ -98,30 +99,31 @@ URLSearchParams::ParseInput(const nsACString& aInput,
name.Assign(string);
}
nsAutoCString decodedName;
nsAutoString decodedName;
DecodeString(name, decodedName);
nsAutoCString decodedValue;
nsAutoString decodedValue;
DecodeString(value, decodedValue);
AppendInternal(NS_ConvertUTF8toUTF16(decodedName),
NS_ConvertUTF8toUTF16(decodedValue));
AppendInternal(decodedName, decodedValue);
}
NotifyObservers(aObserver);
}
void
URLSearchParams::DecodeString(const nsACString& aInput, nsACString& aOutput)
URLSearchParams::DecodeString(const nsACString& aInput, nsAString& aOutput)
{
nsACString::const_iterator start, end;
aInput.BeginReading(start);
aInput.EndReading(end);
nsCString unescaped;
while (start != end) {
// replace '+' with U+0020
if (*start == '+') {
aOutput.Append(' ');
unescaped.Append(' ');
++start;
continue;
}
@ -148,20 +150,62 @@ URLSearchParams::DecodeString(const nsACString& aInput, nsACString& aOutput)
if (first != end && second != end &&
ASCII_HEX_DIGIT(*first) && ASCII_HEX_DIGIT(*second)) {
aOutput.Append(HEX_DIGIT(first) * 16 + HEX_DIGIT(second));
unescaped.Append(HEX_DIGIT(first) * 16 + HEX_DIGIT(second));
start = ++second;
continue;
} else {
aOutput.Append('%');
unescaped.Append('%');
++start;
continue;
}
}
aOutput.Append(*start);
unescaped.Append(*start);
++start;
}
ConvertString(unescaped, aOutput);
}
void
URLSearchParams::ConvertString(const nsACString& aInput, nsAString& aOutput)
{
aOutput.Truncate();
if (!mDecoder) {
mDecoder = EncodingUtils::DecoderForEncoding("UTF-8");
if (!mDecoder) {
MOZ_ASSERT(mDecoder, "Failed to create a decoder.");
return;
}
}
nsACString::const_iterator iter;
aInput.BeginReading(iter);
int32_t inputLength = aInput.Length();
int32_t outputLength = 0;
nsresult rv = mDecoder->GetMaxLength(iter.get(), inputLength,
&outputLength);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
const mozilla::fallible_t fallible = mozilla::fallible_t();
nsAutoArrayPtr<char16_t> buf(new (fallible) char16_t[outputLength + 1]);
if (!buf) {
return;
}
rv = mDecoder->Convert(iter.get(), &inputLength, buf, &outputLength);
if (NS_SUCCEEDED(rv)) {
buf[outputLength] = 0;
if (!aOutput.Assign(buf, outputLength, mozilla::fallible_t())) {
aOutput.Truncate();
}
}
}
/* static */ PLDHashOperator
@ -193,6 +237,12 @@ URLSearchParams::RemoveObserver(URLSearchParamsObserver* aObserver)
mObservers.RemoveElement(aObserver);
}
void
URLSearchParams::RemoveObservers()
{
mObservers.Clear();
}
void
URLSearchParams::Get(const nsAString& aName, nsString& aRetval)
{
@ -343,7 +393,7 @@ URLSearchParams::NotifyObservers(URLSearchParamsObserver* aExceptObserver)
{
for (uint32_t i = 0; i < mObservers.Length(); ++i) {
if (mObservers[i] != aExceptObserver) {
mObservers[i]->URLSearchParamsUpdated();
mObservers[i]->URLSearchParamsUpdated(this);
}
}
}

View File

@ -13,16 +13,19 @@
#include "nsClassHashtable.h"
#include "nsHashKeys.h"
#include "nsISupports.h"
#include "nsIUnicodeDecoder.h"
namespace mozilla {
namespace dom {
class URLSearchParams;
class URLSearchParamsObserver : public nsISupports
{
public:
virtual ~URLSearchParamsObserver() {}
virtual void URLSearchParamsUpdated() = 0;
virtual void URLSearchParamsUpdated(URLSearchParams* aFromThis) = 0;
};
class URLSearchParams MOZ_FINAL : public nsISupports,
@ -58,6 +61,7 @@ public:
void AddObserver(URLSearchParamsObserver* aObserver);
void RemoveObserver(URLSearchParamsObserver* aObserver);
void RemoveObservers();
void Serialize(nsAString& aValue) const;
@ -83,7 +87,8 @@ private:
void DeleteAll();
void DecodeString(const nsACString& aInput, nsACString& aOutput);
void DecodeString(const nsACString& aInput, nsAString& aOutput);
void ConvertString(const nsACString& aInput, nsAString& aOutput);
void NotifyObservers(URLSearchParamsObserver* aExceptObserver);
@ -98,6 +103,7 @@ private:
nsClassHashtable<nsStringHashKey, nsTArray<nsString>> mSearchParams;
nsTArray<nsRefPtr<URLSearchParamsObserver>> mObservers;
nsCOMPtr<nsIUnicodeDecoder> mDecoder;
};
} // namespace dom

View File

@ -1612,7 +1612,7 @@ nsDOMWindowUtils::GetTranslationNodes(nsIDOMNode* aRoot,
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
}
nsTHashtable<nsPtrHashKey<nsIContent>> translationNodesHash(1000);
nsTHashtable<nsPtrHashKey<nsIContent>> translationNodesHash(500);
nsRefPtr<nsTranslationNodeList> list = new nsTranslationNodeList;
uint32_t limit = 15000;

View File

@ -68,16 +68,33 @@ nsLocation::nsLocation(nsPIDOMWindow* aWindow, nsIDocShell *aDocShell)
nsLocation::~nsLocation()
{
RemoveURLSearchParams();
}
// QueryInterface implementation for nsLocation
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsLocation)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMLocation)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMLocation)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsLocation, mInnerWindow)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsLocation)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsLocation)
tmp->RemoveURLSearchParams();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mInnerWindow);
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsLocation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSearchParams)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInnerWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsLocation)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsLocation)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsLocation)
@ -858,6 +875,17 @@ nsLocation::GetSearch(nsAString& aSearch)
NS_IMETHODIMP
nsLocation::SetSearch(const nsAString& aSearch)
{
nsresult rv = SetSearchInternal(aSearch);
if (NS_FAILED(rv)) {
return rv;
}
return NS_OK;
}
nsresult
nsLocation::SetSearchInternal(const nsAString& aSearch)
{
if (!CallerSubsumes())
return NS_ERROR_DOM_SECURITY_ERR;
@ -1036,3 +1064,119 @@ nsLocation::WrapObject(JSContext* aCx)
{
return LocationBinding::Wrap(aCx, this);
}
URLSearchParams*
nsLocation::GetDocShellSearchParams()
{
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
if (!docShell) {
return nullptr;
}
return docShell->GetURLSearchParams();
}
URLSearchParams*
nsLocation::SearchParams()
{
if (!mSearchParams) {
// We must register this object to the URLSearchParams of the docshell in
// order to receive updates.
nsRefPtr<URLSearchParams> searchParams = GetDocShellSearchParams();
if (searchParams) {
searchParams->AddObserver(this);
}
mSearchParams = new URLSearchParams();
mSearchParams->AddObserver(this);
UpdateURLSearchParams();
}
return mSearchParams;
}
void
nsLocation::SetSearchParams(URLSearchParams& aSearchParams)
{
if (mSearchParams) {
mSearchParams->RemoveObserver(this);
}
// the observer will be cleared using the cycle collector.
mSearchParams = &aSearchParams;
mSearchParams->AddObserver(this);
nsAutoString search;
mSearchParams->Serialize(search);
SetSearchInternal(search);
// We don't need to inform the docShell about this new SearchParams because
// setting the new value the docShell will refresh its value automatically.
}
void
nsLocation::URLSearchParamsUpdated(URLSearchParams* aSearchParams)
{
MOZ_ASSERT(mSearchParams);
// This change comes from content.
if (aSearchParams == mSearchParams) {
nsAutoString search;
mSearchParams->Serialize(search);
SetSearchInternal(search);
return;
}
// This change comes from the docShell.
#ifdef DEBUG
{
nsRefPtr<URLSearchParams> searchParams = GetDocShellSearchParams();
MOZ_ASSERT(searchParams);
MOZ_ASSERT(aSearchParams == searchParams);
}
#endif
nsAutoString search;
aSearchParams->Serialize(search);
mSearchParams->ParseInput(NS_ConvertUTF16toUTF8(search), this);
}
void
nsLocation::UpdateURLSearchParams()
{
if (!mSearchParams) {
return;
}
nsAutoCString search;
nsCOMPtr<nsIURI> uri;
nsresult rv = GetURI(getter_AddRefs(uri));
if (NS_WARN_IF(NS_FAILED(rv)) || NS_WARN_IF(!uri)) {
return;
}
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
if (url) {
nsresult rv = url->GetQuery(search);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to get the query from a nsIURL.");
}
}
mSearchParams->ParseInput(search, this);
}
void
nsLocation::RemoveURLSearchParams()
{
if (mSearchParams) {
mSearchParams->RemoveObserver(this);
mSearchParams = nullptr;
nsRefPtr<URLSearchParams> docShellSearchParams = GetDocShellSearchParams();
if (docShellSearchParams) {
docShellSearchParams->RemoveObserver(this);
}
}
}

View File

@ -14,6 +14,7 @@
#include "nsCycleCollectionParticipant.h"
#include "js/TypeDecls.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/URLSearchParams.h"
#include "nsPIDOMWindow.h"
class nsIURI;
@ -26,6 +27,7 @@ class nsIDocShellLoadInfo;
class nsLocation MOZ_FINAL : public nsIDOMLocation
, public nsWrapperCache
, public mozilla::dom::URLSearchParamsObserver
{
typedef mozilla::ErrorResult ErrorResult;
@ -33,7 +35,8 @@ public:
nsLocation(nsPIDOMWindow* aWindow, nsIDocShell *aDocShell);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsLocation)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsLocation,
nsIDOMLocation)
void SetDocShell(nsIDocShell *aDocShell);
nsIDocShell *GetDocShell();
@ -118,6 +121,11 @@ public:
{
aError = SetSearch(aSeach);
}
mozilla::dom::URLSearchParams* SearchParams();
void SetSearchParams(mozilla::dom::URLSearchParams& aSearchParams);
void GetHash(nsAString& aHash, ErrorResult& aError)
{
aError = GetHash(aHash);
@ -136,9 +144,18 @@ public:
}
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
// URLSearchParamsObserver
void URLSearchParamsUpdated(mozilla::dom::URLSearchParams* aSearchParams) MOZ_OVERRIDE;
protected:
virtual ~nsLocation();
nsresult SetSearchInternal(const nsAString& aSearch);
void UpdateURLSearchParams();
void RemoveURLSearchParams();
mozilla::dom::URLSearchParams* GetDocShellSearchParams();
// In the case of jar: uris, we sometimes want the place the jar was
// fetched from as the URI instead of the jar: uri itself. Pass in
// true for aGetInnermostURI when that's the case.
@ -156,6 +173,7 @@ protected:
nsString mCachedHash;
nsCOMPtr<nsPIDOMWindow> mInnerWindow;
nsRefPtr<mozilla::dom::URLSearchParams> mSearchParams;
nsWeakPtr mDocShell;
};

View File

@ -314,7 +314,7 @@ nsScriptNameSpaceManager::RegisterInterface(const char* aIfName,
return NS_OK;
}
#define GLOBALNAME_HASHTABLE_INITIAL_SIZE 1024
#define GLOBALNAME_HASHTABLE_INITIAL_LENGTH 512
nsresult
nsScriptNameSpaceManager::Init()
@ -333,14 +333,14 @@ nsScriptNameSpaceManager::Init()
mIsInitialized = PL_DHashTableInit(&mGlobalNames, &hash_table_ops,
nullptr, sizeof(GlobalNameMapEntry),
GLOBALNAME_HASHTABLE_INITIAL_SIZE,
fallible_t());
fallible_t(),
GLOBALNAME_HASHTABLE_INITIAL_LENGTH);
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_OUT_OF_MEMORY);
mIsInitialized = PL_DHashTableInit(&mNavigatorNames, &hash_table_ops,
nullptr, sizeof(GlobalNameMapEntry),
GLOBALNAME_HASHTABLE_INITIAL_SIZE,
fallible_t());
fallible_t(),
GLOBALNAME_HASHTABLE_INITIAL_LENGTH);
if (!mIsInitialized) {
PL_DHashTableFinish(&mGlobalNames);

View File

@ -47,6 +47,7 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e1
[test_history_state_null.html]
[test_Image_constructor.html]
[test_innersize_scrollport.html]
[test_location_searchParams.html]
[test_messageChannel.html]
[test_messageChannel_cloning.html]
[test_messageChannel_pingpong.html]
@ -74,6 +75,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec
[test_url_malformedHost.html]
[test_urlExceptions.html]
[test_urlSearchParams.html]
[test_urlSearchParams_utf8.html]
[test_urlutils_stringify.html]
[test_window_constructor.html]
[test_window_cross_origin_props.html]

View File

@ -0,0 +1,89 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1037715
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1037715</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1037715">Mozilla Bug 1037715</a>
<iframe id="a"></iframe>
<script type="application/javascript">
var l;
var iframe = document.getElementById('a');
function onload0() {
iframe.removeEventListener('load', onload0);
l = iframe.contentWindow.location;
is(l.searchParams.get('a'), 'test0', 'l.searchParams value is ok');
info('changing location from JS...');
iframe.addEventListener('load', onload1);
iframe.contentWindow.location.href = 'file_empty.html?a=test1';
}
function onload1() {
iframe.removeEventListener('load', onload1);
var ll = iframe.contentWindow.location;
is(ll.searchParams.get('a'), 'test1', 'location.searchParams value is ok');
is(l.searchParams.get('a'), 'test1', 'l.searchParams value is ok');
isnot(ll.searchParams, l.searchParams, '2 different objects.');
info('changing location using l.searchParams...');
iframe.addEventListener('load', onload2);
l.searchParams.set('a', 'test2');
}
function onload2() {
iframe.removeEventListener('load', onload2);
var ll = iframe.contentWindow.location;
is(ll.searchParams.get('a'), 'test2', 'location.searchParams value is ok');
is(l.searchParams.get('a'), 'test2', 'l.searchParams value is ok');
isnot(ll.searchParams, l.searchParams, '2 different objects.');
info('changing iframe.src...');
iframe.addEventListener('load', onload3);
l.search = 'a=test3';
}
function onload3() {
iframe.removeEventListener('load', onload3);
var ll = iframe.contentWindow.location;
is(ll.searchParams.get('a'), 'test3', 'location.searchParams value is ok');
is(l.searchParams.get('a'), 'test3', 'l.searchParams value is ok');
isnot(ll.searchParams, l.searchParams, '2 different objects.');
info('changing iframe.src...');
iframe.addEventListener('load', onload4);
iframe.src = 'file_empty.html?a=test4';
}
function onload4() {
iframe.removeEventListener('load', onload4);
var ll = iframe.contentWindow.location;
is(ll.searchParams.get('a'), 'test4', 'location.searchParams value is ok');
is(l.searchParams.get('a'), 'test4', 'l.searchParams value is ok');
isnot(ll.searchParams, l.searchParams, '2 different objects.');
SimpleTest.finish();
}
iframe.addEventListener('load', onload0);
iframe.src = "file_empty.html?a=test0";
SimpleTest.waitForExplicitFinish();
</script>
</body>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1032511
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1032511</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1032511">Mozilla Bug 1032511</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe name="x" id="x"></iframe>
<iframe name="y" id="y"></iframe>
</div>
<pre id="test">
</pre>
<a href="http://www.example.net?a=b&c=d" id="anchor">foobar</a>
<area href="http://www.example.net?a=b&c=d" id="area">foobar</area>
<script type="application/javascript">
/** Test for Bug 1032511 **/
var a = new URLSearchParams("%e2");
ok(a, "a exists");
is(a.toString(), '=', "The value should be here.");
a = new URLSearchParams("a%e2");
// This is a known decoder bug that fails to emit a REPLACEMENT CHARACTER.
is(a.toString(), 'a=', "The value should be here.");
a = new URLSearchParams("a%e2b");
is(a.toString(), 'a%EF%BF%BDb=', "The value should be here.");
</script>
</body>
</html>

View File

@ -13,6 +13,16 @@
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
#if MOZ_IS_GCC && MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
/* use designated array initializers if supported */
#define CONVERT(in_, out_) \
[in_] = out_
#else
/* otherwise init array element by position */
#define CONVERT(in_, out_) \
out_
#endif
BEGIN_BLUETOOTH_NAMESPACE
template<class T>
@ -27,17 +37,17 @@ static nsresult
Convert(bt_status_t aIn, BluetoothStatus& aOut)
{
static const BluetoothStatus sStatus[] = {
[BT_STATUS_SUCCESS] = STATUS_SUCCESS,
[BT_STATUS_FAIL] = STATUS_FAIL,
[BT_STATUS_NOT_READY] = STATUS_NOT_READY,
[BT_STATUS_NOMEM] = STATUS_NOMEM,
[BT_STATUS_BUSY] = STATUS_BUSY,
[BT_STATUS_DONE] = STATUS_DONE,
[BT_STATUS_UNSUPPORTED] = STATUS_UNSUPPORTED,
[BT_STATUS_PARM_INVALID] = STATUS_PARM_INVALID,
[BT_STATUS_UNHANDLED] = STATUS_UNHANDLED,
[BT_STATUS_AUTH_FAILURE] = STATUS_AUTH_FAILURE,
[BT_STATUS_RMT_DEV_DOWN] = STATUS_RMT_DEV_DOWN
CONVERT(BT_STATUS_SUCCESS, STATUS_SUCCESS),
CONVERT(BT_STATUS_FAIL, STATUS_FAIL),
CONVERT(BT_STATUS_NOT_READY, STATUS_NOT_READY),
CONVERT(BT_STATUS_NOMEM, STATUS_NOMEM),
CONVERT(BT_STATUS_BUSY, STATUS_BUSY),
CONVERT(BT_STATUS_DONE, STATUS_DONE),
CONVERT(BT_STATUS_UNSUPPORTED, STATUS_UNSUPPORTED),
CONVERT(BT_STATUS_PARM_INVALID, STATUS_PARM_INVALID),
CONVERT(BT_STATUS_UNHANDLED, STATUS_UNHANDLED),
CONVERT(BT_STATUS_AUTH_FAILURE, STATUS_AUTH_FAILURE),
CONVERT(BT_STATUS_RMT_DEV_DOWN, STATUS_RMT_DEV_DOWN)
};
if (aIn >= MOZ_ARRAY_LENGTH(sStatus)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -72,8 +82,8 @@ static nsresult
Convert(bool aIn, bt_scan_mode_t& aOut)
{
static const bt_scan_mode_t sScanMode[] = {
[false] = BT_SCAN_MODE_CONNECTABLE,
[true] = BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
CONVERT(false, BT_SCAN_MODE_CONNECTABLE),
CONVERT(true, BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE)
};
if (aIn >= MOZ_ARRAY_LENGTH(sScanMode)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -238,10 +248,10 @@ Convert(BluetoothSocketType aIn, btsock_type_t& aOut)
// by gcc. Start values in |BluetoothSocketType| at index
// 0 to fix this problem.
static const btsock_type_t sSocketType[] = {
[0] = static_cast<btsock_type_t>(0), // invalid, [0] required by gcc
[BluetoothSocketType::RFCOMM] = BTSOCK_RFCOMM,
[BluetoothSocketType::SCO] = BTSOCK_SCO,
[BluetoothSocketType::L2CAP] = BTSOCK_L2CAP,
CONVERT(0, static_cast<btsock_type_t>(0)), // invalid, [0] required by gcc
CONVERT(BluetoothSocketType::RFCOMM, BTSOCK_RFCOMM),
CONVERT(BluetoothSocketType::SCO, BTSOCK_SCO),
CONVERT(BluetoothSocketType::L2CAP, BTSOCK_L2CAP),
// EL2CAP is not supported by Bluedroid
};
if (aIn == BluetoothSocketType::EL2CAP ||
@ -256,8 +266,8 @@ static nsresult
Convert(BluetoothHandsfreeAtResponse aIn, bthf_at_response_t& aOut)
{
static const bthf_at_response_t sAtResponse[] = {
[HFP_AT_RESPONSE_ERROR] = BTHF_AT_RESPONSE_ERROR,
[HFP_AT_RESPONSE_OK] = BTHF_AT_RESPONSE_OK
CONVERT(HFP_AT_RESPONSE_ERROR, BTHF_AT_RESPONSE_ERROR),
CONVERT(HFP_AT_RESPONSE_OK, BTHF_AT_RESPONSE_OK)
};
if (aIn >= MOZ_ARRAY_LENGTH(sAtResponse)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -270,8 +280,9 @@ static nsresult
Convert(BluetoothHandsfreeCallAddressType aIn, bthf_call_addrtype_t& aOut)
{
static const bthf_call_addrtype_t sCallAddressType[] = {
[HFP_CALL_ADDRESS_TYPE_UNKNOWN] = BTHF_CALL_ADDRTYPE_UNKNOWN,
[HFP_CALL_ADDRESS_TYPE_INTERNATIONAL] = BTHF_CALL_ADDRTYPE_INTERNATIONAL
CONVERT(HFP_CALL_ADDRESS_TYPE_UNKNOWN, BTHF_CALL_ADDRTYPE_UNKNOWN),
CONVERT(HFP_CALL_ADDRESS_TYPE_INTERNATIONAL,
BTHF_CALL_ADDRTYPE_INTERNATIONAL)
};
if (aIn >= MOZ_ARRAY_LENGTH(sCallAddressType)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -284,8 +295,8 @@ static nsresult
Convert(BluetoothHandsfreeCallDirection aIn, bthf_call_direction_t& aOut)
{
static const bthf_call_direction_t sCallDirection[] = {
[HFP_CALL_DIRECTION_OUTGOING] = BTHF_CALL_DIRECTION_OUTGOING,
[HFP_CALL_DIRECTION_INCOMING] = BTHF_CALL_DIRECTION_INCOMING
CONVERT(HFP_CALL_DIRECTION_OUTGOING, BTHF_CALL_DIRECTION_OUTGOING),
CONVERT(HFP_CALL_DIRECTION_INCOMING, BTHF_CALL_DIRECTION_INCOMING)
};
if (aIn >= MOZ_ARRAY_LENGTH(sCallDirection)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -298,9 +309,9 @@ static nsresult
Convert(BluetoothHandsfreeCallMode aIn, bthf_call_mode_t& aOut)
{
static const bthf_call_mode_t sCallMode[] = {
[HFP_CALL_MODE_VOICE] = BTHF_CALL_TYPE_VOICE,
[HFP_CALL_MODE_DATA] = BTHF_CALL_TYPE_DATA,
[HFP_CALL_MODE_FAX] = BTHF_CALL_TYPE_FAX
CONVERT(HFP_CALL_MODE_VOICE, BTHF_CALL_TYPE_VOICE),
CONVERT(HFP_CALL_MODE_DATA, BTHF_CALL_TYPE_DATA),
CONVERT(HFP_CALL_MODE_FAX, BTHF_CALL_TYPE_FAX)
};
if (aIn >= MOZ_ARRAY_LENGTH(sCallMode)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -313,8 +324,8 @@ static nsresult
Convert(BluetoothHandsfreeCallMptyType aIn, bthf_call_mpty_type_t& aOut)
{
static const bthf_call_mpty_type_t sCallMptyType[] = {
[HFP_CALL_MPTY_TYPE_SINGLE] = BTHF_CALL_MPTY_TYPE_SINGLE,
[HFP_CALL_MPTY_TYPE_MULTI] = BTHF_CALL_MPTY_TYPE_MULTI
CONVERT(HFP_CALL_MPTY_TYPE_SINGLE, BTHF_CALL_MPTY_TYPE_SINGLE),
CONVERT(HFP_CALL_MPTY_TYPE_MULTI, BTHF_CALL_MPTY_TYPE_MULTI)
};
if (aIn >= MOZ_ARRAY_LENGTH(sCallMptyType)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -327,13 +338,13 @@ static nsresult
Convert(BluetoothHandsfreeCallState aIn, bthf_call_state_t& aOut)
{
static const bthf_call_state_t sCallState[] = {
[HFP_CALL_STATE_ACTIVE] = BTHF_CALL_STATE_ACTIVE,
[HFP_CALL_STATE_HELD] = BTHF_CALL_STATE_HELD,
[HFP_CALL_STATE_DIALING] = BTHF_CALL_STATE_DIALING,
[HFP_CALL_STATE_ALERTING] = BTHF_CALL_STATE_ALERTING,
[HFP_CALL_STATE_INCOMING] = BTHF_CALL_STATE_INCOMING,
[HFP_CALL_STATE_WAITING] = BTHF_CALL_STATE_WAITING,
[HFP_CALL_STATE_IDLE] = BTHF_CALL_STATE_IDLE
CONVERT(HFP_CALL_STATE_ACTIVE, BTHF_CALL_STATE_ACTIVE),
CONVERT(HFP_CALL_STATE_HELD, BTHF_CALL_STATE_HELD),
CONVERT(HFP_CALL_STATE_DIALING, BTHF_CALL_STATE_DIALING),
CONVERT(HFP_CALL_STATE_ALERTING, BTHF_CALL_STATE_ALERTING),
CONVERT(HFP_CALL_STATE_INCOMING, BTHF_CALL_STATE_INCOMING),
CONVERT(HFP_CALL_STATE_WAITING, BTHF_CALL_STATE_WAITING),
CONVERT(HFP_CALL_STATE_IDLE, BTHF_CALL_STATE_IDLE)
};
if (aIn >= MOZ_ARRAY_LENGTH(sCallState)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -346,8 +357,8 @@ static nsresult
Convert(BluetoothHandsfreeNetworkState aIn, bthf_network_state_t& aOut)
{
static const bthf_network_state_t sNetworkState[] = {
[HFP_NETWORK_STATE_NOT_AVAILABLE] = BTHF_NETWORK_STATE_NOT_AVAILABLE,
[HFP_NETWORK_STATE_AVAILABLE] = BTHF_NETWORK_STATE_AVAILABLE
CONVERT(HFP_NETWORK_STATE_NOT_AVAILABLE, BTHF_NETWORK_STATE_NOT_AVAILABLE),
CONVERT(HFP_NETWORK_STATE_AVAILABLE, BTHF_NETWORK_STATE_AVAILABLE)
};
if (aIn >= MOZ_ARRAY_LENGTH(sNetworkState)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -360,8 +371,8 @@ static nsresult
Convert(BluetoothHandsfreeServiceType aIn, bthf_service_type_t& aOut)
{
static const bthf_service_type_t sServiceType[] = {
[HFP_SERVICE_TYPE_HOME] = BTHF_SERVICE_TYPE_HOME,
[HFP_SERVICE_TYPE_ROAMING] = BTHF_SERVICE_TYPE_ROAMING
CONVERT(HFP_SERVICE_TYPE_HOME, BTHF_SERVICE_TYPE_HOME),
CONVERT(HFP_SERVICE_TYPE_ROAMING, BTHF_SERVICE_TYPE_ROAMING)
};
if (aIn >= MOZ_ARRAY_LENGTH(sServiceType)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -374,8 +385,8 @@ static nsresult
Convert(BluetoothHandsfreeVolumeType aIn, bthf_volume_type_t& aOut)
{
static const bthf_volume_type_t sVolumeType[] = {
[HFP_VOLUME_TYPE_SPEAKER] = BTHF_VOLUME_TYPE_SPK,
[HFP_VOLUME_TYPE_MICROPHONE] = BTHF_VOLUME_TYPE_MIC
CONVERT(HFP_VOLUME_TYPE_SPEAKER, BTHF_VOLUME_TYPE_SPK),
CONVERT(HFP_VOLUME_TYPE_MICROPHONE, BTHF_VOLUME_TYPE_MIC)
};
if (aIn >= MOZ_ARRAY_LENGTH(sVolumeType)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -389,11 +400,11 @@ static nsresult
Convert(ControlPlayStatus aIn, btrc_play_status_t& aOut)
{
static const btrc_play_status_t sPlayStatus[] = {
[PLAYSTATUS_STOPPED] = BTRC_PLAYSTATE_STOPPED,
[PLAYSTATUS_PLAYING] = BTRC_PLAYSTATE_PLAYING,
[PLAYSTATUS_PAUSED] = BTRC_PLAYSTATE_PAUSED,
[PLAYSTATUS_FWD_SEEK] = BTRC_PLAYSTATE_FWD_SEEK,
[PLAYSTATUS_REV_SEEK] = BTRC_PLAYSTATE_REV_SEEK
CONVERT(PLAYSTATUS_STOPPED, BTRC_PLAYSTATE_STOPPED),
CONVERT(PLAYSTATUS_PLAYING, BTRC_PLAYSTATE_PLAYING),
CONVERT(PLAYSTATUS_PAUSED, BTRC_PLAYSTATE_PAUSED),
CONVERT(PLAYSTATUS_FWD_SEEK, BTRC_PLAYSTATE_FWD_SEEK),
CONVERT(PLAYSTATUS_REV_SEEK, BTRC_PLAYSTATE_REV_SEEK)
};
if (aIn >= MOZ_ARRAY_LENGTH(sPlayStatus)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -406,10 +417,10 @@ static nsresult
Convert(enum BluetoothAvrcpPlayerAttribute aIn, btrc_player_attr_t& aOut)
{
static const btrc_player_attr_t sPlayerAttr[] = {
[AVRCP_PLAYER_ATTRIBUTE_EQUALIZER] = BTRC_PLAYER_ATTR_EQUALIZER,
[AVRCP_PLAYER_ATTRIBUTE_REPEAT] = BTRC_PLAYER_ATTR_REPEAT,
[AVRCP_PLAYER_ATTRIBUTE_SHUFFLE] = BTRC_PLAYER_ATTR_SHUFFLE,
[AVRCP_PLAYER_ATTRIBUTE_SCAN] = BTRC_PLAYER_ATTR_SCAN
CONVERT(AVRCP_PLAYER_ATTRIBUTE_EQUALIZER, BTRC_PLAYER_ATTR_EQUALIZER),
CONVERT(AVRCP_PLAYER_ATTRIBUTE_REPEAT, BTRC_PLAYER_ATTR_REPEAT),
CONVERT(AVRCP_PLAYER_ATTRIBUTE_SHUFFLE, BTRC_PLAYER_ATTR_SHUFFLE),
CONVERT(AVRCP_PLAYER_ATTRIBUTE_SCAN, BTRC_PLAYER_ATTR_SCAN)
};
if (aIn >= MOZ_ARRAY_LENGTH(sPlayerAttr)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -422,11 +433,11 @@ static nsresult
Convert(enum BluetoothAvrcpStatus aIn, btrc_status_t& aOut)
{
static const btrc_status_t sStatus[] = {
[AVRCP_STATUS_BAD_COMMAND] = BTRC_STS_BAD_CMD,
[AVRCP_STATUS_BAD_PARAMETER] = BTRC_STS_BAD_PARAM,
[AVRCP_STATUS_NOT_FOUND] = BTRC_STS_NOT_FOUND,
[AVRCP_STATUS_INTERNAL_ERROR] = BTRC_STS_INTERNAL_ERR,
[AVRCP_STATUS_SUCCESS] = BTRC_STS_NO_ERROR
CONVERT(AVRCP_STATUS_BAD_COMMAND, BTRC_STS_BAD_CMD),
CONVERT(AVRCP_STATUS_BAD_PARAMETER, BTRC_STS_BAD_PARAM),
CONVERT(AVRCP_STATUS_NOT_FOUND, BTRC_STS_NOT_FOUND),
CONVERT(AVRCP_STATUS_INTERNAL_ERROR, BTRC_STS_INTERNAL_ERR),
CONVERT(AVRCP_STATUS_SUCCESS, BTRC_STS_NO_ERROR)
};
if (aIn >= MOZ_ARRAY_LENGTH(sStatus)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -439,12 +450,12 @@ static nsresult
Convert(enum BluetoothAvrcpEvent aIn, btrc_event_id_t& aOut)
{
static const btrc_event_id_t sEventId[] = {
[AVRCP_EVENT_PLAY_STATUS_CHANGED] = BTRC_EVT_PLAY_STATUS_CHANGED,
[AVRCP_EVENT_TRACK_CHANGE] = BTRC_EVT_TRACK_CHANGE,
[AVRCP_EVENT_TRACK_REACHED_END] = BTRC_EVT_TRACK_REACHED_END,
[AVRCP_EVENT_TRACK_REACHED_START] = BTRC_EVT_TRACK_REACHED_START,
[AVRCP_EVENT_PLAY_POS_CHANGED] = BTRC_EVT_PLAY_POS_CHANGED,
[AVRCP_EVENT_APP_SETTINGS_CHANGED] = BTRC_EVT_APP_SETTINGS_CHANGED
CONVERT(AVRCP_EVENT_PLAY_STATUS_CHANGED, BTRC_EVT_PLAY_STATUS_CHANGED),
CONVERT(AVRCP_EVENT_TRACK_CHANGE, BTRC_EVT_TRACK_CHANGE),
CONVERT(AVRCP_EVENT_TRACK_REACHED_END, BTRC_EVT_TRACK_REACHED_END),
CONVERT(AVRCP_EVENT_TRACK_REACHED_START, BTRC_EVT_TRACK_REACHED_START),
CONVERT(AVRCP_EVENT_PLAY_POS_CHANGED, BTRC_EVT_PLAY_POS_CHANGED),
CONVERT(AVRCP_EVENT_APP_SETTINGS_CHANGED, BTRC_EVT_APP_SETTINGS_CHANGED)
};
if (aIn >= MOZ_ARRAY_LENGTH(sEventId)) {
return NS_ERROR_ILLEGAL_VALUE;
@ -457,8 +468,8 @@ static nsresult
Convert(enum BluetoothAvrcpNotification aIn, btrc_notification_type_t& aOut)
{
static const btrc_notification_type_t sNotificationType[] = {
[AVRCP_NTF_INTERIM] = BTRC_NOTIFICATION_TYPE_INTERIM,
[AVRCP_NTF_CHANGED] = BTRC_NOTIFICATION_TYPE_CHANGED
CONVERT(AVRCP_NTF_INTERIM, BTRC_NOTIFICATION_TYPE_INTERIM),
CONVERT(AVRCP_NTF_CHANGED, BTRC_NOTIFICATION_TYPE_CHANGED)
};
if (aIn >= MOZ_ARRAY_LENGTH(sNotificationType)) {
return NS_ERROR_ILLEGAL_VALUE;

View File

@ -37,6 +37,7 @@
#include "nsDataHashtable.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Atomics.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/Hal.h"
#include "mozilla/ipc/UnixSocket.h"
@ -373,6 +374,7 @@ DispatchToBtThread(nsIRunnable* aRunnable)
sBluetoothThread = new LazyIdleThread(BT_LAZY_THREAD_TIMEOUT_MS,
NS_LITERAL_CSTRING("BluetoothDBusService"),
LazyIdleThread::ManualShutdown);
ClearOnShutdown(&sBluetoothThread);
}
return sBluetoothThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
}

View File

@ -705,17 +705,13 @@ function getDefaultAdapter() {
}
/**
* Flush permission settings and call |finish()|.
* Wait for pending emulator transactions and call |finish()|.
*/
function cleanUp() {
waitFor(function() {
SpecialPowers.flushPermissions(function() {
// Use ok here so that we have at least one test run.
ok(true, "permissions flushed");
// Use ok here so that we have at least one test run.
ok(true, ":: CLEANING UP ::");
finish();
});
}, function() {
waitFor(finish, function() {
return pendingEmulatorCmdCount === 0;
});
}

View File

@ -47,7 +47,7 @@ private:
void (Obj::*mMethod)();
};
template <typename Obj, typename Res, typename Arg1>
template <typename Obj, typename Res, typename Tin1, typename Arg1>
class BluetoothInterfaceRunnable1 : public nsRunnable
{
public:
@ -70,11 +70,12 @@ public:
private:
nsRefPtr<Obj> mObj;
void (Obj::*mMethod)(Arg1);
Arg1 mArg1;
Res (Obj::*mMethod)(Arg1);
Tin1 mArg1;
};
template <typename Obj, typename Res,
typename Tin1, typename Tin2, typename Tin3,
typename Arg1, typename Arg2, typename Arg3>
class BluetoothInterfaceRunnable3 : public nsRunnable
{
@ -102,10 +103,10 @@ public:
private:
nsRefPtr<Obj> mObj;
void (Obj::*mMethod)(Arg1, Arg2, Arg3);
Arg1 mArg1;
Arg2 mArg2;
Arg3 mArg3;
Res (Obj::*mMethod)(Arg1, Arg2, Arg3);
Tin1 mArg1;
Tin2 mArg2;
Tin3 mArg3;
};
//
@ -124,16 +125,18 @@ struct interface_traits<BluetoothSocketInterface>
};
typedef
BluetoothInterfaceRunnable1<BluetoothSocketResultHandler, void, int>
BluetoothInterfaceRunnable1<BluetoothSocketResultHandler, void, int, int>
BluetoothSocketIntResultRunnable;
typedef
BluetoothInterfaceRunnable3<BluetoothSocketResultHandler,
void, int, const nsAString_internal&, int>
BluetoothInterfaceRunnable3<BluetoothSocketResultHandler, void,
int, const nsString, int,
int, const nsAString_internal&, int>
BluetoothSocketIntStringIntResultRunnable;
typedef
BluetoothInterfaceRunnable1<BluetoothSocketResultHandler, void, bt_status_t>
BluetoothInterfaceRunnable1<BluetoothSocketResultHandler, void,
bt_status_t, bt_status_t>
BluetoothSocketErrorRunnable;
static nsresult
@ -581,7 +584,8 @@ typedef
BluetoothHandsfreeResultRunnable;
typedef
BluetoothInterfaceRunnable1<BluetoothHandsfreeResultHandler, void, bt_status_t>
BluetoothInterfaceRunnable1<BluetoothHandsfreeResultHandler, void,
bt_status_t, bt_status_t>
BluetoothHandsfreeErrorRunnable;
static nsresult
@ -852,7 +856,8 @@ typedef
BluetoothA2dpResultRunnable;
typedef
BluetoothInterfaceRunnable1<BluetoothA2dpResultHandler, void, bt_status_t>
BluetoothInterfaceRunnable1<BluetoothA2dpResultHandler, void,
bt_status_t, bt_status_t>
BluetoothA2dpErrorRunnable;
static nsresult
@ -956,7 +961,8 @@ typedef
BluetoothAvrcpResultRunnable;
typedef
BluetoothInterfaceRunnable1<BluetoothAvrcpResultHandler, void, bt_status_t>
BluetoothInterfaceRunnable1<BluetoothAvrcpResultHandler, void,
bt_status_t, bt_status_t>
BluetoothAvrcpErrorRunnable;
static nsresult
@ -1155,7 +1161,7 @@ typedef
BluetoothResultRunnable;
typedef
BluetoothInterfaceRunnable1<BluetoothResultHandler, void, int>
BluetoothInterfaceRunnable1<BluetoothResultHandler, void, int, int>
BluetoothErrorRunnable;
static nsresult

View File

@ -811,10 +811,10 @@ BluetoothSocket::CloseDroidSocket()
NotifyDisconnect();
}
class ConnectResultHandler MOZ_FINAL : public BluetoothSocketResultHandler
class ConnectSocketResultHandler MOZ_FINAL : public BluetoothSocketResultHandler
{
public:
ConnectResultHandler(DroidSocketImpl* aImpl)
ConnectSocketResultHandler(DroidSocketImpl* aImpl)
: mImpl(aImpl)
{
MOZ_ASSERT(mImpl);
@ -861,7 +861,7 @@ BluetoothSocket::Connect(const nsAString& aDeviceAddress, int aChannel)
aChannel,
(BTSOCK_FLAG_ENCRYPT * mEncrypt) |
(BTSOCK_FLAG_AUTH * mAuth),
new ConnectResultHandler(mImpl));
new ConnectSocketResultHandler(mImpl));
return true;
}

View File

@ -37,6 +37,7 @@
#include "nsDataHashtable.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Atomics.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/Hal.h"
#include "mozilla/ipc/UnixSocket.h"
@ -370,6 +371,7 @@ DispatchToBtThread(nsIRunnable* aRunnable)
sBluetoothThread = new LazyIdleThread(BT_LAZY_THREAD_TIMEOUT_MS,
NS_LITERAL_CSTRING("BluetoothDBusService"),
LazyIdleThread::ManualShutdown);
ClearOnShutdown(&sBluetoothThread);
}
return sBluetoothThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
}

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