This commit is contained in:
Wes Kocher 2015-08-20 12:53:30 -07:00
Родитель d1efa92c20 d8fffe1765
Коммит 47d9d26a9a
263 изменённых файлов: 5891 добавлений и 4310 удалений

Просмотреть файл

@ -927,8 +927,6 @@ pref("general.useragent.updates.retry", 86400); // 1 day
// Device ID can be composed of letter, numbers, hyphen ("-") and dot (".")
pref("general.useragent.device_id", "");
// Make <audio> and <video> talk to the AudioChannelService.
pref("media.useAudioChannelService", true);
// Add Mozilla AudioChannel APIs.
pref("media.useAudioChannelAPI", true);

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="aacd9b12da7fc3c8f4deaaa8eedfbb158f4fefe7">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="aacd9b12da7fc3c8f4deaaa8eedfbb158f4fefe7">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -19,7 +19,7 @@
<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="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="bfdb6348725a33bdcdc4e17999cb500be6beedb5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a6f9a1245d98c51172c15afecb9ade1a6ca511e2"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="aacd9b12da7fc3c8f4deaaa8eedfbb158f4fefe7">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -19,7 +19,7 @@
<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="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="aacd9b12da7fc3c8f4deaaa8eedfbb158f4fefe7">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb",
"git_revision": "c6705f739fb605031eb2a0b943ba55c64bee5a03",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "68da3c242dcd332c0aa579fbdc9da20d9db60022",
"revision": "69fd2d2a3adce973a5e86ea2f96d1e311e11239d",
"repo_path": "integration/gaia-central"
}

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="bfdb6348725a33bdcdc4e17999cb500be6beedb5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a6f9a1245d98c51172c15afecb9ade1a6ca511e2"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="89e0096a3de0378e3eda77e6a2a0bb5ca03eb8bb"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6705f739fb605031eb2a0b943ba55c64bee5a03"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -447,7 +447,7 @@ let gFxAccounts = {
this.openPreferences();
break;
default:
this.openAccountsPage(null, { entryPoint: "menupanel" });
this.openAccountsPage(null, { entrypoint: "menupanel" });
break;
}
@ -459,12 +459,12 @@ let gFxAccounts = {
},
openAccountsPage: function (action, urlParams={}) {
// An entryPoint param is used for server-side metrics. If the current tab
// An entrypoint param is used for server-side metrics. If the current tab
// is UITour, assume that it initiated the call to this method and override
// the entryPoint accordingly.
// the entrypoint accordingly.
if (UITour.tourBrowsersByWindow.get(window) &&
UITour.tourBrowsersByWindow.get(window).has(gBrowser.selectedBrowser)) {
urlParams.entryPoint = "uitour";
urlParams.entrypoint = "uitour";
}
let params = new URLSearchParams();
if (action) {
@ -482,7 +482,7 @@ let gFxAccounts = {
},
openSignInAgainPage: function (entryPoint) {
this.openAccountsPage("reauth", { entryPoint: entryPoint });
this.openAccountsPage("reauth", { entrypoint: entryPoint });
},
};

Просмотреть файл

@ -363,7 +363,6 @@ function* test_on_browser(browser) {
add_task(function*() {
yield new Promise((resolve) => {
SpecialPowers.pushPrefEnv({"set": [
["media.useAudioChannelService", true],
["browser.tabs.showAudioPlayingIcon", true],
]}, resolve);
});

Просмотреть файл

@ -84,7 +84,7 @@ add_task(function* test_nouser() {
Assert.ok(!panelUIFooter.hasAttribute("fxastatus"), "no fxsstatus when signed out");
Assert.ok(!panelUIFooter.hasAttribute("fxaprofileimage"), "no fxaprofileimage when signed out");
let promiseOpen = promiseTabOpen("about:accounts?entryPoint=menupanel");
let promiseOpen = promiseTabOpen("about:accounts?entrypoint=menupanel");
panelUIStatus.click();
yield promiseOpen;
});

Просмотреть файл

@ -211,10 +211,6 @@
- in a "receive" state. -->
<!ENTITY netmonitorUI.timings.receive "Receiving:">
<!-- LOCALIZATION NOTE (netmonitorUI.security.warning.protocol): A tooltip
- for warning icon that indicates a connection uses insecure protocol. -->
<!ENTITY netmonitorUI.security.warning.sslv3 "The protocol SSL 3.0 is deprecated and insecure.">
<!-- LOCALIZATION NOTE (netmonitorUI.security.warning.cipher): A tooltip
- for warning icon that indicates a connection uses insecure cipher suite. -->
<!ENTITY netmonitorUI.security.warning.cipher "The cipher used for encryption is deprecated and insecure.">

Просмотреть файл

@ -64,7 +64,7 @@ case "$target" in
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
for version in $android_gnu_compiler_version 4.9 4.8 4.7 4.6 4.4.3; do
for version in $android_gnu_compiler_version 4.9 4.8 4.7; do
case "$target_cpu" in
arm)
target_name=arm-linux-androideabi-$version

Просмотреть файл

@ -19,6 +19,7 @@
#include "nsServiceManagerUtils.h"
#include "mozilla/dom/CSPDictionariesBinding.h"
#include "mozilla/dom/quota/QuotaManager.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/URLSearchParams.h"
@ -34,6 +35,13 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
UniquePtr<URLParams> params(new URLParams());
nsAutoString value;
//
// Important: While serializing any string-valued attributes, perform a
// release-mode assertion to make sure that they don't contain characters that
// will break the quota manager when it uses the serialization for file
// naming (see addonId below).
//
if (mAppId != nsIScriptSecurityManager::NO_APP_ID) {
value.AppendInt(mAppId);
params->Set(NS_LITERAL_STRING("appId"), value);
@ -44,6 +52,7 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
}
if (!mAddonId.IsEmpty()) {
MOZ_RELEASE_ASSERT(mAddonId.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
params->Set(NS_LITERAL_STRING("addonId"), mAddonId);
}
@ -60,6 +69,13 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
aStr.AppendLiteral("^");
aStr.Append(NS_ConvertUTF16toUTF8(value));
}
// In debug builds, check the whole string for illegal characters too (just in case).
#ifdef DEBUG
nsAutoCString str;
str.Assign(aStr);
MOZ_ASSERT(str.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
#endif
}
namespace {

Просмотреть файл

@ -48,6 +48,7 @@
#include "prenv.h"
#include "nsIDOMWindow.h"
#include "nsIGlobalObject.h"
#include "nsIViewSourceChannel.h"
#include "nsIWebBrowserChrome.h"
#include "nsPoint.h"
#include "nsIObserverService.h"
@ -10395,20 +10396,18 @@ nsDocShell::DoURILoad(nsIURI* aURI,
}
if (!isSrcdoc) {
nsCOMPtr<nsILoadInfo> loadInfo =
new LoadInfo(requestingNode ? requestingNode->NodePrincipal() :
triggeringPrincipal.get(),
triggeringPrincipal,
requestingNode,
securityFlags,
aContentPolicyType,
aBaseURI);
rv = NS_NewChannelInternal(getter_AddRefs(channel),
aURI,
loadInfo,
nullptr, // loadGroup
static_cast<nsIInterfaceRequestor*>(this),
loadFlags);
requestingNode,
requestingNode
? requestingNode->NodePrincipal()
: triggeringPrincipal.get(),
triggeringPrincipal,
securityFlags,
aContentPolicyType,
nullptr, // loadGroup
static_cast<nsIInterfaceRequestor*>(this),
loadFlags);
if (NS_FAILED(rv)) {
if (rv == NS_ERROR_UNKNOWN_PROTOCOL) {
@ -10425,6 +10424,12 @@ nsDocShell::DoURILoad(nsIURI* aURI,
}
return rv;
}
if (aBaseURI) {
nsCOMPtr<nsIViewSourceChannel> vsc = do_QueryInterface(channel);
if (vsc) {
vsc->SetBaseURI(aBaseURI);
}
}
} else {
nsAutoCString scheme;
rv = aURI->GetScheme(scheme);
@ -10436,17 +10441,15 @@ nsDocShell::DoURILoad(nsIURI* aURI,
nsViewSourceHandler* vsh = nsViewSourceHandler::GetInstance();
NS_ENSURE_TRUE(vsh, NS_ERROR_FAILURE);
rv = vsh->NewSrcdocChannel(aURI, aSrcdoc, getter_AddRefs(channel));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo =
new LoadInfo(requestingNode ? requestingNode->NodePrincipal() :
triggeringPrincipal.get(),
triggeringPrincipal,
requestingNode,
securityFlags,
aContentPolicyType,
aBaseURI);
channel->SetLoadInfo(loadInfo);
rv = vsh->NewSrcdocChannel(aURI, aBaseURI, aSrcdoc,
requestingNode,
requestingNode
? requestingNode->NodePrincipal()
: triggeringPrincipal.get(),
triggeringPrincipal,
securityFlags,
aContentPolicyType,
getter_AddRefs(channel));
} else {
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
aURI,
@ -10459,9 +10462,11 @@ nsDocShell::DoURILoad(nsIURI* aURI,
triggeringPrincipal,
securityFlags,
aContentPolicyType,
true,
aBaseURI);
true);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIInputStreamChannel> isc = do_QueryInterface(channel);
MOZ_ASSERT(isc);
isc->SetBaseURI(aBaseURI);
}
}
@ -11735,7 +11740,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
nsCOMPtr<nsILoadInfo> loadInfo;
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
nsCOMPtr<nsIURI> baseURI;
loadInfo->GetBaseURI(getter_AddRefs(baseURI));
inStrmChan->GetBaseURI(getter_AddRefs(baseURI));
entry->SetBaseURI(baseURI);
}
}

Просмотреть файл

@ -316,7 +316,7 @@ WebappsRegistry.prototype = {
}
this.addMessageListeners(["Webapps:GetLocalizationResource:Return"]);
return this.createPromise((aResolve, aReject) => {
return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:GetLocalizationResource", {
manifestURL: manifestURL,
lang: aLanguage,
@ -325,10 +325,7 @@ WebappsRegistry.prototype = {
dataType: aType,
oid: this._id,
topId: this._topId,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
})
requestID: aResolverId
});
});
},
@ -609,7 +606,7 @@ WebappsApplication.prototype = {
connect: function(aKeyword, aRules) {
this.addMessageListeners(["Webapps:Connect:Return:OK",
"Webapps:Connect:Return:KO"]);
return this.createPromise(function (aResolve, aReject) {
return this.createPromiseWithId((aResolverId) => {
let from = this._window.location.origin + this._window.location.pathname;
cpmm.sendAsyncMessage("Webapps:Connect", {
keyword: aKeyword,
@ -618,27 +615,21 @@ WebappsApplication.prototype = {
pubPageURL: from,
outerWindowID: this._id,
topWindowID: this._topId,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
})
requestID: aResolverId
});
}.bind(this));
});
},
getConnections: function() {
this.addMessageListeners("Webapps:GetConnections:Return:OK");
return this.createPromise(function (aResolve, aReject) {
return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:GetConnections", {
manifestURL: this.manifestURL,
outerWindowID: this._id,
topWindowID: this._topId,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
})
requestID: aResolverId
});
}.bind(this));
});
},
addReceipt: function(receipt) {
@ -689,22 +680,19 @@ WebappsApplication.prototype = {
export: function() {
this.addMessageListeners(["Webapps:Export:Return"]);
return this.createPromise((aResolve, aReject) => {
return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:Export",
{ manifestURL: this.manifestURL,
oid: this._id,
topId: this._topId,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
})
requestID: aResolverId
});
});
},
getLocalizedValue: function(aProperty, aLang, aEntryPoint) {
this.addMessageListeners(["Webapps:GetLocalizedValue:Return"]);
return this.createPromise((aResolve, aReject) => {
return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:GetLocalizedValue",
{ manifestURL: this.manifestURL,
oid: this._id,
@ -712,10 +700,7 @@ WebappsApplication.prototype = {
property: aProperty,
lang: aLang,
entryPoint: aEntryPoint,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
})
requestID: aResolverId
});
});
},
@ -958,19 +943,16 @@ WebappsApplicationMgmt.prototype = {
},
getIcon: function(aApp, aIconID, aEntryPoint) {
return this.createPromise(function(aResolve, aReject) {
return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:GetIcon", {
oid: this._id,
topId: this._topId,
manifestURL: aApp.manifestURL,
iconID: aIconID,
entryPoint: aEntryPoint,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
})
requestID: aResolverId
});
}.bind(this));
});
},
getNotInstalled: function() {
@ -988,29 +970,25 @@ WebappsApplicationMgmt.prototype = {
import: function(aBlob) {
let principal = this._window.document.nodePrincipal;
return this.createPromise((aResolve, aReject) => {
return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:Import",
{ blob: aBlob,
oid: this._id,
topId: this._topId,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
})}, null, principal);
requestID: aResolverId
}, null, principal);
});
},
extractManifest: function(aBlob) {
let principal = this._window.document.nodePrincipal;
return this.createPromise((aResolve, aReject) => {
return this.createPromiseWithId((aResolverId) => {
cpmm.sendAsyncMessage("Webapps:ExtractManifest",
{ blob: aBlob,
oid: this._id,
topId: this._topId,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
})}, null, principal);
requestID: aResolverId
}, null, principal);
});
},

Просмотреть файл

@ -298,6 +298,17 @@ DOMRequestIpcHelper.prototype = {
return new this._window.Promise(aPromiseInit);
},
/**
* createPromiseWithId() creates a new Promise, accepting a callback
* which is immediately called with the generated resolverId.
*/
createPromiseWithId: function(aCallback) {
return this.createPromise(function(aResolve, aReject) {
let resolverId = this.getPromiseResolverId({ resolve: aResolve, reject: aReject });
aCallback(resolverId);
}.bind(this));
},
forEachRequest: function(aCallback) {
if (!this._requests) {
return;

Просмотреть файл

@ -85,12 +85,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsContentSink)
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParser)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCSSLoader)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mScriptLoader)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsContentSink)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParser)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCSSLoader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mScriptLoader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

Просмотреть файл

@ -30,10 +30,6 @@ var audio = new Audio();
audio.src = "audio.ogg";
var tests = [
function() {
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");

Просмотреть файл

@ -31,10 +31,6 @@ var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
var tests = [
function() {
iframe = document.querySelector("iframe");
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");
runTest();

Просмотреть файл

@ -99,7 +99,7 @@ function runTest() {
iframe.src = "data:text/html,page";
}
SpecialPowers.pushPrefEnv({ "set": [["media.useAudioChannelService", true]]}, runTest);
onload = runTest;
SimpleTest.waitForExplicitFinish();
</script>

Просмотреть файл

@ -14,30 +14,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=913761
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=913761">Mozilla Bug 913761</a>
<script type="application/javascript">
function runTest() {
var transportChannel = new MessageChannel();
transportChannel.port1.onmessage = function (event) {
ok(true, 'Port Returned.');
var portToService = event.data.port;
portToService.onmessage = function (event) {
ok(true, "message received");
SimpleTest.finish();
};
portToService.postMessage('READY?');
}
var serviceChannel = new MessageChannel();
serviceChannel.port1.onmessage = function (event) {
if (event.data == 'READY?') {
this.postMessage('READY!');
}
}
transportChannel.port2.postMessage({ port: serviceChannel.port2}, [serviceChannel.port2]);
var transportChannel = new MessageChannel();
transportChannel.port1.onmessage = function (event) {
ok(true, 'Port Returned.');
var portToService = event.data.port;
portToService.onmessage = function (event) {
ok(true, "message received");
SimpleTest.finish();
};
portToService.postMessage('READY?');
}
var serviceChannel = new MessageChannel();
serviceChannel.port1.onmessage = function (event) {
if (event.data == 'READY?') {
this.postMessage('READY!');
}
}
transportChannel.port2.postMessage({ port: serviceChannel.port2}, [serviceChannel.port2]);
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
</script>
</body>
</html>

Просмотреть файл

@ -408,6 +408,18 @@
ok(promise instanceof Promise, "Returned a Promise");
promise.then(next);
},
function() {
info("== Test createPromiseWithId()");
var _resolverId;
var promise = dummy.createPromiseWithId(function(resolverId) {
_resolverId = resolverId;
});
var resolver = dummy.getPromiseResolver(_resolverId);
ok(promise instanceof Promise, "Returned a Promise");
ok(typeof _resolverId === "string", "resolverId is a string");
ok(resolver != null, "resolverId is a valid id");
next();
},
function() {
info("== Test getResolver()");
var id;

Просмотреть файл

@ -107,7 +107,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=912456
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
runTest();
</script>
</body>

Просмотреть файл

@ -38,10 +38,6 @@ video.onplay = video.onpause = function() {
};
var tests = [
function() {
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");

Просмотреть файл

@ -34,10 +34,6 @@ var audio = new Audio();
audio.loop = true;
var tests = [
function() {
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");

Просмотреть файл

@ -34,10 +34,6 @@ var audio = new Audio();
audio.loop = true;
var tests = [
function() {
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");

Просмотреть файл

@ -34,10 +34,6 @@ var audio = new Audio();
audio.loop = true;
var tests = [
function() {
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");

Просмотреть файл

@ -26,10 +26,6 @@ var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
var ac;
var tests = [
function() {
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");

Просмотреть файл

@ -64,10 +64,6 @@ var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
var tests = [
function() {
iframe = document.querySelector("iframe");
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");
runTest();

Просмотреть файл

@ -385,7 +385,7 @@ function next() {
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, next);
next();
</script>
</body>
</html>

Просмотреть файл

@ -31,10 +31,6 @@ var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
var tests = [
function() {
iframe = document.querySelector("iframe");
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");
runTest();

Просмотреть файл

@ -31,10 +31,6 @@ var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
var tests = [
function() {
iframe = document.querySelector("iframe");
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
},
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");
runTest();

Просмотреть файл

@ -86,30 +86,12 @@ BluetoothAvrcpInterface::~BluetoothAvrcpInterface()
// Notification handling
//
BluetoothGattClientNotificationHandler::~BluetoothGattClientNotificationHandler()
{ }
BluetoothGattServerNotificationHandler::~BluetoothGattServerNotificationHandler()
{ }
BluetoothGattNotificationHandler::~BluetoothGattNotificationHandler()
{ }
// Interface
//
BluetoothGattClientInterface::BluetoothGattClientInterface()
{ }
BluetoothGattClientInterface::~BluetoothGattClientInterface()
{ }
BluetoothGattServerInterface::BluetoothGattServerInterface()
{ }
BluetoothGattServerInterface::~BluetoothGattServerInterface()
{ }
BluetoothGattInterface::BluetoothGattInterface()
{ }

Просмотреть файл

@ -493,7 +493,7 @@ protected:
// GATT Interface
//
class BluetoothGattClientNotificationHandler
class BluetoothGattNotificationHandler
{
public:
virtual void
@ -602,16 +602,6 @@ public:
virtual void
ListenNotification(BluetoothGattStatus aStatus, int aServerIf) { }
protected:
BluetoothGattClientNotificationHandler()
{ }
virtual ~BluetoothGattClientNotificationHandler();
};
class BluetoothGattServerNotificationHandler
{
public:
virtual void
RegisterServerNotification(BluetoothGattStatus aStatus,
int aServerIf,
@ -722,23 +712,11 @@ public:
int aMtu)
{ }
protected:
BluetoothGattServerNotificationHandler()
{ }
virtual ~BluetoothGattServerNotificationHandler();
};
class BluetoothGattNotificationHandler
: public BluetoothGattClientNotificationHandler
, public BluetoothGattServerNotificationHandler
{
public:
virtual ~BluetoothGattNotificationHandler();
protected:
BluetoothGattNotificationHandler()
{ }
virtual ~BluetoothGattNotificationHandler();
};
class BluetoothGattResultHandler
@ -754,15 +732,6 @@ public:
virtual void Init() { }
virtual void Cleanup() { }
protected:
virtual ~BluetoothGattResultHandler() { }
};
class BluetoothGattClientResultHandler : public BluetoothGattResultHandler
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothGattClientResultHandler)
virtual void RegisterClient() { }
virtual void UnregisterClient() { }
@ -794,15 +763,6 @@ public:
virtual void SetAdvData() { }
virtual void TestCommand() { }
protected:
virtual ~BluetoothGattClientResultHandler() { }
};
class BluetoothGattServerResultHandler : public BluetoothGattResultHandler
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothGattServerResultHandler)
virtual void RegisterServer() { }
virtual void UnregisterServer() { }
@ -823,85 +783,89 @@ public:
virtual void SendResponse() { }
protected:
virtual ~BluetoothGattServerResultHandler() { }
virtual ~BluetoothGattResultHandler() { }
};
class BluetoothGattClientInterface
class BluetoothGattInterface
{
public:
virtual void Init(BluetoothGattNotificationHandler* aNotificationHandler,
BluetoothGattResultHandler* aRes) = 0;
virtual void Cleanup(BluetoothGattResultHandler* aRes) = 0;
/* Register / Unregister */
virtual void RegisterClient(const BluetoothUuid& aUuid,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void UnregisterClient(int aClientIf,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Start / Stop LE Scan */
virtual void Scan(int aClientIf, bool aStart,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Connect / Disconnect */
virtual void Connect(int aClientIf,
const nsAString& aBdAddr,
bool aIsDirect, /* auto connect */
BluetoothTransport aTransport,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void Disconnect(int aClientIf,
const nsAString& aBdAddr,
int aConnId,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Start / Stop advertisements to listen for incoming connections */
virtual void Listen(int aClientIf,
bool aIsStart,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Clear the attribute cache for a given device*/
virtual void Refresh(int aClientIf,
const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Enumerate Attributes */
virtual void SearchService(int aConnId,
bool aSearchAll,
const BluetoothUuid& aUuid,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void GetIncludedService(
int aConnId,
const BluetoothGattServiceId& aServiceId,
bool aFirst,
const BluetoothGattServiceId& aStartServiceId,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void GetCharacteristic(int aConnId,
const BluetoothGattServiceId& aServiceId,
bool aFirst,
const BluetoothGattId& aStartCharId,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void GetDescriptor(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
bool aFirst,
const BluetoothGattId& aDescriptorId,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Read / Write An Attribute */
virtual void ReadCharacteristic(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattAuthReq aAuthReq,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void WriteCharacteristic(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattWriteType aWriteType,
BluetoothGattAuthReq aAuthReq,
const nsTArray<uint8_t>& aValue,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void ReadDescriptor(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
const BluetoothGattId& aDescriptorId,
BluetoothGattAuthReq aAuthReq,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void WriteDescriptor(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
@ -909,13 +873,12 @@ public:
BluetoothGattWriteType aWriteType,
BluetoothGattAuthReq aAuthReq,
const nsTArray<uint8_t>& aValue,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Execute / Abort Prepared Write*/
virtual void ExecuteWrite(int aConnId,
int aIsExecute,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Register / Deregister Characteristic Notifications or Indications */
virtual void RegisterNotification(
@ -923,20 +886,20 @@ public:
const nsAString& aBdAddr,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void DeregisterNotification(
int aClientIf,
const nsAString& aBdAddr,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void ReadRemoteRssi(int aClientIf,
const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void GetDeviceType(const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Set advertising data or scan response data */
virtual void SetAdvData(int aServerIf,
@ -952,69 +915,61 @@ public:
char* aServiceData,
uint16_t aServiceUUIDLen,
char* aServiceUUID,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void TestCommand(int aCommand,
const BluetoothGattTestParam& aTestParam,
BluetoothGattClientResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
protected:
BluetoothGattClientInterface();
virtual ~BluetoothGattClientInterface();
};
class BluetoothGattServerInterface
{
public:
/* Register / Unregister */
virtual void RegisterServer(const BluetoothUuid& aUuid,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void UnregisterServer(int aServerIf,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Connect / Disconnect */
virtual void ConnectPeripheral(int aServerIf,
const nsAString& aBdAddr,
bool aIsDirect, /* auto connect */
BluetoothTransport aTransport,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void DisconnectPeripheral(int aServerIf,
const nsAString& aBdAddr,
int aConnId,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Add a services / a characteristic / a descriptor */
virtual void AddService(int aServerIf,
const BluetoothGattServiceId& aServiceId,
int aNumHandles,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void AddIncludedService(int aServerIf,
int aServiceHandle,
int aIncludedServiceHandle,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void AddCharacteristic(int aServerIf,
int aServiceHandle,
const BluetoothUuid& aUuid,
BluetoothGattCharProp aProperties,
BluetoothGattAttrPerm aPermissions,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void AddDescriptor(int aServerIf,
int aServiceHandle,
const BluetoothUuid& aUuid,
BluetoothGattAttrPerm aPermissions,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Start / Stop / Delete a service */
virtual void StartService(int aServerIf,
int aServiceHandle,
BluetoothTransport aTransport,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void StopService(int aServerIf,
int aServiceHandle,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
virtual void DeleteService(int aServerIf,
int aServiceHandle,
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Send an indication or a notification */
virtual void SendIndication(int aServerIf,
@ -1023,29 +978,14 @@ public:
const nsTArray<uint8_t>& aValue,
bool aConfirm, /* true: indication */
/* false: notification */
BluetoothGattServerResultHandler* aRes) = 0;
BluetoothGattResultHandler* aRes) = 0;
/* Send a response for an incoming indication */
virtual void SendResponse(int aConnId,
int aTransId,
BluetoothGattStatus aStatus,
const BluetoothGattResponse& aResponse,
BluetoothGattServerResultHandler* aRes) = 0;
protected:
BluetoothGattServerInterface();
virtual ~BluetoothGattServerInterface();
};
class BluetoothGattInterface
{
public:
virtual void Init(BluetoothGattNotificationHandler* aNotificationHandler,
BluetoothGattResultHandler* aRes) = 0;
virtual void Cleanup(BluetoothGattResultHandler* aRes) = 0;
virtual BluetoothGattClientInterface* GetBluetoothGattClientInterface() = 0;
virtual BluetoothGattServerInterface* GetBluetoothGattServerInterface() = 0;
BluetoothGattResultHandler* aRes) = 0;
protected:
BluetoothGattInterface();

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -85,62 +85,62 @@ public:
/* Register / Unregister */
nsresult ClientRegisterCmd(const BluetoothUuid& aUuid,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientUnregisterCmd(int aClientIf,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Start / Stop LE Scan */
nsresult ClientScanCmd(int aClientIf, bool aStart,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Connect / Disconnect */
nsresult ClientConnectCmd(int aClientIf,
const nsAString& aBdAddr,
bool aIsDirect, /* auto connect */
BluetoothTransport aTransport,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientDisconnectCmd(int aClientIf,
const nsAString& aBdAddr,
int aConnId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Start / Stop advertisements to listen for incoming connections */
nsresult ClientListenCmd(int aClientIf,
bool aIsStart,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Clear the attribute cache for a given device*/
nsresult ClientRefreshCmd(int aClientIf,
const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Enumerate Attributes */
nsresult ClientSearchServiceCmd(int aConnId,
bool aFiltered,
const BluetoothUuid& aUuid,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientGetIncludedServiceCmd(
int aConnId,
const BluetoothGattServiceId& aServiceId,
bool aContinuation,
const BluetoothGattServiceId& aStartServiceId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientGetCharacteristicCmd(int aConnId,
const BluetoothGattServiceId& aServiceId,
bool aContinuation,
const BluetoothGattId& aStartCharId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientGetDescriptorCmd(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
bool aContinuation,
const BluetoothGattId& aDescriptorId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Read / Write An Attribute */
nsresult ClientReadCharacteristicCmd(
@ -148,7 +148,7 @@ public:
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattAuthReq aAuthReq,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientWriteCharacteristicCmd(
int aConnId,
@ -158,14 +158,14 @@ public:
int aLength,
BluetoothGattAuthReq aAuthReq,
char* aValue,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientReadDescriptorCmd(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
const BluetoothGattId& aDescriptorId,
BluetoothGattAuthReq aAuthReq,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientWriteDescriptorCmd(int aConnId,
const BluetoothGattServiceId& aServiceId,
@ -175,12 +175,12 @@ public:
int aLength,
BluetoothGattAuthReq aAuthReq,
char* aValue,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Execute / Abort Prepared Write*/
nsresult ClientExecuteWriteCmd(int aConnId,
int aIsExecute,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Register / Deregister Characteristic Notifications or Indications */
nsresult ClientRegisterNotificationCmd(
@ -188,21 +188,21 @@ public:
const nsAString& aBdAddr,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientDeregisterNotificationCmd(
int aClientIf,
const nsAString& aBdAddr,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientReadRemoteRssiCmd(int aClientIf,
const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientGetDeviceTypeCmd(const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Set advertising data or scan response data */
nsresult ClientSetAdvDataCmd(int aServerIf,
@ -218,69 +218,69 @@ public:
char* aServiceData,
uint16_t aServiceUUIDLen,
char* aServiceUUID,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ClientTestCommandCmd(int aCommand,
const BluetoothGattTestParam& aTestParam,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Register / Unregister */
nsresult ServerRegisterCmd(const BluetoothUuid& aUuid,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ServerUnregisterCmd(int aServerIf,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Connect / Disconnect */
nsresult ServerConnectPeripheralCmd(int aServerIf,
const nsAString& aBdAddr,
bool aIsDirect,
BluetoothTransport aTransport,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ServerDisconnectPeripheralCmd(
int aServerIf,
const nsAString& aBdAddr,
int aConnId,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Add a services / a characteristic / a descriptor */
nsresult ServerAddServiceCmd(int aServerIf,
const BluetoothGattServiceId& aServiceId,
int aNumHandles,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ServerAddIncludedServiceCmd(int aServerIf,
int aServiceHandle,
int aIncludedServiceHandle,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ServerAddCharacteristicCmd(int aServerIf,
int aServiceHandle,
const BluetoothUuid& aUuid,
BluetoothGattCharProp aProperties,
BluetoothGattAttrPerm aPermissions,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ServerAddDescriptorCmd(int aServerIf,
int aServiceHandle,
const BluetoothUuid& aUuid,
BluetoothGattAttrPerm aPermissions,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Start / Stop / Delete a service */
nsresult ServerStartServiceCmd(int aServerIf,
int aServiceHandle,
BluetoothTransport aTransport,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ServerStopServiceCmd(int aServerIf,
int aServiceHandle,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
nsresult ServerDeleteServiceCmd(int aServerIf,
int aServiceHandle,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Send an indication or a notification */
nsresult ServerSendIndicationCmd(int aServerIf,
@ -289,26 +289,20 @@ public:
int aLength,
bool aConfirm,
uint8_t* aValue,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Send a response for an incoming indication */
nsresult ServerSendResponseCmd(int aConnId,
int aTransId,
BluetoothGattStatus aStatus,
const BluetoothGattResponse& aResponse,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
// TODO: Add L support
protected:
nsresult Send(DaemonSocketPDU* aPDU,
BluetoothGattResultHandler* aRes);
nsresult Send(DaemonSocketPDU* aPDU,
BluetoothGattClientResultHandler* aRes);
nsresult Send(DaemonSocketPDU* aPDU,
BluetoothGattServerResultHandler* aRes);
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, void* aUserData);
@ -316,23 +310,15 @@ protected:
// Responses
//
typedef mozilla::ipc::DaemonResultRunnable0<
BluetoothGattClientResultHandler, void>
ClientResultRunnable;
typedef mozilla::ipc::DaemonResultRunnable1<
BluetoothGattClientResultHandler, void,
BluetoothTypeOfDevice, BluetoothTypeOfDevice>
ClientGetDeviceTypeResultRunnable;
typedef mozilla::ipc::DaemonResultRunnable0<
BluetoothGattServerResultHandler, void>
ServerResultRunnable;
typedef mozilla::ipc::DaemonResultRunnable0<
BluetoothGattResultHandler, void>
ResultRunnable;
typedef mozilla::ipc::DaemonResultRunnable1<
BluetoothGattResultHandler, void,
BluetoothTypeOfDevice, BluetoothTypeOfDevice>
ClientGetDeviceTypeResultRunnable;
typedef mozilla::ipc::DaemonResultRunnable1<
BluetoothGattResultHandler, void, BluetoothStatus, BluetoothStatus>
ErrorRunnable;
@ -343,143 +329,143 @@ protected:
void ClientRegisterRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientUnregisterRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientScanRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientConnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientDisconnectRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientListenRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientRefreshRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientSearchServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientGetIncludedServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientGetCharacteristicRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientGetDescriptorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientReadCharacteristicRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientWriteCharacteristicRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientReadDescriptorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientWriteDescriptorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientExecuteWriteRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientRegisterNotificationRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientDeregisterNotificationRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientReadRemoteRssiRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientGetDeviceTypeRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientSetAdvDataRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ClientTestCommandRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerRegisterRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerUnregisterRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerConnectPeripheralRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerDisconnectPeripheralRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerAddServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerAddIncludedServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerAddCharacteristicRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerAddDescriptorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerStartServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerStopServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerDeleteServiceRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerSendIndicationRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ServerSendResponseRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
// TODO: Add L support
@ -492,46 +478,44 @@ protected:
//
class NotificationHandlerWrapper;
class ClientNotificationHandlerWrapper;
class ServerNotificationHandlerWrapper;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, BluetoothUuid,
BluetoothGattStatus, int, const BluetoothUuid&>
ClientRegisterNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
nsString, int, BluetoothGattAdvData,
const nsAString&, int, const BluetoothGattAdvData&>
ClientScanResultNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, int, nsString,
int, BluetoothGattStatus, int, const nsAString&>
ClientConnectNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, int, nsString,
int, BluetoothGattStatus, int, const nsAString&>
ClientDisconnectNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus>
ClientSearchCompleteNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattServiceId,
int, const BluetoothGattServiceId&>
ClientSearchResultNotification;
typedef mozilla::ipc::DaemonNotificationRunnable5<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, BluetoothGattServiceId,
BluetoothGattId, BluetoothGattCharProp,
int, BluetoothGattStatus, const BluetoothGattServiceId&,
@ -539,7 +523,7 @@ protected:
ClientGetCharacteristicNotification;
typedef mozilla::ipc::DaemonNotificationRunnable5<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, BluetoothGattServiceId,
BluetoothGattId, BluetoothGattId,
int, BluetoothGattStatus, const BluetoothGattServiceId&,
@ -547,14 +531,14 @@ protected:
ClientGetDescriptorNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, BluetoothGattServiceId, BluetoothGattServiceId,
int, BluetoothGattStatus, const BluetoothGattServiceId&,
const BluetoothGattServiceId&>
ClientGetIncludedServiceNotification;
typedef mozilla::ipc::DaemonNotificationRunnable5<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, int, BluetoothGattStatus,
BluetoothGattServiceId, BluetoothGattId,
int, int, BluetoothGattStatus,
@ -562,121 +546,121 @@ protected:
ClientRegisterNotificationNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattNotifyParam,
int, const BluetoothGattNotifyParam&>
ClientNotifyNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, BluetoothGattReadParam,
int, BluetoothGattStatus, const BluetoothGattReadParam&>
ClientReadCharacteristicNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, BluetoothGattWriteParam,
int, BluetoothGattStatus, const BluetoothGattWriteParam&>
ClientWriteCharacteristicNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, BluetoothGattReadParam,
int, BluetoothGattStatus, const BluetoothGattReadParam&>
ClientReadDescriptorNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus, BluetoothGattWriteParam,
int, BluetoothGattStatus, const BluetoothGattWriteParam&>
ClientWriteDescriptorNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, BluetoothGattStatus>
ClientExecuteWriteNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, nsString, int, BluetoothGattStatus,
int, const nsAString&, int, BluetoothGattStatus>
ClientReadRemoteRssiNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2<
ClientNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int>
ClientListenNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, BluetoothUuid,
BluetoothGattStatus, int, const BluetoothUuid&>
ServerRegisterNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, int, bool, nsString,
int, int, bool, const nsAString&>
ServerConnectionNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, BluetoothGattServiceId, int,
BluetoothGattStatus, int, const BluetoothGattServiceId&, int>
ServerServiceAddedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, int, int>
ServerIncludedServiceAddedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable5<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, BluetoothUuid, int, int,
BluetoothGattStatus, int, const BluetoothUuid&, int, int>
ServerCharacteristicAddedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable5<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, BluetoothUuid, int, int,
BluetoothGattStatus, int, const BluetoothUuid&, int, int>
ServerDescriptorAddedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, int>
ServerServiceStartedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, int>
ServerServiceStoppedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int, int>
ServerServiceDeletedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable6<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, int, nsString, int, int, bool,
int, int, const nsAString&, int, int, bool>
ServerRequestReadNotification;
typedef mozilla::ipc::DaemonNotificationRunnable9<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, int, nsString, int, int, int, nsAutoArrayPtr<uint8_t>, bool, bool,
int, int, const nsAString&, int, int, int, const uint8_t*, bool, bool>
ServerRequestWriteNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
int, int, nsString, bool,
int, int, const nsAString&, bool>
ServerRequestExecuteWriteNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2<
ServerNotificationHandlerWrapper, void,
NotificationHandlerWrapper, void,
BluetoothGattStatus, int>
ServerResponseConfirmationNotification;
@ -801,100 +785,82 @@ public:
BluetoothDaemonGattInterface(BluetoothDaemonGattModule* aModule);
~BluetoothDaemonGattInterface();
void Init(
BluetoothGattNotificationHandler* aNotificationHandler,
BluetoothGattResultHandler* aRes);
void Init(BluetoothGattNotificationHandler* aNotificationHandler,
BluetoothGattResultHandler* aRes);
void Cleanup(BluetoothGattResultHandler* aRes);
BluetoothGattClientInterface* GetBluetoothGattClientInterface();
BluetoothGattServerInterface* GetBluetoothGattServerInterface();
private:
void DispatchError(BluetoothGattResultHandler* aRes,
BluetoothStatus aStatus);
void DispatchError(BluetoothGattResultHandler* aRes, nsresult aRv);
BluetoothDaemonGattModule* mModule;
};
class BluetoothDaemonGattClientInterface final
: public BluetoothGattClientInterface
{
public:
BluetoothDaemonGattClientInterface(BluetoothDaemonGattModule* aModule);
/* Register / Unregister */
void RegisterClient(const BluetoothUuid& aUuid,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void UnregisterClient(int aClientIf,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Start / Stop LE Scan */
void Scan(int aClientIf, bool aStart,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Connect / Disconnect */
void Connect(int aClientIf,
const nsAString& aBdAddr,
bool aIsDirect, /* auto connect */
BluetoothTransport aTransport,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void Disconnect(int aClientIf,
const nsAString& aBdAddr,
int aConnId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Start / Stop advertisements to listen for incoming connections */
void Listen(int aClientIf,
bool aIsStart,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Clear the attribute cache for a given device*/
void Refresh(int aClientIf,
const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Enumerate Attributes */
void SearchService(int aConnId,
bool aSearchAll,
const BluetoothUuid& aUuid,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void GetIncludedService(int aConnId,
const BluetoothGattServiceId& aServiceId,
bool aFirst,
const BluetoothGattServiceId& aStartServiceId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void GetCharacteristic(int aConnId,
const BluetoothGattServiceId& aServiceId,
bool aFirst,
const BluetoothGattId& aStartCharId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void GetDescriptor(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
bool aFirst,
const BluetoothGattId& aDescriptorId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Read / Write An Attribute */
void ReadCharacteristic(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattAuthReq aAuthReq,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void WriteCharacteristic(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattWriteType aWriteType,
BluetoothGattAuthReq aAuthReq,
const nsTArray<uint8_t>& aValue,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ReadDescriptor(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
const BluetoothGattId& aDescriptorId,
BluetoothGattAuthReq aAuthReq,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void WriteDescriptor(int aConnId,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
@ -902,12 +868,12 @@ public:
BluetoothGattWriteType aWriteType,
BluetoothGattAuthReq aAuthReq,
const nsTArray<uint8_t>& aValue,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Execute / Abort Prepared Write*/
void ExecuteWrite(int aConnId,
int aIsExecute,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Register / Deregister Characteristic Notifications or Indications */
@ -915,19 +881,19 @@ public:
const nsAString& aBdAddr,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void DeregisterNotification(int aClientIf,
const nsAString& aBdAddr,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void ReadRemoteRssi(int aClientIf,
const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void GetDeviceType(const nsAString& aBdAddr,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Set advertising data or scan response data */
void SetAdvData(int aServerIf,
@ -940,74 +906,61 @@ public:
uint16_t aManufacturerLen, char* aManufacturerData,
uint16_t aServiceDataLen, char* aServiceData,
uint16_t aServiceUuidLen, char* aServiceUuid,
BluetoothGattClientResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void TestCommand(int aCommand,
const BluetoothGattTestParam& aTestParam,
BluetoothGattClientResultHandler* aRes);
private:
void DispatchError(BluetoothGattClientResultHandler* aRes,
BluetoothStatus aStatus);
void DispatchError(BluetoothGattClientResultHandler* aRes, nsresult aRv);
BluetoothDaemonGattModule* mModule;
};
class BluetoothDaemonGattServerInterface final
: public BluetoothGattServerInterface
{
public:
BluetoothDaemonGattServerInterface(BluetoothDaemonGattModule* aModule);
BluetoothGattResultHandler* aRes);
/* Register / Unregister */
void RegisterServer(const BluetoothUuid& aUuid,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void UnregisterServer(int aServerIf,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Connect / Disconnect */
void ConnectPeripheral(int aServerIf,
const nsAString& aBdAddr,
bool aIsDirect, /* auto connect */
BluetoothTransport aTransport,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void DisconnectPeripheral(int aServerIf,
const nsAString& aBdAddr,
int aConnId,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Add a services / a characteristic / a descriptor */
void AddService(int aServerIf,
const BluetoothGattServiceId& aServiceId,
int aNumHandles,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void AddIncludedService(int aServerIf,
int aServiceHandle,
int aIncludedServiceHandle,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void AddCharacteristic(int aServerIf,
int aServiceHandle,
const BluetoothUuid& aUuid,
BluetoothGattCharProp aProperties,
BluetoothGattAttrPerm aPermissions,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void AddDescriptor(int aServerIf,
int aServiceHandle,
const BluetoothUuid& aUuid,
BluetoothGattAttrPerm aPermissions,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Start / Stop / Delete a service */
void StartService(int aServerIf,
int aServiceHandle,
BluetoothTransport aTransport,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void StopService(int aServerIf,
int aServiceHandle,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
void DeleteService(int aServerIf,
int aServiceHandle,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Send an indication or a notification */
void SendIndication(
@ -1016,20 +969,20 @@ public:
int aConnId,
const nsTArray<uint8_t>& aValue,
bool aConfirm, /* true: indication, false: notification */
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
/* Send a response for an incoming indication */
void SendResponse(int aConnId,
int aTransId,
BluetoothGattStatus aStatus,
const BluetoothGattResponse& aResponse,
BluetoothGattServerResultHandler* aRes);
BluetoothGattResultHandler* aRes);
private:
void DispatchError(BluetoothGattServerResultHandler* aRes,
void DispatchError(BluetoothGattResultHandler* aRes,
BluetoothStatus aStatus);
void DispatchError(BluetoothGattServerResultHandler* aRes, nsresult aRv);
void DispatchError(BluetoothGattResultHandler* aRes, nsresult aRv);
BluetoothDaemonGattModule* mModule;
};

Просмотреть файл

@ -32,8 +32,6 @@ USING_BLUETOOTH_NAMESPACE
namespace {
StaticRefPtr<BluetoothGattManager> sBluetoothGattManager;
static BluetoothGattInterface* sBluetoothGattInterface;
static BluetoothGattClientInterface* sBluetoothGattClientInterface;
static BluetoothGattServerInterface* sBluetoothGattServerInterface;
} // namespace
bool BluetoothGattManager::mInShutdown = false;
@ -303,14 +301,6 @@ BluetoothGattManager::InitGattInterface(BluetoothProfileResultHandler* aRes)
return;
}
sBluetoothGattClientInterface =
sBluetoothGattInterface->GetBluetoothGattClientInterface();
NS_ENSURE_TRUE_VOID(sBluetoothGattClientInterface);
sBluetoothGattServerInterface =
sBluetoothGattInterface->GetBluetoothGattServerInterface();
NS_ENSURE_TRUE_VOID(sBluetoothGattServerInterface);
if (!sClients) {
sClients = new nsTArray<nsRefPtr<BluetoothGattClient> >;
}
@ -339,8 +329,6 @@ public:
void Cleanup() override
{
sBluetoothGattClientInterface = nullptr;
sBluetoothGattServerInterface = nullptr;
sBluetoothGattInterface = nullptr;
sClients = nullptr;
@ -392,7 +380,7 @@ BluetoothGattManager::DeinitGattInterface(BluetoothProfileResultHandler* aRes)
}
class BluetoothGattManager::RegisterClientResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
RegisterClientResultHandler(BluetoothGattClient* aClient)
@ -403,7 +391,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::RegisterClient failed: %d",
BT_WARNING("BluetoothGattInterface::RegisterClient failed: %d",
(int)aStatus);
BluetoothService* bs = BluetoothService::Get();
@ -430,7 +418,7 @@ private:
};
class BluetoothGattManager::UnregisterClientResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
UnregisterClientResultHandler(BluetoothGattClient* aClient)
@ -460,7 +448,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::UnregisterClient failed: %d",
BT_WARNING("BluetoothGattInterface::UnregisterClient failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mUnregisterClientRunnable);
@ -493,13 +481,13 @@ BluetoothGattManager::UnregisterClient(int aClientIf,
nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
client->mUnregisterClientRunnable = aRunnable;
sBluetoothGattClientInterface->UnregisterClient(
sBluetoothGattInterface->UnregisterClient(
aClientIf,
new UnregisterClientResultHandler(client));
}
class BluetoothGattManager::StartLeScanResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
StartLeScanResultHandler(BluetoothGattClient* aClient)
@ -517,7 +505,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::StartLeScan failed: %d",
BT_WARNING("BluetoothGattInterface::StartLeScan failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mStartLeScanRunnable);
@ -540,7 +528,7 @@ private:
};
class BluetoothGattManager::StopLeScanResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
StopLeScanResultHandler(BluetoothReplyRunnable* aRunnable, int aClientIf)
@ -564,7 +552,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::StopLeScan failed: %d",
BT_WARNING("BluetoothGattInterface::StopLeScan failed: %d",
(int)aStatus);
DispatchReplyError(mRunnable, aStatus);
}
@ -604,7 +592,7 @@ BluetoothGattManager::StartLeScan(const nsTArray<nsString>& aServiceUuids,
StringToUuid(NS_ConvertUTF16toUTF8(appUuidStr).get(), appUuid);
// 'startLeScan' will be proceeded after client registered
sBluetoothGattClientInterface->RegisterClient(
sBluetoothGattInterface->RegisterClient(
appUuid, new RegisterClientResultHandler(client));
}
@ -625,14 +613,14 @@ BluetoothGattManager::StopLeScan(const nsAString& aScanUuid,
}
nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
sBluetoothGattClientInterface->Scan(
sBluetoothGattInterface->Scan(
client->mClientIf,
false /* Stop */,
new StopLeScanResultHandler(aRunnable, client->mClientIf));
}
class BluetoothGattManager::ConnectResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
ConnectResultHandler(BluetoothGattClient* aClient)
@ -643,7 +631,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::Connect failed: %d",
BT_WARNING("BluetoothGattInterface::Connect failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mConnectRunnable);
@ -686,7 +674,7 @@ BluetoothGattManager::Connect(const nsAString& aAppUuid,
client->mConnectRunnable = aRunnable;
if (client->mClientIf > 0) {
sBluetoothGattClientInterface->Connect(client->mClientIf,
sBluetoothGattInterface->Connect(client->mClientIf,
aDeviceAddr,
true, // direct connect
TRANSPORT_AUTO,
@ -696,13 +684,13 @@ BluetoothGattManager::Connect(const nsAString& aAppUuid,
StringToUuid(NS_ConvertUTF16toUTF8(aAppUuid).get(), uuid);
// connect will be proceeded after client registered
sBluetoothGattClientInterface->RegisterClient(
sBluetoothGattInterface->RegisterClient(
uuid, new RegisterClientResultHandler(client));
}
}
class BluetoothGattManager::DisconnectResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
DisconnectResultHandler(BluetoothGattClient* aClient)
@ -713,7 +701,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::Disconnect failed: %d",
BT_WARNING("BluetoothGattInterface::Disconnect failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mDisconnectRunnable);
@ -755,7 +743,7 @@ BluetoothGattManager::Disconnect(const nsAString& aAppUuid,
nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
client->mDisconnectRunnable = aRunnable;
sBluetoothGattClientInterface->Disconnect(
sBluetoothGattInterface->Disconnect(
client->mClientIf,
aDeviceAddr,
client->mConnId,
@ -763,7 +751,7 @@ BluetoothGattManager::Disconnect(const nsAString& aAppUuid,
}
class BluetoothGattManager::DiscoverResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
DiscoverResultHandler(BluetoothGattClient* aClient)
@ -774,7 +762,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::Discover failed: %d",
BT_WARNING("BluetoothGattInterface::Discover failed: %d",
(int)aStatus);
mClient->NotifyDiscoverCompleted(false);
@ -818,7 +806,7 @@ BluetoothGattManager::Discover(const nsAString& aAppUuid,
* 2-3) Discover all descriptors of those characteristics discovered in
* 2-2).
*/
sBluetoothGattClientInterface->SearchService(
sBluetoothGattInterface->SearchService(
client->mConnId,
true, // search all services
BluetoothUuid(),
@ -826,7 +814,7 @@ BluetoothGattManager::Discover(const nsAString& aAppUuid,
}
class BluetoothGattManager::ReadRemoteRssiResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
ReadRemoteRssiResultHandler(BluetoothGattClient* aClient)
@ -837,7 +825,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::ReadRemoteRssi failed: %d",
BT_WARNING("BluetoothGattInterface::ReadRemoteRssi failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mReadRemoteRssiRunnable);
@ -874,13 +862,13 @@ BluetoothGattManager::ReadRemoteRssi(int aClientIf,
nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
client->mReadRemoteRssiRunnable = aRunnable;
sBluetoothGattClientInterface->ReadRemoteRssi(
sBluetoothGattInterface->ReadRemoteRssi(
aClientIf, aDeviceAddr,
new ReadRemoteRssiResultHandler(client));
}
class BluetoothGattManager::RegisterNotificationsResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
RegisterNotificationsResultHandler(BluetoothGattClient* aClient)
@ -909,7 +897,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING(
"BluetoothGattClientInterface::RegisterNotifications failed: %d",
"BluetoothGattInterface::RegisterNotifications failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mRegisterNotificationsRunnable);
@ -950,13 +938,13 @@ BluetoothGattManager::RegisterNotifications(
client->mRegisterNotificationsRunnable = aRunnable;
sBluetoothGattClientInterface->RegisterNotification(
sBluetoothGattInterface->RegisterNotification(
client->mClientIf, client->mDeviceAddr, aServId, aCharId,
new RegisterNotificationsResultHandler(client));
}
class BluetoothGattManager::DeregisterNotificationsResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
DeregisterNotificationsResultHandler(BluetoothGattClient* aClient)
@ -985,7 +973,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING(
"BluetoothGattClientInterface::DeregisterNotifications failed: %d",
"BluetoothGattInterface::DeregisterNotifications failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mDeregisterNotificationsRunnable);
@ -1025,13 +1013,13 @@ BluetoothGattManager::DeregisterNotifications(
client->mDeregisterNotificationsRunnable = aRunnable;
sBluetoothGattClientInterface->DeregisterNotification(
sBluetoothGattInterface->DeregisterNotification(
client->mClientIf, client->mDeviceAddr, aServId, aCharId,
new DeregisterNotificationsResultHandler(client));
}
class BluetoothGattManager::ReadCharacteristicValueResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
ReadCharacteristicValueResultHandler(BluetoothGattClient* aClient)
@ -1042,7 +1030,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::ReadCharacteristicValue failed" \
BT_WARNING("BluetoothGattInterface::ReadCharacteristicValue failed" \
": %d", (int)aStatus);
MOZ_ASSERT(mClient->mReadCharacteristicState.mRunnable);
@ -1100,7 +1088,7 @@ BluetoothGattManager::ReadCharacteristicValue(
* link. If the operation fails due to insufficient authentication/encryption
* key size, retry to read through an authenticated physical link.
*/
sBluetoothGattClientInterface->ReadCharacteristic(
sBluetoothGattInterface->ReadCharacteristic(
client->mConnId,
aServiceId,
aCharacteristicId,
@ -1109,7 +1097,7 @@ BluetoothGattManager::ReadCharacteristicValue(
}
class BluetoothGattManager::WriteCharacteristicValueResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
WriteCharacteristicValueResultHandler(BluetoothGattClient* aClient)
@ -1120,7 +1108,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::WriteCharacteristicValue failed" \
BT_WARNING("BluetoothGattInterface::WriteCharacteristicValue failed" \
": %d", (int)aStatus);
MOZ_ASSERT(mClient->mWriteCharacteristicState.mRunnable);
@ -1181,7 +1169,7 @@ BluetoothGattManager::WriteCharacteristicValue(
* link. If the operation fails due to insufficient authentication/encryption
* key size, retry to write through an authenticated physical link.
*/
sBluetoothGattClientInterface->WriteCharacteristic(
sBluetoothGattInterface->WriteCharacteristic(
client->mConnId,
aServiceId,
aCharacteristicId,
@ -1192,7 +1180,7 @@ BluetoothGattManager::WriteCharacteristicValue(
}
class BluetoothGattManager::ReadDescriptorValueResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
ReadDescriptorValueResultHandler(BluetoothGattClient* aClient)
@ -1203,7 +1191,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::ReadDescriptorValue failed: %d",
BT_WARNING("BluetoothGattInterface::ReadDescriptorValue failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mReadDescriptorState.mRunnable);
@ -1262,7 +1250,7 @@ BluetoothGattManager::ReadDescriptorValue(
* link. If the operation fails due to insufficient authentication/encryption
* key size, retry to read through an authenticated physical link.
*/
sBluetoothGattClientInterface->ReadDescriptor(
sBluetoothGattInterface->ReadDescriptor(
client->mConnId,
aServiceId,
aCharacteristicId,
@ -1272,7 +1260,7 @@ BluetoothGattManager::ReadDescriptorValue(
}
class BluetoothGattManager::WriteDescriptorValueResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
WriteDescriptorValueResultHandler(BluetoothGattClient* aClient)
@ -1283,7 +1271,7 @@ public:
void OnError(BluetoothStatus aStatus) override
{
BT_WARNING("BluetoothGattClientInterface::WriteDescriptorValue failed: %d",
BT_WARNING("BluetoothGattInterface::WriteDescriptorValue failed: %d",
(int)aStatus);
MOZ_ASSERT(mClient->mWriteDescriptorState.mRunnable);
@ -1343,7 +1331,7 @@ BluetoothGattManager::WriteDescriptorValue(
*/
client->mWriteDescriptorState.Assign(aValue, false, aRunnable);
sBluetoothGattClientInterface->WriteDescriptor(
sBluetoothGattInterface->WriteDescriptor(
client->mConnId,
aServiceId,
aCharacteristicId,
@ -1411,12 +1399,12 @@ BluetoothGattManager::RegisterClientNotification(BluetoothGattStatus aStatus,
if (client->mStartLeScanRunnable) {
// Client just registered, proceed remaining startLeScan request.
sBluetoothGattClientInterface->Scan(
sBluetoothGattInterface->Scan(
aClientIf, true /* start */,
new StartLeScanResultHandler(client));
} else if (client->mConnectRunnable) {
// Client just registered, proceed remaining connect request.
sBluetoothGattClientInterface->Connect(
sBluetoothGattInterface->Connect(
aClientIf, client->mDeviceAddr, true /* direct connect */,
TRANSPORT_AUTO,
new ConnectResultHandler(client));
@ -1424,7 +1412,7 @@ BluetoothGattManager::RegisterClientNotification(BluetoothGattStatus aStatus,
}
class BluetoothGattManager::ScanDeviceTypeResultHandler final
: public BluetoothGattClientResultHandler
: public BluetoothGattResultHandler
{
public:
ScanDeviceTypeResultHandler(const nsAString& aBdAddr, int aRssi,
@ -1477,11 +1465,11 @@ BluetoothGattManager::ScanResultNotification(
{
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_TRUE_VOID(sBluetoothGattClientInterface);
NS_ENSURE_TRUE_VOID(sBluetoothGattInterface);
// Distribute "LeDeviceFound" signal after we know the corresponding
// BluetoothTypeOfDevice of the device
sBluetoothGattClientInterface->GetDeviceType(
sBluetoothGattInterface->GetDeviceType(
aBdAddr,
new ScanDeviceTypeResultHandler(aBdAddr, aRssi, aAdvData));
}
@ -1616,7 +1604,7 @@ BluetoothGattManager::SearchCompleteNotification(int aConnId,
// All services are discovered, continue to search included services of each
// service if existed, otherwise, notify application that discover completed
if (!client->mServices.IsEmpty()) {
sBluetoothGattClientInterface->GetIncludedService(
sBluetoothGattInterface->GetIncludedService(
aConnId,
client->mServices[0], // start from first service
true, // first included service
@ -1675,7 +1663,7 @@ BluetoothGattManager::GetCharacteristicNotification(
client->mCharacteristics.AppendElement(attribute);
// Get next characteristic of this service
sBluetoothGattClientInterface->GetCharacteristic(
sBluetoothGattInterface->GetCharacteristic(
aConnId,
aServiceId,
false,
@ -1720,7 +1708,7 @@ BluetoothGattManager::GetDescriptorNotification(
client->mDescriptors.AppendElement(aDescriptorId);
// Get next descriptor of this characteristic
sBluetoothGattClientInterface->GetDescriptor(
sBluetoothGattInterface->GetDescriptor(
aConnId,
aServiceId,
aCharId,
@ -1767,7 +1755,7 @@ BluetoothGattManager::GetIncludedServiceNotification(
client->mIncludedServices.AppendElement(aIncludedServId);
// Get next included service of this service
sBluetoothGattClientInterface->GetIncludedService(
sBluetoothGattInterface->GetIncludedService(
aConnId,
aServiceId,
false,
@ -1787,7 +1775,7 @@ BluetoothGattManager::GetIncludedServiceNotification(
client->mIncludedServices.Clear();
// Start to discover characteristics of this service
sBluetoothGattClientInterface->GetCharacteristic(
sBluetoothGattInterface->GetCharacteristic(
aConnId,
aServiceId,
true, // first characteristic
@ -1908,7 +1896,7 @@ BluetoothGattManager::ReadCharacteristicNotification(
aStatus == GATT_STATUS_INSUFFICIENT_ENCRYPTION)) {
client->mReadCharacteristicState.mAuthRetry = true;
// Retry with another authentication requirement
sBluetoothGattClientInterface->ReadCharacteristic(
sBluetoothGattInterface->ReadCharacteristic(
aConnId,
aReadParam.mServiceId,
aReadParam.mCharId,
@ -1947,7 +1935,7 @@ BluetoothGattManager::WriteCharacteristicNotification(
aStatus == GATT_STATUS_INSUFFICIENT_ENCRYPTION)) {
client->mWriteCharacteristicState.mAuthRetry = true;
// Retry with another authentication requirement
sBluetoothGattClientInterface->WriteCharacteristic(
sBluetoothGattInterface->WriteCharacteristic(
aConnId,
aWriteParam.mServiceId,
aWriteParam.mCharId,
@ -2002,7 +1990,7 @@ BluetoothGattManager::ReadDescriptorNotification(
aStatus == GATT_STATUS_INSUFFICIENT_ENCRYPTION)) {
client->mReadDescriptorState.mAuthRetry = true;
// Retry with another authentication requirement
sBluetoothGattClientInterface->ReadDescriptor(
sBluetoothGattInterface->ReadDescriptor(
aConnId,
aReadParam.mServiceId,
aReadParam.mCharId,
@ -2042,7 +2030,7 @@ BluetoothGattManager::WriteDescriptorNotification(
aStatus == GATT_STATUS_INSUFFICIENT_ENCRYPTION)) {
client->mWriteDescriptorState.mAuthRetry = true;
// Retry with another authentication requirement
sBluetoothGattClientInterface->WriteDescriptor(
sBluetoothGattInterface->WriteDescriptor(
aConnId,
aWriteParam.mServiceId,
aWriteParam.mCharId,
@ -2166,7 +2154,7 @@ BluetoothGattManager::ProceedDiscoverProcess(
* Discover is done, notify application.
*/
if (!aClient->mCharacteristics.IsEmpty()) {
sBluetoothGattClientInterface->GetDescriptor(
sBluetoothGattInterface->GetDescriptor(
aClient->mConnId,
aServiceId,
aClient->mCharacteristics[0].mId,
@ -2175,7 +2163,7 @@ BluetoothGattManager::ProceedDiscoverProcess(
new DiscoverResultHandler(aClient));
aClient->mCharacteristics.RemoveElementAt(0);
} else if (!aClient->mServices.IsEmpty()) {
sBluetoothGattClientInterface->GetIncludedService(
sBluetoothGattInterface->GetIncludedService(
aClient->mConnId,
aClient->mServices[0],
true, // first included service

Просмотреть файл

@ -9,8 +9,6 @@ SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
SpecialPowers.setBoolPref("media.useAudioChannelService", true);
function noaudio() {
var iframe = document.createElement('iframe');
iframe.setAttribute('mozbrowser', 'true');

Просмотреть файл

@ -68,8 +68,4 @@ function runTest() {
iframe.src = browserElementTestHelpers.emptyPage1;
}
addEventListener('testready', () => {
// Audio channel service is needed for events
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]},
runTest);
});
addEventListener('testready', runTest);

Просмотреть файл

@ -47,12 +47,7 @@ function runTest() {
document.body.appendChild(iframe);
}
// This test relies on <audio> elements interacting with the audio channel
// service. This is controled by the media.useAudioChannelService pref.
addEventListener('testready', function() {
SpecialPowers.pushPrefEnv({set: [['media.useAudioChannelService', true]]},
runTest);
});
addEventListener('testready', runTest);
</script>
</body>

Просмотреть файл

@ -1014,7 +1014,7 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
*aColor = value.GetColorValue();
} else {
// otherwise resolve it
nsIPresShell* presShell = GetPresShell();
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
nsRefPtr<nsStyleContext> parentContext;
if (mCanvasElement && mCanvasElement->IsInDoc()) {
// Inherit from the canvas element.
@ -2151,9 +2151,15 @@ GetFontParentStyleContext(Element* aElement, nsIPresShell* presShell,
ErrorResult& error)
{
if (aElement && aElement->IsInDoc()) {
// inherit from the canvas element
return nsComputedDOMStyle::GetStyleContextForElement(aElement, nullptr,
presShell);
// Inherit from the canvas element.
nsRefPtr<nsStyleContext> result =
nsComputedDOMStyle::GetStyleContextForElement(aElement, nullptr,
presShell);
if (!result) {
error.Throw(NS_ERROR_FAILURE);
return nullptr;
}
return result.forget();
}
// otherwise inherit from default (10px sans-serif)
@ -2168,7 +2174,14 @@ GetFontParentStyleContext(Element* aElement, nsIPresShell* presShell,
nsTArray<nsCOMPtr<nsIStyleRule>> parentRules;
parentRules.AppendElement(parentRule);
return presShell->StyleSet()->ResolveStyleForRules(nullptr, parentRules);
nsRefPtr<nsStyleContext> result =
presShell->StyleSet()->ResolveStyleForRules(nullptr, parentRules);
if (!result) {
error.Throw(NS_ERROR_FAILURE);
return nullptr;
}
return result.forget();
}
static bool
@ -2222,6 +2235,12 @@ GetFontStyleContext(Element* aElement, const nsAString& aFont,
return nullptr;
}
MOZ_RELEASE_ASSERT(parentContext,
"GetFontParentStyleContext should have returned an error if it couldn't get a parent context.");
MOZ_ASSERT(!presShell->IsDestroying(),
"GetFontParentStyleContext should have returned an error if the presshell is being destroyed.");
nsTArray<nsCOMPtr<nsIStyleRule>> rules;
rules.AppendElement(rule);
// add a rule to prevent text zoom from affecting the style
@ -2299,7 +2318,7 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
return false;
}
nsIPresShell* presShell = GetPresShell();
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
if (!presShell) {
error.Throw(NS_ERROR_FAILURE);
return false;
@ -3034,6 +3053,13 @@ CanvasRenderingContext2D::TransformWillUpdate()
void
CanvasRenderingContext2D::SetFont(const nsAString& font,
ErrorResult& error)
{
SetFontInternal(font, error);
}
bool
CanvasRenderingContext2D::SetFontInternal(const nsAString& font,
ErrorResult& error)
{
/*
* If font is defined with relative units (e.g. ems) and the parent
@ -3046,20 +3072,20 @@ CanvasRenderingContext2D::SetFont(const nsAString& font,
if (!mCanvasElement && !mDocShell) {
NS_WARNING("Canvas element must be non-null or a docshell must be provided");
error.Throw(NS_ERROR_FAILURE);
return;
return false;
}
nsIPresShell* presShell = GetPresShell();
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
if (!presShell) {
error.Throw(NS_ERROR_FAILURE);
return;
return false;
}
nsString usedFont;
nsRefPtr<nsStyleContext> sc =
GetFontStyleContext(mCanvasElement, font, presShell, usedFont, error);
if (!sc) {
return;
return false;
}
const nsStyleFont* fontStyle = sc->StyleFont();
@ -3099,6 +3125,8 @@ CanvasRenderingContext2D::SetFont(const nsAString& font,
CurrentState().fontFont.size = fontStyle->mSize;
CurrentState().fontLanguage = fontStyle->mLanguage;
CurrentState().fontExplicitLanguage = fontStyle->mExplicitLanguage;
return true;
}
void
@ -3693,7 +3721,12 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
}
gfxFontGroup* currentFontStyle = GetCurrentFontStyle();
NS_ASSERTION(currentFontStyle, "font group is null");
if (!currentFontStyle) {
return NS_ERROR_FAILURE;
}
MOZ_ASSERT(!presShell->IsDestroying(),
"GetCurrentFontStyle() should have returned null if the presshell is being destroyed");
// ensure user font set is up to date
currentFontStyle->
@ -3891,8 +3924,9 @@ gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
ErrorResult err;
NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
static float kDefaultFontSize = 10.0;
SetFont(kDefaultFontStyle, err);
if (err.Failed()) {
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
bool fontUpdated = SetFontInternal(kDefaultFontStyle, err);
if (err.Failed() || !fontUpdated) {
gfxFontStyle style;
style.size = kDefaultFontSize;
CurrentState().fontGroup =
@ -3901,9 +3935,7 @@ gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
nullptr);
if (CurrentState().fontGroup) {
CurrentState().font = kDefaultFontStyle;
nsIPresShell* presShell = GetPresShell();
if (presShell) {
if (presShell && !presShell->IsDestroying()) {
CurrentState().fontGroup->SetTextPerfMetrics(
presShell->GetPresContext()->GetTextPerfMetrics());
}
@ -3911,7 +3943,6 @@ gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
NS_ERROR("Default canvas font is invalid");
}
}
}
return CurrentState().fontGroup;

Просмотреть файл

@ -597,6 +597,10 @@ protected:
nsTArray<nsStyleFilter>& aFilterChain,
ErrorResult& error);
// Returns whether the font was successfully updated.
bool SetFontInternal(const nsAString& font, mozilla::ErrorResult& error);
/**
* Creates the error target, if it doesn't exist
*/
@ -631,7 +635,7 @@ protected:
*/
RenderingMode EnsureTarget(RenderingMode aRenderMode = RenderingMode::DefaultBackendMode);
/*
/**
* Disposes an old target and prepares to lazily create a new target.
*/
void ClearTarget();
@ -867,10 +871,10 @@ protected:
protected:
gfxFontGroup *GetCurrentFontStyle();
/*
* Implementation of the fillText, strokeText, and measure functions with
* the operation abstracted to a flag.
*/
/**
* Implementation of the fillText, strokeText, and measure functions with
* the operation abstracted to a flag.
*/
nsresult DrawOrMeasureText(const nsAString& text,
float x,
float y,

Просмотреть файл

@ -95,7 +95,7 @@ WebGLContext::ClearDepth(GLclampf v)
MakeContextCurrent();
mDepthClearValue = GLClampFloat(v);
gl->fClearDepth(v);
gl->fClearDepth(mDepthClearValue);
}
void

Просмотреть файл

@ -159,4 +159,4 @@ pref(canvas.customfocusring.enabled,true) skip-if(B2G) skip-if(Android&&AndroidV
# Check that captureStream() displays in a local video element
pref(canvas.capturestream.enabled,true) skip-if(winWidget&&layersGPUAccelerated&&d2d) == capturestream.html wrapper.html?green.png
fuzzy-if(Android,3,40) == 1177726-text-stroke-bounds.html 1177726-text-stroke-bounds-ref.html
fuzzy-if(Android,3,40) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),1,1) == 1177726-text-stroke-bounds.html 1177726-text-stroke-bounds-ref.html

Просмотреть файл

@ -52,36 +52,30 @@ EngineeringModeAPI.prototype = {
// This returns a Promise<DOMString>
getValue: function getValue(aName) {
debug("getValue " + aName);
let promiseInit = function(resolve, reject) {
debug("promise init called for getValue " + aName);
let resolverId = this.getPromiseResolverId({resolve: resolve,
reject: reject });
debug("promise init " + resolverId);
let promiseInit = function(aResolverId) {
debug("promise init called for getValue " + aName + " has resolverId " + aResolverId);
cpmm.sendAsyncMessage("EngineeringMode:GetValue", {
requestId: resolverId,
requestId: aResolverId,
name: aName
});
}.bind(this);
return this.createPromise(promiseInit);
return this.createPromiseWithId(promiseInit);
},
// This returns a Promise<void>
setValue: function setValue(aName, aValue) {
debug("setValue " + aName + ' as ' + aValue );
let promiseInit = function(resolve, reject) {
debug("promise init called for setValue " + aName);
let resolverId = this.getPromiseResolverId({resolve: resolve,
reject: reject });
debug("promise init " + resolverId);
let promiseInit = function(aResolverId) {
debug("promise init called for getValue " + aName + " has resolverId " + aResolverId);
cpmm.sendAsyncMessage("EngineeringMode:SetValue", {
requestId: resolverId,
requestId: aResolverId,
name: aName,
value: aValue
});
}.bind(this);
return this.createPromise(promiseInit);
return this.createPromiseWithId(promiseInit);
},
set onmessage(aHandler) {

Просмотреть файл

@ -60,7 +60,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=848294
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
runTest();
</script>
</body>
</html>

Просмотреть файл

@ -135,10 +135,6 @@ FMRadio::Init(nsPIDOMWindow *aWindow)
RegisterSwitchObserver(SWITCH_HEADPHONES, this);
}
// All of the codes below are for AudioChannel. We can directly return here
// if preferences doesn't enable AudioChannelService.
NS_ENSURE_TRUE_VOID(Preferences::GetBool("media.useAudioChannelService"));
nsCOMPtr<nsIAudioChannelAgent> audioChannelAgent =
do_CreateInstance("@mozilla.org/audiochannelagent;1");
NS_ENSURE_TRUE_VOID(audioChannelAgent);

Просмотреть файл

@ -878,19 +878,21 @@ HTMLCanvasElement::UpdateContext(JSContext* aCx, JS::Handle<JS::Value> aNewConte
nsIntSize sz = GetWidthHeight();
nsresult rv = mCurrentContext->SetIsOpaque(HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque));
nsCOMPtr<nsICanvasRenderingContextInternal> currentContext = mCurrentContext;
nsresult rv = currentContext->SetIsOpaque(HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque));
if (NS_FAILED(rv)) {
mCurrentContext = nullptr;
return rv;
}
rv = mCurrentContext->SetContextOptions(aCx, aNewContextOptions);
rv = currentContext->SetContextOptions(aCx, aNewContextOptions);
if (NS_FAILED(rv)) {
mCurrentContext = nullptr;
return rv;
}
rv = mCurrentContext->SetDimensions(sz.width, sz.height);
rv = currentContext->SetDimensions(sz.width, sz.height);
if (NS_FAILED(rv)) {
mCurrentContext = nullptr;
return rv;

Просмотреть файл

@ -1097,11 +1097,6 @@ static bool IsAutoplayEnabled()
return Preferences::GetBool("media.autoplay.enabled");
}
static bool UseAudioChannelService()
{
return Preferences::GetBool("media.useAudioChannelService");
}
static bool UseAudioChannelAPI()
{
return Preferences::GetBool("media.useAudioChannelAPI");
@ -2411,10 +2406,6 @@ bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID,
bool HTMLMediaElement::CheckAudioChannelPermissions(const nsAString& aString)
{
if (!UseAudioChannelService()) {
return true;
}
// Only normal channel doesn't need permission.
if (aString.EqualsASCII("normal")) {
return true;
@ -4457,10 +4448,6 @@ ImageContainer* HTMLMediaElement::GetImageContainer()
nsresult HTMLMediaElement::UpdateChannelMuteState(float aVolume, bool aMuted)
{
if (!UseAudioChannelService()) {
return NS_OK;
}
if (mAudioChannelVolume != aVolume) {
mAudioChannelVolume = aVolume;
SetVolumeInternal();
@ -4487,10 +4474,6 @@ nsresult HTMLMediaElement::UpdateChannelMuteState(float aVolume, bool aMuted)
void HTMLMediaElement::UpdateAudioChannelPlayingState()
{
if (!UseAudioChannelService()) {
return;
}
bool playingThroughTheAudioChannel =
(!mPaused &&
!Muted() &&
@ -4551,7 +4534,7 @@ HTMLMediaElement::NotifyAudioChannelAgent(bool aPlaying)
NS_IMETHODIMP HTMLMediaElement::WindowVolumeChanged(float aVolume, bool aMuted)
{
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
MOZ_ASSERT(NS_IsMainThread());
UpdateChannelMuteState(aVolume, aMuted);

Просмотреть файл

@ -394,7 +394,7 @@ MozInputMethod.prototype = {
},
removeInput: function(inputId) {
return this._sendPromise(function(resolverId) {
return this.createPromiseWithId(function(resolverId) {
let appId = this._window.document.nodePrincipal.appId;
cpmm.sendAsyncMessage('InputRegistry:Remove', {
@ -435,14 +435,6 @@ MozInputMethod.prototype = {
if (!this._isSystem) {
throw new this._window.Error("Should have 'input-manage' permssion.");
}
},
_sendPromise: function(callback) {
let self = this;
return this.createPromise(function(resolve, reject) {
let resolverId = self.getPromiseResolverId({ resolve: resolve, reject: reject });
callback(resolverId);
});
}
};
@ -786,14 +778,13 @@ MozInputContext.prototype = {
_sendPromise: function(callback) {
let self = this;
return this._ipcHelper.createPromise(function(resolve, reject) {
let resolverId = self._ipcHelper.getPromiseResolverId({ resolve: resolve, reject: reject });
return this._ipcHelper.createPromiseWithId(function(aResolverId) {
if (!WindowMap.isActive(self._window)) {
self._ipcHelper.removePromiseResolver(resolverId);
self._ipcHelper.removePromiseResolver(aResolverId);
reject('Input method is not active.');
return;
}
callback(resolverId);
callback(aResolverId);
});
}
};

Просмотреть файл

@ -68,7 +68,5 @@ UnsupportedHashAlg=Unsupported hash algorithm in the integrity attribute: "%1$S"
# LOCALIZATION NOTE: Do not translate "integrity"
NoValidMetadata=The integrity attribute does not contain any valid metadata.
# LOCALIZATION NOTE: Do not translate "SSL 3.0".
WeakProtocolVersionWarning=This site uses the protocol SSL 3.0 for encryption, which is deprecated and insecure.
# LOCALIZATION NOTE: Do not translate "RC4".
WeakCipherSuiteWarning=This site uses the cipher RC4 for encryption, which is deprecated and insecure.

Просмотреть файл

@ -26,6 +26,7 @@ public:
const nsACString& aContentType) :
mBuffer(aBuffer),
mLength(aLength),
mOffset(0),
mPrincipal(aPrincipal),
mContentType(aContentType)
{

Просмотреть файл

@ -105,7 +105,8 @@ UpdateStreamBlocking(MediaStream* aStream, bool aBlocking)
*/
class DecodedStreamData {
public:
DecodedStreamData(SourceMediaStream* aStream, bool aPlaying);
DecodedStreamData(SourceMediaStream* aStream, bool aPlaying,
MozPromiseHolder<GenericPromise>&& aPromise);
~DecodedStreamData();
bool IsFinished() const;
int64_t GetPosition() const;
@ -139,11 +140,10 @@ public:
// True if we need to send a compensation video frame to ensure the
// StreamTime going forward.
bool mEOSVideoCompensation;
// This promise will be resolved when the SourceMediaStream is finished.
nsRefPtr<GenericPromise> mFinishPromise;
};
DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream, bool aPlaying)
DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream, bool aPlaying,
MozPromiseHolder<GenericPromise>&& aPromise)
: mAudioFramesWritten(0)
, mNextVideoTime(-1)
, mNextAudioTime(-1)
@ -155,10 +155,8 @@ DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream, bool aPlaying)
, mPlaying(aPlaying)
, mEOSVideoCompensation(false)
{
MozPromiseHolder<GenericPromise> promise;
mFinishPromise = promise.Ensure(__func__);
// DecodedStreamGraphListener will resolve this promise.
mListener = new DecodedStreamGraphListener(mStream, Move(promise));
mListener = new DecodedStreamGraphListener(mStream, Move(aPromise));
mStream->AddListener(mListener);
// Block the stream if we are not playing.
@ -293,10 +291,19 @@ OutputStreamData::Remove()
mOwner->Remove(mStream);
}
MediaStreamGraph*
OutputStreamData::Graph() const
{
return mStream->Graph();
}
void
OutputStreamManager::Add(ProcessedMediaStream* aStream, bool aFinishWhenEnded)
{
MOZ_ASSERT(NS_IsMainThread());
// All streams must belong to the same graph.
MOZ_ASSERT(!Graph() || Graph() == aStream->Graph());
// Ensure that aStream finishes the moment mDecodedStream does.
if (aFinishWhenEnded) {
aStream->SetAutofinish(true);
@ -359,6 +366,7 @@ DecodedStream::DecodedStream(MediaQueue<MediaData>& aAudioQueue,
DecodedStream::~DecodedStream()
{
MOZ_ASSERT(mStartTime.isNothing(), "playback should've ended.");
}
nsRefPtr<GenericPromise>
@ -366,65 +374,82 @@ DecodedStream::StartPlayback(int64_t aStartTime, const MediaInfo& aInfo)
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
MOZ_ASSERT(mStartTime.isNothing(), "playback already started.");
mStartTime.emplace(aStartTime);
mInfo = aInfo;
// TODO: Unfortunately, current call flow of MDSM guarantees mData is non-null
// when StartPlayback() is called which imposes an obscure dependency on MDSM.
// We will align the life cycle of mData with {Start,Stop}Playback so that
// DecodedStream doesn't need to make assumptions about mData's life cycle.
return mData->mFinishPromise;
class R : public nsRunnable {
typedef MozPromiseHolder<GenericPromise> Promise;
typedef void(DecodedStream::*Method)(Promise&&);
public:
R(DecodedStream* aThis, Method aMethod, Promise&& aPromise)
: mThis(aThis), mMethod(aMethod)
{
mPromise = Move(aPromise);
}
NS_IMETHOD Run() override
{
(mThis->*mMethod)(Move(mPromise));
return NS_OK;
}
private:
nsRefPtr<DecodedStream> mThis;
Method mMethod;
Promise mPromise;
};
MozPromiseHolder<GenericPromise> promise;
nsRefPtr<GenericPromise> rv = promise.Ensure(__func__);
nsCOMPtr<nsIRunnable> r = new R(this, &DecodedStream::CreateData, Move(promise));
AbstractThread::MainThread()->Dispatch(r.forget());
return rv.forget();
}
void DecodedStream::StopPlayback()
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
// Playback didn't even start at all.
if (mStartTime.isNothing()) {
return;
}
mStartTime.reset();
}
void
DecodedStream::DestroyData()
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
// Avoid the redundant blocking to output stream.
if (!mData) {
// Clear mData immediately when this playback session ends so we won't
// send data to the wrong stream in SendData() in next playback session.
DecodedStreamData* data = mData.release();
// mData is not yet created on the main thread.
if (!data) {
return;
}
mOutputStreamManager.Disconnect();
mData = nullptr;
}
void
DecodedStream::RecreateData()
{
nsRefPtr<DecodedStream> self = this;
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self] () -> void {
self->RecreateData(nullptr);
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
self->mOutputStreamManager.Disconnect();
delete data;
});
AbstractThread::MainThread()->Dispatch(r.forget());
}
void
DecodedStream::RecreateData(MediaStreamGraph* aGraph)
DecodedStream::CreateData(MozPromiseHolder<GenericPromise>&& aPromise)
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
MOZ_ASSERT((aGraph && !mData && !HasConsumers()) || // first time
(!aGraph && mData)); // 2nd time and later
MOZ_ASSERT(!mData, "Already created.");
if (!aGraph) {
aGraph = mData->mStream->Graph();
// No need to create a source stream when there are no output streams. This
// happens when RemoveOutput() is called immediately after StartPlayback().
// We also bail out when the playback session has ended. This happens when
// StopPlayback() is called immediately after StartPlayback().
if (!mOutputStreamManager.Graph() || mStartTime.isNothing()) {
// Resolve the promise to indicate the end of playback.
aPromise.Resolve(true, __func__);
return;
}
auto source = aGraph->CreateSourceStream(nullptr);
DestroyData();
mData.reset(new DecodedStreamData(source, mPlaying));
// Note that the delay between removing ports in DestroyData
// and adding new ones won't cause a glitch since all graph operations
// between main-thread stable states take effect atomically.
auto source = mOutputStreamManager.Graph()->CreateSourceStream(nullptr);
mData.reset(new DecodedStreamData(source, mPlaying, Move(aPromise)));
mOutputStreamManager.Connect(mData->mStream);
}
@ -441,20 +466,13 @@ DecodedStream::GetReentrantMonitor() const
}
void
DecodedStream::Connect(ProcessedMediaStream* aStream, bool aFinishWhenEnded)
DecodedStream::AddOutput(ProcessedMediaStream* aStream, bool aFinishWhenEnded)
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if (!mData) {
RecreateData(aStream->Graph());
}
mOutputStreamManager.Add(aStream, aFinishWhenEnded);
}
void
DecodedStream::Remove(MediaStream* aStream)
DecodedStream::RemoveOutput(MediaStream* aStream)
{
mOutputStreamManager.Remove(aStream);
}
@ -736,6 +754,11 @@ DecodedStream::SendData()
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
MOZ_ASSERT(mStartTime.isSome(), "Must be called after StartPlayback()");
// Not yet created on the main thread. MDSM will try again later.
if (!mData) {
return;
}
// Nothing to do when the stream is finished.
if (mData->mHaveSentFinish) {
return;
@ -759,7 +782,7 @@ int64_t
DecodedStream::AudioEndTime() const
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if (mStartTime.isSome() && mInfo.HasAudio()) {
if (mStartTime.isSome() && mInfo.HasAudio() && mData) {
CheckedInt64 t = mStartTime.ref() +
FramesToUsecs(mData->mAudioFramesWritten, mInfo.mAudio.mRate);
if (t.isValid()) {
@ -776,14 +799,14 @@ DecodedStream::GetPosition() const
// This is only called after MDSM starts playback. So mStartTime is
// guaranteed to be something.
MOZ_ASSERT(mStartTime.isSome());
return mStartTime.ref() + mData->GetPosition();
return mStartTime.ref() + (mData ? mData->GetPosition() : 0);
}
bool
DecodedStream::IsFinished() const
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
return mData->IsFinished();
return mData && mData->IsFinished();
}
} // namespace mozilla

Просмотреть файл

@ -56,6 +56,8 @@ public:
{
return mStream == aStream;
}
// Return the graph mStream belongs to.
MediaStreamGraph* Graph() const;
private:
OutputStreamManager* mOwner;
@ -81,6 +83,12 @@ public:
void Connect(MediaStream* aStream);
// Disconnect all output streams from the input stream.
void Disconnect();
// Return the graph these streams belong to or null if empty.
MediaStreamGraph* Graph() const
{
MOZ_ASSERT(NS_IsMainThread());
return !IsEmpty() ? mStreams[0].Graph() : nullptr;
}
private:
// Keep the input stream so we can connect the output streams that
@ -105,10 +113,8 @@ public:
// Mimic MDSM::StopAudioThread.
void StopPlayback();
void DestroyData();
void RecreateData();
void Connect(ProcessedMediaStream* aStream, bool aFinishWhenEnded);
void Remove(MediaStream* aStream);
void AddOutput(ProcessedMediaStream* aStream, bool aFinishWhenEnded);
void RemoveOutput(MediaStream* aStream);
void SetPlaying(bool aPlaying);
void SetVolume(double aVolume);
@ -126,7 +132,7 @@ protected:
private:
ReentrantMonitor& GetReentrantMonitor() const;
void RecreateData(MediaStreamGraph* aGraph);
void CreateData(MozPromiseHolder<GenericPromise>&& aPromise);
void InitTracks();
void AdvanceTracks();
void SendAudio(double aVolume, bool aIsSameOrigin);

Просмотреть файл

@ -386,7 +386,9 @@ void MediaDecoderStateMachine::SendStreamData()
// keep decoding audio samples till the end and consume a lot of memory.
// Therefore we only discard those behind the stream clock to throttle
// the decoding speed.
if (a && a->mTime <= clockTime) {
// Note we don't discard a sample when |a->mTime == clockTime| because that
// will discard the 1st sample when clockTime is still 0.
if (a && a->mTime < clockTime) {
nsRefPtr<MediaData> releaseMe = AudioQueue().PopFront();
continue;
}
@ -1552,10 +1554,6 @@ MediaDecoderStateMachine::InitiateSeek()
"Can only seek in range [0,duration]");
mCurrentSeek.mTarget.mTime = seekTime;
if (mAudioCaptured) {
mDecodedStream->RecreateData();
}
mDropAudioUntilNextDiscontinuity = HasAudio();
mDropVideoUntilNextDiscontinuity = HasVideo();
mCurrentTimeBeforeSeek = GetMediaTime();
@ -3173,7 +3171,7 @@ void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream,
{
MOZ_ASSERT(NS_IsMainThread());
DECODER_LOG("AddOutputStream aStream=%p!", aStream);
mDecodedStream->Connect(aStream, aFinishWhenEnded);
mDecodedStream->AddOutput(aStream, aFinishWhenEnded);
DispatchAudioCaptured();
}
@ -3181,7 +3179,7 @@ void MediaDecoderStateMachine::RemoveOutputStream(MediaStream* aStream)
{
MOZ_ASSERT(NS_IsMainThread());
DECODER_LOG("RemoveOutputStream=%p!", aStream);
mDecodedStream->Remove(aStream);
mDecodedStream->RemoveOutput(aStream);
if (!mDecodedStream->HasConsumers()) {
DispatchAudioUncaptured();
}

Просмотреть файл

@ -319,7 +319,6 @@ public:
if (mReader) {
mReader->BreakCycles();
}
mDecodedStream->DestroyData();
mResource = nullptr;
mDecoder = nullptr;
}

Просмотреть файл

@ -683,26 +683,22 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' # mimetype check, bug 969289
tags=msg capturestream
[test_mediarecorder_record_no_timeslice.html]
tags=msg capturestream
skip-if = toolkit == 'gonk' && debug
[test_mediarecorder_record_nosrc.html]
tags=msg capturestream
[test_mediarecorder_record_session.html]
tags=msg capturestream
[test_mediarecorder_record_startstopstart.html]
tags=msg
skip-if = toolkit == 'gonk' && debug
[test_mediarecorder_record_stopms.html]
tags=msg
[test_mediarecorder_record_timeslice.html]
tags=msg capturestream
skip-if = toolkit == 'gonk' && debug
[test_mediarecorder_reload_crash.html]
tags=msg capturestream
[test_mediarecorder_unsupported_src.html]
tags=msg
[test_mediarecorder_record_getdata_afterstart.html]
tags=msg capturestream
skip-if = toolkit == 'gonk' && debug
[test_mediatrack_consuming_mediaresource.html]
[test_mediatrack_consuming_mediastream.html]
tags=msg

Просмотреть файл

@ -235,7 +235,6 @@ function setupEnvironment() {
SpecialPowers.pushPrefEnv({
'set': [
['canvas.capturestream.enabled', true],
['dom.messageChannel.enabled', true],
['media.peerconnection.enabled', true],
['media.peerconnection.identity.enabled', true],
['media.peerconnection.identity.timeout', 120000],
@ -246,7 +245,6 @@ function setupEnvironment() {
['media.getusermedia.screensharing.enabled', true],
['media.getusermedia.screensharing.allowed_domains', "mochi.test"],
['media.getusermedia.audiocapture.enabled', true],
['media.useAudioChannelService', true],
['media.recorder.audio_node.enabled', true]
]
}, setTestOptions);

Просмотреть файл

@ -105,8 +105,7 @@ function testMultipleFingerprints() {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({
set: [ [ 'dom.messageChannel.enabled', true ],
[ 'media.peerconnection.identity.enabled', true ] ]
set: [ [ 'media.peerconnection.identity.enabled', true ] ]
}, testMultipleFingerprints);
</script>
</body>

Просмотреть файл

@ -162,9 +162,7 @@ function run_all_tests() {
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({
set: [ [ 'dom.messageChannel.enabled', true ] ]
}, run_all_tests);
run_all_tests();
</script>
</body>
</html>

Просмотреть файл

@ -305,11 +305,6 @@ private:
bool mSuspended;
};
static bool UseAudioChannelService()
{
return Preferences::GetBool("media.useAudioChannelService");
}
static bool UseAudioChannelAPI()
{
return Preferences::GetBool("media.useAudioChannelAPI");
@ -597,10 +592,6 @@ AudioDestinationNode::SetMozAudioChannelType(AudioChannel aValue, ErrorResult& a
bool
AudioDestinationNode::CheckAudioChannelPermissions(AudioChannel aValue)
{
if (!UseAudioChannelService()) {
return true;
}
// Only normal channel doesn't need permission.
if (aValue == AudioChannel::Normal) {
return true;
@ -636,7 +627,7 @@ AudioDestinationNode::CheckAudioChannelPermissions(AudioChannel aValue)
void
AudioDestinationNode::CreateAudioChannelAgent()
{
if (mIsOffline || !UseAudioChannelService()) {
if (mIsOffline) {
return;
}

Просмотреть файл

@ -141,8 +141,7 @@ function runTest() {
test();
}
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelAPI", true ],
["media.useAudioChannelService", true ]]}, runTest);
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelAPI", true ]]}, runTest);
SimpleTest.waitForExplicitFinish();
SimpleTest.requestLongerTimeout(5);

Просмотреть файл

@ -6,7 +6,6 @@
#include "MessageChannel.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/MessageChannelBinding.h"
#include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/Navigator.h"
@ -30,149 +29,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MessageChannel)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
namespace {
bool gPrefInitialized = false;
bool gPrefEnabled = false;
bool
CheckPermission(nsIPrincipal* aPrincipal, bool aCallerChrome)
{
MOZ_ASSERT(NS_IsMainThread());
if (!gPrefInitialized) {
Preferences::AddBoolVarCache(&gPrefEnabled, "dom.messageChannel.enabled");
gPrefInitialized = true;
}
// Enabled by pref
if (gPrefEnabled) {
return true;
}
// Chrome callers are allowed.
if (aCallerChrome) {
return true;
}
nsCOMPtr<nsIURI> uri;
if (NS_FAILED(aPrincipal->GetURI(getter_AddRefs(uri))) || !uri) {
return false;
}
bool isResource = false;
if (NS_FAILED(uri->SchemeIs("resource", &isResource))) {
return false;
}
return isResource;
}
nsIPrincipal*
GetPrincipalFromWorkerPrivate(workers::WorkerPrivate* aWorkerPrivate)
{
MOZ_ASSERT(NS_IsMainThread());
nsIPrincipal* principal = aWorkerPrivate->GetPrincipal();
if (principal) {
return principal;
}
// Walk up to our containing page
workers::WorkerPrivate* wp = aWorkerPrivate;
while (wp->GetParent()) {
wp = wp->GetParent();
}
nsPIDOMWindow* window = wp->GetWindow();
if (!window) {
return nullptr;
}
nsIDocument* doc = window->GetExtantDoc();
if (!doc) {
return nullptr;
}
return doc->NodePrincipal();
}
// A WorkerMainThreadRunnable to synchronously dispatch the call of
// CheckPermission() from the worker thread to the main thread.
class CheckPermissionRunnable final : public workers::WorkerMainThreadRunnable
{
public:
bool mResult;
bool mCallerChrome;
explicit CheckPermissionRunnable(workers::WorkerPrivate* aWorkerPrivate)
: workers::WorkerMainThreadRunnable(aWorkerPrivate)
, mResult(false)
, mCallerChrome(false)
{
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
mCallerChrome = aWorkerPrivate->UsesSystemPrincipal();
}
protected:
virtual bool
MainThreadRun() override
{
MOZ_ASSERT(NS_IsMainThread());
nsIPrincipal* principal = GetPrincipalFromWorkerPrivate(mWorkerPrivate);
if (!principal) {
return true;
}
bool isNullPrincipal;
nsresult rv = principal->GetIsNullPrincipal(&isNullPrincipal);
if (NS_WARN_IF(NS_FAILED(rv))) {
return true;
}
if (NS_WARN_IF(isNullPrincipal)) {
return true;
}
mResult = CheckPermission(principal, mCallerChrome);
return true;
}
};
} // namespace
/* static */ bool
MessageChannel::Enabled(JSContext* aCx, JSObject* aGlobal)
{
if (NS_IsMainThread()) {
JS::Rooted<JSObject*> global(aCx, aGlobal);
nsCOMPtr<nsPIDOMWindow> win = Navigator::GetWindowFromGlobal(global);
if (!win) {
return false;
}
nsIDocument* doc = win->GetExtantDoc();
if (!doc) {
return false;
}
return CheckPermission(doc->NodePrincipal(),
nsContentUtils::IsCallerChrome());
}
workers::WorkerPrivate* workerPrivate =
workers::GetWorkerPrivateFromContext(aCx);
workerPrivate->AssertIsOnWorkerThread();
nsRefPtr<CheckPermissionRunnable> runnable =
new CheckPermissionRunnable(workerPrivate);
runnable->Dispatch(aCx);
return runnable->mResult;
}
MessageChannel::MessageChannel(nsPIDOMWindow* aWindow)
: mWindow(aWindow)
{

Просмотреть файл

@ -28,9 +28,6 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MessageChannel)
static bool Enabled(JSContext* aCx, JSObject* aGlobal);
public:
nsPIDOMWindow*
GetParentObject() const
{

Просмотреть файл

@ -14,7 +14,6 @@ support-files =
[test_messageChannel_cloning.html]
[test_messageChannel_pingpong.html]
[test_messageChannel_post.html]
[test_messageChannel_pref.html]
[test_messageChannel_start.html]
[test_messageChannel_transferable.html]
[test_messageChannel_unshipped.html]

Просмотреть файл

@ -21,29 +21,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
</pre>
<script type="application/javascript">
function runTest() {
/** Test for Bug 677638 **/
var a = new MessageChannel();
ok(a, "MessageChannel created");
/** Test for Bug 677638 **/
var a = new MessageChannel();
ok(a, "MessageChannel created");
var port1 = a.port1;
ok(port1, "MessageChannel.port1 exists");
is(port1, a.port1, "MessageChannel.port1 is port1");
var port1 = a.port1;
ok(port1, "MessageChannel.port1 exists");
is(port1, a.port1, "MessageChannel.port1 is port1");
var port2 = a.port2;
ok(port2, "MessageChannel.port1 exists");
is(port2, a.port2, "MessageChannel.port2 is port2");
var port2 = a.port2;
ok(port2, "MessageChannel.port1 exists");
is(port2, a.port2, "MessageChannel.port2 is port2");
[ 'postMessage', 'start', 'close' ].forEach(function(e) {
ok(e in port1, "MessagePort1." + e + " exists");
ok(e in port2, "MessagePort2." + e + " exists");
});
[ 'postMessage', 'start', 'close' ].forEach(function(e) {
ok(e in port1, "MessagePort1." + e + " exists");
ok(e in port2, "MessagePort2." + e + " exists");
});
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
</script>
</body>
</html>

Просмотреть файл

@ -109,7 +109,7 @@ function runTest() {
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
runTest();
</script>
</body>
</html>

Просмотреть файл

@ -32,7 +32,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1178076
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
runTest();
</script>
</body>
</html>

Просмотреть файл

@ -64,7 +64,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
runTest();
</script>
</body>
</html>

Просмотреть файл

@ -16,21 +16,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1176034
</pre>
<script type="application/javascript">
function runTests() {
var mc = new MessageChannel();
var mc = new MessageChannel();
try {
postMessage(42, "*", [ mc.port1, window ]);
ok(false, "Something went wrong.");
} catch(e) {
ok(true, "PostMessage should fail and we should not leak.");
}
SimpleTest.finish();
try {
postMessage(42, "*", [ mc.port1, window ]);
ok(false, "Something went wrong.");
} catch(e) {
ok(true, "PostMessage should fail and we should not leak.");
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
</script>
</body>
</html>

Просмотреть файл

@ -71,7 +71,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
runTest();
</script>
</body>
</html>

Просмотреть файл

@ -70,7 +70,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, start);
start();
</script>
</body>
</html>

Просмотреть файл

@ -1,42 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=677638
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 677638 - pref</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=677638">Mozilla Bug 677638</a>
<div id="content"></div>
<pre id="test">
</pre>
<script type="application/javascript">
function runTest(what) {
var status;
try {
status = MessageChannel;
ok(what, "Should MessageChannel exist?");
} catch(e) {
ok(!what, "Should MessageChannel exist?");
}
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", false]]},
function() {
runTest(false);
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]},
function() {
runTest(true);
SimpleTest.finish();
});
});
</script>
</body>
</html>

Просмотреть файл

@ -16,7 +16,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
</pre>
<script type="application/javascript">
function runTest() {
var a = new MessageChannel();
var status = false;
@ -27,11 +26,7 @@ function runTest() {
}
ok(status, "Transfering the same port should throw");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
</script>
</body>
</html>

Просмотреть файл

@ -20,19 +20,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
</pre>
<script type="application/javascript">
function runTest() {
var a = new SharedWorker('sharedWorker_messageChannel.js');
a.port.onmessage = function(evt) {
is(evt.ports.length, 1, "We received a port.");
evt.ports[0].onmessage = function(e) {
is(e.data, 42, "Message reiceved back!");
SimpleTest.finish();
}
evt.ports[0].postMessage(42);
var a = new SharedWorker('sharedWorker_messageChannel.js');
a.port.onmessage = function(evt) {
is(evt.ports.length, 1, "We received a port.");
evt.ports[0].onmessage = function(e) {
is(e.data, 42, "Message reiceved back!");
SimpleTest.finish();
}
evt.ports[0].postMessage(42);
}
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
SimpleTest.waitForExplicitFinish();
</script>
</body>

Просмотреть файл

@ -15,22 +15,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
<script type="application/javascript">
function runTest() {
var iframe = document.createElement('iframe');
iframe.setAttribute('src', "iframe_messageChannel_sharedWorker2.html");
document.getElementById('content').appendChild(iframe);
var iframe = document.createElement('iframe');
iframe.setAttribute('src', "iframe_messageChannel_sharedWorker2.html");
document.getElementById('content').appendChild(iframe);
var a = new SharedWorker('sharedWorker2_messageChannel.js');
a.port.onmessage = function(evt) {
is(evt.ports.length, 1, "We received a port.");
evt.ports[0].onmessage = function(e) {
is(e.data, "Hello from the iframe!", "Message reiceved from the iframe!");
SimpleTest.finish();
}
var a = new SharedWorker('sharedWorker2_messageChannel.js');
a.port.onmessage = function(evt) {
is(evt.ports.length, 1, "We received a port.");
evt.ports[0].onmessage = function(e) {
is(e.data, "Hello from the iframe!", "Message reiceved from the iframe!");
SimpleTest.finish();
}
}
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
SimpleTest.waitForExplicitFinish();
</script>
</body>

Просмотреть файл

@ -229,7 +229,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
runTests();
</script>
</body>
</html>

Просмотреть файл

@ -105,7 +105,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
runTests();
</script>
</body>
</html>

Просмотреть файл

@ -117,7 +117,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
runTests();
</script>
</body>
</html>

Просмотреть файл

@ -54,7 +54,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
runTests();
</script>
</body>
</html>

Просмотреть файл

@ -37,11 +37,8 @@ NfcCallback.prototype = {
_requestId: null,
_createPromise: function _createPromise() {
this.promise = this.createPromise((aResolve, aReject) => {
this._requestId = btoa(this.getPromiseResolverId({
resolve: aResolve,
reject: aReject
}));
this.promise = this.createPromiseWithId((aResolverId) => {
this._requestId = btoa(aResolverId);
});
},

Просмотреть файл

@ -104,10 +104,9 @@ PresentationDeviceInfoManager.prototype = {
getAll: function() {
log("getAll");
let self = this;
return this.createPromise(function(aResolve, aReject) {
let resolverId = self.getPromiseResolverId({ resolve: aResolve, reject: aReject });
return this.createPromiseWithId(function(aResolverId) {
cpmm.sendAsyncMessage("PresentationDeviceInfoManager:GetAll", {
requestId: resolverId,
requestId: aResolverId,
});
});
},

Просмотреть файл

@ -92,6 +92,12 @@ namespace mozilla {
namespace dom {
namespace quota {
// We want profiles to be platform-independent so we always need to replace
// the same characters on every platform. Windows has the most extensive set
// of illegal characters so we use its FILE_ILLEGAL_CHARACTERS and
// FILE_PATH_SEPARATOR.
const char QuotaManager::kReplaceChars[] = CONTROL_CHARACTERS "/:*?\"<>|\\";
namespace {
/*******************************************************************************
@ -1075,19 +1081,14 @@ public:
void
SanitizeOriginString(nsCString& aOrigin)
{
// We want profiles to be platform-independent so we always need to replace
// the same characters on every platform. Windows has the most extensive set
// of illegal characters so we use its FILE_ILLEGAL_CHARACTERS and
// FILE_PATH_SEPARATOR.
static const char kReplaceChars[] = CONTROL_CHARACTERS "/:*?\"<>|\\";
#ifdef XP_WIN
NS_ASSERTION(!strcmp(kReplaceChars,
NS_ASSERTION(!strcmp(QuotaManager::kReplaceChars,
FILE_ILLEGAL_CHARACTERS FILE_PATH_SEPARATOR),
"Illegal file characters have changed!");
#endif
aOrigin.ReplaceChar(kReplaceChars, '+');
aOrigin.ReplaceChar(QuotaManager::kReplaceChars, '+');
}
bool

Просмотреть файл

@ -124,6 +124,8 @@ public:
NS_DECL_NSIQUOTAMANAGER
NS_DECL_NSIOBSERVER
static const char kReplaceChars[];
// Returns a non-owning reference.
static QuotaManager*
GetOrCreate();

Просмотреть файл

@ -46,9 +46,8 @@ RequestSyncManager.prototype = {
sendMessage: function(aMsg, aObj) {
let self = this;
return this.createPromise(function(aResolve, aReject) {
aObj.requestID =
self.getPromiseResolverId({ resolve: aResolve, reject: aReject });
return this.createPromiseWithId(function(aResolverId) {
aObj.requestID = aResolverId;
cpmm.sendAsyncMessage(aMsg, aObj, null,
self._window.document.nodePrincipal);
});

Просмотреть файл

@ -68,9 +68,8 @@ RequestSyncScheduler.prototype = {
sendMessage: function(aMsg, aObj) {
let self = this;
return this.createPromise(function(aResolve, aReject) {
aObj.requestID =
self.getPromiseResolverId({ resolve: aResolve, reject: aReject });
return this.createPromiseWithId(function(aResolverId) {
aObj.requestID = aResolverId;
cpmm.sendAsyncMessage(aMsg, aObj, null,
self._window.document.nodePrincipal);
});

Просмотреть файл

@ -146,18 +146,6 @@ function ResourceStatsManager() {
ResourceStatsManager.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
_getPromise: function(aCallback) {
let self = this;
return this.createPromise(function(aResolve, aReject) {
let resolverId = self.getPromiseResolverId({
resolve: aResolve,
reject: aReject
});
aCallback(resolverId);
});
},
// Check time range.
_checkTimeRange: function(aStart, aEnd) {
if (DEBUG) {
@ -180,7 +168,7 @@ ResourceStatsManager.prototype = {
// Create Promise.
let self = this;
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.cpmm.sendAsyncMessage("ResourceStats:GetStats", {
resolverId: aResolverId,
type: self.type,
@ -198,7 +186,7 @@ ResourceStatsManager.prototype = {
// Create Promise.
let self = this;
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.cpmm.sendAsyncMessage("ResourceStats:ClearStats", {
resolverId: aResolverId,
type: self.type,
@ -213,7 +201,7 @@ ResourceStatsManager.prototype = {
clearAllStats: function() {
// Create Promise.
let self = this;
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.cpmm.sendAsyncMessage("ResourceStats:ClearAllStats", {
resolverId: aResolverId,
type: self.type,
@ -239,7 +227,7 @@ ResourceStatsManager.prototype = {
// Create Promise.
let self = this;
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.cpmm.sendAsyncMessage("ResourceStats:AddAlarm", {
resolverId: aResolverId,
type: self.type,
@ -255,7 +243,7 @@ ResourceStatsManager.prototype = {
getAlarms: function(aStatsOptions) {
// Create Promise.
let self = this;
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.cpmm.sendAsyncMessage("ResourceStats:GetAlarms", {
resolverId: aResolverId,
type: self.type,
@ -268,7 +256,7 @@ ResourceStatsManager.prototype = {
removeAlarm: function(aAlarmId) {
// Create Promise.
let self = this;
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.cpmm.sendAsyncMessage("ResourceStats:RemoveAlarm", {
resolverId: aResolverId,
type: self.type,
@ -281,7 +269,7 @@ ResourceStatsManager.prototype = {
removeAllAlarms: function() {
// Create Promise.
let self = this;
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.cpmm.sendAsyncMessage("ResourceStats:RemoveAllAlarms", {
resolverId: aResolverId,
type: self.type,
@ -293,7 +281,7 @@ ResourceStatsManager.prototype = {
getAvailableComponents: function() {
// Create Promise.
let self = this;
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.cpmm.sendAsyncMessage("ResourceStats:GetComponents", {
resolverId: aResolverId,
type: self.type,

Просмотреть файл

@ -62,12 +62,8 @@ PromiseHelpersSubclass.prototype = {
callback(resolverId);
};
return this.createPromise((resolve, reject) => {
let resolverId = this.getPromiseResolverId({
resolve: resolve,
reject: reject
});
ctxCallback(resolverId);
return this.createPromiseWithId((aResolverId) => {
ctxCallback(aResolverId);
});
},

Просмотреть файл

@ -225,7 +225,7 @@ SystemUpdateManager.prototype = {
},
getProviders: function() {
return this._sendPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
cpmm.sendAsyncMessage("SystemUpdate:GetProviders", {
requestId: aResolverId,
});
@ -233,7 +233,7 @@ SystemUpdateManager.prototype = {
},
getActiveProvider: function() {
return this._sendPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
cpmm.sendAsyncMessage("SystemUpdate:GetActiveProvider", {
requestId: aResolverId,
});
@ -241,21 +241,12 @@ SystemUpdateManager.prototype = {
},
setActiveProvider: function(aUuid) {
return this._sendPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
cpmm.sendAsyncMessage("SystemUpdate:SetActiveProvider", {
requestId: aResolverId,
uuid: aUuid
});
});
},
_sendPromise: function(aCallback) {
let self = this;
return this.createPromise(function(aResolve, aReject) {
let resolverId = self.getPromiseResolverId({resolve: aResolve,
reject: aReject});
aCallback(resolverId);
});
}
};

Просмотреть файл

@ -40,19 +40,6 @@ TetheringManager.prototype = {
this.initDOMRequestHelper(aWindow, messages);
},
_getPromise: function(aCallback) {
let self = this;
return this.createPromise(function(aResolve, aReject) {
let resolverId = self.getPromiseResolverId({
resolve: aResolve,
reject: aReject
});
aCallback(resolverId);
});
},
// TODO : aMessage format may be different after supporting bt/usb.
// for now, use wifi format first.
receiveMessage: function(aMessage) {
@ -77,7 +64,7 @@ TetheringManager.prototype = {
let self = this;
switch (aType) {
case TETHERING_TYPE_WIFI:
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
let data = { resolverId: aResolverId, enabled: aEnabled, config: aConfig };
cpmm.sendAsyncMessage("WifiManager:setWifiTethering", { data: data});
});
@ -85,7 +72,7 @@ TetheringManager.prototype = {
case TETHERING_TYPE_USB:
default:
debug("tethering type(" + aType + ") doesn't support");
return this._getPromise(function(aResolverId) {
return this.createPromiseWithId(function(aResolverId) {
self.takePromiseResolver(aResolverId).reject();
});
}

Просмотреть файл

@ -7,8 +7,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/#channel-messaging
*/
[Constructor, Func="MessageChannel::Enabled",
Exposed=(Window,Worker)]
[Constructor, Exposed=(Window,Worker)]
interface MessageChannel {
readonly attribute MessagePort port1;
readonly attribute MessagePort port2;

Просмотреть файл

@ -202,7 +202,6 @@
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.interception.enabled", true],
["dom.messageChannel.enabled", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.caches.testing.enabled", true],

Просмотреть файл

@ -1,9 +1,9 @@
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == empty-1.xul empty-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
skip-if((B2G&&browserIsRemote)||Mulet) != empty-2.xul empty-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
# There is no way to simulate an autocomplete textbox in windows XP/Vista/7 default theme using CSS.
# There is no way to simulate an autocomplete textbox in windows XP/Vista/7/8/10 default theme using CSS.
# Therefore, the equlity tests below should be marked as failing.
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == autocomplete-1.xul autocomplete-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == emptyautocomplete-1.xul emptyautocomplete-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == autocomplete-1.xul autocomplete-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == emptyautocomplete-1.xul emptyautocomplete-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
skip-if((B2G&&browserIsRemote)||Mulet) != emptymultiline-1.xul emptymultiline-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == emptymultiline-2.xul emptymultiline-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == emptytextbox-1.xul emptytextbox-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
@ -15,10 +15,10 @@ fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == emptytextbox-5.
# Therefore, the equlity tests below should be marked as failing.
skip-if((B2G&&browserIsRemote)||Mulet) != number-1.xul number-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
skip-if((B2G&&browserIsRemote)||Mulet) != number-2.xul number-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == number-3.xul number-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == number-3.xul number-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
skip-if((B2G&&browserIsRemote)||Mulet) != number-4.xul number-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == number-5.xul number-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == numberwithvalue-1.xul numberwithvalue-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == number-5.xul number-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == numberwithvalue-1.xul numberwithvalue-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == passwd-1.xul passwd-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == passwd-2.xul passwd-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
skip-if((B2G&&browserIsRemote)||Mulet) != passwd-3.xul passwd-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
@ -26,4 +26,4 @@ fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == plain-1.xul pla
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == textbox-1.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
skip-if((B2G&&browserIsRemote)||Mulet) != textbox-disabled.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
# Read-only textboxes look like normal textboxes in windows Vista/7 default theme
fails-if(windowsDefaultTheme&&/^Windows\x20NT\x206\.[012]/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) != textbox-readonly.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) != textbox-readonly.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop

Просмотреть файл

@ -2083,9 +2083,9 @@ UpdatePluginWindowState(uint64_t aId)
bool shouldComposePlugin = !!lts.mRoot &&
!!lts.mRoot->GetParent();
bool shouldHidePlugin = (!lts.mRoot ||
!lts.mRoot->GetParent()) &&
!lts.mUpdatedPluginDataAvailable;
bool shouldHidePlugin = !lts.mRoot ||
!lts.mRoot->GetParent();
if (shouldComposePlugin) {
if (!lts.mPluginData.Length()) {
// We will pass through here in cases where the previous shadow layer

Просмотреть файл

@ -188,7 +188,10 @@ static void ImageBridgeShutdownStep1(ReentrantMonitor *aBarrier, bool *aDone)
InfallibleTArray<PTextureChild*> textures;
sImageBridgeChildSingleton->ManagedPTextureChild(textures);
for (int i = textures.Length() - 1; i >= 0; --i) {
TextureClient::AsTextureClient(textures[i])->ForceRemove();
TextureClient* client = TextureClient::AsTextureClient(textures[i]);
if (client) {
client->ForceRemove();
}
}
sImageBridgeChildSingleton->SendWillStop();
sImageBridgeChildSingleton->MarkShutDown();

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше