This commit is contained in:
Ryan VanderMeulen 2014-10-22 16:38:48 -04:00
Родитель a1e41d89c8 a8a76f690d
Коммит 9c995d0076
145 изменённых файлов: 1733 добавлений и 765 удалений

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

@ -20,6 +20,14 @@ INSTALL_TARGETS += UA_UPDATE
# Make sure the standalone glue doesn't try to get libxpcom.so from b2g/app.
NSDISTMODE = copy
# Copy the Firefox OS fonts if available
ifdef MOZTTDIR
include $(MOZTTDIR)/fonts.mk
MOZTT_DEST = $(FINAL_TARGET)/fonts
MOZTT_FILES = $(patsubst external/moztt/%,$(MOZTTDIR)/%,$(filter external/moztt/%,$(subst :, ,$(PRODUCT_COPY_FILES))))
INSTALL_TARGETS += MOZTT
endif
include $(topsrcdir)/config/rules.mk
APP_ICON = b2g

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -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="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

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

@ -17,7 +17,7 @@
</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="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -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="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -17,7 +17,7 @@
</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="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>

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

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "d3b2bb39fd5873ff8d537a3267d21d20491c3d1d",
"revision": "8d483aad9a257678544e70bdfadee0e576cc3239",
"repo_path": "/integration/gaia-central"
}

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

@ -17,7 +17,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="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -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="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -34,4 +34,7 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
# Include Firefox OS fonts.
MOZTTDIR=$topsrcdir/moztt
. "$topsrcdir/b2g/config/mozconfigs/common.override"

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

@ -32,6 +32,9 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
# Include Firefox OS fonts.
MOZTTDIR=$topsrcdir/moztt
# Build simulator xpi and phone tweaks for b2g-desktop
FXOS_SIMULATOR=1

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

@ -34,4 +34,7 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
# Include Firefox OS fonts.
MOZTTDIR=$topsrcdir/moztt
. "$topsrcdir/b2g/config/mozconfigs/common.override"

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

@ -32,6 +32,9 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
# Include Firefox OS fonts.
MOZTTDIR=$topsrcdir/moztt
# Build simulator xpi and phone tweaks for b2g-desktop
FXOS_SIMULATOR=1

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

@ -32,4 +32,7 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
# Include Firefox OS fonts.
MOZTTDIR=$topsrcdir/moztt
. "$topsrcdir/b2g/config/mozconfigs/common.override"

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

@ -29,6 +29,9 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
# Include Firefox OS fonts.
MOZTTDIR=$topsrcdir/moztt
# Build simulator xpi and phone tweaks for b2g-desktop
FXOS_SIMULATOR=1

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

@ -28,4 +28,7 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
# Include Firefox OS fonts.
MOZTTDIR=$topsrcdir/moztt
. "$topsrcdir/b2g/config/mozconfigs/common.override"

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

@ -25,6 +25,9 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia
# Include Firefox OS fonts.
MOZTTDIR=$topsrcdir/moztt
# Build simulator xpi and phone tweaks for b2g-desktop
FXOS_SIMULATOR=1

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

@ -17,7 +17,7 @@
</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="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>

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

@ -10,5 +10,12 @@
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
},
{
"size": 31057326,
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
"algorithm": "sha512",
"filename": "moztt.tar.bz2",
"unpack": "True"
}
]

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

@ -10,5 +10,12 @@
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
},
{
"size": 31057326,
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
"algorithm": "sha512",
"filename": "moztt.tar.bz2",
"unpack": "True"
}
]

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

@ -19,5 +19,12 @@
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
},
{
"size": 31057326,
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
"algorithm": "sha512",
"filename": "moztt.tar.bz2",
"unpack": "True"
}
]

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

@ -4,5 +4,12 @@
"digest": "bb345b0e700ffab4d09436981f14b5de84da55a3f18a7f09ebc4364a4488acdeab8d46f447b12ac70f2da1444a68b8ce8b8675f0dae2ccf845e966d1df0f0869",
"algorithm": "sha512",
"filename": "mozmake.exe"
},
{
"size": 31057326,
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
"algorithm": "sha512",
"filename": "moztt.tar.bz2",
"unpack": "True"
}
]

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

@ -17,7 +17,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="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="27a1d1baaa8e375b70e043efee67d5f2206c330b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -886,3 +886,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/gaia/*
@BINPATH@/b2g-bin@BIN_SUFFIX@
#endif
#ifdef PACKAGE_MOZTT
@BINPATH@/fonts/*
#endif

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

@ -1549,6 +1549,8 @@ var gBrowserInit = {
// initialize the sync UI
gSyncUI.init();
#endif
gRemoteTabsUI.init();
},
nonBrowserWindowShutdown: function() {
@ -6974,7 +6976,9 @@ let gPrivateBrowsingUI = {
let gRemoteTabsUI = {
init: function() {
if (window.location.href != getBrowserURL()) {
if (window.location.href != getBrowserURL() &&
// Also check hidden window for the Mac no-window case
window.location.href != "chrome://browser/content/hiddenWindow.xul") {
return;
}

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

@ -1485,10 +1485,12 @@
// Restore the progress listener.
aBrowser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
if (aShouldBeRemote)
if (aShouldBeRemote) {
tab.setAttribute("remote", "true");
else
} else {
tab.removeAttribute("remote");
aBrowser.messageManager.sendAsyncMessage("Browser:AppTab", { isAppTab: tab.pinned })
}
if (wasActive)
aBrowser.focus();
@ -3099,6 +3101,13 @@
window.focus();
break;
}
case "Browser:Init": {
let tab = this.getTabForBrowser(browser);
if (!tab)
return;
browser.messageManager.sendAsyncMessage("Browser:AppTab", { isAppTab: tab.pinned })
break;
}
}
]]></body>
</method>
@ -3156,6 +3165,7 @@
messageManager.addMessageListener("DOMTitleChanged", this);
messageManager.addMessageListener("DOMWindowClose", this);
messageManager.addMessageListener("contextmenu", this);
messageManager.addMessageListener("Browser:Init", this);
// If this window has remote tabs, switch to our tabpanels fork
// which does asynchronous tab switching.

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

@ -394,6 +394,7 @@ skip-if = buildapp == 'mulet'
[browser_removeTabsToTheEnd.js]
[browser_removeUnsafeProtocolsFromURLBarPaste.js]
skip-if = e10s
[browser_restore_isAppTab.js]
[browser_sanitize-download-history.js]
skip-if = true # bug 432425
[browser_sanitize-passwordDisabledHosts.js]

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

@ -0,0 +1,154 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const DUMMY = "http://example.com/browser/browser/base/content/test/general/dummy_page.html";
function getMinidumpDirectory() {
let dir = Services.dirsvc.get('ProfD', Ci.nsIFile);
dir.append("minidumps");
return dir;
}
// This observer is needed so we can clean up all evidence of the crash so
// the testrunner thinks things are peachy.
let CrashObserver = {
observe: function(subject, topic, data) {
is(topic, 'ipc:content-shutdown', 'Received correct observer topic.');
ok(subject instanceof Ci.nsIPropertyBag2,
'Subject implements nsIPropertyBag2.');
// we might see this called as the process terminates due to previous tests.
// We are only looking for "abnormal" exits...
if (!subject.hasKey("abnormal")) {
info("This is a normal termination and isn't the one we are looking for...");
return;
}
let dumpID;
if ('nsICrashReporter' in Ci) {
dumpID = subject.getPropertyAsAString('dumpID');
ok(dumpID, "dumpID is present and not an empty string");
}
if (dumpID) {
let minidumpDirectory = getMinidumpDirectory();
let file = minidumpDirectory.clone();
file.append(dumpID + '.dmp');
file.remove(true);
file = minidumpDirectory.clone();
file.append(dumpID + '.extra');
file.remove(true);
}
}
}
Services.obs.addObserver(CrashObserver, 'ipc:content-shutdown', false);
registerCleanupFunction(() => {
Services.obs.removeObserver(CrashObserver, 'ipc:content-shutdown');
});
function frameScript() {
addMessageListener("Test:GetIsAppTab", function() {
sendAsyncMessage("Test:IsAppTab", { isAppTab: docShell.isAppTab });
});
addMessageListener("Test:Crash", function() {
privateNoteIntentionalCrash();
Components.utils.import("resource://gre/modules/ctypes.jsm");
let zero = new ctypes.intptr_t(8);
let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
badptr.contents
});
}
function loadFrameScript(browser) {
browser.messageManager.loadFrameScript("data:,(" + frameScript.toString() + ")();", true);
}
function isBrowserAppTab(browser) {
return new Promise(resolve => {
function listener({ data }) {
browser.messageManager.removeMessageListener("Test:IsAppTab", listener);
resolve(data.isAppTab);
}
browser.messageManager.addMessageListener("Test:IsAppTab", listener);
browser.messageManager.sendAsyncMessage("Test:GetIsAppTab");
});
}
// Restarts the child process by crashing it then reloading the tab
let restart = Task.async(function*(browser) {
// If the tab isn't remote this would crash the main process so skip it
if (!browser.isRemoteBrowser)
return browser;
// Make sure the main process has all of the current tab state before crashing
TabState.flush(browser);
browser.messageManager.sendAsyncMessage("Test:Crash");
yield promiseWaitForEvent(browser, "AboutTabCrashedLoad", false, true);
let tab = gBrowser.getTabForBrowser(browser);
SessionStore.reviveCrashedTab(tab);
yield promiseTabLoaded(tab);
});
add_task(function* navigate() {
let tab = gBrowser.addTab("about:robots");
let browser = tab.linkedBrowser;
gBrowser.selectedTab = tab;
yield waitForDocLoadComplete();
loadFrameScript(browser);
let isAppTab = yield isBrowserAppTab(browser);
ok(!isAppTab, "Docshell shouldn't think it is an app tab");
gBrowser.pinTab(tab);
isAppTab = yield isBrowserAppTab(browser);
ok(isAppTab, "Docshell should think it is an app tab");
gBrowser.loadURI(DUMMY);
yield waitForDocLoadComplete();
loadFrameScript(browser);
isAppTab = yield isBrowserAppTab(browser);
ok(isAppTab, "Docshell should think it is an app tab");
gBrowser.unpinTab(tab);
isAppTab = yield isBrowserAppTab(browser);
ok(!isAppTab, "Docshell shouldn't think it is an app tab");
gBrowser.pinTab(tab);
isAppTab = yield isBrowserAppTab(browser);
ok(isAppTab, "Docshell should think it is an app tab");
gBrowser.loadURI("about:robots");
yield waitForDocLoadComplete();
loadFrameScript(browser);
isAppTab = yield isBrowserAppTab(browser);
ok(isAppTab, "Docshell should think it is an app tab");
gBrowser.removeCurrentTab();
});
add_task(function* crash() {
if (!gMultiProcessBrowser || !("nsICrashReporter" in Ci))
return;
let tab = gBrowser.addTab(DUMMY);
let browser = tab.linkedBrowser;
gBrowser.selectedTab = tab;
yield waitForDocLoadComplete();
loadFrameScript(browser);
let isAppTab = yield isBrowserAppTab(browser);
ok(!isAppTab, "Docshell shouldn't think it is an app tab");
gBrowser.pinTab(tab);
isAppTab = yield isBrowserAppTab(browser);
ok(isAppTab, "Docshell should think it is an app tab");
yield restart(browser);
loadFrameScript(browser);
isAppTab = yield isBrowserAppTab(browser);
ok(isAppTab, "Docshell should think it is an app tab");
gBrowser.removeCurrentTab();
});

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

@ -108,16 +108,16 @@ function promiseWaitForCondition(aConditionFn) {
return deferred.promise;
}
function promiseWaitForEvent(object, eventName, capturing = false) {
function promiseWaitForEvent(object, eventName, capturing = false, chrome = false) {
return new Promise((resolve) => {
function listener(event) {
info("Saw " + eventName);
object.removeEventListener(eventName, listener, capturing);
object.removeEventListener(eventName, listener, capturing, chrome);
resolve(event);
}
info("Waiting for " + eventName);
object.addEventListener(eventName, listener, capturing);
object.addEventListener(eventName, listener, capturing, chrome);
});
}

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

@ -15,6 +15,9 @@
LOOP_SERVER_URL := $(shell echo $${LOOP_SERVER_URL-http://localhost:5000})
LOOP_FEEDBACK_API_URL := $(shell echo $${LOOP_FEEDBACK_API_URL-"https://input.allizom.org/api/v1/feedback"})
LOOP_FEEDBACK_PRODUCT_NAME := $(shell echo $${LOOP_FEEDBACK_PRODUCT_NAME-Loop})
LOOP_BRAND_WEBSITE_URL := $(shell echo $${LOOP_BRAND_WEBSITE_URL-"https://www.mozilla.org/firefox/"})
LOOP_PRIVACY_WEBSITE_URL := $(shell echo $${LOOP_PRIVACY_WEBSITE_URL-"https://www.mozilla.org/privacy"})
LOOP_LEGAL_WEBSITE_URL := $(shell echo $${LOOP_LEGAL_WEBSITE_URL-"/legal/terms"})
NODE_LOCAL_BIN=./node_modules/.bin
@ -73,6 +76,9 @@ config:
@echo "loop.config.serverUrl = '`echo $(LOOP_SERVER_URL)`';" >> content/config.js
@echo "loop.config.feedbackApiUrl = '`echo $(LOOP_FEEDBACK_API_URL)`';" >> content/config.js
@echo "loop.config.feedbackProductName = '`echo $(LOOP_FEEDBACK_PRODUCT_NAME)`';" >> content/config.js
@echo "loop.config.brandWebsiteUrl = '`echo $(LOOP_BRAND_WEBSITE_URL)`';" >> content/config.js
@echo "loop.config.privacyWebsiteUrl = '`echo $(LOOP_PRIVACY_WEBSITE_URL)`';" >> content/config.js
@echo "loop.config.legalWebsiteUrl = '`echo $(LOOP_LEGAL_WEBSITE_URL)`';" >> content/config.js
@echo "loop.config.fxosApp = loop.config.fxosApp || {};" >> content/config.js
@echo "loop.config.fxosApp.name = 'Loop';" >> content/config.js
@echo "loop.config.fxosApp.manifestUrl = 'http://fake-market.herokuapp.com/apps/packagedApp/manifest.webapp';" >> content/config.js

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

@ -37,7 +37,9 @@ loop.webapp = (function($, _, OT, mozL10n) {
render: function() {
var useLatestFF = mozL10n.get("use_latest_firefox", {
"firefoxBrandNameLink": React.renderComponentToStaticMarkup(
React.DOM.a({target: "_blank", href: mozL10n.get("brand_website")}, mozL10n.get("brandShortname"))
React.DOM.a({target: "_blank", href: loop.config.brandWebsiteUrl},
mozL10n.get("brandShortname")
)
)
});
return (
@ -82,8 +84,10 @@ loop.webapp = (function($, _, OT, mozL10n) {
React.DOM.h3(null, mozL10n.get("promote_firefox_hello_heading", {brandShortname: mozL10n.get("brandShortname")})),
React.DOM.p(null,
React.DOM.a({className: "btn btn-large btn-accept",
href: mozL10n.get("brand_website")},
mozL10n.get("get_firefox_button", {brandShortname: mozL10n.get("brandShortname")})
href: loop.config.brandWebsiteUrl},
mozL10n.get("get_firefox_button", {
brandShortname: mozL10n.get("brandShortname")
})
)
)
)
@ -462,10 +466,10 @@ loop.webapp = (function($, _, OT, mozL10n) {
var tosHTML = mozL10n.get("legal_text_and_links", {
"clientShortname": mozL10n.get("clientShortname2"),
"terms_of_use_url": "<a target=_blank href='" +
mozL10n.get("legal_website") + "'>" +
loop.config.legalWebsiteUrl + "'>" +
tosLinkName + "</a>",
"privacy_notice_url": "<a target=_blank href='" +
mozL10n.get("privacy_website") + "'>" + privacyNoticeName + "</a>"
loop.config.privacyWebsiteUrl + "'>" + privacyNoticeName + "</a>"
});
var tosClasses = React.addons.classSet({

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

@ -37,7 +37,9 @@ loop.webapp = (function($, _, OT, mozL10n) {
render: function() {
var useLatestFF = mozL10n.get("use_latest_firefox", {
"firefoxBrandNameLink": React.renderComponentToStaticMarkup(
<a target="_blank" href={mozL10n.get("brand_website")}>{mozL10n.get("brandShortname")}</a>
<a target="_blank" href={loop.config.brandWebsiteUrl}>
{mozL10n.get("brandShortname")}
</a>
)
});
return (
@ -82,8 +84,10 @@ loop.webapp = (function($, _, OT, mozL10n) {
<h3>{mozL10n.get("promote_firefox_hello_heading", {brandShortname: mozL10n.get("brandShortname")})}</h3>
<p>
<a className="btn btn-large btn-accept"
href={mozL10n.get("brand_website")}>
{mozL10n.get("get_firefox_button", {brandShortname: mozL10n.get("brandShortname")})}
href={loop.config.brandWebsiteUrl}>
{mozL10n.get("get_firefox_button", {
brandShortname: mozL10n.get("brandShortname")
})}
</a>
</p>
</div>
@ -462,10 +466,10 @@ loop.webapp = (function($, _, OT, mozL10n) {
var tosHTML = mozL10n.get("legal_text_and_links", {
"clientShortname": mozL10n.get("clientShortname2"),
"terms_of_use_url": "<a target=_blank href='" +
mozL10n.get("legal_website") + "'>" +
loop.config.legalWebsiteUrl + "'>" +
tosLinkName + "</a>",
"privacy_notice_url": "<a target=_blank href='" +
mozL10n.get("privacy_website") + "'>" + privacyNoticeName + "</a>"
loop.config.privacyWebsiteUrl + "'>" + privacyNoticeName + "</a>"
});
var tosClasses = React.addons.classSet({

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

@ -116,10 +116,6 @@ rooms_room_full_call_to_action_label=Learn more about {{clientShortname}} »
rooms_room_joined_label=Someone has joined the conversation!
rooms_room_join_label=Join the conversation
brand_website=https://www.mozilla.org/firefox/
privacy_website=https://www.mozilla.org/privacy/
legal_website=/legal/terms/
## LOCALIZATION_NOTE(standalone_title_with_status): {{clientShortname}} will be
## replaced by the brand name and {{currentStatus}} will be replaced
## by the current call status (Connecting, Ringing, etc.)

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

@ -24,6 +24,9 @@ function getConfigFile(req, res) {
// XXX Update with the real marketplace url once the FxOS Loop app is
// uploaded to the marketplace bug 1053424
"loop.config.marketplaceUrl = 'http://fake-market.herokuapp.com/iframe-install.html'",
"loop.config.brandWebsiteUrl = 'https://www.mozilla.org/firefox/';",
"loop.config.privacyWebsiteUrl = 'https://www.mozilla.org/privacy';",
"loop.config.legalWebsiteUrl = '/legal/terms';",
"loop.config.fxosApp = loop.config.fxosApp || {};",
"loop.config.fxosApp.name = 'Loop';",
"loop.config.fxosApp.manifestUrl = 'http://fake-market.herokuapp.com/apps/packagedApp/manifest.webapp';"

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

@ -10,7 +10,6 @@ Cu.import("resource://gre/modules/Services.jsm");
let promise = require("devtools/toolkit/deprecated-sync-thenables");
let EventEmitter = require("devtools/toolkit/event-emitter");
let {CssLogic} = require("devtools/styleinspector/css-logic");
let clipboard = require("sdk/clipboard");
loader.lazyGetter(this, "MarkupView", () => require("devtools/markupview/markup-view").MarkupView);
@ -410,9 +409,11 @@ InspectorPanel.prototype = {
// On any new selection made by the user, store the unique css selector
// of the selected node so it can be restored after reload of the same page
if (reason !== "navigateaway" &&
this.selection.node &&
this.canGetUniqueSelector &&
this.selection.isElementNode()) {
this.selectionCssSelector = CssLogic.findCssSelector(this.selection.node);
selection.getUniqueSelector().then((selector) => {
this.selectionCssSelector = selector;
}).then(null, console.error);
}
let selfUpdate = this.updating("inspector-panel");

Двоичные данные
browser/themes/linux/loop/menuPanel.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.9 KiB

После

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичные данные
browser/themes/linux/loop/toolbar-inverted.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.6 KiB

После

Ширина:  |  Высота:  |  Размер: 3.0 KiB

Двоичные данные
browser/themes/linux/loop/toolbar.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.7 KiB

После

Ширина:  |  Высота:  |  Размер: 4.7 KiB

Двоичные данные
browser/themes/osx/loop/menuPanel-yosemite.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 9.5 KiB

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

После

Ширина:  |  Высота:  |  Размер: 26 KiB

Двоичные данные
browser/themes/osx/loop/menuPanel.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.1 KiB

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
browser/themes/osx/loop/menuPanel@2x.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 16 KiB

После

Ширина:  |  Высота:  |  Размер: 37 KiB

Двоичные данные
browser/themes/osx/loop/toolbar-inverted.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.5 KiB

После

Ширина:  |  Высота:  |  Размер: 4.3 KiB

Двоичные данные
browser/themes/osx/loop/toolbar-inverted@2x.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 8.1 KiB

После

Ширина:  |  Высота:  |  Размер: 11 KiB

Двоичные данные
browser/themes/osx/loop/toolbar-yosemite.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.3 KiB

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичные данные
browser/themes/osx/loop/toolbar-yosemite@2x.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.7 KiB

После

Ширина:  |  Высота:  |  Размер: 6.2 KiB

Двоичные данные
browser/themes/osx/loop/toolbar.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.9 KiB

После

Ширина:  |  Высота:  |  Размер: 4.5 KiB

Двоичные данные
browser/themes/osx/loop/toolbar@2x.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 9.9 KiB

После

Ширина:  |  Высота:  |  Размер: 13 KiB

Двоичные данные
browser/themes/windows/loop/menuPanel-aero.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.7 KiB

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
browser/themes/windows/loop/menuPanel.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.9 KiB

После

Ширина:  |  Высота:  |  Размер: 8.7 KiB

Двоичные данные
browser/themes/windows/loop/toolbar-XPVista7.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.9 KiB

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичные данные
browser/themes/windows/loop/toolbar-inverted.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.6 KiB

После

Ширина:  |  Высота:  |  Размер: 3.0 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.2 KiB

После

Ширина:  |  Высота:  |  Размер: 4.7 KiB

Двоичные данные
browser/themes/windows/loop/toolbar.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

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

@ -183,6 +183,15 @@ if test -n "$FXOS_SIMULATOR" ; then
AC_SUBST(FXOS_SIMULATOR)
fi
if test -n "$MOZTTDIR" -a ! -d "$MOZTTDIR" ; then
AC_MSG_ERROR([MOZTTDIR '$MOZTTDIR' isn't a valid directory])
fi
AC_SUBST(MOZTTDIR)
if test -n "$MOZTTDIR" ; then
AC_DEFINE(PACKAGE_MOZTT)
fi
MOZ_ARG_WITH_STRING(gonk,
[ --with-gonk=DIR
location of gonk dir],

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

@ -274,7 +274,7 @@ MediaEngineWebRTC::EnumerateVideoDevices(MediaSourceType aMediaSource,
}
}
if (mHasTabVideoSource)
if (mHasTabVideoSource || MediaSourceType::Browser == aMediaSource)
aVSources->AppendElement(new MediaEngineTabVideoSource());
return;

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

@ -92,10 +92,11 @@ public:
sSetPropertyRunnableArray.Clear();
sUnbondingRunnableArray.Clear();
// Bluetooth scan mode is NONE by default
// Bluetooth scan mode is SCAN_MODE_CONNECTABLE by default, i.e., It should
// be connectable and non-discoverable.
NS_ENSURE_TRUE(sBtInterface, NS_ERROR_FAILURE);
sBtInterface->SetAdapterProperty(
BluetoothNamedValue(NS_ConvertUTF8toUTF16("Discoverable"), true),
BluetoothNamedValue(NS_ConvertUTF8toUTF16("Discoverable"), false),
new SetAdapterPropertyResultHandler());
// Try to fire event 'AdapterAdded' to fit the original behaviour when

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

@ -107,10 +107,11 @@ public:
sBondingRunnableArray.Clear();
sUnbondingRunnableArray.Clear();
// Bluetooth scan mode is NONE by default
// Bluetooth scan mode is SCAN_MODE_CONNECTABLE by default, i.e., It should
// be connectable and non-discoverable.
NS_ENSURE_TRUE(sBtInterface, NS_ERROR_FAILURE);
sBtInterface->SetAdapterProperty(
BluetoothNamedValue(NS_ConvertUTF8toUTF16("Discoverable"), true),
BluetoothNamedValue(NS_ConvertUTF8toUTF16("Discoverable"), false),
new SetAdapterPropertyResultHandler());
// Trigger BluetoothOppManager to listen

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

@ -352,7 +352,7 @@ GonkCameraParameters::SetTranslated(uint32_t aKey, const ICameraControl::Size& a
if (aSize.width > INT_MAX || aSize.height > INT_MAX) {
// AOSP can only handle signed ints.
DOM_CAMERA_LOGE("Camera parameter aKey=%d out of bounds (width=%u, height=%u)\n",
aSize.width, aSize.height);
aKey, aSize.width, aSize.height);
return NS_ERROR_INVALID_ARG;
}

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

@ -121,7 +121,13 @@ protected:
void get(const char* aKey, double& aRet) { aRet = getFloat(aKey); }
void get(const char* aKey, const char*& aRet) { aRet = get(aKey); }
void get(const char* aKey, int& aRet) { aRet = getInt(aKey); }
void get(const char* aKey, bool& aRet) { aRet = strcmp(get(aKey), FALSE); }
void
get(const char* aKey, bool& aRet)
{
const char* value = get(aKey);
aRet = value ? strcmp(value, TRUE) == 0 : false;
}
void remove(const char* aKey) { android::CameraParameters::remove(aKey); }

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

@ -29,6 +29,17 @@ const MOBILECALLFORWARDINGOPTIONS_CID =
Components.ID("{e0cf4463-ee63-4b05-ab2e-d94bf764836c}");
const TELEPHONYDIALCALLBACK_CID =
Components.ID("{c2af1a5d-3649-44ef-a1ff-18e9ac1dec51}");
const NEIGHBORINGCELLINFO_CID =
Components.ID("{6078cbf1-f34c-44fa-96f8-11a88d4bfdd3}");
const GSMCELLINFO_CID =
Components.ID("{e3cf3aa0-f992-48fe-967b-ec98a28c8535}");
const WCDMACELLINFO_CID =
Components.ID("{62e2c83c-b535-4068-9762-8039fac48106}");
const CDMACELLINFO_CID =
Components.ID("{40f491f0-dd8b-42fd-af32-aef5b002749a}");
const LTECELLINFO_CID =
Components.ID("{715e2c76-3b08-41e4-8ea5-e60c5ce6393e}");
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
@ -36,6 +47,9 @@ const NS_NETWORK_ACTIVE_CHANGED_TOPIC_ID = "network-active-changed";
const kPrefRilDebuggingEnabled = "ril.debugging.enabled";
const INT32_MAX = 2147483647;
const UNKNOWN_RSSI = 99;
XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger",
"@mozilla.org/system-message-internal;1",
"nsISystemMessagesInternal");
@ -138,6 +152,134 @@ MobileCallForwardingOptions.prototype = {
serviceClass: Ci.nsIMobileConnection.ICC_SERVICE_CLASS_NONE
}
function NeighboringCellInfo() {}
NeighboringCellInfo.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsINeighboringCellInfo]),
classID: NEIGHBORINGCELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: NEIGHBORINGCELLINFO_CID,
classDescription: "NeighboringCellInfo",
interfaces: [Ci.nsINeighboringCellInfo]
}),
// nsINeighboringCellInfo
networkType: null,
gsmLocationAreaCode: -1,
gsmCellId: -1,
wcdmaPsc: -1,
signalStrength: UNKNOWN_RSSI
};
function CellInfo() {}
CellInfo.prototype = {
// nsICellInfo
type: null,
registered: false,
timestampType: Ci.nsICellInfo.TIMESTAMP_TYPE_UNKNOWN,
timestamp: 0
};
function GsmCellInfo() {}
GsmCellInfo.prototype = {
__proto__: CellInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfo,
Ci.nsIGsmCellInfo]),
classID: GSMCELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: GSMCELLINFO_CID,
classDescription: "GsmCellInfo",
interfaces: [Ci.nsIGsmCellInfo]
}),
// nsIGsmCellInfo
mcc: INT32_MAX,
mnc: INT32_MAX,
lac: INT32_MAX,
cid: INT32_MAX,
signalStrength: UNKNOWN_RSSI,
bitErrorRate: UNKNOWN_RSSI
};
function WcdmaCellInfo() {}
WcdmaCellInfo.prototype = {
__proto__: CellInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfo,
Ci.nsIWcdmaCellInfo]),
classID: WCDMACELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: WCDMACELLINFO_CID,
classDescription: "WcdmaCellInfo",
interfaces: [Ci.nsIWcdmaCellInfo]
}),
// nsIWcdmaCellInfo
mcc: INT32_MAX,
mnc: INT32_MAX,
lac: INT32_MAX,
cid: INT32_MAX,
psc: INT32_MAX,
signalStrength: UNKNOWN_RSSI,
bitErrorRate: UNKNOWN_RSSI
};
function LteCellInfo() {}
LteCellInfo.prototype = {
__proto__: CellInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfo,
Ci.nsILteCellInfo]),
classID: LTECELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: LTECELLINFO_CID,
classDescription: "LteCellInfo",
interfaces: [Ci.nsILteCellInfo]
}),
// nsILteCellInfo
mcc: INT32_MAX,
mnc: INT32_MAX,
cid: INT32_MAX,
pcid: INT32_MAX,
tac: INT32_MAX,
signalStrength: UNKNOWN_RSSI,
rsrp: INT32_MAX,
rsrq: INT32_MAX,
rssnr: INT32_MAX,
cqi: INT32_MAX,
timingAdvance: INT32_MAX
};
function CdmaCellInfo() {}
CdmaCellInfo.prototype = {
__proto__: CellInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfo,
Ci.nsICdmaCellInfo]),
classID: CDMACELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: CDMACELLINFO_CID,
classDescription: "CdmaCellInfo",
interfaces: [Ci.nsICdmaCellInfo]
}),
// nsICdmaCellInfo
networkId: INT32_MAX,
systemId: INT32_MAX,
baseStationId: INT32_MAX,
longitude: INT32_MAX,
latitude: INT32_MAX,
cdmaDbm: INT32_MAX,
cdmaEcio: INT32_MAX,
evdoDbm: INT32_MAX,
evdoEcio: INT32_MAX,
evdoSnr: INT32_MAX
};
/**
* Wrap a MobileConnectionCallback to a TelephonyDialCallback.
*/
@ -904,6 +1046,67 @@ MobileConnectionProvider.prototype = {
return true;
}).bind(this));
},
getCellInfoList: function(aCallback) {
this._radioInterface.sendWorkerMessage("getCellInfoList",
null,
function(aResponse) {
if (aResponse.errorMsg) {
aCallback.notifyGetCellInfoListFailed(aResponse.errorMsg);
return;
}
let cellInfoList = [];
let count = aResponse.result.length;
for (let i = 0; i < count; i++) {
let srcCellInfo = aResponse.result[i];
let cellInfo;
switch (srcCellInfo.type) {
case RIL.CELL_INFO_TYPE_GSM:
cellInfo = new GsmCellInfo();
break;
case RIL.CELL_INFO_TYPE_WCDMA:
cellInfo = new WcdmaCellInfo();
break;
case RIL.CELL_INFO_TYPE_LTE:
cellInfo = new LteCellInfo();
break;
case RIL.CELL_INFO_TYPE_CDMA:
cellInfo = new CdmaCellInfo();
break;
}
if (!cellInfo) {
continue;
}
this._updateInfo(cellInfo, srcCellInfo);
cellInfoList.push(cellInfo);
}
aCallback.notifyGetCellInfoList(count, cellInfoList);
}.bind(this));
},
getNeighboringCellIds: function(aCallback) {
this._radioInterface.sendWorkerMessage("getNeighboringCellIds",
null,
function(aResponse) {
if (aResponse.errorMsg) {
aCallback.notifyGetNeighboringCellIdsFailed(aResponse.errorMsg);
return;
}
let neighboringCellIds = [];
let count = aResponse.result.length;
for (let i = 0; i < count; i++) {
let srcCellInfo = aResponse.result[i];
let cellInfo = new NeighboringCellInfo();
this._updateInfo(cellInfo, srcCellInfo);
neighboringCellIds.push(cellInfo);
}
aCallback.notifyGetNeighboringCellIds(count, neighboringCellIds);
}.bind(this));
},
};
function MobileConnectionService() {

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

@ -4,13 +4,17 @@
#include "nsISupports.idl"
[scriptable, uuid(1aed4c36-979e-4d20-9fa0-55139da8301e)]
interface nsICellInfo;
[scriptable, uuid(d8fae631-7ade-4024-b288-7efe75e6b091)]
interface nsICellInfoListCallback : nsISupports
{
/**
* result is an array of nsICellInfo.
* result is an array of nsICellInfo, which could be instances of
* nsIGsmCellInfo, nsIWcdmaCellInfo, nsICdmaCellInfo or nsILteCellInfo.
*/
void notifyGetCellInfoList(in jsval result);
void notifyGetCellInfoList(in uint32_t count,
[array, size_is(count)] in nsICellInfo result);
/**
* Callback function with error message.

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

@ -4,10 +4,12 @@
#include "nsISupports.idl"
interface nsICellInfoListCallback;
interface nsIMobileCallForwardingOptions;
interface nsIMobileConnection;
interface nsIMobileConnectionInfo;
interface nsIMobileNetworkInfo;
interface nsINeighboringCellIdsCallback;
interface nsIVariant;
[scriptable, uuid(823d935e-8262-47ed-8429-8203096b2ff4)]
@ -234,7 +236,7 @@ already_AddRefed<nsIMobileConnectionService>
NS_CreateMobileConnectionService();
%}
[scriptable, uuid(bde83c1d-1335-43b6-8268-ec7e320167f0)]
[scriptable, uuid(cfc7d15b-d2c2-4f28-ad9f-b250030c3073)]
interface nsIMobileConnection : nsISupports
{
/*
@ -764,4 +766,23 @@ interface nsIMobileConnection : nsISupports
*/
void setRadioEnabled(in bool enabled,
in nsIMobileConnectionCallback requestCallback);
/**
* Request neighboring cell ids in GSM/UMTS network.
*
* @param callback
* Called when request is finished. See nsINeighboringCellIdsCallback
* for details.
*/
void getNeighboringCellIds(in nsINeighboringCellIdsCallback callback);
/**
* Request all of the current cell information known to the radio, including
* neighboring cells.
*
* @param callback
* Called when request is finished. See nsICellInfoListCallback
* for details.
*/
void getCellInfoList(in nsICellInfoListCallback callback);
};

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

@ -4,13 +4,16 @@
#include "nsISupports.idl"
[scriptable, uuid(909f5972-c74e-44dd-b72a-7ddb62aae617)]
interface nsINeighboringCellInfo;
[scriptable, uuid(0941cb79-36e5-41e0-b05f-cdb854c53f03)]
interface nsINeighboringCellIdsCallback : nsISupports
{
/**
* result is an array of nsINeighboringCellInfo.
*/
void notifyGetNeighboringCellIds(in jsval result);
void notifyGetNeighboringCellIds(in uint32_t count,
[array, size_is(count)] in nsINeighboringCellInfo result);
/**
* Callback function with error message.

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

@ -340,6 +340,20 @@ MobileConnectionChild::SetRadioEnabled(bool aEnabled,
? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
MobileConnectionChild::GetNeighboringCellIds(nsINeighboringCellIdsCallback* aCallback)
{
// This function is supported in chrome context only.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MobileConnectionChild::GetCellInfoList(nsICellInfoListCallback* aCallback)
{
// This function is supported in chrome context only.
return NS_ERROR_NOT_IMPLEMENTED;
}
bool
MobileConnectionChild::SendRequest(const MobileConnectionRequest& aRequest,
nsIMobileConnectionCallback* aCallback)

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

@ -36,3 +36,4 @@ disabled = Bug 979137
[test_dsds_mobile_data_connection.js]
[test_mobile_clir.js]
[test_mobile_clir_radio_off.js]
[test_mobile_neighboring_cell_ids.js]

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

@ -0,0 +1,38 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 30000;
// This test must run in chrome context.
MARIONETTE_CONTEXT = "chrome";
let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
let service = Cc["@mozilla.org/mobileconnection/mobileconnectionservice;1"]
.getService(Ci.nsIMobileConnectionService);
ok(service, "service.constructor is " + service.constructor);
let mobileConnection = service.getItemByServiceId(0);
ok(mobileConnection, "mobileConnection.constructor is " + mobileConnection.constrctor);
function testGetNeighboringCellIds() {
log("Test getting mobile neighboring cell ids");
let deferred = Promise.defer();
mobileConnection.getNeighboringCellIds({
notifyGetNeighboringCellIds: function(aResult) {
deferred.resolve(aResult);
},
notifyGetNeighboringCellIdsFailed: function(aError) {
deferred.reject(aError);
}
});
return deferred.promise;
}
// Start tests
testGetNeighboringCellIds()
.then(function resolve(aResult) {
ok(false, "getNeighboringCellIds should not success");
}, function reject(aError) {
is(aError, "RequestNotSupported", "failed to getNeighboringCellIds");
}).then(finish);

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

@ -80,10 +80,13 @@ USING_MTP_NAMESPACE
#define USE_DEBUG 0
#undef LOG
#undef LOGW
#undef ERR
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "AutoMounter", ## args)
#define LOGW(args...) __android_log_print(ANDROID_LOG_WARN, "AutoMounter", ## args)
#define ERR(args...) __android_log_print(ANDROID_LOG_ERROR, "AutoMounter", ## args)
#undef DBG
#if USE_DEBUG
#define DBG(args...) __android_log_print(ANDROID_LOG_DEBUG, "AutoMounter" , ## args)
#else
@ -270,7 +273,7 @@ public:
void ConfigureUsbFunction(const char* aUsbFunc);
void StartMtpServer();
bool StartMtpServer();
void StopMtpServer();
void StartUmsSharing();
@ -582,16 +585,33 @@ SetUsbFunction(const char* aUsbFunc)
property_set(SYS_USB_CONFIG, newSysUsbConfig);
}
void
bool
AutoMounter::StartMtpServer()
{
if (sMozMtpServer) {
// Mtp Server is already running - nothing to do
return;
return true;
}
LOG("Starting MtpServer");
// For debugging, Change the #if 0 to #if 1, and then attach gdb during
// the 5 second interval below. Otherwise, configuring MTP will cause adb
// (and thus gdb) to get bounced.
#if 0
LOG("Sleeping");
PRTime now = PR_Now();
PRTime stopTime = now + 5000000;
while (PR_Now() < stopTime) {
LOG("Sleeping...");
sleep(1);
}
LOG("Sleep done");
#endif
sMozMtpServer = new MozMtpServer();
sMozMtpServer->Run();
if (!sMozMtpServer->Init()) {
return false;
}
VolumeArray::index_type volIndex;
VolumeArray::size_type numVolumes = VolumeManager::NumVolumes();
@ -600,6 +620,9 @@ AutoMounter::StartMtpServer()
nsRefPtr<MozMtpStorage> storage = new MozMtpStorage(vol, sMozMtpServer);
mMozMtpStorage.AppendElement(storage);
}
sMozMtpServer->Run();
return true;
}
void
@ -736,8 +759,13 @@ AutoMounter::UpdateState()
// and start the MTP server. This particular codepath will not
// normally be taken, but it could happen if you stop and restart
// b2g while sys.usb.config is set to enable mtp.
StartMtpServer();
SetState(STATE_MTP_STARTED);
if (StartMtpServer()) {
SetState(STATE_MTP_STARTED);
} else {
// Unable to start MTP. Go back to UMS.
SetUsbFunction(USB_FUNC_UMS);
SetState(STATE_UMS_CONFIGURING);
}
} else {
// We need to configure USB to use mtp. Wait for it to be configured
// before we start the MTP server.
@ -763,8 +791,13 @@ AutoMounter::UpdateState()
if (mtpEnabled && mtpConfigured) {
// The USB layer has been configured. Now we can go ahead and start
// the MTP server.
StartMtpServer();
SetState(STATE_MTP_STARTED);
if (StartMtpServer()) {
SetState(STATE_MTP_STARTED);
} else {
// Unable to start MTP. Go back to UMS.
SetUsbFunction(USB_FUNC_UMS);
SetState(STATE_UMS_CONFIGURING);
}
break;
}
if (rndisConfigured) {

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

@ -24,6 +24,7 @@
#include "mozilla/dom/SettingChangeNotificationBinding.h"
#undef LOG
#undef ERR
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "AutoMounterSetting" , ## args)
#define ERR(args...) __android_log_print(ANDROID_LOG_ERROR, "AutoMounterSetting" , ## args)

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

@ -171,9 +171,29 @@ void
MozMtpDatabase::RemoveEntry(MtpObjectHandle aHandle)
{
MutexAutoLock lock(mMutex);
if (!IsValidHandle(aHandle)) {
return;
}
if (aHandle > 0 && aHandle < mDb.Length()) {
mDb[aHandle] = nullptr;
RefPtr<DbEntry> removedEntry = mDb[aHandle];
mDb[aHandle] = nullptr;
MTP_DBG("0x%08x removed", aHandle);
// if the entry is not a folder, just return.
if (removedEntry->mObjectFormat != MTP_FORMAT_ASSOCIATION) {
return;
}
// Find out and remove the children of aHandle.
// Since the index for a directory will always be less than the index of any of its children,
// we can remove the entire subtree in one pass.
ProtectedDbArray::size_type numEntries = mDb.Length();
ProtectedDbArray::index_type entryIndex;
for (entryIndex = aHandle+1; entryIndex < numEntries; entryIndex++) {
RefPtr<DbEntry> entry = mDb[entryIndex];
if (entry && IsValidHandle(entry->mParent) && !mDb[entry->mParent]) {
mDb[entryIndex] = nullptr;
MTP_DBG("0x%08x removed", aHandle);
}
}
}

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

@ -226,6 +226,11 @@ private:
MatchParentFormat,
};
bool IsValidHandle(MtpObjectHandle aHandle)
{
return aHandle > 0 && aHandle < mDb.Length();
}
void AddEntry(DbEntry* aEntry);
void AddEntryAndNotify(DbEntry* aEntr, RefCountedMtpServer* aMtpServer);
void DumpEntries(const char* aLabel);

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

@ -20,7 +20,6 @@
#include "base/message_loop.h"
#include "DeviceStorage.h"
#include "mozilla/FileUtils.h"
#include "mozilla/LazyIdleThread.h"
#include "mozilla/Scoped.h"
#include "mozilla/Services.h"
@ -225,33 +224,38 @@ MozMtpServer::GetMozMtpDatabase()
return db.forget();
}
void
MozMtpServer::Run()
bool
MozMtpServer::Init()
{
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
const char *mtpUsbFilename = "/dev/mtp_usb";
ScopedClose mtpUsbFd(open(mtpUsbFilename, O_RDWR));
if (mtpUsbFd.get() < 0) {
mMtpUsbFd = open(mtpUsbFilename, O_RDWR);
if (mMtpUsbFd.get() < 0) {
MTP_ERR("open of '%s' failed", mtpUsbFilename);
return;
return false;
}
MTP_LOG("Opened '%s' fd %d", mtpUsbFilename, mtpUsbFd.get());
MTP_LOG("Opened '%s' fd %d", mtpUsbFilename, mMtpUsbFd.get());
mMozMtpDatabase = new MozMtpDatabase();
mMtpServer = new RefCountedMtpServer(mtpUsbFd.get(), // fd
mMtpServer = new RefCountedMtpServer(mMtpUsbFd.get(), // fd
mMozMtpDatabase.get(), // MtpDatabase
false, // ptp?
AID_MEDIA_RW, // file group
0664, // file permissions
0775); // dir permissions
return true;
}
void
MozMtpServer::Run()
{
nsresult rv = NS_NewNamedThread("MtpServer", getter_AddRefs(mServerThread));
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
MOZ_ASSERT(mServerThread);
mServerThread->Dispatch(new MtpServerRunnable(mtpUsbFd.forget(), this), NS_DISPATCH_NORMAL);
mServerThread->Dispatch(new MtpServerRunnable(mMtpUsbFd.forget(), this), NS_DISPATCH_NORMAL);
}
END_MTP_NAMESPACE

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

@ -10,6 +10,8 @@
#include "MozMtpCommon.h"
#include "MozMtpDatabase.h"
#include "mozilla/FileUtils.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsIThread.h"
@ -40,10 +42,9 @@ class MozMtpServer
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MozMtpServer)
bool Init();
void Run();
// void UpdateStorage(android::MtpStorageID id, Volume *vol);
already_AddRefed<RefCountedMtpServer> GetMtpServer();
already_AddRefed<MozMtpDatabase> GetMozMtpDatabase();
@ -51,6 +52,7 @@ private:
nsRefPtr<RefCountedMtpServer> mMtpServer;
nsRefPtr<MozMtpDatabase> mMozMtpDatabase;
nsCOMPtr<nsIThread> mServerThread;
ScopedClose mMtpUsbFd;
};
END_MTP_NAMESPACE

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

@ -13,10 +13,13 @@
#define USE_DEBUG 0
#undef LOG
#undef LOGW
#undef ERR
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "OpenFileFinder", ## args)
#define LOGW(args...) __android_log_print(ANDROID_LOG_WARN, "OpenFileFinder", ## args)
#define ERR(args...) __android_log_print(ANDROID_LOG_ERROR, "OpenFileFinder", ## args)
#undef DBG
#if USE_DEBUG
#define DBG(args...) __android_log_print(ANDROID_LOG_DEBUG, "OpenFileFinder" , ## args)
#else

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

@ -53,16 +53,6 @@ const RADIOINTERFACE_CID =
Components.ID("{6a7c91f0-a2b3-4193-8562-8969296c0b54}");
const RILNETWORKINTERFACE_CID =
Components.ID("{3bdd52a9-3965-4130-b569-0ac5afed045e}");
const NEIGHBORINGCELLINFO_CID =
Components.ID("{f9dfe26a-851e-4a8b-a769-cbb1baae7ded}");
const GSMCELLINFO_CID =
Components.ID("{41f6201e-7263-42e3-b31f-38a9dc8a280a}");
const WCDMACELLINFO_CID =
Components.ID("{eeaaf307-df6e-4c98-b121-e3302b1fc468}");
const CDMACELLINFO_CID =
Components.ID("{b497d6e4-4cb8-4d6e-b673-840c7d5ddf25}");
const LTECELLINFO_CID =
Components.ID("{c7e0a78a-4e99-42f5-9251-e6172c5ed8d8}");
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
const kNetworkConnStateChangedTopic = "network-connection-state-changed";
@ -97,9 +87,6 @@ const RADIO_POWER_OFF_TIMEOUT = 30000;
const SMS_HANDLED_WAKELOCK_TIMEOUT = 5000;
const HW_DEFAULT_CLIENT_ID = 0;
const INT32_MAX = 2147483647;
const UNKNOWN_RSSI = 99;
const RIL_IPC_ICCMANAGER_MSG_NAMES = [
"RIL:GetRilContext",
"RIL:SendStkResponse",
@ -962,127 +949,6 @@ CdmaIccInfo.prototype = {
prlVersion: 0
};
function NeighboringCellInfo() {}
NeighboringCellInfo.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsINeighboringCellInfo]),
classID: NEIGHBORINGCELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: NEIGHBORINGCELLINFO_CID,
classDescription: "NeighboringCellInfo",
interfaces: [Ci.nsINeighboringCellInfo]
}),
// nsINeighboringCellInfo
networkType: null,
gsmLocationAreaCode: -1,
gsmCellId: -1,
wcdmaPsc: -1,
signalStrength: UNKNOWN_RSSI
};
function CellInfo() {}
CellInfo.prototype = {
type: null,
registered: false,
timestampType: Ci.nsICellInfo.TIMESTAMP_TYPE_UNKNOWN,
timestamp: 0
};
function GsmCellInfo() {}
GsmCellInfo.prototype = {
__proto__: CellInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGsmCellInfo]),
classID: GSMCELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: GSMCELLINFO_CID,
classDescription: "GsmCellInfo",
interfaces: [Ci.nsIGsmCellInfo]
}),
// nsIGsmCellInfo
mcc: INT32_MAX,
mnc: INT32_MAX,
lac: INT32_MAX,
cid: INT32_MAX,
signalStrength: UNKNOWN_RSSI,
bitErrorRate: UNKNOWN_RSSI
};
function WcdmaCellInfo() {}
WcdmaCellInfo.prototype = {
__proto__: CellInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWcdmaCellInfo]),
classID: WCDMACELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: WCDMACELLINFO_CID,
classDescription: "WcdmaCellInfo",
interfaces: [Ci.nsIWcdmaCellInfo]
}),
// nsIWcdmaCellInfo
mcc: INT32_MAX,
mnc: INT32_MAX,
lac: INT32_MAX,
cid: INT32_MAX,
psc: INT32_MAX,
signalStrength: UNKNOWN_RSSI,
bitErrorRate: UNKNOWN_RSSI
};
function LteCellInfo() {}
LteCellInfo.prototype = {
__proto__: CellInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsILteCellInfo]),
classID: LTECELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: LTECELLINFO_CID,
classDescription: "LteCellInfo",
interfaces: [Ci.nsILteCellInfo]
}),
// nsILteCellInfo
mcc: INT32_MAX,
mnc: INT32_MAX,
cid: INT32_MAX,
pcid: INT32_MAX,
tac: INT32_MAX,
signalStrength: UNKNOWN_RSSI,
rsrp: INT32_MAX,
rsrq: INT32_MAX,
rssnr: INT32_MAX,
cqi: INT32_MAX,
timingAdvance: INT32_MAX
};
function CdmaCellInfo() {}
CdmaCellInfo.prototype = {
__proto__: CellInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsICdmaCellInfo]),
classID: CDMACELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: CDMACELLINFO_CID,
classDescription: "CdmaCellInfo",
interfaces: [Ci.nsICdmaCellInfo]
}),
// nsICdmaCellInfo
networkId: INT32_MAX,
systemId: INT32_MAX,
baseStationId: INT32_MAX,
longitude: INT32_MAX,
latitude: INT32_MAX,
cdmaDbm: INT32_MAX,
cdmaEcio: INT32_MAX,
evdoDbm: INT32_MAX,
evdoEcio: INT32_MAX,
evdoSnr: INT32_MAX
};
function DataConnectionHandler(clientId, radioInterface) {
// Initial owning attributes.
this.clientId = clientId;
@ -3895,67 +3761,6 @@ RadioInterface.prototype = {
this.workerMessenger.send(rilMessageType, message);
}
},
getCellInfoList: function(callback) {
this.workerMessenger.send("getCellInfoList",
null,
function(response) {
if (response.errorMsg) {
callback.notifyGetCellInfoListFailed(response.errorMsg);
return;
}
let cellInfoList = [];
let count = response.result.length;
for (let i = 0; i < count; i++) {
let srcCellInfo = response.result[i];
let cellInfo;
switch (srcCellInfo.type) {
case RIL.CELL_INFO_TYPE_GSM:
cellInfo = new GsmCellInfo();
break;
case RIL.CELL_INFO_TYPE_WCDMA:
cellInfo = new WcdmaCellInfo();
break;
case RIL.CELL_INFO_TYPE_LTE:
cellInfo = new LteCellInfo();
break;
case RIL.CELL_INFO_TYPE_CDMA:
cellInfo = new CdmaCellInfo();
break;
}
if (!cellInfo) {
continue;
}
this.updateInfo(srcCellInfo, cellInfo);
cellInfoList.push(cellInfo);
}
callback.notifyGetCellInfoList(cellInfoList);
}.bind(this));
},
getNeighboringCellIds: function(callback) {
this.workerMessenger.send("getNeighboringCellIds",
null,
function(response) {
if (response.errorMsg) {
callback.notifyGetNeighboringCellIdsFailed(response.errorMsg);
return;
}
let neighboringCellIds = [];
let count = response.result.length;
for (let i = 0; i < count; i++) {
let srcCellInfo = response.result[i];
let cellInfo = new NeighboringCellInfo();
this.updateInfo(srcCellInfo, cellInfo);
neighboringCellIds.push(cellInfo);
}
callback.notifyGetNeighboringCellIds(neighboringCellIds);
}.bind(this));
}
};
function DataCall(clientId, apnSetting) {

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

@ -12,9 +12,11 @@
#endif
#undef LOG
#undef ERR
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, VOLUME_MANAGER_LOG_TAG, ## args)
#define ERR(args...) __android_log_print(ANDROID_LOG_ERROR, VOLUME_MANAGER_LOG_TAG, ## args)
#undef DBG
#if USE_DEBUG
#define DBG(args...) __android_log_print(ANDROID_LOG_DEBUG, VOLUME_MANAGER_LOG_TAG, ## args)
#else

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

@ -5,11 +5,9 @@
#include "nsISupports.idl"
#include "nsINetworkManager.idl"
interface nsICellInfoListCallback;
interface nsIIccInfo;
interface nsIMobileConnectionInfo;
interface nsIMobileMessageCallback;
interface nsINeighboringCellIdsCallback;
[scriptable, uuid(6e0f45b8-410e-11e3-8c8e-b715b2cd0128)]
interface nsIRilNetworkInterface : nsINetworkInterface
@ -42,7 +40,7 @@ interface nsIRilSendWorkerMessageCallback : nsISupports
boolean handleResponse(in jsval response);
};
[scriptable, uuid(c13a8890-797b-4557-b92f-6b959f56c1d8)]
[scriptable, uuid(622e8809-1a89-45f7-9b35-7e49b5aaa69f)]
interface nsIRadioInterface : nsISupports
{
readonly attribute nsIRilContext rilContext;
@ -72,17 +70,6 @@ interface nsIRadioInterface : nsISupports
[optional] in nsIRilSendWorkerMessageCallback callback);
void getSmscAddress(in nsIMobileMessageCallback request);
/**
* Request neighboring cell ids in GSM/UMTS network.
*/
void getNeighboringCellIds(in nsINeighboringCellIdsCallback callback);
/**
* Request all of the current cell information known to the radio, including
* neighboring cells.
*/
void getCellInfoList(in nsICellInfoListCallback callback);
};
[scriptable, uuid(78b65e8c-68e7-4510-9a05-65bba12b283e)]

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

@ -215,6 +215,7 @@ const TELEPHONY_REQUESTS = [
REQUEST_DIAL,
REQUEST_DIAL_EMERGENCY_CALL,
REQUEST_HANGUP,
REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND,
REQUEST_HANGUP_WAITING_OR_BACKGROUND,
REQUEST_SEPARATE_CONNECTION,
REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE,
@ -1779,13 +1780,25 @@ RilObject.prototype = {
Buf.sendParcel();
},
sendHangUpBackgroundRequest: function() {
this.telephonyRequestQueue.push(REQUEST_HANGUP_WAITING_OR_BACKGROUND,
this.sendRilRequestHangUpWaiting, null);
sendHangUpForegroundRequest: function(options) {
this.telephonyRequestQueue.push(REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND,
this.sendRilRequestHangUpForeground,
options);
},
sendRilRequestHangUpWaiting: function() {
this.context.Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
sendRilRequestHangUpForeground: function(options) {
this.context.Buf.simpleRequest(REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND,
options);
},
sendHangUpBackgroundRequest: function(options) {
this.telephonyRequestQueue.push(REQUEST_HANGUP_WAITING_OR_BACKGROUND,
this.sendRilRequestHangUpWaiting, options);
},
sendRilRequestHangUpWaiting: function(options) {
this.context.Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND,
options);
},
/**
@ -1961,6 +1974,27 @@ RilObject.prototype = {
Buf.sendParcel();
},
hangUpConference: function(options) {
if (this._isCdma) {
// In cdma, ril only maintains one call index.
let call = this.currentCalls[1];
if (!call) {
options.success = false;
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
this.sendChromeMessage(options);
return;
}
call.hangUpLocal = true;
this.sendHangUpRequest(1);
} else {
if (this.currentConference.state === CALL_STATE_ACTIVE) {
this.sendHangUpForegroundRequest(options);
} else {
this.sendHangUpBackgroundRequest(options);
}
}
},
holdConference: function() {
if (this._isCdma) {
return;
@ -5430,26 +5464,19 @@ RilObject.prototype[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, option
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_HANGUP] = function REQUEST_HANGUP(length, options) {
if (options.rilRequestError) {
return;
}
options.success = options.rilRequestError === 0;
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
this.getCurrentCalls();
if (options.success) {
this.getCurrentCalls();
}
};
RilObject.prototype[REQUEST_HANGUP_WAITING_OR_BACKGROUND] = function REQUEST_HANGUP_WAITING_OR_BACKGROUND(length, options) {
if (options.rilRequestError) {
return;
}
this.getCurrentCalls();
RilObject.prototype[REQUEST_HANGUP].call(this, length, options);
};
// TODO Bug 1012599: This one is not used.
RilObject.prototype[REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND] = function REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND(length, options) {
if (options.rilRequestError) {
return;
}
this.getCurrentCalls();
RilObject.prototype[REQUEST_HANGUP].call(this, length, options);
};
RilObject.prototype[REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE] = function REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE(length, options) {
if (options.rilRequestError) {
@ -7844,6 +7871,12 @@ GsmPDUHelperObject.prototype = {
msg.body = null;
msg.data = null;
if (length <= 0) {
// No data to read.
return;
}
switch (msg.encoding) {
case PDU_DCS_MSG_CODING_7BITS_ALPHABET:
// 7 bit encoding allows 140 octets, which means 160 characters

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

@ -12,4 +12,3 @@ disabled = Bug 808783
[test_data_connection.js]
[test_network_active_changed.js]
[test_multiple_data_connection.js]
[test_neighboring_cell_ids.js]

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

@ -1,33 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 30000;
MARIONETTE_HEAD_JS = "head.js";
function testGetNeighboringCellIds() {
log("Test getting neighboring cell ids");
let deferred = Promise.defer();
radioInterface.getNeighboringCellIds({
notifyGetNeighboringCellIds: function(aResult) {
deferred.resolve(aResult);
},
notifyGetNeighboringCellIdsFailed: function(aError) {
deferred.reject(aError);
}
});
return deferred.promise;
}
// Start tests
startTestBase(function() {
// TODO: Bug 1028837 - B2G Emulator: support neighboring cell ids.
// Currently, emulator does not support RIL_REQUEST_NEIGHBORING_CELL_IDS,
// so we expect to get a 'RequestNotSupported' error here.
return testGetNeighboringCellIds()
.then(function resolve(aResult) {
ok(false, "getNeighboringCellIds should not success");
}, function reject(aError) {
is(aError, "RequestNotSupported", "failed to getNeighboringCellIds");
});
});

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

@ -5,14 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "TelephonyCallGroup.h"
#include "mozilla/dom/TelephonyCallGroupBinding.h"
#include "CallsList.h"
#include "Telephony.h"
#include "mozilla/dom/CallEvent.h"
#include "mozilla/dom/CallGroupErrorEvent.h"
#include "Telephony.h"
#include "mozilla/dom/TelephonyCallGroupBinding.h"
#include "mozilla/dom/telephony/TelephonyCallback.h"
using namespace mozilla::dom;
using namespace mozilla::dom::telephony;
using mozilla::ErrorResult;
TelephonyCallGroup::TelephonyCallGroup(nsPIDOMWindow* aOwner)
@ -277,6 +279,28 @@ TelephonyCallGroup::Remove(TelephonyCall& aCall, ErrorResult& aRv)
}
}
already_AddRefed<Promise>
TelephonyCallGroup::HangUp(ErrorResult& aRv)
{
MOZ_ASSERT(!mCalls.IsEmpty());
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
if (!global) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
aRv = mTelephony->Service()->HangUpConference(mCalls[0]->ServiceId(),
callback);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
return promise.forget();
}
void
TelephonyCallGroup::Hold(ErrorResult& aRv)
{

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

@ -7,6 +7,7 @@
#ifndef mozilla_dom_telephony_telephonycallgroup_h__
#define mozilla_dom_telephony_telephonycallgroup_h__
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/telephony/TelephonyCommon.h"
namespace mozilla {
@ -52,6 +53,9 @@ public:
void
Remove(TelephonyCall& aCall, ErrorResult& aRv);
already_AddRefed<Promise>
HangUp(ErrorResult& aRv);
void
Hold(ErrorResult& aRv);

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

@ -1038,6 +1038,16 @@ TelephonyService.prototype = {
});
},
hangUpConference: function(aClientId, aCallback) {
this._sendToRilWorker(aClientId, "hangUpConference", null, response => {
if (!response.success) {
aCallback.notifyError(response.errorMsg);
} else {
aCallback.notifySuccess();
}
});
},
holdConference: function(aClientId) {
this._sendToRilWorker(aClientId, "holdConference");
},

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

@ -30,11 +30,17 @@ struct USSDRequest
nsString ussd;
};
struct HangUpConferenceRequest
{
uint32_t clientId;
};
union IPCTelephonyRequest
{
EnumerateCallsRequest;
DialRequest;
USSDRequest;
HangUpConferenceRequest;
};
sync protocol PTelephony {

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

@ -253,6 +253,13 @@ TelephonyIPCService::SeparateCall(uint32_t aClientId, uint32_t aCallIndex)
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCService::HangUpConference(uint32_t aClientId,
nsITelephonyCallback *aCallback)
{
return SendRequest(nullptr, aCallback, HangUpConferenceRequest(aClientId));
}
NS_IMETHODIMP
TelephonyIPCService::HoldConference(uint32_t aClientId)
{

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

@ -45,6 +45,8 @@ TelephonyParent::RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActo
return actor->DoRequest(aRequest.get_DialRequest());
case IPCTelephonyRequest::TUSSDRequest:
return actor->DoRequest(aRequest.get_USSDRequest());
case IPCTelephonyRequest::THangUpConferenceRequest:
return actor->DoRequest(aRequest.get_HangUpConferenceRequest());
default:
MOZ_CRASH("Unknown type!");
}
@ -451,6 +453,20 @@ TelephonyRequestParent::DoRequest(const USSDRequest& aRequest)
return true;
}
bool
TelephonyRequestParent::DoRequest(const HangUpConferenceRequest& aRequest)
{
nsCOMPtr<nsITelephonyService> service =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
if (service) {
service->HangUpConference(aRequest.clientId(), this);
} else {
return NS_SUCCEEDED(NotifyError(NS_LITERAL_STRING("InvalidStateError")));
}
return true;
}
nsresult
TelephonyRequestParent::SendResponse(const IPCTelephonyResponse& aResponse)
{

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

@ -129,6 +129,9 @@ private:
bool
DoRequest(const USSDRequest& aRequest);
bool
DoRequest(const HangUpConferenceRequest& aRequest);
};
END_TELEPHONY_NAMESPACE

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

@ -240,7 +240,7 @@ interface nsITelephonyDialCallback : nsITelephonyCallback
* XPCOM component (in the content process) that provides the telephony
* information.
*/
[scriptable, uuid(79188caa-046a-48e1-b9c5-2e891504dc7a)]
[scriptable, uuid(6fa2d94b-80ee-4085-b6a0-535811ba9bb6)]
interface nsITelephonyService : nsISupports
{
const unsigned short CALL_STATE_UNKNOWN = 0;
@ -296,6 +296,8 @@ interface nsITelephonyService : nsISupports
void conferenceCall(in unsigned long clientId);
void separateCall(in unsigned long clientId, in unsigned long callIndex);
void hangUpConference(in unsigned long clientId,
in nsITelephonyCallback callback);
void holdConference(in unsigned long clientId);
void resumeConference(in unsigned long clientId);

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

@ -1110,6 +1110,44 @@ let emulator = (function() {
return deferred.promise;
}
/**
* Hangup conference.
*
* @return A deferred promise.
*/
function hangUpConference() {
log("Hangup conference.");
let deferred = Promise.defer();
let done = function() {
deferred.resolve();
};
let pending = ["conference.hangUp", "conference.onstatechange"];
let receive = function(name) {
receivedPending(name, pending, done);
};
for (let call of conference.calls) {
let callName = "Call (" + call.id.number + ')';
let onstatechange = callName + ".onstatechange";
pending.push(onstatechange);
check_onstatechange(call, callName, 'disconnected',
receive.bind(null, onstatechange));
}
check_onstatechange(conference, 'conference', '', function() {
receive("conference.onstatechange");
});
conference.hangUp().then(() => {
receive("conference.hangUp");
});
return deferred.promise;
}
/**
* Create a conference with an outgoing call and an incoming call.
*
@ -1254,6 +1292,7 @@ let emulator = (function() {
this.gResumeConference = resumeConference;
this.gRemoveCallInConference = removeCallInConference;
this.gHangUpCallInConference = hangUpCallInConference;
this.gHangUpConference = hangUpConference;
this.gSetupConference = setupConference;
this.gReceivedPending = receivedPending;
}());

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

@ -52,6 +52,7 @@ disabled = Bug 821958
[test_conference_two_calls.js]
[test_conference_add_error.js]
[test_conference_remove_error.js]
[test_conference_two_hangup_all.js]
[test_conference_two_hangup_one.js]
[test_conference_two_hold_resume.js]
[test_conference_two_remove_one.js]

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

@ -0,0 +1,56 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
function testConferenceHangUpForeground() {
log('= testConferenceHangUpForeground =');
let outCall;
let inCall;
let outNumber = "5555550101";
let inNumber = "5555550201";
return Promise.resolve()
.then(() => gSetupConference([outNumber, inNumber]))
.then(calls => {
[outCall, inCall] = calls;
})
.then(() => gHangUpConference())
.then(() => gCheckAll(null, [], '', [], []));
}
function testConferenceHangUpBackground() {
log('= testConferenceHangUpBackground =');
let outCall;
let inCall;
let outNumber = "5555550101";
let inNumber = "5555550201";
let outInfo = gOutCallStrPool(outNumber);
let inInfo = gInCallStrPool(inNumber);
return Promise.resolve()
.then(() => gSetupConference([outNumber, inNumber]))
.then(calls => {
[outCall, inCall] = calls;
})
.then(() => gHoldConference([outCall, inCall], function() {
gCheckState(null, [], 'held', [outCall, inCall]);
}))
.then(() => gCheckAll(null, [], 'held', [outCall, inCall],
[outInfo.held, inInfo.held]))
.then(() => gHangUpConference())
.then(() => gCheckAll(null, [], '', [], []));
}
// Start the test
startTest(function() {
testConferenceHangUpForeground()
.then(() => testConferenceHangUpBackground())
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.then(finish);
});

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

@ -136,7 +136,7 @@ let PDUBuilder = {
};
}
let encodedBodyLength = options.body.length;
let encodedBodyLength = (options.body) ? options.body.length : 0;
let headerOctets = (headerLength ? headerLength + 1 : 0);
let paddingBits;
@ -161,9 +161,11 @@ let PDUBuilder = {
}
}
this.writeStringAsSeptets(options.body, paddingBits,
RIL.PDU_NL_IDENTIFIER_DEFAULT,
RIL.PDU_NL_IDENTIFIER_DEFAULT);
if (encodedBodyLength > 0) {
this.writeStringAsSeptets(options.body, paddingBits,
RIL.PDU_NL_IDENTIFIER_DEFAULT,
RIL.PDU_NL_IDENTIFIER_DEFAULT);
}
return this.buf;
},

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

@ -20,7 +20,7 @@ function checkEventStatus(aEvent, aServiceId, aHasMessages, aMessageCount,
compareVoicemailStatus(voicemail.getStatus(), status);
}
function testLevel2DiscardActive(aActive) {
function testLevel2Discard(aActive) {
log(" Active: " + aActive);
let sender = "+15125551235";
@ -32,15 +32,14 @@ function testLevel2DiscardActive(aActive) {
}
// Tests for Level 3 MWI with a message count in the User Data Header
function testLevel3DiscardActive(aMessageCount) {
log(" Message Count: " + aMessageCount);
function testLevel3Discard(aMessageCount, aBody) {
log(" Message Count: " + aMessageCount + ", Body: " + aBody);
let sender = "+15125551236";
let body = aMessageCount + " voicemails";
let pdu = PDUBuilder.buildLevel3DiscardMwi(aMessageCount, sender, body);
let pdu = PDUBuilder.buildLevel3DiscardMwi(aMessageCount, sender, aBody);
return sendIndicatorPDUAndWait(pdu)
.then((aResults) => checkEventStatus(aResults[0], 0, !!aMessageCount,
aMessageCount, sender, body));
aMessageCount, sender, aBody));
}
startTestCommon(function() {
@ -49,12 +48,14 @@ startTestCommon(function() {
.then(() => log("Testing Message Waiting Indication Group"))
// Level 2 discarded active/inactive MWI.
.then(() => log(" Discard Message"))
.then(() => testLevel2DiscardActive(true))
.then(() => testLevel2DiscardActive(false))
.then(() => testLevel2Discard(true))
.then(() => testLevel2Discard(false))
.then(() => log("Testing Special SMS Message Indication"))
.then(() => log(" Discard Message"))
// Level 3 discarded active/inactive MWI.
.then(() => testLevel3DiscardActive(3))
.then(() => testLevel3DiscardActive(0));
.then(() => testLevel3Discard(3, "3 voicemails"))
.then(() => testLevel3Discard(0, "0 voicemail"))
.then(() => testLevel3Discard(3, null))
.then(() => testLevel3Discard(0, null));
});

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

@ -17,6 +17,9 @@ interface TelephonyCallGroup : EventTarget {
[Throws]
void remove(TelephonyCall call);
[NewObject, Throws]
Promise<void> hangUp();
[Throws]
void hold();

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

@ -359,9 +359,6 @@ public:
// Whether or not this frame may have touch listeners.
bool mMayHaveTouchListeners;
// Whether or not this frame may have touch caret.
bool mMayHaveTouchCaret;
public:
void SetIsRoot(bool aIsRoot)
{
@ -530,10 +527,23 @@ public:
mContentDescription = aContentDescription;
}
bool GetMayHaveTouchCaret() const
{
return mMayHaveTouchCaret;
}
void SetMayHaveTouchCaret(bool aMayHaveTouchCaret)
{
mMayHaveTouchCaret = aMayHaveTouchCaret;
}
private:
// New fields from now on should be made private and old fields should
// be refactored to be private.
// Whether or not this frame may have a touch caret.
bool mMayHaveTouchCaret;
// Whether or not this is the root scroll frame for the root content document.
bool mIsRoot;

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

@ -1036,7 +1036,7 @@ nsEventStatus AsyncPanZoomController::ReceiveInputEvent(const InputData& aEvent)
block->GetOverscrollHandoffChain()->CancelAnimations();
}
if (mFrameMetrics.mMayHaveTouchListeners || mFrameMetrics.mMayHaveTouchCaret) {
if (mFrameMetrics.mMayHaveTouchListeners || mFrameMetrics.GetMayHaveTouchCaret()) {
// Content may intercept the touch events and prevent-default them. So we schedule
// a timeout to give content time to do that.
ScheduleContentResponseTimeout();
@ -2677,7 +2677,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
UpdateTransformScale();
mFrameMetrics.mMayHaveTouchListeners = aLayerMetrics.mMayHaveTouchListeners;
mFrameMetrics.mMayHaveTouchCaret = aLayerMetrics.mMayHaveTouchCaret;
mFrameMetrics.SetMayHaveTouchCaret(aLayerMetrics.GetMayHaveTouchCaret());
mFrameMetrics.SetScrollParentId(aLayerMetrics.GetScrollParentId());
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d", this, aIsFirstPaint);

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

@ -63,6 +63,7 @@
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "ProfilerMarkers.h"
#endif
#include "mozilla/VsyncDispatcher.h"
namespace mozilla {
namespace layers {
@ -190,6 +191,117 @@ static void SetThreadPriority()
hal::SetCurrentThreadPriority(hal::THREAD_PRIORITY_COMPOSITOR);
}
CompositorVsyncObserver::CompositorVsyncObserver(CompositorParent* aCompositorParent)
: mNeedsComposite(false)
, mIsObservingVsync(false)
, mCompositorParent(aCompositorParent)
, mCurrentCompositeTaskMonitor("CurrentCompositeTaskMonitor")
, mCurrentCompositeTask(nullptr)
{
}
CompositorVsyncObserver::~CompositorVsyncObserver()
{
MOZ_ASSERT(NS_IsMainThread());
UnobserveVsync();
mCompositorParent = nullptr;
mNeedsComposite = false;
CancelCurrentCompositeTask();
}
/**
* TODO Potential performance heuristics:
* If a composite takes 17 ms, do we composite ASAP or wait until next vsync?
* If a layer transaction comes after vsync, do we composite ASAP or wait until
* next vsync?
* How many skipped vsync events until we stop listening to vsync events?
*/
void
CompositorVsyncObserver::SetNeedsComposite(bool aNeedsComposite)
{
MOZ_ASSERT(CompositorParent::IsInCompositorThread());
mNeedsComposite = aNeedsComposite;
if (!mIsObservingVsync && mNeedsComposite) {
ObserveVsync();
}
}
bool
CompositorVsyncObserver::NotifyVsync(TimeStamp aVsyncTimestamp)
{
// Called from the vsync dispatch thread
MOZ_ASSERT(!CompositorParent::IsInCompositorThread());
MOZ_ASSERT(!NS_IsMainThread());
MonitorAutoLock lock(mCurrentCompositeTaskMonitor);
if (mCurrentCompositeTask == nullptr) {
mCurrentCompositeTask = NewRunnableMethod(this,
&CompositorVsyncObserver::Composite,
aVsyncTimestamp);
CompositorParent::CompositorLoop()->PostTask(FROM_HERE, mCurrentCompositeTask);
}
return true;
}
void
CompositorVsyncObserver::CancelCurrentCompositeTask()
{
MOZ_ASSERT(CompositorParent::IsInCompositorThread() || NS_IsMainThread());
MonitorAutoLock lock(mCurrentCompositeTaskMonitor);
if (mCurrentCompositeTask) {
mCurrentCompositeTask->Cancel();
mCurrentCompositeTask = nullptr;
}
}
void
CompositorVsyncObserver::Composite(TimeStamp aVsyncTimestamp)
{
MOZ_ASSERT(CompositorParent::IsInCompositorThread());
{
MonitorAutoLock lock(mCurrentCompositeTaskMonitor);
mCurrentCompositeTask = nullptr;
}
if (mNeedsComposite && mCompositorParent) {
mNeedsComposite = false;
mCompositorParent->CompositeCallback(aVsyncTimestamp);
} else {
// We're getting vsync notifications but we don't need to composite so
// unregister the vsync.
UnobserveVsync();
}
}
bool
CompositorVsyncObserver::NeedsComposite()
{
MOZ_ASSERT(CompositorParent::IsInCompositorThread());
return mNeedsComposite;
}
/**
* Since the vsync thread has its own locks before notifying us of vsync
* we can't register/unregister from the vsync thread. Any other thread is fine
*/
void
CompositorVsyncObserver::ObserveVsync()
{
MOZ_ASSERT(CompositorParent::IsInCompositorThread());
VsyncDispatcher::GetInstance()->AddCompositorVsyncObserver(this);
mIsObservingVsync = true;
}
void
CompositorVsyncObserver::UnobserveVsync()
{
MOZ_ASSERT(CompositorParent::IsInCompositorThread() || NS_IsMainThread());
VsyncDispatcher::GetInstance()->RemoveCompositorVsyncObserver(this);
mIsObservingVsync = false;
}
void CompositorParent::StartUp()
{
MOZ_ASSERT(NS_IsMainThread(), "Should be on the main Thread!");
@ -254,6 +366,10 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
if (gfxPrefs::AsyncPanZoomEnabled()) {
mApzcTreeManager = new APZCTreeManager();
}
if (gfxPrefs::VsyncAlignedCompositor()) {
mCompositorVsyncObserver = new CompositorVsyncObserver(this);
}
}
bool
@ -293,6 +409,7 @@ CompositorParent::Destroy()
mApzcTreeManager = nullptr;
}
sIndirectLayerTrees.erase(mRootLayerTreeID);
mCompositorVsyncObserver = nullptr;
}
void
@ -374,12 +491,17 @@ CompositorParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
bool
CompositorParent::RecvFlushRendering()
{
// If we're waiting to do a composite, then cancel it
// and do it immediately instead.
if (mCurrentCompositeTask) {
if (gfxPrefs::VsyncAlignedCompositor() && mCompositorVsyncObserver->NeedsComposite()) {
mCompositorVsyncObserver->SetNeedsComposite(false);
CancelCurrentCompositeTask();
ForceComposeToTarget(nullptr);
} else if (mCurrentCompositeTask) {
// If we're waiting to do a composite, then cancel it
// and do it immediately instead.
CancelCurrentCompositeTask();
ForceComposeToTarget(nullptr);
}
return true;
}
@ -497,7 +619,9 @@ CompositorParent::ForceComposition()
void
CompositorParent::CancelCurrentCompositeTask()
{
if (mCurrentCompositeTask) {
if (gfxPrefs::VsyncAlignedCompositor()) {
mCompositorVsyncObserver->CancelCurrentCompositeTask();
} else if (mCurrentCompositeTask) {
mCurrentCompositeTask->Cancel();
mCurrentCompositeTask = nullptr;
}
@ -604,8 +728,10 @@ CalculateCompositionFrameRate()
}
void
CompositorParent::ScheduleComposition()
CompositorParent::ScheduleSoftwareTimerComposition()
{
MOZ_ASSERT(!gfxPrefs::VsyncAlignedCompositor());
if (mCurrentCompositeTask || mPaused) {
return;
}
@ -621,8 +747,9 @@ CompositorParent::ScheduleComposition()
TimeDuration minFrameDelta = TimeDuration::FromMilliseconds(
rate == 0 ? 0.0 : std::max(0.0, 1000.0 / rate));
mCurrentCompositeTask = NewRunnableMethod(this, &CompositorParent::CompositeCallback);
mCurrentCompositeTask = NewRunnableMethod(this,
&CompositorParent::CompositeCallback,
TimeStamp::Now());
if (!initialComposition && delta < minFrameDelta) {
TimeDuration delay = minFrameDelta - delta;
@ -639,8 +766,28 @@ CompositorParent::ScheduleComposition()
}
void
CompositorParent::CompositeCallback()
CompositorParent::ScheduleComposition()
{
MOZ_ASSERT(IsInCompositorThread());
if (gfxPrefs::VsyncAlignedCompositor()) {
mCompositorVsyncObserver->SetNeedsComposite(true);
} else {
ScheduleSoftwareTimerComposition();
}
}
void
CompositorParent::CompositeCallback(TimeStamp aScheduleTime)
{
if (gfxPrefs::VsyncAlignedCompositor()) {
// Align OMTA to vsync time.
// TODO: ensure it aligns with the refresh / start time of
// animations
mLastCompose = aScheduleTime;
} else {
mLastCompose = TimeStamp::Now();
}
mCurrentCompositeTask = nullptr;
CompositeToTarget(nullptr);
}
@ -664,8 +811,6 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
}
#endif
mLastCompose = TimeStamp::Now();
if (!CanComposite()) {
DidComposite();
return;
@ -840,13 +985,17 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
// However, we only do this update when a composite operation is already
// scheduled in order to better match the behavior under regular sampling
// conditions.
if (mIsTesting && root && mCurrentCompositeTask) {
bool needTestComposite = mIsTesting && root &&
(mCurrentCompositeTask ||
(gfxPrefs::VsyncAlignedCompositor() &&
mCompositorVsyncObserver->NeedsComposite()));
if (needTestComposite) {
AutoResolveRefLayers resolve(mCompositionManager);
bool requestNextFrame =
mCompositionManager->TransformShadowTree(mTestTime);
if (!requestNextFrame) {
CancelCurrentCompositeTask();
// Pretend we composited in case someone is wating for this event.
// Pretend we composited in case someone is waiting for this event.
DidComposite();
}
}
@ -871,8 +1020,12 @@ CompositorParent::SetTestSampleTime(LayerTransactionParent* aLayerTree,
mIsTesting = true;
mTestTime = aTime;
bool testComposite = mCompositionManager && (mCurrentCompositeTask ||
(gfxPrefs::VsyncAlignedCompositor()
&& mCompositorVsyncObserver->NeedsComposite()));
// Update but only if we were already scheduled to animate
if (mCompositionManager && mCurrentCompositeTask) {
if (testComposite) {
AutoResolveRefLayers resolve(mCompositionManager);
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
if (!requestNextFrame) {

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

@ -35,6 +35,7 @@
#include "nsISupportsImpl.h"
#include "nsSize.h" // for nsIntSize
#include "ThreadSafeRefcountingWithMainThreadDestruction.h"
#include "mozilla/VsyncDispatcher.h"
class CancelableTask;
class MessageLoop;
@ -51,6 +52,7 @@ namespace layers {
class APZCTreeManager;
class AsyncCompositionManager;
class Compositor;
class CompositorParent;
class LayerManagerComposite;
class LayerTransactionParent;
@ -87,10 +89,45 @@ private:
friend class CompositorParent;
};
/**
* Manages the vsync (de)registration and tracking on behalf of the
* compositor when it need to paint.
* Turns vsync notifications into scheduled composites.
**/
class CompositorVsyncObserver MOZ_FINAL : public VsyncObserver
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(CompositorVsyncObserver)
friend class CompositorParent;
public:
CompositorVsyncObserver(CompositorParent* aCompositorParent);
virtual bool NotifyVsync(TimeStamp aVsyncTimestamp) MOZ_OVERRIDE;
void SetNeedsComposite(bool aSchedule);
bool NeedsComposite();
void CancelCurrentCompositeTask();
private:
virtual ~CompositorVsyncObserver();
void Composite(TimeStamp aVsyncTimestamp);
void NotifyCompositeTaskExecuted();
void ObserveVsync();
void UnobserveVsync();
bool mNeedsComposite;
bool mIsObservingVsync;
nsRefPtr<CompositorParent> mCompositorParent;
mozilla::Monitor mCurrentCompositeTaskMonitor;
CancelableTask* mCurrentCompositeTask;
};
class CompositorParent MOZ_FINAL : public PCompositorParent,
public ShadowLayersManager
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(CompositorParent)
friend class CompositorVsyncObserver;
public:
explicit CompositorParent(nsIWidget* aWidget,
@ -287,7 +324,7 @@ protected:
bool* aSuccess) MOZ_OVERRIDE;
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE;
virtual void ScheduleTask(CancelableTask*, int);
void CompositeCallback();
void CompositeCallback(TimeStamp aScheduleTime);
void CompositeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr);
void ForceComposeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr);
@ -299,6 +336,7 @@ protected:
void ResumeCompositionAndResize(int width, int height);
void ForceComposition();
void CancelCurrentCompositeTask();
void ScheduleSoftwareTimerComposition();
/**
* Add a compositor to the global compositor map.
@ -348,6 +386,7 @@ protected:
nsRefPtr<APZCTreeManager> mApzcTreeManager;
nsRefPtr<CompositorThreadHolder> mCompositorThreadHolder;
nsRefPtr<CompositorVsyncObserver> mCompositorVsyncObserver;
DISALLOW_EVIL_CONSTRUCTORS(CompositorParent);
};

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