merge b2g-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2014-12-04 17:03:38 +01:00
commit fa429030ad
42 changed files with 408 additions and 229 deletions

View File

@ -15,6 +15,7 @@ pref("browser.chromeURL", "chrome://b2g/content/");
// so that it can't be set a just a string.
// data: url is a workaround this.
pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=chrome://b2g/content/shell.html");
pref("b2g.is_mulet", true);
// Prevent having the firstrun page
pref("startup.homepage_welcome_url", "");
pref("browser.shell.checkDefaultBrowser", false);

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -19,13 +19,13 @@
<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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="8b13bfc1d7d25cee4de55f332654fdba25b8460b"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -19,13 +19,13 @@
<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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="8b13bfc1d7d25cee4de55f332654fdba25b8460b"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "d7e815eb184c843a9d7e5784e99d5e39a31c59da",
"revision": "9a69c3f26819cc3ee8060307289ca8712d0c5e22",
"repo_path": "integration/gaia-central"
}

View File

@ -17,11 +17,11 @@
<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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

View File

@ -15,7 +15,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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -17,12 +17,12 @@
<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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -411,8 +411,13 @@ this.PermissionsTable = { geolocation: {
app: DENY_ACTION,
trusted: DENY_ACTION,
privileged: DENY_ACTION,
certified: ALLOW_ACTION,
access: ["read", "write"]
certified: ALLOW_ACTION
},
"nfc-share": {
app: DENY_ACTION,
trusted: DENY_ACTION,
privileged: DENY_ACTION,
certified: ALLOW_ACTION
},
"nfc-manager": {
app: DENY_ACTION,

View File

@ -1414,6 +1414,19 @@ Navigator::GetFeature(const nsAString& aName, ErrorResult& aRv)
} // hardware.memory
#endif
p->MaybeResolve(JS::UndefinedHandleValue);
return p.forget();
}
already_AddRefed<Promise>
Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
nsRefPtr<Promise> p = Promise::Create(go, aRv);
if (aRv.Failed()) {
return nullptr;
}
// Hardcoded manifest features. Some are still b2g specific.
const char manifestFeatures[][64] = {
"manifest.origin"
@ -1432,19 +1445,6 @@ Navigator::GetFeature(const nsAString& aName, ErrorResult& aRv)
}
}
p->MaybeResolve(JS::UndefinedHandleValue);
return p.forget();
}
already_AddRefed<Promise>
Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
nsRefPtr<Promise> p = Promise::Create(go, aRv);
if (aRv.Failed()) {
return nullptr;
}
NS_NAMED_LITERAL_STRING(apiWindowPrefix, "api.window.");
if (StringBeginsWith(aName, apiWindowPrefix)) {
const nsAString& featureName = Substring(aName, apiWindowPrefix.Length());

View File

@ -52,6 +52,7 @@
#include "nsIPermissionManager.h"
#include "nsISHistory.h"
#include "nsNullPrincipal.h"
#include "nsIScriptError.h"
#include "nsLayoutUtils.h"
#include "nsView.h"
@ -1762,6 +1763,30 @@ nsFrameLoader::MaybeCreateDocShell()
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
/* allowDelayedLoad = */ true,
/* aRunInGlobalScope */ true);
// For inproc frames, set the docshell properties.
nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
nsAutoString name;
if (mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
item->SetName(name);
}
mDocShell->SetFullscreenAllowed(
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen));
bool isPrivate = mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing);
if (isPrivate) {
bool nonBlank;
mDocShell->GetHasLoadedNonBlankURI(&nonBlank);
if (nonBlank) {
nsContentUtils::ReportToConsoleNonLocalized(
NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("mozprivatebrowsing"),
nullptr);
} else {
nsCOMPtr<nsILoadContext> context = do_GetInterface(mDocShell);
context->SetUsePrivateBrowsing(true);
}
}
}
return NS_OK;

View File

@ -51,18 +51,27 @@ function testNotSupported() {
ok(typeof tv === 'undefined', "Resolve the Promise with undefined value (hardware.tv)");
runNextTest();
},function(tv) {
ok(false, "The Promise should not be rejected")
ok(false, "The Promise should not be rejected");
});
}
function testNotSupportedManifest() {
navigator.getFeature("manifest.origin").then(function(feature) {
ok(typeof feature == 'undefined', "manifest.* resolves with undefined on getFeature");
runNextTest();
}, function() {
ok(false, "The Promise should not be rejected");
});
}
function createManifestTest(aFeature) {
return function() {
var res;
navigator.getFeature(aFeature).then(function(res) {
navigator.hasFeature(aFeature).then(function(res) {
ok(res === true, "Resolve the Promise with 'true' for " + aFeature);
runNextTest();
},function(tv) {
ok(false, "The Promise should not be rejected")
}, function(tv) {
ok(false, "The Promise should not be rejected");
});
}
}
@ -70,6 +79,7 @@ function createManifestTest(aFeature) {
var currentTest = -1;
var tests = [
testNotSupported,
testNotSupportedManifest,
testSupported,
createManifestTest("manifest.origin"),
createManifestTest("manifest.redirects")
@ -90,6 +100,7 @@ SpecialPowers.pushPermissions([
{type: "feature-detection", allow: 1, context: document}
], function() {
ok('getFeature' in navigator, "navigator.getFeature should exist");
ok('hasFeature' in navigator, "navigator.hasFeature should exist");
// B2G specific manifest features.
// Touching navigator before pushPermissions makes it fail.
if (!navigator.userAgent.contains("Android") &&

View File

@ -52,14 +52,5 @@ if (!('BrowserElementIsPreloaded' in this)) {
var BrowserElementIsReady = true;
let infos = sendSyncMessage('browser-element-api:call',
{ 'msg_name': 'hello' })[0];
docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name;
docShell.setFullscreenAllowed(infos.fullscreenAllowed);
if (infos.isPrivate) {
if (docShell.hasLoadedNonBlankURI) {
Cu.reportError("We should not switch to Private Browsing after loading a document.");
} else {
docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
}
}
sendAsyncMessage('browser-element-api:call', { 'msg_name': 'hello' });

View File

@ -325,14 +325,6 @@ BrowserElementParent.prototype = {
this._domRequestReady = true;
this._runPendingAPICall();
}
return {
name: this._frameElement.getAttribute('name'),
fullscreenAllowed:
this._frameElement.hasAttribute('allowfullscreen') ||
this._frameElement.hasAttribute('mozallowfullscreen'),
isPrivate: this._frameElement.hasAttribute('mozprivatebrowsing')
};
},
_fireCtxMenuEvent: function(data) {

View File

@ -15,10 +15,6 @@ iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
}, 0);
}, 0);
}
else {
// Pass the message up to our parent.
alert(e.detail.message);
}
});
document.body.appendChild(iframe);

View File

@ -69,6 +69,13 @@ union MaybeNativeKeyBinding
void_t;
};
struct ShowInfo
{
nsString name;
bool fullscreenAllowed;
bool isPrivate;
};
prio(normal upto urgent) intr protocol PBrowser
{
manager PContent or PContentBridge;
@ -411,6 +418,7 @@ child:
* point.
*/
Show(nsIntSize size,
ShowInfo info,
ScrollingBehavior scrolling,
TextureFactoryIdentifier textureFactoryIdentifier,
uint64_t layersId,

View File

@ -90,6 +90,7 @@
#include "nsIAppsService.h"
#include "nsNetUtil.h"
#include "nsIPermissionManager.h"
#include "nsIScriptError.h"
#define BROWSER_ELEMENT_CHILD_SCRIPT \
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
@ -1881,10 +1882,36 @@ TabChild::DoFakeShow(const ScrollingBehavior& aScrolling,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame)
{
RecvShow(nsIntSize(0, 0), aScrolling, aTextureFactoryIdentifier, aLayersId, aRenderFrame);
ShowInfo info(EmptyString(), false, false);
RecvShow(nsIntSize(0, 0), info, aScrolling, aTextureFactoryIdentifier, aLayersId, aRenderFrame);
mDidFakeShow = true;
}
void
TabChild::ApplyShowInfo(const ShowInfo& aInfo)
{
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
if (docShell) {
nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
item->SetName(aInfo.name());
docShell->SetFullscreenAllowed(aInfo.fullscreenAllowed());
if (aInfo.isPrivate()) {
bool nonBlank;
docShell->GetHasLoadedNonBlankURI(&nonBlank);
if (nonBlank) {
nsContentUtils::ReportToConsoleNonLocalized(
NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("mozprivatebrowsing"),
nullptr);
} else {
nsCOMPtr<nsILoadContext> context = do_GetInterface(docShell);
context->SetUsePrivateBrowsing(true);
}
}
}
}
#ifdef MOZ_WIDGET_GONK
void
TabChild::MaybeRequestPreinitCamera()
@ -1945,6 +1972,7 @@ TabChild::MaybeRequestPreinitCamera()
bool
TabChild::RecvShow(const nsIntSize& aSize,
const ShowInfo& aInfo,
const ScrollingBehavior& aScrolling,
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
@ -1953,6 +1981,7 @@ TabChild::RecvShow(const nsIntSize& aSize,
MOZ_ASSERT((!mDidFakeShow && aRenderFrame) || (mDidFakeShow && !aRenderFrame));
if (mDidFakeShow) {
ApplyShowInfo(aInfo);
return true;
}
@ -1976,7 +2005,9 @@ TabChild::RecvShow(const nsIntSize& aSize,
MaybeRequestPreinitCamera();
#endif
return InitTabChildGlobal();
bool res = InitTabChildGlobal();
ApplyShowInfo(aInfo);
return res;
}
bool

View File

@ -317,6 +317,7 @@ public:
const FileDescriptor& aFileDescriptor)
MOZ_OVERRIDE;
virtual bool RecvShow(const nsIntSize& aSize,
const ShowInfo& aInfo,
const ScrollingBehavior& aScrolling,
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
@ -552,6 +553,8 @@ private:
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame);
void ApplyShowInfo(const ShowInfo& aInfo);
// These methods are used for tracking synthetic mouse events
// dispatched for compatibility. On each touch event, we
// UpdateTapState(). If we've detected that the current gesture

View File

@ -600,7 +600,19 @@ TabParent::Show(const nsIntSize& size)
unused << SendPRenderFrameConstructor(renderFrame);
}
}
unused << SendShow(size, scrolling, textureFactoryIdentifier, layersId, renderFrame);
ShowInfo info(EmptyString(), false, false);
if (mFrameElement) {
nsAutoString name;
mFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
bool allowFullscreen =
mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen);
bool isPrivate = mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing);
info = ShowInfo(name, allowFullscreen, isPrivate);
}
unused << SendShow(size, info, scrolling, textureFactoryIdentifier, layersId, renderFrame);
}
void

View File

@ -131,21 +131,6 @@ NfcContentHelper.prototype = {
return encodedRecords;
},
// NFC interface:
checkSessionToken: function checkSessionToken(sessionToken, isP2P) {
if (sessionToken == null) {
throw Components.Exception("No session token!",
Cr.NS_ERROR_UNEXPECTED);
return false;
}
// Report session to Nfc.js only.
let val = cpmm.sendSyncMessage("NFC:CheckSessionToken", {
sessionToken: sessionToken,
isP2P: isP2P
});
return (val[0] === NFC.NFC_GECKO_SUCCESS);
},
// NFCTag interface
readNDEF: function readNDEF(sessionToken, callback) {
let requestId = callback.getCallbackId();

View File

@ -54,25 +54,21 @@ const NFC_CONTRACTID = "@mozilla.org/nfc;1";
const NFC_CID =
Components.ID("{2ff24790-5e74-11e1-b86c-0800200c9a66}");
const NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES = [
"NFC:AddEventListener"
];
const NFC_IPC_MSG_NAMES = [
"NFC:CheckSessionToken",
"NFC:AddEventListener",
"NFC:QueryInfo"
];
const NFC_IPC_READ_PERM_MSG_NAMES = [
const NFC_IPC_NFC_PERM_MSG_NAMES = [
"NFC:ReadNDEF",
"NFC:Connect",
"NFC:Close",
];
const NFC_IPC_WRITE_PERM_MSG_NAMES = [
"NFC:WriteNDEF",
"NFC:MakeReadOnly",
"NFC:Format",
];
const NFC_IPC_NFC_SHARE_PERM_MSG_NAMES = [
"NFC:SendFile",
"NFC:RegisterPeerReadyTarget",
"NFC:UnregisterPeerReadyTarget"
@ -131,19 +127,15 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
_registerMessageListeners: function _registerMessageListeners() {
ppmm.addMessageListener("child-process-shutdown", this);
for (let message of NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES) {
ppmm.addMessageListener(message, this);
}
for (let message of NFC_IPC_MSG_NAMES) {
ppmm.addMessageListener(message, this);
}
for (let message of NFC_IPC_READ_PERM_MSG_NAMES) {
for (let message of NFC_IPC_NFC_PERM_MSG_NAMES) {
ppmm.addMessageListener(message, this);
}
for (let message of NFC_IPC_WRITE_PERM_MSG_NAMES) {
for (let message of NFC_IPC_NFC_SHARE_PERM_MSG_NAMES) {
ppmm.addMessageListener(message, this);
}
@ -155,19 +147,15 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
_unregisterMessageListeners: function _unregisterMessageListeners() {
ppmm.removeMessageListener("child-process-shutdown", this);
for (let message of NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES) {
ppmm.removeMessageListener(message, this);
}
for (let message of NFC_IPC_MSG_NAMES) {
ppmm.removeMessageListener(message, this);
}
for (let message of NFC_IPC_READ_PERM_MSG_NAMES) {
for (let message of NFC_IPC_NFC_PERM_MSG_NAMES) {
ppmm.removeMessageListener(message, this);
}
for (let message of NFC_IPC_WRITE_PERM_MSG_NAMES) {
for (let message of NFC_IPC_NFC_SHARE_PERM_MSG_NAMES) {
ppmm.removeMessageListener(message, this);
}
@ -290,19 +278,18 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
return null;
}
if (NFC_IPC_MSG_NAMES.indexOf(message.name) != -1 ||
NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES.indexOf(message.name) != -1 ) {
if (NFC_IPC_MSG_NAMES.indexOf(message.name) != -1) {
// Do nothing.
} else if (NFC_IPC_READ_PERM_MSG_NAMES.indexOf(message.name) != -1) {
if (!message.target.assertPermission("nfc-read")) {
debug("Nfc message " + message.name +
" from a content process with no 'nfc-read' privileges.");
} else if (NFC_IPC_NFC_PERM_MSG_NAMES.indexOf(message.name) != -1) {
if (!message.target.assertPermission("nfc")) {
debug("Nfc Peer message " + message.name +
" from a content process with no 'nfc' privileges.");
return null;
}
} else if (NFC_IPC_WRITE_PERM_MSG_NAMES.indexOf(message.name) != -1) {
if (!message.target.assertPermission("nfc-write")) {
} else if (NFC_IPC_NFC_SHARE_PERM_MSG_NAMES.indexOf(message.name) != -1) {
if (!message.target.assertPermission("nfc-share")) {
debug("Nfc Peer message " + message.name +
" from a content process with no 'nfc-write' privileges.");
" from a content process with no 'nfc-share' privileges.");
return null;
}
} else if (NFC_IPC_MANAGER_PERM_MSG_NAMES.indexOf(message.name) != -1) {
@ -320,11 +307,6 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
case "NFC:AddEventListener":
this.addEventListener(message.target);
return null;
case "NFC:CheckSessionToken":
let sessionToken = message.data.sessionToken;
return SessionHelper.isValidToken(sessionToken, message.data.isP2P) ?
NFC.NFC_GECKO_SUCCESS :
NFC.NFC_GECKO_ERROR_BAD_SESSION_TOKEN;
case "NFC:RegisterPeerReadyTarget":
this.registerPeerReadyTarget(message.target, message.data.appId);
return null;
@ -341,7 +323,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
// Upon receiving the status of sendFile operation, send the response
// to appropriate content process.
message.data.type = "NotifySendFileStatusResponse";
if (message.data.status !== NFC.NFC_SUCCESS) {
if (message.data.status) {
message.data.errorMsg =
this.nfc.getErrorMessage(NFC.NFC_GECKO_ERROR_SEND_FILE_FAILED);
}
@ -421,17 +403,6 @@ let SessionHelper = {
isP2PSession: function isP2PSession(id) {
return (this.tokenMap[id] != null) && this.tokenMap[id].isP2P;
},
isValidToken: function isValidToken(token, isP2P) {
for (let id in this.tokenMap) {
if ((this.tokenMap[id].token == token) &&
(this.tokenMap[id].isP2P == isP2P)) {
return true;
}
}
return false;
}
};
@ -511,8 +482,7 @@ Nfc.prototype = {
},
getErrorMessage: function getErrorMessage(errorCode) {
return NFC.NFC_ERROR_MSG[errorCode] ||
NFC.NFC_ERROR_MSG[NFC.NFC_GECKO_ERROR_GENERIC_FAILURE];
return NFC.NFC_ERROR_MSG[errorCode];
},
/**

View File

@ -23,17 +23,12 @@ this.DEBUG_CONTENT_HELPER = DEBUG_ALL || false;
this.DEBUG_NFC = DEBUG_ALL || false;
// Gecko specific error codes
this.NFC_GECKO_SUCCESS = 0;
this.NFC_GECKO_ERROR_GENERIC_FAILURE = 1;
this.NFC_GECKO_ERROR_P2P_REG_INVALID = 2;
this.NFC_GECKO_ERROR_SEND_FILE_FAILED = 3;
this.NFC_GECKO_ERROR_BAD_SESSION_TOKEN = 4;
this.NFC_GECKO_ERROR_P2P_REG_INVALID = 1;
this.NFC_GECKO_ERROR_SEND_FILE_FAILED = 2;
this.NFC_ERROR_MSG = {};
this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_GENERIC_FAILURE] = "NfcGenericFailureError";
this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_P2P_REG_INVALID] = "NfcP2PRegistrationInvalid";
this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_SEND_FILE_FAILED] = "NfcSendFileFailed";
this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_BAD_SESSION_TOKEN] = "NfcBadSessionToken";
this.NFC_RF_STATE_IDLE = "idle";
this.NFC_RF_STATE_LISTEN = "listen";

View File

@ -87,13 +87,11 @@ interface nsINfcRequestCallback : nsISupports
void notifyError(in DOMString errorMsg);
};
[scriptable, uuid(bcf214de-885b-43e6-9e53-9b7d880e1633)]
[scriptable, uuid(c5fdf956-735e-45d3-aa25-3a871bd3e2f8)]
interface nsINfcContentHelper : nsISupports
{
void init(in nsIDOMWindow window);
boolean checkSessionToken(in DOMString sessionToken, in boolean isP2P);
/**
* Read current NDEF data on the tag.
*

View File

@ -332,23 +332,6 @@ MozNFCImpl.prototype = {
return callback.promise;
},
_createNFCPeer: function _createNFCPeer(sessionToken) {
let peer = new MozNFCPeerImpl(this._window, sessionToken);
return this._window.MozNFCPeer._create(this._window, peer);
},
getNFCPeer: function getNFCPeer(sessionToken) {
if (!sessionToken || !this._nfcContentHelper.checkSessionToken(sessionToken, true)) {
return null;
}
if (!this.nfcPeer || this.nfcPeer.session != sessionToken) {
this.nfcPeer = this._createNFCPeer(sessionToken);
}
return this.nfcPeer;
},
defineEventHandlerGetterSetter: function defineEventHandlerGetterSetter(name) {
Object.defineProperty(this, name, {
get: function get() {
@ -389,7 +372,7 @@ MozNFCImpl.prototype = {
return;
}
if (!this.checkPermissions(["nfc-read", "nfc-write"])) {
if (!this.checkPermissions(["nfc"])) {
return;
}
@ -426,7 +409,7 @@ MozNFCImpl.prototype = {
return;
}
if (!this.checkPermissions(["nfc-read", "nfc-write"])) {
if (!this.checkPermissions(["nfc"])) {
return;
}
@ -461,14 +444,16 @@ MozNFCImpl.prototype = {
return;
}
if (!this.checkPermissions(["nfc-write"])) {
let perm = isPeerReady ? ["nfc-share"] : ["nfc"];
if (!this.checkPermissions(perm)) {
return;
}
this.eventService.addSystemEventListener(this._window, "visibilitychange",
this, /* useCapture */false);
this.nfcPeer = this._createNFCPeer(sessionToken);
let peerImpl = new MozNFCPeerImpl(this._window, sessionToken);
this.nfcPeer = this._window.MozNFCPeer._create(this._window, peerImpl)
let eventData = { "peer": this.nfcPeer };
let type = (isPeerReady) ? "peerready" : "peerfound";
@ -483,7 +468,7 @@ MozNFCImpl.prototype = {
return;
}
if (!this.checkPermissions(["nfc-write"])) {
if (!this.checkPermissions(["nfc", "nfc-share"])) {
return;
}

View File

@ -146,11 +146,11 @@ let tests = [
/**
* nfc-manager for mozNfc.checkP2PRegistration(manifestUrl)
* -> "NFC:CheckP2PRegistration" IPC
* nfc-write to set/unset onpeerready
* nfc-share to set/unset onpeerready
* -> "NFC:RegisterPeerTarget", "NFC:UnregisterPeerTarget" IPC
*/
SpecialPowers.pushPermissions(
[
{'type': 'nfc-manager', 'allow': true, context: document},
{'type': 'nfc-write', 'allow': true, context: document}
{'type': 'nfc-share', 'allow': true, context: document}
], runTests);

View File

@ -146,11 +146,11 @@ let tests = [
/**
* nfc-manager for mozNfc.checkP2PRegistration(manifestUrl)
* -> "NFC:CheckP2PRegistration" IPC
* nfc-write to set/unset onpeerready
* nfc-share to set/unset onpeerready
* -> "NFC:RegisterPeerTarget", "NFC:UnregisterPeerTarget" IPC
*/
SpecialPowers.pushPermissions(
[
{'type': 'nfc-manager', 'allow': true, context: document},
{'type': 'nfc-write', 'allow': true, context: document}
{'type': 'nfc-share', 'allow': true, context: document}
], runTests);

View File

@ -66,10 +66,7 @@ function testPeerReady() {
function testGetNFCPeer() {
sysMsgHelper.waitForTechDiscovered(function (msg) {
let peer = nfc.getNFCPeer(msg.sessionToken);
ok(peer instanceof MozNFCPeer, "Should get a NFCPeer object.");
let peer1 = nfc.getNFCPeer(msg.sessionToken);
ok(peer == peer1, "Should get the same MozNFCPeer object");
ok(msg.peer instanceof MozNFCPeer, "Should get a NFCPeer object.");
NCI.deactivate().then(() => toggleNFC(false)).then(runNextTest);
});
@ -181,24 +178,17 @@ function testPeerShouldThrow() {
.then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
}
function testPeerInvalidToken() {
log("testPeerInvalidToken");
let peer = nfc.getNFCPeer("fakeSessionToken");
is(peer, null, "NFCPeer should be null on wrong session token");
runNextTest();
}
let tests = [
testPeerReady,
testGetNFCPeer,
testCheckP2PRegFailure,
testPeerLostShouldBeCalled,
testPeerLostShouldNotBeCalled,
testPeerShouldThrow,
testPeerInvalidToken
testPeerShouldThrow
];
SpecialPowers.pushPermissions(
[{"type": "nfc-manager", "allow": true, context: document},
{"type": "nfc-write", "allow": true, context: document}], runTests);
{"type": "nfc", "allow": true, context: document},
{"type": "nfc-share", "allow": true, context: document}], runTests);

View File

@ -8,8 +8,7 @@ let MANIFEST_URL = "app://system.gaiamobile.org/manifest.webapp";
function sendFile(msg) {
log("sendFile msg="+JSON.stringify(msg));
let peer = nfc.getNFCPeer(msg.sessionToken);
ok(peer instanceof MozNFCPeer, "should get a MozNFCPeer");
ok(msg.peer instanceof MozNFCPeer, "should get a MozNFCPeer");
ok(msg.blob instanceof Blob, "should get a Blob");
nfc.peerready = null;

View File

@ -6,13 +6,12 @@ MARIONETTE_HEAD_JS = "head.js";
let url = "https://www.example.com";
function sendNDEF(techType, sessionToken) {
function sendNDEF(techType, peer) {
let tnf = NDEF.TNF_WELL_KNOWN;
let type = new Uint8Array(NfcUtils.fromUTF8("U"));
let payload = new Uint8Array(NfcUtils.fromUTF8(url));
let ndef = [new MozNDEFRecord({tnf: tnf, type: type, payload: payload})];
let peer = window.navigator.mozNfc.getNFCPeer(sessionToken);
let promise = peer.sendNDEF(ndef);
promise.then(() => {
log("Successfully sent NDEF message");
@ -35,7 +34,7 @@ function handleTechnologyDiscoveredRE0(msg) {
is(msg.type, "techDiscovered", "check for correct message type");
let index = msg.techList.indexOf("P2P");
isnot(index, -1, "check for \'P2P\' in tech list");
sendNDEF(msg.techList[index], msg.sessionToken);
sendNDEF(msg.techList[index], msg.peer);
}
function testOnPeerReadyRE0() {

View File

@ -130,7 +130,7 @@ SystemWorkerManager::Shutdown()
mWifiWorker = nullptr;
if (mKeyStore) {
mKeyStore->CloseSocket();
mKeyStore->Shutdown();
mKeyStore = nullptr;
}

View File

@ -28,12 +28,6 @@ enum NfcErrorMessage {
[NoInterfaceObject]
interface MozNFCManager {
/**
* Returns MozNFCPeer object or null in case of invalid sessionToken
*/
[CheckPermissions="nfc-manager"]
MozNFCPeer? getNFCPeer(DOMString sessionToken);
/**
* API to check if the given application's manifest
* URL is registered with the Chrome Process or not.
@ -78,7 +72,7 @@ interface MozNFCManager {
[JSImplementation="@mozilla.org/navigatorNfc;1",
NavigatorProperty="mozNfc",
Func="Navigator::HasNFCSupport",
CheckPermissions="nfc-read nfc-write",
CheckPermissions="nfc nfc-share",
AvailableIn="CertifiedApps"]
interface MozNFC : EventTarget {
/**
@ -86,32 +80,28 @@ interface MozNFC : EventTarget {
* to share data to the NFCPeer object by calling mozNFC.notifyUserAcceptedP2P.
* The event will be type of NFCPeerEvent.
*/
[CheckPermissions="nfc-write"]
[CheckPermissions="nfc-share"]
attribute EventHandler onpeerready;
/**
* This event will be fired when a NFCPeer is detected.
*/
[CheckPermissions="nfc-write"]
attribute EventHandler onpeerfound;
/**
* This event will be fired when NFCPeer, earlier detected in onpeerready
* or onpeerfound, moves out of range.
*/
[CheckPermissions="nfc-write"]
attribute EventHandler onpeerlost;
/**
* Ths event will be fired when a NFCTag is detected.
*/
[CheckPermissions="nfc-read nfc-write"]
attribute EventHandler ontagfound;
/**
* This event will be fired if the tag detected in ontagfound has been removed.
*/
[CheckPermissions="nfc-read nfc-write"]
attribute EventHandler ontaglost;
};

View File

@ -19,7 +19,7 @@ interface MozNFCPeer {
/**
* Send file to peer device.
*/
[Throws]
[Throws, CheckPermissions="nfc-share"]
Promise<void> sendFile(Blob blob);
};

View File

@ -5,7 +5,7 @@
*/
[Constructor(DOMString type, optional MozNFCPeerEventInit eventInitDict),
Func="Navigator::HasNFCSupport", CheckPermissions="nfc-write",
Func="Navigator::HasNFCSupport", CheckPermissions="nfc nfc-share",
AvailableIn="CertifiedApps"]
interface MozNFCPeerEvent : Event
{

View File

@ -5,7 +5,7 @@
*/
[Constructor(DOMString type, optional MozNFCTagEventInit eventInitDict),
Func="Navigator::HasNFCSupport", CheckPermissions="nfc-read nfc-write",
Func="Navigator::HasNFCSupport", CheckPermissions="nfc",
AvailableIn="CertifiedApps"]
interface MozNFCTagEvent : Event
{

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=4 ts=8 et ft=cpp: */
/* vim: set sw=2 ts=2 et ft=cpp: tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -369,7 +369,92 @@ KeyStoreConnector::GetSocketAddr(const sockaddr_any& aAddr,
MOZ_CRASH("This should never be called!");
}
//
// KeyStore::ListenSocket
//
KeyStore::ListenSocket::ListenSocket(KeyStore* aKeyStore)
: mKeyStore(aKeyStore)
{
MOZ_ASSERT(mKeyStore);
MOZ_COUNT_CTOR(KeyStore::ListenSocket);
}
void
KeyStore::ListenSocket::OnConnectSuccess()
{
mKeyStore->OnConnectSuccess(LISTEN_SOCKET);
MOZ_COUNT_DTOR(KeyStore::ListenSocket);
}
void
KeyStore::ListenSocket::OnConnectError()
{
mKeyStore->OnConnectError(LISTEN_SOCKET);
}
void
KeyStore::ListenSocket::OnDisconnect()
{
mKeyStore->OnDisconnect(LISTEN_SOCKET);
}
//
// KeyStore::StreamSocket
//
KeyStore::StreamSocket::StreamSocket(KeyStore* aKeyStore)
: mKeyStore(aKeyStore)
{
MOZ_ASSERT(mKeyStore);
MOZ_COUNT_CTOR(KeyStore::StreamSocket);
}
KeyStore::StreamSocket::~StreamSocket()
{
MOZ_COUNT_DTOR(KeyStore::StreamSocket);
}
void
KeyStore::StreamSocket::OnConnectSuccess()
{
mKeyStore->OnConnectSuccess(STREAM_SOCKET);
}
void
KeyStore::StreamSocket::OnConnectError()
{
mKeyStore->OnConnectError(STREAM_SOCKET);
}
void
KeyStore::StreamSocket::OnDisconnect()
{
mKeyStore->OnDisconnect(STREAM_SOCKET);
}
void
KeyStore::StreamSocket::ReceiveSocketData(
nsAutoPtr<UnixSocketRawData>& aMessage)
{
mKeyStore->ReceiveSocketData(aMessage);
}
ConnectionOrientedSocketIO*
KeyStore::StreamSocket::GetIO()
{
return PrepareAccept(new KeyStoreConnector());
}
//
// KeyStore
//
KeyStore::KeyStore()
: mShutdown(false)
{
MOZ_COUNT_CTOR(KeyStore);
::startKeyStoreService();
@ -379,19 +464,45 @@ KeyStore::KeyStore()
KeyStore::~KeyStore()
{
MOZ_COUNT_DTOR(KeyStore);
MOZ_ASSERT(!mListenSocket);
MOZ_ASSERT(!mStreamSocket);
}
void
KeyStore::Shutdown()
{
// We set mShutdown first, so that |OnDisconnect| won't try to reconnect.
mShutdown = true;
CloseSocket();
if (mStreamSocket) {
mStreamSocket->Close();
mStreamSocket = nullptr;
}
if (mListenSocket) {
mListenSocket->Close();
mListenSocket = nullptr;
}
}
void
KeyStore::Listen()
{
ListenSocket(new KeyStoreConnector());
// We only allocate one |StreamSocket|, but re-use it for every connection.
if (mStreamSocket) {
mStreamSocket->Close();
} else {
mStreamSocket = new StreamSocket(this);
}
if (!mListenSocket) {
// We only ever allocate one |ListenSocket|...
mListenSocket = new ListenSocket(this);
mListenSocket->Listen(new KeyStoreConnector(), mStreamSocket);
} else {
// ... but keep it open.
mListenSocket->Listen(mStreamSocket);
}
ResetHandlerInfo();
}
@ -512,25 +623,29 @@ KeyStore::ReadData(UnixSocketRawData *aMessage)
void
KeyStore::SendResponse(ResponseCode aResponse)
{
MOZ_ASSERT(mStreamSocket);
if (aResponse == NO_RESPONSE)
return;
uint8_t response = (uint8_t)aResponse;
UnixSocketRawData* data = new UnixSocketRawData((const void *)&response, 1);
SendSocketData(data);
mStreamSocket->SendSocketData(data);
}
// Data response
void
KeyStore::SendData(const uint8_t *aData, int aLength)
{
MOZ_ASSERT(mStreamSocket);
unsigned short dataLength = htons(aLength);
UnixSocketRawData* length = new UnixSocketRawData((const void *)&dataLength, 2);
SendSocketData(length);
mStreamSocket->SendSocketData(length);
UnixSocketRawData* data = new UnixSocketRawData((const void *)aData, aLength);
SendSocketData(data);
mStreamSocket->SendSocketData(data);
}
void
@ -583,24 +698,43 @@ KeyStore::ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage)
}
void
KeyStore::OnConnectSuccess()
KeyStore::OnConnectSuccess(SocketType aSocketType)
{
mShutdown = false;
if (aSocketType == STREAM_SOCKET) {
mShutdown = false;
}
}
void
KeyStore::OnConnectError()
KeyStore::OnConnectError(SocketType aSocketType)
{
if (!mShutdown) {
if (mShutdown) {
return;
}
if (aSocketType == STREAM_SOCKET) {
// Stream socket error; start listening again
Listen();
}
}
void
KeyStore::OnDisconnect()
KeyStore::OnDisconnect(SocketType aSocketType)
{
if (!mShutdown) {
Listen();
if (mShutdown) {
return;
}
switch (aSocketType) {
case LISTEN_SOCKET:
// Listen socket disconnected; start anew.
mListenSocket = nullptr;
Listen();
break;
case STREAM_SOCKET:
// Stream socket disconnected; start listening again.
Listen();
break;
}
}

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp: */
/* vim: set sw=2 ts=2 et ft=cpp: tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -7,11 +7,12 @@
#ifndef mozilla_ipc_KeyStore_h
#define mozilla_ipc_KeyStore_h 1
#include "mozilla/ipc/UnixSocket.h"
#include <sys/socket.h>
#include <sys/un.h>
#include "cert.h"
#include "mozilla/ipc/ListenSocket.h"
#include "mozilla/ipc/StreamSocket.h"
#include "mozilla/ipc/UnixSocketConnector.h"
namespace mozilla {
namespace ipc {
@ -94,21 +95,69 @@ public:
nsAString& aAddrStr);
};
class KeyStore : public mozilla::ipc::UnixSocketConsumer
class KeyStore MOZ_FINAL
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(KeyStore)
KeyStore();
void Shutdown();
private:
virtual ~KeyStore();
enum SocketType {
LISTEN_SOCKET,
STREAM_SOCKET
};
virtual void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage);
class ListenSocket MOZ_FINAL : public mozilla::ipc::ListenSocket
{
public:
ListenSocket(KeyStore* aKeyStore);
ListenSocket();
virtual void OnConnectSuccess();
virtual void OnConnectError();
virtual void OnDisconnect();
// SocketBase
//
void OnConnectSuccess() MOZ_OVERRIDE;
void OnConnectError() MOZ_OVERRIDE;
void OnDisconnect() MOZ_OVERRIDE;
private:
KeyStore* mKeyStore;
};
class StreamSocket MOZ_FINAL : public mozilla::ipc::StreamSocket
{
public:
StreamSocket(KeyStore* aKeyStore);
~StreamSocket();
// SocketConsumerBase
//
void OnConnectSuccess() MOZ_OVERRIDE;
void OnConnectError() MOZ_OVERRIDE;
void OnDisconnect() MOZ_OVERRIDE;
void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage) MOZ_OVERRIDE;
// ConnectionOrientedSocket
//
ConnectionOrientedSocketIO* GetIO() MOZ_OVERRIDE;
private:
KeyStore* mKeyStore;
};
~KeyStore();
void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage);
void OnConnectSuccess(enum SocketType aSocketType);
void OnConnectError(enum SocketType aSocketType);
void OnDisconnect(enum SocketType aSocketType);
struct {
ProtocolHandlerState state;
@ -128,6 +177,9 @@ private:
void SendData(const uint8_t *data, int length);
bool mShutdown;
nsRefPtr<ListenSocket> mListenSocket;
nsRefPtr<StreamSocket> mStreamSocket;
};
} // namespace ipc

View File

@ -37,8 +37,16 @@ specialpowers.specialPowersObserver.init();
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
function isMulet() {
let isMulet = false;
try {
isMulet = Services.prefs.getBoolPref("b2g.is_mulet");
} catch (ex) { }
return isMulet;
}
Services.prefs.setBoolPref("marionette.contentListener", false);
let appName = Services.appinfo.name;
let appName = isMulet() ? "B2G" : Services.appinfo.name;
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils.js");
@ -2943,10 +2951,9 @@ BrowserObj.prototype = {
setBrowser: function BO_setBrowser(win) {
switch (appName) {
case "Firefox":
if (this.window.location.href.indexOf("chrome://b2g") == -1) {
if (!isMulet()) {
this.browser = win.gBrowser;
}
else {
} else {
// this is Mulet
appName = "B2G";
}