Merge last PGO-green changeset of mozilla-inbound to mozilla-central

This commit is contained in:
Ed Morley 2012-12-19 19:30:22 +00:00
commit c46531d501
144 changed files with 2490 additions and 1173 deletions

View File

@ -554,6 +554,8 @@ pref("hal.processPriorityManager.gonk.masterOomScoreAdjust", 0);
pref("hal.processPriorityManager.gonk.masterKillUnderMB", 1);
pref("hal.processPriorityManager.gonk.foregroundOomScoreAdjust", 67);
pref("hal.processPriorityManager.gonk.foregroundKillUnderMB", 4);
pref("hal.processPriorityManager.gonk.backgroundHomescreenOomScoreAdjust", 200);
pref("hal.processPriorityManager.gonk.backgroundHomescreenKillUnderMB", 5);
pref("hal.processPriorityManager.gonk.backgroundOomScoreAdjust", 400);
pref("hal.processPriorityManager.gonk.backgroundKillUnderMB", 8);
pref("hal.processPriorityManager.gonk.notifyLowMemUnderMB", 10);

View File

@ -1,6 +1,6 @@
[
{
"clang_version": "r169730"
"clang_version": "r170377"
},
{
"size": 47,
@ -9,8 +9,8 @@
"filename": "setup.sh"
},
{
"size": 56115091,
"digest": "d7188264f28d6f6a84fab9737520cad22fe3d575917a87fc110d0b9a2033617c35da83530ea20553f5c55a996459f750fa2d0c49288c1fb9671f6252a92cf4c9",
"size": 56131193,
"digest": "a1e705d3a72e0e95eeb15722f538a3908277f9f756909ce5e67f0a09b8531c1ba7fcc4816e20795af2e98839e0308b1bc6df95308cda310ae06abf21d429624f",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}

View File

@ -20,7 +20,7 @@ _BROWSER_FILES = \
browser_social_mozSocial_API.js \
browser_social_isVisible.js \
browser_social_chatwindow.js \
$(filter disabled-temporarily--bug-820489, browser_social_multiprovider.js) \
browser_social_multiprovider.js \
social_panel.html \
social_share_image.png \
social_sidebar.html \

View File

@ -17,6 +17,23 @@ function test() {
}
var tests = {
testProfileNone: function(next, useNull) {
let profile = useNull ? null : {};
Social.provider.updateUserProfile(profile);
// check dom values
let portrait = document.getElementsByClassName("social-statusarea-user-portrait")[0].getAttribute("src");
// this is the default image for the profile area when not logged in.
is(portrait, "chrome://global/skin/icons/information-32.png", "portrait is empty");
let userDetailsBroadcaster = document.getElementById("socialBroadcaster_userDetails");
let notLoggedInStatusValue = userDetailsBroadcaster.getAttribute("notLoggedInLabel");
let userButton = document.getElementsByClassName("social-statusarea-loggedInStatus")[0];
ok(!userButton.hidden, "username is visible");
is(userButton.getAttribute("label"), notLoggedInStatusValue, "label reflects not being logged in");
next();
},
testProfileNull: function(next) {
this.testProfileNone(next, true);
},
testProfileSet: function(next) {
let profile = {
portrait: "https://example.com/portrait.jpg",

View File

@ -118,6 +118,12 @@ DownloadElementShell.prototype = {
throw new Error("Unexpected download element state");
},
get _downloadURIObj() {
if (!("__downloadURIObj" in this))
this.__downloadURIObj = NetUtil.newURI(this.downloadURI);
return this.__downloadURIObj;
},
get _icon() {
if (this._targetFileURI)
return "moz-icon://" + this._targetFileURI + "?size=32";
@ -136,7 +142,7 @@ DownloadElementShell.prototype = {
let value;
try {
value = PlacesUtils.annotations.getPageAnnotation(
NetUtil.newURI(this.downloadURI), aAnnotation);
this._downloadURIObj, aAnnotation);
}
catch(ex) {
if (aDefaultValue === undefined) {
@ -466,7 +472,7 @@ DownloadElementShell.prototype = {
if (this._dataItem)
this._dataItem.remove();
if (this._placesNode)
PlacesUtils.bhistory.removePage(NetUtil.newURI(this.downloadURI));
PlacesUtils.bhistory.removePage(this._downloadURIObj);
break;
}
case "downloadsCmd_retry": {
@ -577,18 +583,35 @@ DownloadsPlacesView.prototype = {
}
},
// Given a data item for a session download, or a places node for a past
// download, updates the view as necessary.
// 1. If the given data is a places node, we check whether there are any
// element for the same download url. If there are, then we just reset
// their places node. Otherwise we add a new download element.
// 2. If the given data is a data item, we first check if there's an history
// download in the list that is not associated with a data item. If we found
// one, we use it for the data item as well and reposition it alongside the
// other session downloads. If we don't, then we go ahead and create a new
// element for the download.
/**
* Given a data item for a session download, or a places node for a past
* download, updates the view as necessary.
* 1. If the given data is a places node, we check whether there are any
* elements for the same download url. If there are, then we just reset
* their places node. Otherwise we add a new download element.
* 2. If the given data is a data item, we first check if there's a history
* download in the list that is not associated with a data item. If we
* found one, we use it for the data item as well and reposition it
* alongside the other session downloads. If we don't, then we go ahead
* and create a new element for the download.
*
* @param aDataItem
* The data item of a session download. Set to null for history
* downloads data.
* @param [optional] aPlacesNode
* The places node for a history download. Required if there's no data
* item.
* @param [optional] aNewest
* @see onDataItemAdded. Ignored for history downlods.
* @param [optional] aDocumentFragment
* To speed up the appending of multiple elements to the end of the
* list which are coming in a single batch (i.e. invalidateContainer),
* a document fragment may be passed to which the new elements would
* be appended. It's the caller's job to ensure the fragment is merged
* to the richlistbox at the end.
*/
_addDownloadData:
function DPV_addDownload(aDataItem, aPlacesNode, aNewest) {
function DPV_addDownload(aDataItem, aPlacesNode, aNewest = false, aDocumentFragment = null) {
let downloadURI = aPlacesNode ? aPlacesNode.uri : aDataItem.uri;
let shellsForURI = this._downloadElementsShellsForURI.get(downloadURI, null);
if (!shellsForURI) {
@ -658,12 +681,13 @@ DownloadsPlacesView.prototype = {
}
else if (aDataItem) {
let before = this._lastSessionDownloadElement ?
this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild
this._richlistbox.insertBefore(newOrUpdatedShell.element, before)
this._lastSessionDownloadElement.nextSibling : this._richlistbox.firstChild;
this._richlistbox.insertBefore(newOrUpdatedShell.element, before);
this._lastSessionDownloadElement = newOrUpdatedShell.element;
}
else {
this._richlistbox.appendChild(newOrUpdatedShell.element);
let appendTo = aDocumentFragment || this._richlistbox;
appendTo.appendChild(newOrUpdatedShell.element);
}
if (this.searchTerm) {
@ -821,18 +845,22 @@ DownloadsPlacesView.prototype = {
this._removeHistoryDownloadFromView(element._shell.placesNode);
}
let elementsToAppendFragment = document.createDocumentFragment();
for (let i = 0; i < aContainer.childCount; i++) {
try {
this._addDownloadData(null, aContainer.getChild(i), false)
this._addDownloadData(null, aContainer.getChild(i), false,
elementsToAppendFragment);
}
catch(ex) {
Cu.reportError(ex);
}
}
this._richlistbox.appendChild(elementsToAppendFragment);
},
nodeInserted: function DPV_nodeInserted(aParent, aPlacesNode) {
this._addDownloadData(null, aPlacesNode, false);
this._addDownloadData(null, aPlacesNode);
},
nodeRemoved: function DPV_nodeRemoved(aParent, aPlacesNode, aOldIndex) {
@ -895,7 +923,7 @@ DownloadsPlacesView.prototype = {
},
onDataItemRemoved: function DPV_onDataItemRemoved(aDataItem) {
this._removeSessionDownloadFromView(aDataItem)
this._removeSessionDownloadFromView(aDataItem);
},
getViewItem: function(aDataItem)
@ -939,7 +967,7 @@ DownloadsPlacesView.prototype = {
Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard);
// Getting the data or creating the nsIURI might fail
// Getting the data or creating the nsIURI might fail.
try {
let data = {};
trans.getAnyTransferData({}, data, {});

View File

@ -1273,8 +1273,8 @@ let SessionStoreInternal = {
// If this tab was in the middle of restoring or still needs to be restored,
// we need to reset that state. If the tab was restoring, we will attempt to
// restore the next tab.
let previousState;
if (previousState = browser.__SS_restoreState) {
let previousState = browser.__SS_restoreState;
if (previousState) {
this._resetTabRestoringState(aTab);
if (previousState == TAB_STATE_RESTORING)
this.restoreNextTab();

View File

@ -142,6 +142,7 @@ else
MOCHITEST_BROWSER_FILES += \
browser_248970_a.js \
browser_248970_b.js \
+ browser_248970_b_perwindowpb.js \
browser_354894.js \
browser_394759_privatebrowsing.js \
$(NULL)

View File

@ -0,0 +1,167 @@
/* 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/. */
function test() {
/** Test (B) for Bug 248970 **/
waitForExplicitFinish();
let windowsToClose = [];
let file = Services.dirsvc.get("TmpD", Ci.nsIFile);
let filePath = file.path;
let fieldList = {
"//input[@name='input']": Date.now().toString(),
"//input[@name='spaced 1']": Math.random().toString(),
"//input[3]": "three",
"//input[@type='checkbox']": true,
"//input[@name='uncheck']": false,
"//input[@type='radio'][1]": false,
"//input[@type='radio'][2]": true,
"//input[@type='radio'][3]": false,
"//select": 2,
"//select[@multiple]": [1, 3],
"//textarea[1]": "",
"//textarea[2]": "Some text... " + Math.random(),
"//textarea[3]": "Some more text\n" + new Date(),
"//input[@type='file']": filePath
};
registerCleanupFunction(function() {
windowsToClose.forEach(function(win) {
win.close();
});
});
function test(aLambda) {
try {
return aLambda() || true;
} catch(ex) { }
return false;
}
function getElementByXPath(aTab, aQuery) {
let doc = aTab.linkedBrowser.contentDocument;
let xptype = Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
return doc.evaluate(aQuery, doc, null, xptype, null).singleNodeValue;
}
function setFormValue(aTab, aQuery, aValue) {
let node = getElementByXPath(aTab, aQuery);
if (typeof aValue == "string")
node.value = aValue;
else if (typeof aValue == "boolean")
node.checked = aValue;
else if (typeof aValue == "number")
node.selectedIndex = aValue;
else
Array.forEach(node.options, function(aOpt, aIx)
(aOpt.selected = aValue.indexOf(aIx) > -1));
}
function compareFormValue(aTab, aQuery, aValue) {
let node = getElementByXPath(aTab, aQuery);
if (!node)
return false;
if (node instanceof Ci.nsIDOMHTMLInputElement)
return aValue == (node.type == "checkbox" || node.type == "radio" ?
node.checked : node.value);
if (node instanceof Ci.nsIDOMHTMLTextAreaElement)
return aValue == node.value;
if (!node.multiple)
return aValue == node.selectedIndex;
return Array.every(node.options, function(aOpt, aIx)
(aValue.indexOf(aIx) > -1) == aOpt.selected);
}
//////////////////////////////////////////////////////////////////
// Test (B) : Session data restoration between windows //
//////////////////////////////////////////////////////////////////
let rootDir = getRootDirectory(gTestPath);
const testURL = rootDir + "browser_248970_b_sample.html";
const testURL2 = "http://mochi.test:8888/browser/" +
"browser/components/sessionstore/test/browser_248970_b_sample.html";
whenNewWindowLoaded(false, function(aWin) {
windowsToClose.push(aWin);
// get closed tab count
let count = ss.getClosedTabCount(aWin);
let max_tabs_undo =
Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
ok(0 <= count && count <= max_tabs_undo,
"getClosedTabCount should return zero or at most max_tabs_undo");
// setup a state for tab (A) so we can check later that is restored
let key = "key";
let value = "Value " + Math.random();
let state = { entries: [{ url: testURL }], extData: { key: value } };
// public session, add new tab: (A)
let tab_A = aWin.gBrowser.addTab(testURL);
ss.setTabState(tab_A, JSON.stringify(state));
whenBrowserLoaded(tab_A.linkedBrowser, function() {
// make sure that the next closed tab will increase getClosedTabCount
Services.prefs.setIntPref(
"browser.sessionstore.max_tabs_undo", max_tabs_undo + 1)
// populate tab_A with form data
for (let i in fieldList)
setFormValue(tab_A, i, fieldList[i]);
// public session, close tab: (A)
aWin.gBrowser.removeTab(tab_A);
// verify that closedTabCount increased
ok(ss.getClosedTabCount(aWin) > count,
"getClosedTabCount has increased after closing a tab");
// verify tab: (A), in undo list
let tab_A_restored = test(function() ss.undoCloseTab(aWin, 0));
ok(tab_A_restored, "a tab is in undo list");
whenBrowserLoaded(tab_A_restored.linkedBrowser, function() {
is(testURL, tab_A_restored.linkedBrowser.currentURI.spec,
"it's the same tab that we expect");
aWin.gBrowser.removeTab(tab_A_restored);
whenNewWindowLoaded(true, function(aWin) {
windowsToClose.push(aWin);
// setup a state for tab (B) so we can check that its duplicated
// properly
let key1 = "key1";
let value1 = "Value " + Math.random();
let state1 = {
entries: [{ url: testURL2 }], extData: { key1: value1 }
};
let tab_B = aWin.gBrowser.addTab(testURL2);
ss.setTabState(tab_B, JSON.stringify(state1));
whenBrowserLoaded(tab_B.linkedBrowser, function() {
// populate tab: (B) with different form data
for (let item in fieldList)
setFormValue(tab_B, item, fieldList[item]);
// duplicate tab: (B)
let tab_C = aWin.gBrowser.duplicateTab(tab_B);
whenBrowserLoaded(tab_C.linkedBrowser, function() {
// verify the correctness of the duplicated tab
is(ss.getTabValue(tab_C, key1), value1,
"tab successfully duplicated - correct state");
for (let item in fieldList)
ok(compareFormValue(tab_C, item, fieldList[item]),
"The value for \"" + item + "\" was correctly duplicated");
// private browsing session, close tab: (C) and (B)
aWin.gBrowser.removeTab(tab_C);
aWin.gBrowser.removeTab(tab_B);
finish();
});
});
});
});
});
});
}

View File

@ -277,3 +277,11 @@ function closeAllButPrimaryWindow() {
}
}
}
function whenNewWindowLoaded(aIsPrivate, aCallback) {
let win = OpenBrowserWindow({private: aIsPrivate});
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
aCallback(win);
}, false);
}

View File

@ -64,6 +64,7 @@ let UI = {
// the operation interactive.
_maxInteractiveWait: 250,
#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
// Variable: _privateBrowsing
// Keeps track of info related to private browsing, including:
// transitionMode - whether we're entering or exiting PB
@ -72,7 +73,8 @@ let UI = {
transitionMode: "",
wasInTabView: false
},
#endif
// Variable: _storageBusy
// Tells whether the storage is currently busy or not.
_storageBusy: false,
@ -595,8 +597,13 @@ let UI = {
// ----------
// Function: storageBusy
#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
// Pauses the storage activity that conflicts with sessionstore updates.
// Calls can be nested.
#else
// Pauses the storage activity that conflicts with sessionstore updates and
// private browsing mode switches. Calls can be nested.
#endif
storageBusy: function UI_storageBusy() {
if (this._storageBusy)
return;
@ -649,6 +656,7 @@ let UI = {
gWindow.removeEventListener("SSWindowStateReady", handleSSWindowStateReady, false);
});
#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
// Private Browsing:
// When transitioning to PB, we exit Panorama if necessary (making note of the
// fact that we were there so we can return after PB) and make sure we
@ -689,6 +697,7 @@ let UI = {
Services.obs.removeObserver(pbObserver, "private-browsing-change-granted");
Services.obs.removeObserver(pbObserver, "private-browsing-transition-complete");
});
#endif
// TabOpen
this._eventListeners.open = function (event) {
@ -714,7 +723,11 @@ let UI = {
if (self._currentTab == tab)
self._closedSelectedTabInTabView = true;
} else {
#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
// If we're currently in the process of session store update,
#else
// If we're currently in the process of entering private browsing,
#endif
// we don't want to go to the Tab View UI.
if (self._storageBusy)
return;
@ -825,9 +838,14 @@ let UI = {
if (this.isTabViewVisible()) {
// We want to zoom in if:
// 1) we didn't just restore a tab via Ctrl+Shift+T
#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
// 2) the currently selected tab is the last created tab and has a tabItem
if (!this.restoredClosedTab &&
#else
// 2) we're not in the middle of switching from/to private browsing
// 3) the currently selected tab is the last created tab and has a tabItem
if (!this.restoredClosedTab && !this._privateBrowsing.transitionMode &&
#endif
this._lastOpenedTab == tab && tab._tabViewTabItem) {
tab._tabViewTabItem.zoomIn(true);
this._lastOpenedTab = null;
@ -1012,8 +1030,10 @@ let UI = {
#ifdef XP_MACOSX
"fullScreen",
#endif
"closeWindow", "tabview", "undoCloseTab", "undoCloseWindow",
"privatebrowsing"
"closeWindow", "tabview", "undoCloseTab", "undoCloseWindow"
#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
, "privatebrowsing"
#endif
].forEach(function(key) {
let element = gWindow.document.getElementById("key_" + key);
let code = element.getAttribute("key").toLocaleLowerCase().charCodeAt(0);

View File

@ -1,6 +1,6 @@
[
{
"clang_version": "r169730"
"clang_version": "r170377"
},
{
"size": 47,
@ -9,8 +9,8 @@
"filename": "setup.sh"
},
{
"size": 61875575,
"digest": "7098e1cc85a8ae45672333320c7673c284023366fbe6d4fab3e9276960b7f92fd74ee63d0ad6c43a86fd96a1b886408993479260ac897fa6fe101c4a9fb807b1",
"size": 61878564,
"digest": "bc344ad6cb8f4d7b25447a8f06ae3a22c6b90283fcc70f28f12578bdaf01ec960a774cdc215bdda4960cef04b6a991e462daeeda4f7e802bf65e6c9a3967f66c",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}

View File

@ -1,6 +1,6 @@
[
{
"clang_version": "r169730"
"clang_version": "r170377"
},
{
"size": 47,
@ -9,8 +9,8 @@
"filename": "setup.sh"
},
{
"size": 62279267,
"digest": "0c9f87e3d7675feaa79b6d5d0997c8f370785901b8668f51da3339ae674291b3946e9d76629adb1c4ccd15aa851d84e4cd39ddd9032c916cc75233fe73c68f2e",
"size": 62277867,
"digest": "b9c6ab4069e336fcbe705f07fd2beda37aecfd4078863898826c9591305b92f3f3f762e7f5c1b0eeb7e0fb1c0dacbca60f24868e0b3181bd34dcd9c5d44d20ee",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}

View File

@ -1,6 +1,6 @@
[
{
"clang_version": "r169730"
"clang_version": "r170377"
},
{
"size": 47,
@ -9,8 +9,8 @@
"filename": "setup.sh"
},
{
"size": 56115091,
"digest": "d7188264f28d6f6a84fab9737520cad22fe3d575917a87fc110d0b9a2033617c35da83530ea20553f5c55a996459f750fa2d0c49288c1fb9671f6252a92cf4c9",
"size": 56131193,
"digest": "a1e705d3a72e0e95eeb15722f538a3908277f9f756909ce5e67f0a09b8531c1ba7fcc4816e20795af2e98839e0308b1bc6df95308cda310ae06abf21d429624f",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}

View File

@ -1,6 +1,6 @@
[
{
"clang_version": "r169730"
"clang_version": "r170377"
},
{
"size": 47,
@ -9,8 +9,8 @@
"filename": "setup.sh"
},
{
"size": 56115091,
"digest": "d7188264f28d6f6a84fab9737520cad22fe3d575917a87fc110d0b9a2033617c35da83530ea20553f5c55a996459f750fa2d0c49288c1fb9671f6252a92cf4c9",
"size": 56131193,
"digest": "a1e705d3a72e0e95eeb15722f538a3908277f9f756909ce5e67f0a09b8531c1ba7fcc4816e20795af2e98839e0308b1bc6df95308cda310ae06abf21d429624f",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}

View File

@ -23,40 +23,6 @@ if test "$OS_ARCH" = "WINNT"; then
fi
fi
# The value of ACCEPTED_MAR_CHANNEL_IDS should usually be the same as the value
# MAR_CHANNEL_ID. If more than one ID is needed, then you should use a comma
# separated list of values.
# The MAR_CHANNEL_ID must not contain the following 3 characters: ",\t "
case "$MOZ_UPDATE_CHANNEL" in
release|aurora|esr)
ACCEPTED_MAR_CHANNEL_IDS=firefox-mozilla-$MOZ_UPDATE_CHANNEL
MAR_CHANNEL_ID=firefox-mozilla-$MOZ_UPDATE_CHANNEL
;;
beta)
ACCEPTED_MAR_CHANNEL_IDS=firefox-mozilla-beta,firefox-mozilla-release
MAR_CHANNEL_ID=firefox-mozilla-beta
;;
*)
ACCEPTED_MAR_CHANNEL_IDS=firefox-mozilla-central
MAR_CHANNEL_ID=firefox-mozilla-central
;;
esac
# MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
# Changing MOZ_*BRANDING_DIRECTORY requires a clobber to ensure correct results,
# because branding dependencies are broken.
# MOZ_BRANDING_DIRECTORY is the default branding directory used when none is
# specified. It should never point to the "official" branding directory.
# For mozilla-beta, mozilla-release, or mozilla-central repositories, use
# "nightly" branding (until bug 659568 is fixed).
# For the mozilla-aurora repository, use "aurora".
MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official
if test "$MOZ_UPDATE_CHANNEL" = "aurora"; then
MOZ_BRANDING_DIRECTORY=browser/branding/aurora
else
MOZ_BRANDING_DIRECTORY=browser/branding/nightly
fi
MOZ_CHROME_FILE_FORMAT=omni
MOZ_SAFE_BROWSING=1
MOZ_SERVICES_AITC=1
@ -67,7 +33,23 @@ MOZ_SERVICES_NOTIFICATIONS=1
MOZ_SERVICES_SYNC=1
MOZ_APP_VERSION=$FIREFOX_VERSION
MOZ_EXTENSIONS_DEFAULT=" gio"
# MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
# Changing MOZ_*BRANDING_DIRECTORY requires a clobber to ensure correct results,
# because branding dependencies are broken.
# MOZ_BRANDING_DIRECTORY is the default branding directory used when none is
# specified. It should never point to the "official" branding directory.
# For mozilla-beta, mozilla-release, or mozilla-central repositories, use
# "nightly" branding (until bug 659568 is fixed).
# For the mozilla-aurora repository, use "aurora".
MOZ_BRANDING_DIRECTORY=browser/branding/nightly
MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official
MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
# This should usually be the same as the value MAR_CHANNEL_ID.
# If more than one ID is needed, then you should use a comma separated list
# of values.
ACCEPTED_MAR_CHANNEL_IDS=firefox-mozilla-central
# The MAR_CHANNEL_ID must not contain the following 3 characters: ",\t "
MAR_CHANNEL_ID=firefox-mozilla-central
MOZ_PROFILE_MIGRATOR=1
MOZ_EXTENSION_MANAGER=1
MOZ_APP_STATIC_INI=1

View File

@ -539,7 +539,7 @@ let PlacesProvider = {
handleResult: function (aResultSet) {
let row;
while (row = aResultSet.getNextRow()) {
while ((row = aResultSet.getNextRow())) {
let url = row.getResultByIndex(1);
if (LinkChecker.checkLoadURI(url)) {
let title = row.getResultByIndex(2);

View File

@ -57,6 +57,12 @@ APP_INI_DEPS += $(DEPTH)/config/buildid
DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DAPP_BUILDID=$(APP_BUILDID)
# Set a flag that can be used in pref files to disable features if
# we are not building for Aurora or Nightly.
ifeq (,$(findstring a,$(GRE_MILESTONE)))
PREF_PPFLAGS += -DRELEASE_BUILD
endif
DEFINES += -DMOZ_APP_VERSION="$(MOZ_APP_VERSION)"
APP_INI_DEPS += $(DEPTH)/config/autoconf.mk

View File

@ -54,7 +54,7 @@ arm-linux*-android*|*-linuxandroid*)
android_tool_prefix="arm-linux-androideabi"
;;
i?86-*android*)
android_tool_prefix="i686-android-linux"
android_tool_prefix="i686-linux-android"
;;
mipsel-*android*)
android_tool_prefix="mipsel-linux-android"
@ -119,6 +119,17 @@ case "$target" in
fi
fi
dnl Old NDK support. If minimum requirement is changed to NDK r8b,
dnl please remove this.
case "$target_cpu" in
i?86)
if ! test -e "$android_toolchain"/bin/"$android_tool_prefix"-gcc; then
dnl Old NDK toolchain name
android_tool_prefix="i686-android-linux"
fi
;;
esac
dnl set up compilers
TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
AS="$android_toolchain"/bin/"$android_tool_prefix"-as

View File

@ -3,7 +3,7 @@
# 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/.
llvm_revision = "169730"
llvm_revision = "170377"
moz_version = "moz0"
##############################################

View File

@ -19,12 +19,11 @@
#include "nsMargin.h"
#include "nsCOMPtr.h"
#include "SVGAttrValueWrapper.h"
#include "nsTArrayForwardDeclare.h"
class nsAString;
class nsIAtom;
class nsIDocument;
template<class E, class A> class nsTArray;
struct nsTArrayDefaultAllocator;
class nsStyledElementNotElementCSSInlineStyle;
struct MiscContainer;
@ -426,7 +425,7 @@ private:
int32_t EnumTableEntryToValue(const EnumTable* aEnumTable,
const EnumTable* aTableEntry);
static nsTArray<const EnumTable*, nsTArrayDefaultAllocator>* sEnumTableArray;
static nsTArray<const EnumTable*>* sEnumTableArray;
uintptr_t mBits;
};

View File

@ -2064,6 +2064,14 @@ nsFrameLoader::TryRemoteBrowser()
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mOwnerContent);
mRemoteBrowser->SetOwnerElement(element);
// If we're an app, send the frame element's mozapptype down to the child
// process. This ends up in TabChild::GetAppType().
if (ownApp) {
nsAutoString appType;
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapptype, appType);
mRemoteBrowser->SendSetAppType(appType);
}
nsCOMPtr<nsIDocShellTreeItem> rootItem;
parentAsItem->GetRootTreeItem(getter_AddRefs(rootItem));
nsCOMPtr<nsIDOMWindow> rootWin = do_GetInterface(rootItem);

View File

@ -89,6 +89,7 @@ GK_ATOM(mozapp, "mozapp")
GK_ATOM(applet, "applet")
GK_ATOM(applyImports, "apply-imports")
GK_ATOM(applyTemplates, "apply-templates")
GK_ATOM(mozapptype, "mozapptype")
GK_ATOM(archive, "archive")
GK_ATOM(area, "area")
GK_ATOM(article, "article")

View File

@ -1064,6 +1064,7 @@ WebGLContext::DeleteTexture(WebGLTexture *tex)
if (mBoundFramebuffer)
mBoundFramebuffer->DetachTexture(tex);
WebGLuint activeTexture = mActiveTexture;
for (int32_t i = 0; i < mGLMaxTextureUnits; i++) {
if ((tex->Target() == LOCAL_GL_TEXTURE_2D && mBound2DTextures[i] == tex) ||
(tex->Target() == LOCAL_GL_TEXTURE_CUBE_MAP && mBoundCubeMapTextures[i] == tex))
@ -1072,7 +1073,7 @@ WebGLContext::DeleteTexture(WebGLTexture *tex)
BindTexture(tex->Target(), static_cast<WebGLTexture*>(nullptr));
}
}
ActiveTexture(LOCAL_GL_TEXTURE0 + mActiveTexture);
ActiveTexture(LOCAL_GL_TEXTURE0 + activeTexture);
tex->RequestDelete();
}

View File

@ -95,18 +95,20 @@ nsDOMLocalMediaStream::CreateSourceStream(uint32_t aHintContents)
}
already_AddRefed<nsDOMMediaStream>
nsDOMMediaStream::CreateTrackUnionStream()
nsDOMMediaStream::CreateTrackUnionStream(uint32_t aHintContents)
{
nsRefPtr<nsDOMMediaStream> stream = new nsDOMMediaStream();
stream->SetHintContents(aHintContents);
MediaStreamGraph* gm = MediaStreamGraph::GetInstance();
stream->mStream = gm->CreateTrackUnionStream(stream);
return stream.forget();
}
already_AddRefed<nsDOMLocalMediaStream>
nsDOMLocalMediaStream::CreateTrackUnionStream()
nsDOMLocalMediaStream::CreateTrackUnionStream(uint32_t aHintContents)
{
nsRefPtr<nsDOMLocalMediaStream> stream = new nsDOMLocalMediaStream();
stream->SetHintContents(aHintContents);
MediaStreamGraph* gm = MediaStreamGraph::GetInstance();
stream->mStream = gm->CreateTrackUnionStream(stream);
return stream.forget();

View File

@ -70,7 +70,7 @@ public:
/**
* Create an nsDOMMediaStream whose underlying stream is a TrackUnionStream.
*/
static already_AddRefed<nsDOMMediaStream> CreateTrackUnionStream();
static already_AddRefed<nsDOMMediaStream> CreateTrackUnionStream(uint32_t aHintContents = 0);
protected:
// MediaStream is owned by the graph, but we tell it when to die, and it won't
@ -106,7 +106,7 @@ public:
/**
* Create an nsDOMLocalMediaStream whose underlying stream is a TrackUnionStream.
*/
static already_AddRefed<nsDOMLocalMediaStream> CreateTrackUnionStream();
static already_AddRefed<nsDOMLocalMediaStream> CreateTrackUnionStream(uint32_t aHintContents = 0);
};
#endif /* NSDOMMEDIASTREAM_H_ */

View File

@ -421,14 +421,17 @@ nsresult OggReader::DecodeVorbis(ogg_packet* aPacket) {
nsresult OggReader::DecodeOpus(ogg_packet* aPacket) {
NS_ASSERTION(aPacket->granulepos != -1, "Must know opus granulepos!");
// Maximum value is 63*2880.
// Maximum value is 63*2880, so there's no chance of overflow.
int32_t frames_number = opus_packet_get_nb_frames(aPacket->packet,
aPacket->bytes);
if (frames_number <= 0)
return NS_ERROR_FAILURE; // Invalid packet header.
int32_t samples = opus_packet_get_samples_per_frame(aPacket->packet,
(opus_int32) mOpusState->mRate);
int32_t frames = frames_number*samples;
if (frames <= 0)
// A valid Opus packet must be between 2.5 and 120 ms long.
if (frames < 120 || frames > 5760)
return NS_ERROR_FAILURE;
uint32_t channels = mOpusState->mChannels;
nsAutoArrayPtr<AudioDataValue> buffer(new AudioDataValue[frames * channels]);

View File

@ -18,11 +18,10 @@ interface nsIDocShell;
#define NS_SHISTORY_INTERNAL_CONTRACTID "@mozilla.org/browser/shistory-internal;1"
template<class E, class A> class nsTArray;
struct nsTArrayDefaultAllocator;
#include "nsTArrayForwardDeclare.h"
%}
[ref] native nsDocshellIDArray(nsTArray<uint64_t, nsTArrayDefaultAllocator>);
[ref] native nsDocshellIDArray(nsTArray<uint64_t>);
[scriptable, uuid(f9348014-0239-11e2-b029-3d38e719eb2d)]
interface nsISHistoryInternal: nsISupports

View File

@ -868,15 +868,26 @@ this.DOMApplicationRegistry = {
},
cancelDownload: function cancelDownload(aManifestURL) {
// We can't cancel appcache downloads for now.
if (!this.downloads[aManifestURL]) {
debug("cancelDownload " + aManifestURL);
let download = this.downloads[aManifestURL];
if (!download) {
debug("Could not find a download for " + aManifestURL);
return;
}
// This is a HTTP channel.
let download = this.downloads[aManifestURL]
download.channel.cancel(Cr.NS_BINDING_ABORTED);
let app = this.webapps[download.appId];
if (download.cacheUpdate) {
// Cancel hosted app download.
try {
download.cacheUpdate.cancel();
} catch (e) { debug (e); }
} else if (download.channel) {
// Cancel packaged app download.
download.channel.cancel(Cr.NS_BINDING_ABORTED);
} else {
return;
}
let app = this.webapps[download.appId];
app.progress = 0;
app.installState = download.previousState;
app.downloading = false;
@ -1038,26 +1049,42 @@ this.DOMApplicationRegistry = {
aProfileDir,
aOfflineCacheObserver,
aIsUpdate) {
// if the manifest has an appcache_path property, use it to populate the appcache
if (aManifest.appcache_path) {
let appcacheURI = Services.io.newURI(aManifest.fullAppcachePath(), null, null);
let docURI = Services.io.newURI(aManifest.fullLaunchPath(), null, null);
// We determine the app's 'installState' according to its previous
// state. Cancelled download should remain as 'pending'. Successfully
// installed apps should morph to 'updating'.
if (aIsUpdate) {
aApp.installState = "updating";
}
// We set the 'downloading' flag right before starting the app
// download/update.
aApp.downloading = true;
let cacheUpdate = aProfileDir
? updateSvc.scheduleCustomProfileUpdate(appcacheURI, docURI, aProfileDir)
: updateSvc.scheduleAppUpdate(appcacheURI, docURI, aApp.localId, false);
cacheUpdate.addObserver(new AppcacheObserver(aApp), false);
if (aOfflineCacheObserver) {
cacheUpdate.addObserver(aOfflineCacheObserver, false);
}
if (!aManifest.appcache_path) {
return;
}
// If the manifest has an appcache_path property, use it to populate the
// appcache.
let appcacheURI = Services.io.newURI(aManifest.fullAppcachePath(),
null, null);
let docURI = Services.io.newURI(aManifest.fullLaunchPath(), null, null);
// We determine the app's 'installState' according to its previous
// state. Cancelled downloads should remain as 'pending'. Successfully
// installed apps should morph to 'updating'.
if (aIsUpdate) {
aApp.installState = "updating";
}
// We set the 'downloading' flag right before starting the app
// download/update.
aApp.downloading = true;
let cacheUpdate = aProfileDir
? updateSvc.scheduleCustomProfileUpdate(appcacheURI, docURI, aProfileDir)
: updateSvc.scheduleAppUpdate(appcacheURI, docURI, aApp.localId, false);
// We save the download details for potential further usage like cancelling
// it.
let download = {
cacheUpdate: cacheUpdate,
appId: this._appIdForManifestURL(aApp.manifestURL),
previousState: aIsUpdate ? "installed" : "pending"
};
this.downloads[aApp.manifestURL] = download;
cacheUpdate.addObserver(new AppcacheObserver(aApp), false);
if (aOfflineCacheObserver) {
cacheUpdate.addObserver(aOfflineCacheObserver, false);
}
},
@ -1714,11 +1741,11 @@ this.DOMApplicationRegistry = {
let requestChannel = NetUtil.newChannel(aManifest.fullPackagePath())
.QueryInterface(Ci.nsIHttpChannel);
self.downloads[aApp.manifestURL] =
{ channel:requestChannel,
appId: id,
previousState: aIsUpdate ? "installed" : "pending"
};
self.downloads[aApp.manifestURL] = {
channel: requestChannel,
appId: id,
previousState: aIsUpdate ? "installed" : "pending"
};
let lastProgressTime = 0;
requestChannel.notificationCallbacks = {

View File

@ -1370,6 +1370,10 @@ public:
return mImpl.ref();
}
// If we ever decide to add conversion operators for optional arrays
// like the ones Nullable has, we'll need to ensure that Maybe<> has
// the boolean before the actual data.
private:
// Forbid copy-construction and assignment
Optional(const Optional& other) MOZ_DELETE;

View File

@ -8,6 +8,7 @@
#define mozilla_dom_Nullable_h
#include "mozilla/Assertions.h"
#include "nsTArrayForwardDeclare.h"
namespace mozilla {
namespace dom {
@ -17,17 +18,19 @@ template <typename T>
struct Nullable
{
private:
T mValue;
// mIsNull MUST COME FIRST because otherwise the casting in our array
// conversion operators would shift where it is found in the struct.
bool mIsNull;
T mValue;
public:
Nullable()
: mIsNull(true)
{}
Nullable(T aValue)
: mValue(aValue)
, mIsNull(false)
explicit Nullable(T aValue)
: mIsNull(false)
, mValue(aValue)
{}
void SetValue(T aValue) {
@ -60,6 +63,23 @@ public:
bool IsNull() const {
return mIsNull;
}
// Make it possible to use a const Nullable of an array type with other
// array types.
template<typename U>
operator const Nullable< nsTArray<U> >&() const {
// Make sure that T is ok to reinterpret to nsTArray<U>
const nsTArray<U>& arr = mValue;
(void)arr;
return *reinterpret_cast<const Nullable< nsTArray<U> >*>(this);
}
template<typename U>
operator const Nullable< FallibleTArray<U> >&() const {
// Make sure that T is ok to reinterpret to FallibleTArray<U>
const FallibleTArray<U>& arr = mValue;
(void)arr;
return *reinterpret_cast<const Nullable< FallibleTArray<U> >*>(this);
}
};
} // namespace dom

View File

@ -181,7 +181,7 @@ BluetoothDevice::Notify(const BluetoothSignal& aData)
if (aData.name().EqualsLiteral("PropertyChanged")) {
NS_ASSERTION(aData.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue,
"PropertyChanged: Invalid value type");
InfallibleTArray<BluetoothNamedValue> arr = aData.value().get_ArrayOfBluetoothNamedValue();
InfallibleTArray<BluetoothNamedValue> arr(aData.value().get_ArrayOfBluetoothNamedValue());
NS_ASSERTION(arr.Length() == 1, "Got more than one property in a change message!");
BluetoothNamedValue v = arr[0];

View File

@ -703,7 +703,7 @@ BluetoothService::Observe(nsISupports* aSubject, const char* aTopic,
void
BluetoothService::Notify(const BluetoothSignal& aData)
{
InfallibleTArray<BluetoothNamedValue> arr = aData.value().get_ArrayOfBluetoothNamedValue();
InfallibleTArray<BluetoothNamedValue> arr(aData.value().get_ArrayOfBluetoothNamedValue());
nsString type;
JSContext* cx = nsContentUtils::GetSafeJSContext();

View File

@ -393,9 +393,8 @@ BluetoothRequestParent::DoRequest(const DevicePropertiesRequest& aRequest)
MOZ_ASSERT(mService);
MOZ_ASSERT(mRequestType == Request::TDevicePropertiesRequest);
// Have to copy because our array types don't match up
nsresult rv =
mService->GetPairedDevicePropertiesInternal(nsTArray<nsString>(aRequest.addresses()),
mService->GetPairedDevicePropertiesInternal(aRequest.addresses(),
mReplyRunnable.get());
NS_ENSURE_SUCCESS(rv, false);

View File

@ -1720,7 +1720,7 @@ public:
BluetoothValue v = mSignal.value();
if (v.type() == BluetoothValue::TArrayOfBluetoothNamedValue &&
v.get_ArrayOfBluetoothNamedValue().Length() ) {
InfallibleTArray<BluetoothNamedValue> arr = v.get_ArrayOfBluetoothNamedValue();
const InfallibleTArray<BluetoothNamedValue>& arr = v.get_ArrayOfBluetoothNamedValue();
NS_ASSERTION(arr[0].value().type() == BluetoothValue::TnsString, "failed to get_nsString");
devicePath = arr[0].value().get_nsString();
}
@ -1737,11 +1737,11 @@ public:
NS_WARNING("Getting properties failed!");
return NS_ERROR_FAILURE;
}
InfallibleTArray<BluetoothNamedValue> properties = prop.get_ArrayOfBluetoothNamedValue();
InfallibleTArray<BluetoothNamedValue> properties(prop.get_ArrayOfBluetoothNamedValue());
if (v.type() == BluetoothValue::TArrayOfBluetoothNamedValue) {
// Return original dbus message parameters and also device name
// for agent events "RequestConfirmation", "RequestPinCode", and "RequestPasskey"
InfallibleTArray<BluetoothNamedValue> parameters = v.get_ArrayOfBluetoothNamedValue();
InfallibleTArray<BluetoothNamedValue> parameters(v.get_ArrayOfBluetoothNamedValue());
// For consistency, append path
nsString path = parameters[0].value();
@ -1804,7 +1804,7 @@ public:
BluetoothValue values = InfallibleTArray<BluetoothNamedValue>();
for (int i = 0; i < mDeviceAddresses.Length(); i++) {
for (uint32_t i = 0; i < mDeviceAddresses.Length(); i++) {
BluetoothValue v;
if (!GetPropertiesInternal(mDeviceAddresses[i], DBUS_DEVICE_IFACE, v)) {
nsAutoString errorStr;

View File

@ -4,7 +4,7 @@
const ContentPanning = {
init: function cp_init() {
['mousedown', 'mouseup', 'mousemove', 'touchstart', 'touchend', 'touchmove'].forEach(function(type) {
['mousedown', 'mouseup', 'mousemove'].forEach(function(type) {
addEventListener(type, ContentPanning, false);
});
@ -12,41 +12,15 @@ const ContentPanning = {
addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
},
evtFilter: '',
_filterEvent: function cp_filterEvent(evt) {
switch (this.evtFilter) {
case 'mouse':
if (evt.type == 'touchstart' || evt.type == 'touchend' || evt.type == 'touchmove') {
return false;
}
break;
case 'touch':
if (evt.type == 'mousedown' || evt.type == 'mouseup' || evt.type == 'mousemove') {
return false;
}
break;
}
return true;
},
handleEvent: function cp_handleEvent(evt) {
// determine scrolling detection is based on touch or mouse event at runtime
if (!this.evtFilter) {
if (evt.type == 'touchstart') this.evtFilter = 'touch';
else if (evt.type == 'mousedown') this.evtFilter = 'mouse';
}
if (evt.defaultPrevented || !this._filterEvent(evt)) return;
switch (evt.type) {
case 'mousedown':
case 'touchstart':
this.onTouchStart(evt);
break;
case 'mousemove':
case 'touchmove':
this.onTouchMove(evt);
break;
case 'mouseup':
case 'touchend':
this.onTouchEnd(evt);
break;
case 'click':
@ -63,39 +37,12 @@ const ContentPanning = {
position: new Point(0 , 0),
findFirstTouch: function cp_findFirstTouch(touches) {
if (!('trackingId' in this)) return undefined;
for (let i = 0; i < touches.length; i++) {
if (touches[i].identifier === this.trackingId)
return touches[i];
}
return undefined;
},
onTouchStart: function cp_onTouchStart(evt) {
let target, screenX, screenY;
if (this.evtFilter == 'touch') {
if ('trackingId' in this) {
return;
}
let firstTouch = evt.changedTouches[0];
this.trackingId = firstTouch.identifier;
target = firstTouch.target;
screenX = firstTouch.screenX;
screenY = firstTouch.screenY;
} else {
target = evt.target;
screenX = evt.screenX;
screenY = evt.screenY;
}
this.dragging = true;
this.panning = false;
let oldTarget = this.target;
[this.target, this.scrollCallback] = this.getPannable(target);
[this.target, this.scrollCallback] = this.getPannable(evt.target);
// If we found a target, that means we have found a scrollable subframe. In
// this case, and if we are using async panning and zooming on the parent
@ -104,7 +51,7 @@ const ContentPanning = {
// time we get a touch end).
if (this.target != null && ContentPanning._asyncPanZoomForViewportFrame) {
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
os.notifyObservers(docShell, 'detect-scrollable-subframe', null);
os.notifyObservers(docShell, 'cancel-default-pan-zoom', null);
}
// If there is a pan animation running (from a previous pan gesture) and
@ -120,24 +67,18 @@ const ContentPanning = {
}
this.position.set(screenX, screenY);
this.position.set(evt.screenX, evt.screenY);
KineticPanning.record(new Point(0, 0), evt.timeStamp);
},
onTouchEnd: function cp_onTouchEnd(evt) {
if (this.evtFilter == 'touch' && !this.findFirstTouch(evt.changedTouches))
return;
if (!this.dragging)
return;
this.dragging = false;
this.isScrolling = false;
this.onTouchMove(evt);
delete this.trackingId;
let click = (this.evtFilter == 'touch') ? true : evt.detail;
let click = evt.detail;
if (this.target && click && (this.panning || this.preventNextClick)) {
let target = this.target;
let view = target.ownerDocument ? target.ownerDocument.defaultView
@ -149,54 +90,23 @@ const ContentPanning = {
KineticPanning.start(this);
},
isScrolling: false, // Scrolling gesture is executed in BrowserElementScrolling
onTouchMove: function cp_onTouchMove(evt) {
if (!this.dragging || !this.scrollCallback)
return;
let screenX, screenY;
if (this.evtFilter == 'touch') {
let firstTouch = this.findFirstTouch(evt.changedTouches);
if (evt.touches.length > 1 || !firstTouch)
return;
screenX = firstTouch.screenX;
screenY = firstTouch.screenY;
} else {
screenX = evt.screenX;
screenY = evt.screenY;
}
let current = this.position;
let delta = new Point(screenX - current.x, screenY - current.y);
current.set(screenX, screenY);
let delta = new Point(evt.screenX - current.x, evt.screenY - current.y);
current.set(evt.screenX, evt.screenY);
KineticPanning.record(delta, evt.timeStamp);
let success = this.scrollCallback(delta.scale(-1));
this.scrollCallback(delta.scale(-1));
// Stop async-pan-zooming if the subframe is really scrolled.
if (!this.isScrolling && ContentPanning._asyncPanZoomForViewportFrame) {
if (success) {
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
os.notifyObservers(docShell, 'cancel-default-pan-zoom', null);
} else {
// Let AsyncPanZoomController handle the scrolling gesture.
delete this.trackingId;
return;
}
}
// Successfully scroll the inner scrollable region.
if (success && !this.isScrolling) {
this.isScrolling = true;
}
// If a pan action happens, cancel the active state of the
// current target.
if (!this.panning && KineticPanning.isPan()) {
this.panning = true;
this._resetActive();
}
evt.stopPropagation();
evt.preventDefault();
},

View File

@ -47,6 +47,16 @@ using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace android;
/**
* See bug 783682. Most camera implementations, despite claiming they
* support 'yuv420p' as a preview format, actually ignore this setting
* and return 'yuv420sp' data anyway. We have come across a new implementation
* that, while reporting that 'yuv420p' is supported *and* has been accepted,
* still returns the frame data in 'yuv420sp' anyway. So for now, since
* everyone seems to return this format, we just force it.
*/
#define FORCE_PREVIEW_FORMAT_YUV420SP 1
static const char* getKeyText(uint32_t aKey)
{
switch (aKey) {
@ -189,7 +199,11 @@ nsGonkCameraControl::nsGonkCameraControl(uint32_t aCameraId, nsIThread* aCameraT
, mHeight(0)
, mLastPictureWidth(0)
, mLastPictureHeight(0)
#if !FORCE_PREVIEW_FORMAT_YUV420SP
, mFormat(PREVIEW_FORMAT_UNKNOWN)
#else
, mFormat(PREVIEW_FORMAT_YUV420SP)
#endif
, mFps(30)
, mDiscardedFrameCount(0)
, mMediaProfiles(nullptr)
@ -217,15 +231,21 @@ nsGonkCameraControl::Init()
PullParametersImpl();
// Try to set preferred image format and frame rate
#if !FORCE_PREVIEW_FORMAT_YUV420SP
DOM_CAMERA_LOGI("Camera preview formats: %s\n", mParams.get(mParams.KEY_SUPPORTED_PREVIEW_FORMATS));
const char* const PREVIEW_FORMAT = "yuv420p";
const char* const BAD_PREVIEW_FORMAT = "yuv420sp";
mParams.setPreviewFormat(PREVIEW_FORMAT);
mParams.setPreviewFrameRate(mFps);
#else
mParams.setPreviewFormat("yuv420sp");
mParams.setPreviewFrameRate(mFps);
#endif
PushParametersImpl();
// Check that our settings stuck
PullParametersImpl();
#if !FORCE_PREVIEW_FORMAT_YUV420SP
const char* format = mParams.getPreviewFormat();
if (strcmp(format, PREVIEW_FORMAT) == 0) {
mFormat = PREVIEW_FORMAT_YUV420P; /* \o/ */
@ -236,6 +256,7 @@ nsGonkCameraControl::Init()
mFormat = PREVIEW_FORMAT_UNKNOWN;
DOM_CAMERA_LOGE("Camera ignored our request for '%s' preview, returned UNSUPPORTED format '%s'\n", PREVIEW_FORMAT, format);
}
#endif
// Check the frame rate and log if the camera ignored our setting
uint32_t fps = mParams.getPreviewFrameRate();

View File

@ -9,6 +9,11 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const PREF_DEBUG = "toolkit.identity.debug";
const PREF_ENABLED = "dom.identity.enabled";
// Bug 822450: Workaround for Bug 821740. When testing with marionette,
// relax navigator.id.request's requirement that it be handling native
// events. Synthetic marionette events are ok.
const PREF_SYNTHETIC_EVENTS_OK = "dom.identity.syntheticEventsOk";
// Maximum length of a string that will go through IPC
const MAX_STRING_LENGTH = 2048;
// Maximum number of times navigator.id.request can be called for a document
@ -47,7 +52,14 @@ nsDOMIdentity.prototype = {
raiseAuthenticationFailure: 'r',
},
// nsIDOMIdentity
// require native events unless syntheticEventsOk is set
get nativeEventsRequired() {
if (Services.prefs.prefHasUserValue(PREF_SYNTHETIC_EVENTS_OK)) {
return !Services.prefs.getBoolPref(PREF_SYNTHETIC_EVENTS_OK);
}
return true;
},
/**
* Relying Party (RP) APIs
*/
@ -115,7 +127,8 @@ nsDOMIdentity.prototype = {
// input handler is when we are handling the (deprecated) get() or
// getVerifiedEmail() calls, which make use of an RP context
// marked as _internal.
if (!util.isHandlingUserInput && !aOptions._internal) {
if (this.nativeEventsRequired && !util.isHandlingUserInput && !aOptions._internal) {
this._log("request: rejecting non-native event");
return;
}

View File

@ -1668,7 +1668,7 @@ GetAllHelper::UnpackResponseFromParentProcess(
for (uint32_t index = 0; index < cloneInfos.Length(); index++) {
const SerializedStructuredCloneReadInfo srcInfo = cloneInfos[index];
const InfallibleTArray<PBlobChild*> blobs = blobArrays[index].blobsChild();
const InfallibleTArray<PBlobChild*>& blobs = blobArrays[index].blobsChild();
StructuredCloneReadInfo* destInfo = mCloneReadInfos.AppendElement();
if (!destInfo->SetFromSerialized(srcInfo)) {

View File

@ -3907,7 +3907,7 @@ GetAllHelper::UnpackResponseFromParentProcess(
for (uint32_t index = 0; index < cloneInfos.Length(); index++) {
const SerializedStructuredCloneReadInfo srcInfo = cloneInfos[index];
const InfallibleTArray<PBlobChild*> blobs = blobArrays[index].blobsChild();
const InfallibleTArray<PBlobChild*>& blobs = blobArrays[index].blobsChild();
StructuredCloneReadInfo* destInfo = mCloneReadInfos.AppendElement();
if (!destInfo->SetFromSerialized(srcInfo)) {

View File

@ -382,6 +382,20 @@ child:
uint32_t renderFlags, bool flushLayout,
nsIntSize renderSize);
/**
* Send the child its app type. The app type identifies the kind of app
* shown in this PBrowser. Currently, the only recognized app type is
* "homescreen".
*
* The value here corresponds to the "mozapptype" attribute on iframes. For
* example, <iframe mozbrowser mozapp="..." mozapptype="homescreen">.
*
* Only app frames (i.e., frames with an app-id) should have a non-empty app
* type. If you try to SetAppType() with a non-empty app type on a non-app
* PBrowserChild, we may assert.
*/
SetAppType(nsString appType);
/**
* Sent by the chrome process when it no longer wants this remote
* <browser>. The child side cleans up in response, then

View File

@ -5,6 +5,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/ipc/ProcessPriorityManager.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/Hal.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
@ -68,6 +70,33 @@ GetPPMLog()
#define LOG(fmt, ...)
#endif
/**
* Get the appropriate backround priority for this process.
*/
ProcessPriority
GetBackgroundPriority()
{
bool isHomescreen = false;
ContentChild* contentChild = ContentChild::GetSingleton();
if (contentChild) {
const InfallibleTArray<PBrowserChild*>& browsers =
contentChild->ManagedPBrowserChild();
for (uint32_t i = 0; i < browsers.Length(); i++) {
nsAutoString appType;
static_cast<TabChild*>(browsers[i])->GetAppType(appType);
if (appType.EqualsLiteral("homescreen")) {
isHomescreen = true;
break;
}
}
}
return isHomescreen ?
PROCESS_PRIORITY_BACKGROUND_HOMESCREEN :
PROCESS_PRIORITY_BACKGROUND;
}
/**
* This class listens to window creation and visibilitychange events and
* informs the hal back-end when this process transitions between having no
@ -106,8 +135,8 @@ private:
void RecomputeNumVisibleWindows();
// mProcessPriority tracks the priority we've given this process in hal,
// except that, when the grace period timer is active,
// mProcessPriority == BACKGROUND even though hal still thinks we're a
// except that, when the grace period timer is active, mProcessPriority ==
// BACKGROUND or HOMESCREEN_BACKGROUND even though hal still thinks we're a
// foreground process.
ProcessPriority mProcessPriority;
@ -251,7 +280,7 @@ ProcessPriorityManager::RecomputeNumVisibleWindows()
}
SetPriority(allHidden ?
PROCESS_PRIORITY_BACKGROUND :
GetBackgroundPriority() :
PROCESS_PRIORITY_FOREGROUND);
}
@ -262,7 +291,8 @@ ProcessPriorityManager::SetPriority(ProcessPriority aPriority)
return;
}
if (aPriority == PROCESS_PRIORITY_BACKGROUND) {
if (aPriority == PROCESS_PRIORITY_BACKGROUND ||
aPriority == PROCESS_PRIORITY_BACKGROUND_HOMESCREEN) {
// If this is a foreground --> background transition, give ourselves a
// grace period before informing hal.
uint32_t gracePeriodMS = Preferences::GetUint("dom.ipc.processPriorityManager.gracePeriodMS", 1000);
@ -304,15 +334,16 @@ void
ProcessPriorityManager::OnGracePeriodTimerFired()
{
LOG("Grace period timer fired; setting priority to %d.",
PROCESS_PRIORITY_BACKGROUND);
mProcessPriority);
// mProcessPriority should already be BACKGROUND: We set it in
// SetPriority(BACKGROUND), and we canceled this timer if there was an
// mProcessPriority should already be one of the BACKGROUND values: We set it
// in SetPriority(BACKGROUND), and we canceled this timer if there was an
// intervening SetPriority(FOREGROUND) call.
MOZ_ASSERT(mProcessPriority == PROCESS_PRIORITY_BACKGROUND);
MOZ_ASSERT(mProcessPriority == PROCESS_PRIORITY_BACKGROUND ||
mProcessPriority == PROCESS_PRIORITY_BACKGROUND_HOMESCREEN);
mGracePeriodTimer = nullptr;
hal::SetProcessPriority(getpid(), PROCESS_PRIORITY_BACKGROUND);
hal::SetProcessPriority(getpid(), mProcessPriority);
// We're in the background; dump as much memory as we can.
nsCOMPtr<nsIMemoryReporterManager> mgr =

View File

@ -97,7 +97,6 @@ static const nsIntSize kDefaultViewportSize(980, 480);
static const char CANCEL_DEFAULT_PAN_ZOOM[] = "cancel-default-pan-zoom";
static const char BROWSER_ZOOM_TO_RECT[] = "browser-zoom-to-rect";
static const char BEFORE_FIRST_PAINT[] = "before-first-paint";
static const char DETECT_SCROLLABLE_SUBFRAME[] = "detect-scrollable-subframe";
NS_IMETHODIMP
ContentListener::HandleEvent(nsIDOMEvent* aEvent)
@ -243,12 +242,6 @@ TabChild::Observe(nsISupports *aSubject,
HandlePossibleViewportChange();
}
}
} else if (!strcmp(aTopic, DETECT_SCROLLABLE_SUBFRAME)) {
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aSubject));
nsCOMPtr<nsITabChild> tabChild(GetTabChildFrom(docShell));
if (tabChild == this) {
mRemoteFrame->DetectScrollableSubframe();
}
}
return NS_OK;
@ -1687,7 +1680,6 @@ TabChild::RecvDestroy()
observerService->RemoveObserver(this, CANCEL_DEFAULT_PAN_ZOOM);
observerService->RemoveObserver(this, BROWSER_ZOOM_TO_RECT);
observerService->RemoveObserver(this, BEFORE_FIRST_PAINT);
observerService->RemoveObserver(this, DETECT_SCROLLABLE_SUBFRAME);
const InfallibleTArray<PIndexedDBChild*>& idbActors =
ManagedPIndexedDBChild();
@ -1701,6 +1693,14 @@ TabChild::RecvDestroy()
return Send__delete__(this);
}
/* virtual */ bool
TabChild::RecvSetAppType(const nsString& aAppType)
{
MOZ_ASSERT_IF(!aAppType.IsEmpty(), HasOwnApp());
mAppType = aAppType;
return true;
}
PRenderFrameChild*
TabChild::AllocPRenderFrame(ScrollingBehavior* aScrolling,
LayersBackend* aBackend,
@ -1815,9 +1815,6 @@ TabChild::InitRenderingState()
observerService->AddObserver(this,
BEFORE_FIRST_PAINT,
false);
observerService->AddObserver(this,
DETECT_SCROLLABLE_SUBFRAME,
false);
}
return true;

View File

@ -307,6 +307,16 @@ public:
void MakeVisible();
void MakeHidden();
virtual bool RecvSetAppType(const nsString& aAppType);
/**
* Get this object's app type.
*
* A TabChild's app type corresponds to the value of its frame element's
* "mozapptype" attribute.
*/
void GetAppType(nsAString& aAppType) const { aAppType = mAppType; }
protected:
virtual PRenderFrameChild* AllocPRenderFrame(ScrollingBehavior* aScrolling,
LayersBackend* aBackend,
@ -408,6 +418,7 @@ private:
bool mNotified;
bool mContentDocumentIsDisplayed;
bool mTriedBrowserInit;
nsString mAppType;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};

View File

@ -262,21 +262,29 @@ public:
// Create a media stream.
nsRefPtr<nsDOMLocalMediaStream> stream;
nsRefPtr<nsDOMLocalMediaStream> trackunion;
uint32_t hints = (mAudioSource ? nsDOMMediaStream::HINT_CONTENTS_AUDIO : 0);
hints |= (mVideoSource ? nsDOMMediaStream::HINT_CONTENTS_VIDEO : 0);
stream = nsDOMLocalMediaStream::CreateSourceStream(hints);
if (!stream) {
stream = nsDOMLocalMediaStream::CreateSourceStream(hints);
trackunion = nsDOMLocalMediaStream::CreateTrackUnionStream(hints);
if (!stream || !trackunion) {
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error(mError);
LOG(("Returning error for getUserMedia() - no stream"));
error->OnError(NS_LITERAL_STRING("NO_STREAM"));
return NS_OK;
}
// connect the source stream to the track union stream to avoid us blocking
trackunion->GetStream()->AsProcessedStream()->SetAutofinish(true);
nsRefPtr<MediaInputPort> port = trackunion->GetStream()->AsProcessedStream()->
AllocateInputPort(stream->GetStream()->AsSourceStream(),
MediaInputPort::FLAG_BLOCK_OUTPUT);
nsPIDOMWindow *window = static_cast<nsPIDOMWindow*>
(nsGlobalWindow::GetInnerWindowWithId(mWindowID));
if (window && window->GetExtantDoc()) {
stream->CombineWithPrincipal(window->GetExtantDoc()->NodePrincipal());
trackunion->CombineWithPrincipal(window->GetExtantDoc()->NodePrincipal());
}
// Ensure there's a thread for gum to proxy to off main thread
@ -287,6 +295,7 @@ public:
// when the page is invalidated (on navigation or close).
GetUserMediaCallbackMediaStreamListener* listener =
new GetUserMediaCallbackMediaStreamListener(mediaThread, stream,
port.forget(),
mAudioSource,
mVideoSource);
stream->GetStream()->AddListener(listener);
@ -311,7 +320,7 @@ public:
// This is safe since we're on main-thread, and the windowlist can only
// be invalidated from the main-thread (see OnNavigation)
LOG(("Returning success for getUserMedia()"));
success->OnSuccess(static_cast<nsIDOMLocalMediaStream*>(stream));
success->OnSuccess(static_cast<nsIDOMLocalMediaStream*>(trackunion));
return NS_OK;
}

View File

@ -89,6 +89,7 @@ public:
, mStream(aStream)
{}
// so we can send Stop without AddRef()ing from the MSG thread
MediaOperationRunnable(MediaOperation aType,
SourceMediaStream* aStream,
MediaEngineSource* aAudioSource,
@ -161,6 +162,7 @@ public:
}
// Do this after stopping all tracks with EndTrack()
mSourceStream->Finish();
// the TrackUnion destination of the port will autofinish
nsRefPtr<GetUserMediaNotificationEvent> event =
new GetUserMediaNotificationEvent(GetUserMediaNotificationEvent::STOPPING);
@ -190,12 +192,14 @@ class GetUserMediaCallbackMediaStreamListener : public MediaStreamListener
public:
GetUserMediaCallbackMediaStreamListener(nsIThread *aThread,
nsDOMMediaStream* aStream,
already_AddRefed<MediaInputPort> aPort,
MediaEngineSource* aAudioSource,
MediaEngineSource* aVideoSource)
: mMediaThread(aThread)
, mAudioSource(aAudioSource)
, mVideoSource(aVideoSource)
, mStream(aStream) {}
, mStream(aStream)
, mPort(aPort) {}
void
Invalidate()
@ -206,7 +210,7 @@ public:
// thread.
// XXX FIX! I'm cheating and passing a raw pointer to the sourcestream
// which is valid as long as the mStream pointer here is. Need a better solution.
runnable = new MediaOperationRunnable(MEDIA_STOP,
runnable = new MediaOperationRunnable(MEDIA_STOP,
mStream->GetStream()->AsSourceStream(),
mAudioSource, mVideoSource);
mMediaThread->Dispatch(runnable, NS_DISPATCH_NORMAL);
@ -239,6 +243,7 @@ private:
nsRefPtr<MediaEngineSource> mAudioSource;
nsRefPtr<MediaEngineSource> mVideoSource;
nsRefPtr<nsDOMMediaStream> mStream;
nsRefPtr<MediaInputPort> mPort;
};
typedef nsTArray<nsRefPtr<GetUserMediaCallbackMediaStreamListener> > StreamListeners;

View File

@ -98,6 +98,7 @@ MOCHITEST_FILES = \
test_missingManifest.html \
missing.html \
jupiter.jpg \
test_cancelOfflineCache.html \
$(NULL)
# test_offlineMode.html disabled due to bug 656943

View File

@ -0,0 +1,59 @@
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
<head>
<title>Cancel offline cache</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
var manifestURI = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(manifest, null, null);
var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
.getService(Ci.nsIOfflineCacheUpdateService);
function manifestCached () {
OfflineTest.ok(false, "The update was supposed to be canceled");
OfflineTest.teardown();
OfflineTest.finish();
}
function onError () {
OfflineTest.ok(true, "Expected error: Update canceled");
OfflineTest.teardown();
OfflineTest.finish();
}
function onProgress () {
var i = 0;
while (i < updateService.numUpdates) {
var update = updateService.getUpdate(i);
if (update.manifestURI.spec == manifestURI.spec) {
update.cancel();
return;
}
i++;
}
}
if (OfflineTest.setup()) {
applicationCache.onerror = OfflineTest.priv(onError);
applicationCache.onprogress = OfflineTest.priv(onProgress);
applicationCache.oncached = OfflineTest.priv(manifestCached);
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body>
</body>
</html>

View File

@ -270,11 +270,7 @@ void ResizeFilter::ComputeFilters(int src_size,
// downscale should "cover" the pixels around the pixel with *its center*
// at coordinates (2.5, 2.5) in the source, not those around (0, 0).
// Hence we need to scale coordinates (0.5, 0.5), not (0, 0).
// TODO(evannier): this code is therefore incorrect and should read:
// float src_pixel = (static_cast<float>(dest_subset_i) + 0.5f) * inv_scale;
// I leave it incorrect, because changing it would require modifying
// the results for the webkit test, which I will do in a subsequent checkin.
float src_pixel = dest_subset_i * inv_scale;
float src_pixel = (static_cast<float>(dest_subset_i) + 0.5f) * inv_scale;
// Compute the (inclusive) range of source pixels the filter covers.
int src_begin = NS_MAX(0, FloorInt(src_pixel - src_support));
@ -291,11 +287,8 @@ void ResizeFilter::ComputeFilters(int src_size,
// example used above the distance from the center of the filter to
// the pixel with coordinates (2, 2) should be 0, because its center
// is at (2.5, 2.5).
// TODO(evannier): as above (in regards to the 0.5 pixel error),
// this code is incorrect, but is left it for the same reasons.
// float src_filter_dist =
// ((static_cast<float>(cur_filter_pixel) + 0.5f) - src_pixel);
float src_filter_dist = cur_filter_pixel - src_pixel;
float src_filter_dist =
((static_cast<float>(cur_filter_pixel) + 0.5f) - src_pixel);
// Since the filter really exists in dest space, map it there.
float dest_filter_dist = src_filter_dist * clamped_scale;

View File

@ -525,7 +525,8 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
{ (PRFuncPtr*) &mSymbols.fGetTexLevelParameteriv, { "GetTexLevelParameteriv", nullptr } },
{ nullptr, { nullptr } },
};
LoadSymbols(&auxSymbols[0], trygl, prefix);
bool warnOnFailures = DebugMode();
LoadSymbols(&auxSymbols[0], trygl, prefix, warnOnFailures);
}
if (mInitialized) {
@ -594,6 +595,16 @@ GLContext::InitExtensions()
mAvailableExtensions.Load(extensions, sExtensionNames, firstRun && DebugMode());
#ifdef XP_MACOSX
// The Mac Nvidia driver, for versions up to and including 10.8, don't seem
// to properly support this. See 814839
if (WorkAroundDriverBugs() &&
Vendor() == gl::GLContext::VendorNVIDIA)
{
MarkExtensionUnsupported(gl::GLContext::EXT_packed_depth_stencil);
}
#endif
#ifdef DEBUG
firstRun = false;
#endif

View File

@ -995,12 +995,25 @@ public:
// Read call hooks:
void fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) {
y = FixYValue(y, height);
BeforeGLReadCall();
raw_fReadPixels(x, y, width, height, format, type, pixels);
AfterGLReadCall();
}
void fCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
y = FixYValue(y, height);
if (!IsTextureSizeSafeToPassToDriver(target, width, height)) {
// pass wrong values to cause the GL to generate GL_INVALID_VALUE.
// See bug 737182 and the comment in IsTextureSizeSafeToPassToDriver.
level = -1;
width = -1;
height = -1;
border = -1;
}
BeforeGLReadCall();
raw_fCopyTexImage2D(target, level, internalformat,
x, y, width, height, border);
@ -1008,6 +1021,8 @@ public:
}
void fCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
y = FixYValue(y, height);
BeforeGLReadCall();
raw_fCopyTexSubImage2D(target, level, xoffset, yoffset,
x, y, width, height);
@ -1713,6 +1728,15 @@ public:
#endif
#define ASSERT_SYMBOL_PRESENT(func) \
do {\
MOZ_ASSERT(strstr(MOZ_FUNCTION_NAME, #func) != nullptr, "Mismatched symbol check.");\
if (MOZ_UNLIKELY(!mSymbols.func)) {\
printf_stderr("RUNTIME ASSERT: Uninitialized GL function: %s\n", #func);\
MOZ_CRASH();\
}\
} while (0)
/*** In GL debug mode, we completely override glGetError ***/
GLenum fGetError() {
@ -1732,29 +1756,19 @@ public:
/*** Scissor functions ***/
protected:
GLint FixYValue(GLint y, GLint height)
{
MOZ_ASSERT( !(mIsOffscreen && mFlipped) );
return mFlipped ? ViewportRect().height - (height + y) : y;
}
// only does the glScissor call, no ScissorRect business
void raw_fScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
BEFORE_GL_CALL;
// GL's coordinate system is flipped compared to ours (in the Y axis),
// so we may need to flip our rectangle.
mSymbols.fScissor(x,
FixYValue(y, height),
width,
height);
AFTER_GL_CALL;
}
public:
// but let GL-using code use that instead, updating the ScissorRect
void fScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
ScissorRect().SetRect(x, y, width, height);
// GL's coordinate system is flipped compared to the one we use in
// OGL Layers (in the Y axis), so we may need to flip our rectangle.
y = FixYValue(y, height);
raw_fScissor(x, y, width, height);
}
@ -1788,8 +1802,7 @@ public:
/*** Viewport functions ***/
protected:
private:
// only does the glViewport call, no ViewportRect business
void raw_fViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
BEFORE_GL_CALL;
@ -1803,7 +1816,6 @@ protected:
}
public:
void fViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
ViewportRect().SetRect(x, y, width, height);
raw_fViewport(x, y, width, height);
@ -1899,9 +1911,16 @@ public:
AFTER_GL_CALL;
}
void fBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
private:
void raw_fBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
BEFORE_GL_CALL;
mSymbols.fBufferData(target, size, data, usage);
AFTER_GL_CALL;
}
public:
void fBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
raw_fBufferData(target, size, data, usage);
// bug 744888
if (WorkAroundDriverBugs() &&
@ -1909,10 +1928,8 @@ public:
Vendor() == VendorNVIDIA)
{
char c = 0;
mSymbols.fBufferSubData(target, size-1, 1, &c);
fBufferSubData(target, size-1, 1, &c);
}
AFTER_GL_CALL;
}
void fBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
@ -1921,12 +1938,14 @@ public:
AFTER_GL_CALL;
}
private:
void raw_fClear(GLbitfield mask) {
BEFORE_GL_CALL;
mSymbols.fClear(mask);
AFTER_GL_CALL;
}
public:
void fClearColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) {
BEFORE_GL_CALL;
mSymbols.fClearColor(r, g, b, a);
@ -1993,6 +2012,7 @@ public:
AFTER_GL_CALL;
}
private:
void raw_fDrawArrays(GLenum mode, GLint first, GLsizei count) {
BEFORE_GL_CALL;
mSymbols.fDrawArrays(mode, first, count);
@ -2005,6 +2025,7 @@ public:
AFTER_GL_CALL;
}
public:
void fEnable(GLenum capability) {
BEFORE_GL_CALL;
mSymbols.fEnable(capability);
@ -2128,21 +2149,16 @@ public:
}
void fGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *img) {
if (!mSymbols.fGetTexImage) {
return;
}
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetTexImage);
mSymbols.fGetTexImage(target, level, format, type, img);
AFTER_GL_CALL;
}
void fGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
{
if (!mSymbols.fGetTexLevelParameteriv) {
*params = 0;
return;
}
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetTexLevelParameteriv);
mSymbols.fGetTexLevelParameteriv(target, level, pname, params);
AFTER_GL_CALL;
}
@ -2209,28 +2225,28 @@ public:
return retval;
}
realGLboolean fIsEnabled (GLenum capability) {
realGLboolean fIsEnabled(GLenum capability) {
BEFORE_GL_CALL;
realGLboolean retval = mSymbols.fIsEnabled(capability);
AFTER_GL_CALL;
return retval;
}
realGLboolean fIsProgram (GLuint program) {
realGLboolean fIsProgram(GLuint program) {
BEFORE_GL_CALL;
realGLboolean retval = mSymbols.fIsProgram(program);
AFTER_GL_CALL;
return retval;
}
realGLboolean fIsShader (GLuint shader) {
realGLboolean fIsShader(GLuint shader) {
BEFORE_GL_CALL;
realGLboolean retval = mSymbols.fIsShader(shader);
AFTER_GL_CALL;
return retval;
}
realGLboolean fIsTexture (GLuint texture) {
realGLboolean fIsTexture(GLuint texture) {
BEFORE_GL_CALL;
realGLboolean retval = mSymbols.fIsTexture(texture);
AFTER_GL_CALL;
@ -2273,18 +2289,28 @@ public:
AFTER_GL_CALL;
}
private:
void raw_fReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) {
BEFORE_GL_CALL;
mSymbols.fReadPixels(x, FixYValue(y, height), width, height, format, type, pixels);
AFTER_GL_CALL;
}
public:
void fSampleCoverage(GLclampf value, realGLboolean invert) {
BEFORE_GL_CALL;
mSymbols.fSampleCoverage(value, invert);
AFTER_GL_CALL;
}
private:
void raw_fScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
BEFORE_GL_CALL;
mSymbols.fScissor(x, y, width, height);
AFTER_GL_CALL;
}
public:
void fStencilFunc(GLenum func, GLint ref, GLuint mask) {
BEFORE_GL_CALL;
mSymbols.fStencilFunc(func, ref, mask);
@ -2321,18 +2347,27 @@ public:
AFTER_GL_CALL;
}
void fTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {
private:
void raw_fTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {
BEFORE_GL_CALL;
if (IsTextureSizeSafeToPassToDriver(target, width, height)) {
mSymbols.fTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
} else {
// pass wrong values to cause the GL to generate GL_INVALID_VALUE.
// See bug 737182 and the comment in IsTextureSizeSafeToPassToDriver.
mSymbols.fTexImage2D(target, -1, internalformat, -1, -1, -1, format, type, nullptr);
}
mSymbols.fTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
AFTER_GL_CALL;
}
public:
void fTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {
if (!IsTextureSizeSafeToPassToDriver(target, width, height)) {
// pass wrong values to cause the GL to generate GL_INVALID_VALUE.
// See bug 737182 and the comment in IsTextureSizeSafeToPassToDriver.
level = -1;
width = -1;
height = -1;
border = -1;
}
raw_fTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
}
void fTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) {
BEFORE_GL_CALL;
mSymbols.fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
@ -2525,32 +2560,20 @@ public:
AFTER_GL_CALL;
}
private:
void raw_fCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
BEFORE_GL_CALL;
if (IsTextureSizeSafeToPassToDriver(target, width, height)) {
mSymbols.fCopyTexImage2D(target, level, internalformat,
x, FixYValue(y, height),
width, height, border);
} else {
// pass wrong values to cause the GL to generate GL_INVALID_VALUE.
// See bug 737182 and the comment in IsTextureSizeSafeToPassToDriver.
mSymbols.fCopyTexImage2D(target, -1, internalformat,
x, FixYValue(y, height),
-1, -1, -1);
}
mSymbols.fCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
AFTER_GL_CALL;
}
void raw_fCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
BEFORE_GL_CALL;
mSymbols.fCopyTexSubImage2D(target, level, xoffset, yoffset,
x, FixYValue(y, height),
width, height);
mSymbols.fCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
AFTER_GL_CALL;
}
public:
void fGetShaderiv(GLuint shader, GLenum pname, GLint* param) {
BEFORE_GL_CALL;
mSymbols.fGetShaderiv(shader, pname, param);
@ -2563,15 +2586,24 @@ public:
AFTER_GL_CALL;
}
void fGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
private:
void raw_fGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
MOZ_ASSERT(mIsGLES2);
BEFORE_GL_CALL;
if (mIsGLES2) {
mSymbols.fGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
ASSERT_SYMBOL_PRESENT(fGetShaderPrecisionFormat);
mSymbols.fGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
AFTER_GL_CALL;
}
public:
void fGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
if (mIsGLES2) {
raw_fGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
} else {
// Fall back to automatic values because almost all desktop hardware supports the OpenGL standard precisions.
GetShaderPrecisionFormatNonES2(shadertype, precisiontype, range, precision);
}
AFTER_GL_CALL;
}
void fGetShaderSource(GLint obj, GLsizei maxLength, GLsizei* length, GLchar* source) {
@ -2638,12 +2670,15 @@ public:
return retval;
}
private:
void raw_fBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fBlitFramebuffer);
mSymbols.fBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
AFTER_GL_CALL;
}
public:
realGLboolean fIsRenderbuffer (GLuint renderbuffer) {
BEFORE_GL_CALL;
realGLboolean retval = mSymbols.fIsRenderbuffer(renderbuffer);
@ -2659,32 +2694,68 @@ public:
void fRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fRenderbufferStorageMultisample);
mSymbols.fRenderbufferStorageMultisample(target, samples, internalFormat, width, height);
AFTER_GL_CALL;
}
void fDepthRange(GLclampf a, GLclampf b) {
private:
void raw_fDepthRange(GLclampf a, GLclampf b) {
MOZ_ASSERT(!mIsGLES2);
BEFORE_GL_CALL;
if (mIsGLES2) {
mSymbols.fDepthRangef(a, b);
} else {
mSymbols.fDepthRange(a, b);
}
ASSERT_SYMBOL_PRESENT(fDepthRange);
mSymbols.fDepthRange(a, b);
AFTER_GL_CALL;
}
void fClearDepth(GLclampf v) {
void raw_fDepthRangef(GLclampf a, GLclampf b) {
MOZ_ASSERT(mIsGLES2);
BEFORE_GL_CALL;
if (mIsGLES2) {
mSymbols.fClearDepthf(v);
} else {
mSymbols.fClearDepth(v);
}
ASSERT_SYMBOL_PRESENT(fDepthRangef);
mSymbols.fDepthRangef(a, b);
AFTER_GL_CALL;
}
void raw_fClearDepth(GLclampf v) {
MOZ_ASSERT(!mIsGLES2);
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fClearDepth);
mSymbols.fClearDepth(v);
AFTER_GL_CALL;
}
void raw_fClearDepthf(GLclampf v) {
MOZ_ASSERT(mIsGLES2);
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fClearDepthf);
mSymbols.fClearDepthf(v);
AFTER_GL_CALL;
}
public:
void fDepthRange(GLclampf a, GLclampf b) {
if (mIsGLES2) {
raw_fDepthRangef(a, b);
} else {
raw_fDepthRange(a, b);
}
}
void fClearDepth(GLclampf v) {
if (mIsGLES2) {
raw_fClearDepthf(v);
} else {
raw_fClearDepth(v);
}
}
void* fMapBuffer(GLenum target, GLenum access) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fMapBuffer);
void *ret = mSymbols.fMapBuffer(target, access);
AFTER_GL_CALL;
return ret;
@ -2692,12 +2763,14 @@ public:
realGLboolean fUnmapBuffer(GLenum target) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fUnmapBuffer);
realGLboolean ret = mSymbols.fUnmapBuffer(target);
AFTER_GL_CALL;
return ret;
}
private:
#ifdef DEBUG
GLContext *TrackingContext() {
GLContext *tip = this;
@ -2711,106 +2784,163 @@ public:
#define TRACKING_CONTEXT(a) do {} while (0)
#endif
GLuint GLAPIENTRY fCreateProgram() {
GLuint GLAPIENTRY raw_fCreateProgram() {
BEFORE_GL_CALL;
GLuint ret = mSymbols.fCreateProgram();
AFTER_GL_CALL;
return ret;
}
GLuint GLAPIENTRY raw_fCreateShader(GLenum t) {
BEFORE_GL_CALL;
GLuint ret = mSymbols.fCreateShader(t);
AFTER_GL_CALL;
return ret;
}
void GLAPIENTRY raw_fGenBuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenBuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenFramebuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenFramebuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenRenderbuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenRenderbuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenTextures(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenTextures(n, names);
AFTER_GL_CALL;
}
public:
GLuint fCreateProgram() {
GLuint ret = raw_fCreateProgram();
TRACKING_CONTEXT(CreatedProgram(this, ret));
return ret;
}
GLuint GLAPIENTRY fCreateShader(GLenum t) {
BEFORE_GL_CALL;
GLuint ret = mSymbols.fCreateShader(t);
AFTER_GL_CALL;
GLuint fCreateShader(GLenum t) {
GLuint ret = raw_fCreateShader(t);
TRACKING_CONTEXT(CreatedShader(this, ret));
return ret;
}
void GLAPIENTRY fGenBuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenBuffers(n, names);
AFTER_GL_CALL;
void fGenBuffers(GLsizei n, GLuint* names) {
raw_fGenBuffers(n, names);
TRACKING_CONTEXT(CreatedBuffers(this, n, names));
}
void GLAPIENTRY fGenTextures(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenTextures(n, names);
AFTER_GL_CALL;
TRACKING_CONTEXT(CreatedTextures(this, n, names));
}
void GLAPIENTRY fGenFramebuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenFramebuffers(n, names);
AFTER_GL_CALL;
void fGenFramebuffers(GLsizei n, GLuint* names) {
raw_fGenFramebuffers(n, names);
TRACKING_CONTEXT(CreatedFramebuffers(this, n, names));
}
void GLAPIENTRY fGenRenderbuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenRenderbuffers(n, names);
AFTER_GL_CALL;
void fGenRenderbuffers(GLsizei n, GLuint* names) {
raw_fGenRenderbuffers(n, names);
TRACKING_CONTEXT(CreatedRenderbuffers(this, n, names));
}
void GLAPIENTRY fDeleteProgram(GLuint program) {
void fGenTextures(GLsizei n, GLuint* names) {
raw_fGenTextures(n, names);
TRACKING_CONTEXT(CreatedTextures(this, n, names));
}
private:
void GLAPIENTRY raw_fDeleteProgram(GLuint program) {
BEFORE_GL_CALL;
mSymbols.fDeleteProgram(program);
AFTER_GL_CALL;
TRACKING_CONTEXT(DeletedProgram(this, program));
}
void GLAPIENTRY fDeleteShader(GLuint shader) {
void GLAPIENTRY raw_fDeleteShader(GLuint shader) {
BEFORE_GL_CALL;
mSymbols.fDeleteShader(shader);
AFTER_GL_CALL;
TRACKING_CONTEXT(DeletedShader(this, shader));
}
void GLAPIENTRY fDeleteBuffers(GLsizei n, GLuint *names) {
void GLAPIENTRY raw_fDeleteBuffers(GLsizei n, GLuint *names) {
BEFORE_GL_CALL;
mSymbols.fDeleteBuffers(n, names);
AFTER_GL_CALL;
TRACKING_CONTEXT(DeletedBuffers(this, n, names));
}
void GLAPIENTRY fDeleteTextures(GLsizei n, GLuint *names) {
void GLAPIENTRY raw_fDeleteFramebuffers(GLsizei n, GLuint *names) {
BEFORE_GL_CALL;
mSymbols.fDeleteTextures(n, names);
mSymbols.fDeleteFramebuffers(n, names);
AFTER_GL_CALL;
TRACKING_CONTEXT(DeletedTextures(this, n, names));
}
void GLAPIENTRY fDeleteFramebuffers(GLsizei n, GLuint *names) {
BEFORE_GL_CALL;
if (n == 1 && *names == 0) {
/* Deleting framebuffer 0 causes hangs on the DROID. See bug 623228 */
} else {
mSymbols.fDeleteFramebuffers(n, names);
}
AFTER_GL_CALL;
TRACKING_CONTEXT(DeletedFramebuffers(this, n, names));
}
void GLAPIENTRY fDeleteRenderbuffers(GLsizei n, GLuint *names) {
void GLAPIENTRY raw_fDeleteRenderbuffers(GLsizei n, GLuint *names) {
BEFORE_GL_CALL;
mSymbols.fDeleteRenderbuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteTextures(GLsizei n, GLuint *names) {
BEFORE_GL_CALL;
mSymbols.fDeleteTextures(n, names);
AFTER_GL_CALL;
}
public:
void fDeleteProgram(GLuint program) {
raw_fDeleteProgram(program);
TRACKING_CONTEXT(DeletedProgram(this, program));
}
void fDeleteShader(GLuint shader) {
raw_fDeleteShader(shader);
TRACKING_CONTEXT(DeletedShader(this, shader));
}
void fDeleteBuffers(GLsizei n, GLuint *names) {
raw_fDeleteBuffers(n, names);
TRACKING_CONTEXT(DeletedBuffers(this, n, names));
}
void fDeleteFramebuffers(GLsizei n, GLuint *names) {
if (n == 1 && *names == 0) {
// Deleting framebuffer 0 causes hangs on the DROID. See bug 623228.
} else {
raw_fDeleteFramebuffers(n, names);
}
TRACKING_CONTEXT(DeletedFramebuffers(this, n, names));
}
void fDeleteRenderbuffers(GLsizei n, GLuint *names) {
raw_fDeleteRenderbuffers(n, names);
TRACKING_CONTEXT(DeletedRenderbuffers(this, n, names));
}
void fDeleteTextures(GLsizei n, GLuint *names) {
raw_fDeleteTextures(n, names);
TRACKING_CONTEXT(DeletedTextures(this, n, names));
}
GLenum GLAPIENTRY fGetGraphicsResetStatus() {
MOZ_ASSERT(mHasRobustness);
BEFORE_GL_CALL;
GLenum ret = mHasRobustness ? mSymbols.fGetGraphicsResetStatus() : 0;
ASSERT_SYMBOL_PRESENT(fGetGraphicsResetStatus);
GLenum ret = mSymbols.fGetGraphicsResetStatus();
AFTER_GL_CALL;
return ret;
}
GLsync GLAPIENTRY fFenceSync(GLenum condition, GLbitfield flags) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fFenceSync);
GLsync ret = mSymbols.fFenceSync(condition, flags);
AFTER_GL_CALL;
return ret;
@ -2818,6 +2948,7 @@ public:
realGLboolean GLAPIENTRY fIsSync(GLsync sync) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fIsSync);
realGLboolean ret = mSymbols.fIsSync(sync);
AFTER_GL_CALL;
return ret;
@ -2825,12 +2956,14 @@ public:
void GLAPIENTRY fDeleteSync(GLsync sync) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDeleteSync);
mSymbols.fDeleteSync(sync);
AFTER_GL_CALL;
}
GLenum GLAPIENTRY fClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fClientWaitSync);
GLenum ret = mSymbols.fClientWaitSync(sync, flags, timeout);
AFTER_GL_CALL;
return ret;
@ -2838,30 +2971,35 @@ public:
void GLAPIENTRY fWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fWaitSync);
mSymbols.fWaitSync(sync, flags, timeout);
AFTER_GL_CALL;
}
void GLAPIENTRY fGetInteger64v(GLenum pname, GLint64 *params) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetInteger64v);
mSymbols.fGetInteger64v(pname, params);
AFTER_GL_CALL;
}
void GLAPIENTRY fGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetSynciv);
mSymbols.fGetSynciv(sync, pname, bufSize, length, values);
AFTER_GL_CALL;
}
// OES_EGL_image (GLES)
void fEGLImageTargetTexture2D(GLenum target, GLeglImage image)
{
void fEGLImageTargetTexture2D(GLenum target, GLeglImage image) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fEGLImageTargetTexture2D);
mSymbols.fEGLImageTargetTexture2D(target, image);
AFTER_GL_CALL;
}
#undef ASSERT_SYMBOL_PRESENT
#ifdef DEBUG
void THEBES_API CreatedProgram(GLContext *aOrigin, GLuint aName);
void THEBES_API CreatedShader(GLContext *aOrigin, GLuint aName);

View File

@ -4,6 +4,8 @@
#include "GLLibraryLoader.h"
#include "nsDebug.h"
namespace mozilla {
namespace gl {
@ -22,15 +24,22 @@ GLLibraryLoader::OpenLibrary(const char *library)
}
bool
GLLibraryLoader::LoadSymbols(SymLoadStruct *firstStruct, bool tryplatform, const char *prefix)
GLLibraryLoader::LoadSymbols(SymLoadStruct *firstStruct,
bool tryplatform,
const char *prefix,
bool warnOnFailure)
{
return LoadSymbols(mLibrary, firstStruct, tryplatform ? mLookupFunc : nullptr, prefix);
return LoadSymbols(mLibrary,
firstStruct,
tryplatform ? mLookupFunc : nullptr,
prefix,
warnOnFailure);
}
PRFuncPtr
GLLibraryLoader::LookupSymbol(PRLibrary *lib,
const char *sym,
PlatformLookupFunction lookupFunction)
const char *sym,
PlatformLookupFunction lookupFunction)
{
PRFuncPtr res = 0;
@ -55,9 +64,10 @@ GLLibraryLoader::LookupSymbol(PRLibrary *lib,
bool
GLLibraryLoader::LoadSymbols(PRLibrary *lib,
SymLoadStruct *firstStruct,
PlatformLookupFunction lookupFunction,
const char *prefix)
SymLoadStruct *firstStruct,
PlatformLookupFunction lookupFunction,
const char *prefix,
bool warnOnFailure)
{
char sbuf[MAX_SYMBOL_LENGTH * 2];
int failCount = 0;
@ -85,7 +95,9 @@ GLLibraryLoader::LoadSymbols(PRLibrary *lib,
}
if (*ss->symPointer == 0) {
fprintf (stderr, "Can't find symbol '%s'\n", ss->symNames[0]);
if (warnOnFailure)
printf_stderr("Can't find symbol '%s'.\n", ss->symNames[0]);
failCount++;
}

View File

@ -37,8 +37,9 @@ public:
} SymLoadStruct;
bool LoadSymbols(SymLoadStruct *firstStruct,
bool tryplatform = false,
const char *prefix = nullptr);
bool tryplatform = false,
const char *prefix = nullptr,
bool warnOnFailure = true);
/*
* Static version of the functions in this class
@ -47,9 +48,10 @@ public:
const char *symname,
PlatformLookupFunction lookupFunction = nullptr);
static bool LoadSymbols(PRLibrary *lib,
SymLoadStruct *firstStruct,
PlatformLookupFunction lookupFunction = nullptr,
const char *prefix = nullptr);
SymLoadStruct *firstStruct,
PlatformLookupFunction lookupFunction = nullptr,
const char *prefix = nullptr,
bool warnOnFailure = true);
protected:
GLLibraryLoader() {
mLibrary = nullptr;

View File

@ -629,16 +629,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
void
BasicLayerManager::FlashWidgetUpdateArea(gfxContext *aContext)
{
static bool sWidgetFlashingEnabled;
static bool sWidgetFlashingPrefCached = false;
if (!sWidgetFlashingPrefCached) {
sWidgetFlashingPrefCached = true;
mozilla::Preferences::AddBoolVarCache(&sWidgetFlashingEnabled,
"nglayout.debug.widget_update_flashing");
}
if (sWidgetFlashingEnabled) {
if (gfxPlatform::GetPlatform()->WidgetUpdateFlashing()) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;

View File

@ -237,26 +237,6 @@ nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent)
return rv;
}
if (mDelayPanning && aEvent.mInputType == MULTITOUCH_INPUT) {
const MultiTouchInput& multiTouchInput = aEvent.AsMultiTouchInput();
if (multiTouchInput.mType == MultiTouchInput::MULTITOUCH_MOVE) {
// Let BrowserElementScrolling perform panning gesture first.
SetState(WAITING_LISTENERS);
mTouchQueue.AppendElement(multiTouchInput);
if (!mTouchListenerTimeoutTask) {
mTouchListenerTimeoutTask =
NewRunnableMethod(this, &AsyncPanZoomController::TimeoutTouchListeners);
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
mTouchListenerTimeoutTask,
TOUCH_LISTENER_TIMEOUT);
}
return nsEventStatus_eConsumeNoDefault;
}
}
switch (aEvent.mInputType) {
case MULTITOUCH_INPUT: {
const MultiTouchInput& multiTouchInput = aEvent.AsMultiTouchInput();
@ -1109,7 +1089,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aViewportFr
mLastContentPaintMetrics = aViewportFrame;
mFrameMetrics.mMayHaveTouchListeners = aViewportFrame.mMayHaveTouchListeners;
if (mWaitingForContentToPaint) {
// Remove the oldest sample we have if adding a new sample takes us over our
// desired number of samples.
@ -1203,10 +1182,6 @@ void AsyncPanZoomController::CancelDefaultPanZoom() {
}
}
void AsyncPanZoomController::DetectScrollableSubframe() {
mDelayPanning = true;
}
void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
gfx::Rect zoomToRect(gfx::Rect(aRect.x, aRect.y, aRect.width, aRect.height));
@ -1293,7 +1268,7 @@ void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
}
void AsyncPanZoomController::ContentReceivedTouch(bool aPreventDefault) {
if (!mFrameMetrics.mMayHaveTouchListeners && !mDelayPanning) {
if (!mFrameMetrics.mMayHaveTouchListeners) {
mTouchQueue.Clear();
return;
}
@ -1305,21 +1280,12 @@ void AsyncPanZoomController::ContentReceivedTouch(bool aPreventDefault) {
if (mState == WAITING_LISTENERS) {
if (!aPreventDefault) {
// Delayed scrolling gesture is pending at TOUCHING state.
if (mDelayPanning) {
SetState(TOUCHING);
} else {
SetState(NOTHING);
}
SetState(NOTHING);
}
mHandlingTouchQueue = true;
while (!mTouchQueue.IsEmpty()) {
// we need to reset mDelayPanning before handling scrolling gesture.
if (mTouchQueue[0].mType == MultiTouchInput::MULTITOUCH_MOVE) {
mDelayPanning = false;
}
if (!aPreventDefault) {
HandleInputEvent(mTouchQueue[0]);
}

View File

@ -108,7 +108,7 @@ public:
void UpdateCompositionBounds(const nsIntRect& aCompositionBounds);
/**
* We are scrolling a subframe, so disable our machinery until we hit
* We have found a scrollable subframe, so disable our machinery until we hit
* a touch end or a new touch start. This prevents us from accidentally
* panning both the subframe and the parent frame.
*
@ -117,12 +117,6 @@ public:
*/
void CancelDefaultPanZoom();
/**
* We have found a scrollable subframe, so we need to delay the scrolling
* gesture executed and let subframe do the scrolling first.
*/
void DetectScrollableSubframe();
/**
* Kicks an animation to zoom to a rect. This may be either a zoom out or zoom
* in. The actual animation is done on the compositor thread after being set
@ -555,12 +549,6 @@ private:
// and we don't want to queue the events back up again.
bool mHandlingTouchQueue;
// Flag used to determine whether or not we should try scrolling by
// BrowserElementScrolling first. If set, this means we should pend touch move
// event, which not be cosumed by GestureListener. This flag will be reset
// after touch move event has been handled by content process.
bool mDelayPanning;
friend class Axis;
};

View File

@ -340,6 +340,9 @@ gfxPlatform::Init()
gPlatform->mWorkAroundDriverBugs = Preferences::GetBool("gfx.work-around-driver-bugs", true);
mozilla::Preferences::AddBoolVarCache(&gPlatform->mWidgetUpdateFlashing,
"nglayout.debug.widget_update_flashing");
mozilla::gl::GLContext::PlatformStartup();
#ifdef MOZ_WIDGET_ANDROID

View File

@ -493,6 +493,8 @@ public:
virtual int GetScreenDepth() const;
bool WidgetUpdateFlashing() const { return mWidgetUpdateFlashing; }
protected:
gfxPlatform();
virtual ~gfxPlatform();
@ -586,6 +588,7 @@ private:
bool mWorkAroundDriverBugs;
mozilla::RefPtr<mozilla::gfx::DrawEventRecorder> mRecorder;
bool mWidgetUpdateFlashing;
};
#endif /* GFX_PLATFORM_H */

View File

@ -69,6 +69,7 @@ typedef Observer<SwitchEvent> SwitchObserver;
enum ProcessPriority {
PROCESS_PRIORITY_BACKGROUND,
PROCESS_PRIORITY_BACKGROUND_HOMESCREEN,
PROCESS_PRIORITY_FOREGROUND,
PROCESS_PRIORITY_MASTER,
NUM_PROCESS_PRIORITY

View File

@ -1046,7 +1046,8 @@ EnsureKernelLowMemKillerParamsSet()
nsAutoCString adjParams;
nsAutoCString minfreeParams;
const char* priorityClasses[] = {"master", "foreground", "background"};
const char* priorityClasses[] =
{"master", "foreground", "background", "backgroundHomescreen"};
for (size_t i = 0; i < NS_ARRAY_LENGTH(priorityClasses); i++) {
int32_t oomScoreAdj;
if (!NS_SUCCEEDED(Preferences::GetInt(nsPrintfCString(
@ -1108,6 +1109,9 @@ SetProcessPriority(int aPid, ProcessPriority aPriority)
case PROCESS_PRIORITY_BACKGROUND:
priorityStr = "background";
break;
case PROCESS_PRIORITY_BACKGROUND_HOMESCREEN:
priorityStr = "backgroundHomescreen";
break;
case PROCESS_PRIORITY_FOREGROUND:
priorityStr = "foreground";
break;

View File

@ -437,8 +437,7 @@ public:
nsCOMPtr<nsIDOMWindow> window =
do_QueryInterface(tabParent->GetBrowserDOMWindow());
WindowIdentifier newID(id, window);
// Have to copy, because Vibrate doesn't take a compatible array type
hal::Vibrate(nsTArray<uint32_t>(pattern), newID);
hal::Vibrate(pattern, newID);
return true;
}

View File

@ -336,10 +336,10 @@ struct ParamTraits<nsString> : ParamTraits<nsAString>
typedef nsString paramType;
};
template <typename E, class A>
struct ParamTraits<nsTArray<E, A> >
template <typename E>
struct ParamTraits<FallibleTArray<E> >
{
typedef nsTArray<E, A> paramType;
typedef FallibleTArray<E> paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
@ -380,17 +380,19 @@ struct ParamTraits<nsTArray<E, A> >
};
template<typename E>
struct ParamTraits<InfallibleTArray<E> > :
ParamTraits<nsTArray<E, nsTArrayInfallibleAllocator> >
struct ParamTraits<InfallibleTArray<E> >
{
typedef InfallibleTArray<E> paramType;
// use nsTArray Write() method
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<const FallibleTArray<E>&>(aParam));
}
// deserialize the array fallibly, but return an InfallibleTArray
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
nsTArray<E> temp;
FallibleTArray<E> temp;
if (!ReadParam(aMsg, aIter, &temp))
return false;
@ -398,7 +400,10 @@ struct ParamTraits<InfallibleTArray<E> > :
return true;
}
// use nsTArray Log() method
static void Log(const paramType& aParam, std::wstring* aLog)
{
LogParam(static_cast<const FallibleTArray<E>&>(aParam), aLog);
}
};
template<>

View File

@ -3292,7 +3292,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
indent=1),
StmtDecl(
Decl(p.managedVarType(managed, self.side), kidsvar.name),
init=p.managedVar(managed, self.side)),
initargs=[ p.managedVar(managed, self.side) ]),
foreachdestroy,
])
destroysubtree.addstmt(block)
@ -4401,7 +4401,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
tmpvar = ExprVar('tmp')
ct = c.bareType()
readcase.addstmts([
StmtDecl(Decl(ct, tmpvar.name), init=c.defaultValue()),
StmtDecl(Decl(ct, tmpvar.name)),
StmtExpr(ExprAssn(ExprDeref(var), tmpvar)),
StmtReturn(self.read(
c.ipdltype,

View File

@ -904,7 +904,8 @@ export:: selfhosting
selfhosting:: selfhosted.out.h
selfhosting_srcs := \
$(srcdir)/builtin/array.js \
$(srcdir)/builtin/Utilities.js \
$(srcdir)/builtin/Array.js \
$(NULL)
selfhosted_out_h_deps := \

View File

@ -54,7 +54,7 @@ arm-linux*-android*|*-linuxandroid*)
android_tool_prefix="arm-linux-androideabi"
;;
i?86-*android*)
android_tool_prefix="i686-android-linux"
android_tool_prefix="i686-linux-android"
;;
mipsel-*android*)
android_tool_prefix="mipsel-linux-android"
@ -119,6 +119,17 @@ case "$target" in
fi
fi
dnl Old NDK support. If minimum requirement is changed to NDK r8b,
dnl please remove this.
case "$target_cpu" in
i?86)
if ! test -e "$android_toolchain"/bin/"$android_tool_prefix"-gcc; then
dnl Old NDK toolchain name
android_tool_prefix="i686-android-linux"
fi
;;
esac
dnl set up compilers
TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
AS="$android_toolchain"/bin/"$android_tool_prefix"-as

View File

@ -0,0 +1,93 @@
/* 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/. */
/*jshint bitwise: true, camelcase: false, curly: false, eqeqeq: true, forin: true,
immed: true, indent: 4, latedef: false, newcap: false, noarg: true,
noempty: true, nonew: true, plusplus: false, quotmark: false, regexp: true,
undef: true, unused: false, strict: false, trailing: true,
*/
/*global ToObject: false, ToInteger: false, IsCallable: false, ThrowError: false,
AssertionFailed: false, MakeConstructible: false, DecompileArg: false,
callFunction: false,
IS_UNDEFINED: false, TO_UINT32: false,
JSMSG_NOT_FUNCTION: false, JSMSG_MISSING_FUN_ARG: false,
JSMSG_EMPTY_ARRAY_REDUCE: false,
*/
/* cache built-in functions before applications can change them */
var std_ArrayIndexOf = ArrayIndexOf;
var std_ArrayJoin = Array.prototype.join;
var std_ArrayPush = Array.prototype.push;
var std_ArraySlice = Array.prototype.slice;
var std_ArraySort = Array.prototype.sort;
var std_ObjectCreate = Object.create;
var std_String = String;
/********** List specification type **********/
/* Spec: ECMAScript Language Specification, 5.1 edition, 8.8 */
function List() {
if (IS_UNDEFINED(List.prototype)) {
var proto = std_ObjectCreate(null);
proto.indexOf = std_ArrayIndexOf;
proto.join = std_ArrayJoin;
proto.push = std_ArrayPush;
proto.slice = std_ArraySlice;
proto.sort = std_ArraySort;
List.prototype = proto;
}
}
MakeConstructible(List);
/********** Record specification type **********/
/* Spec: ECMAScript Internationalization API Specification, draft, 5 */
function Record() {
return std_ObjectCreate(null);
}
MakeConstructible(Record);
/********** Abstract operations defined in ECMAScript Language Specification **********/
/* Spec: ECMAScript Language Specification, 5.1 edition, 8.12.6 and 11.8.7 */
function HasProperty(o, p) {
return p in o;
}
/* Spec: ECMAScript Language Specification, 5.1 edition, 9.2 and 11.4.9 */
function ToBoolean(v) {
return !!v;
}
/* Spec: ECMAScript Language Specification, 5.1 edition, 9.3 and 11.4.6 */
function ToNumber(v) {
return +v;
}
/* Spec: ECMAScript Language Specification, 5.1 edition, 9.8 and 15.2.1.1 */
function ToString(v) {
assert(arguments.length > 0, "__toString");
return std_String(v);
}
/********** Assertions **********/
function assert(b, info) {
if (!b)
AssertionFailed(info);
}

View File

@ -1209,10 +1209,13 @@ SequentialCompileContext::compile(IonBuilder *builder, MIRGraph *graph,
// Try to compile the script off thread, if possible. Compilation cannot be
// performed off thread during an incremental GC, as doing so may trip
// incremental read barriers.
// incremental read barriers. Also skip off thread compilation if script
// execution is being profiled, as CodeGenerator::maybeCreateScriptCounts
// will not attach script profiles when running off thread.
if (js_IonOptions.parallelCompilation &&
OffThreadCompilationAvailable(cx) &&
cx->runtime->gcIncrementalState == gc::NO_INCREMENTAL)
cx->runtime->gcIncrementalState == gc::NO_INCREMENTAL &&
!cx->runtime->profilingScripts)
{
builder->script()->ion = ION_COMPILING_SCRIPT;

View File

@ -1388,9 +1388,10 @@ js::ion::SetPropertyCache(JSContext *cx, size_t cacheIndex, HandleObject obj, Ha
if (!SetProperty(cx, obj, name, value, cache.strict(), isSetName))
return false;
// The property did not exists before, now we can try again to inline the
// procedure which is adding the property.
if (inlinable && !addedSetterStub && IsPropertyAddInlineable(cx, obj, id, oldSlots, &shape)) {
// The property did not exist before, now we can try to inline the propery add.
if (inlinable && !addedSetterStub && obj->lastProperty() != oldShape &&
IsPropertyAddInlineable(cx, obj, id, oldSlots, &shape))
{
RootedShape newShape(cx, obj->lastProperty());
cache.incrementStubCount();
if (!cache.attachNativeAdding(cx, ion, obj, oldShape, newShape, shape))

View File

@ -0,0 +1,10 @@
var g = newGlobal('new-compartment');
var dbg = Debugger(g);
function test(code, expected) {
var actual = '';
g.h = function () { actual += dbg.getNewestFrame().environment.type; }
g.eval(code);
}
test("h();", 'object');
gczeal(4);
var count2 = countHeap();

View File

@ -0,0 +1,46 @@
var counterF = 0;
function f(v, value)
{
if (v === null)
counterF++;
assertEq(counterF, value,
"failed: " + v + " " + value);
}
f({}, 0);
f({}, 0);
f(null, 1);
f(null, 2);
f(undefined, 2);
f(undefined, 2);
f(objectEmulatingUndefined(), 2);
f(objectEmulatingUndefined(), 2);
f(Object.prototype, 2);
f(Object.prototype, 2);
var counterG = 0;
function g(v, value)
{
if (v === null)
counterG++;
assertEq(counterG, value,
"failed: " + v + " " + value);
}
g({}, 0);
g({}, 0);
var counterH = 0;
function h(v, value)
{
if (v === null)
counterH++;
assertEq(counterH, value,
"failed: " + v + " " + value);
}
h(objectEmulatingUndefined(), 0);
h(objectEmulatingUndefined(), 0);

View File

@ -0,0 +1,46 @@
var counterF = 0;
function f(v, value)
{
if (v === undefined)
counterF++;
assertEq(counterF, value,
"failed: " + v + " " + value);
}
f({}, 0);
f({}, 0);
f(null, 0);
f(null, 0);
f(undefined, 1);
f(undefined, 2);
f(objectEmulatingUndefined(), 2);
f(objectEmulatingUndefined(), 2);
f(Object.prototype, 2);
f(Object.prototype, 2);
var counterG = 0;
function g(v, value)
{
if (v === undefined)
counterG++;
assertEq(counterG, value,
"failed: " + v + " " + value);
}
g({}, 0);
g({}, 0);
var counterH = 0;
function h(v, value)
{
if (v === undefined)
counterH++;
assertEq(counterH, value,
"failed: " + v + " " + value);
}
h(objectEmulatingUndefined(), 0);
h(objectEmulatingUndefined(), 0);

View File

@ -0,0 +1,46 @@
var counterF = 0;
function f(v, value)
{
if (v !== null)
counterF++;
assertEq(counterF, value,
"failed: " + v + " " + value);
}
f({}, 1);
f({}, 2);
f(null, 2);
f(null, 2);
f(undefined, 3);
f(undefined, 4);
f(objectEmulatingUndefined(), 5);
f(objectEmulatingUndefined(), 6);
f(Object.prototype, 7);
f(Object.prototype, 8);
var counterG = 0;
function g(v, value)
{
if (v !== null)
counterG++;
assertEq(counterG, value,
"failed: " + v + " " + value);
}
g({}, 1);
g({}, 2);
var counterH = 0;
function h(v, value)
{
if (v !== null)
counterH++;
assertEq(counterH, value,
"failed: " + v + " " + value);
}
h(objectEmulatingUndefined(), 1);
h(objectEmulatingUndefined(), 2);

View File

@ -0,0 +1,46 @@
var counterF = 0;
function f(v, value)
{
if (v !== undefined)
counterF++;
assertEq(counterF, value,
"failed: " + v + " " + value);
}
f({}, 1);
f({}, 2);
f(null, 3);
f(null, 4);
f(undefined, 4);
f(undefined, 4);
f(objectEmulatingUndefined(), 5);
f(objectEmulatingUndefined(), 6);
f(Object.prototype, 7);
f(Object.prototype, 8);
var counterG = 0;
function g(v, value)
{
if (v !== undefined)
counterG++;
assertEq(counterG, value,
"failed: " + v + " " + value);
}
g({}, 1);
g({}, 2);
var counterH = 0;
function h(v, value)
{
if (v !== undefined)
counterH++;
assertEq(counterH, value,
"failed: " + v + " " + value);
}
h(objectEmulatingUndefined(), 1);
h(objectEmulatingUndefined(), 2);

View File

@ -0,0 +1,23 @@
function f(v1, v2, value)
{
var b = v1 == v2;
assertEq(b, value,
"failed: " + v1 + ", " + v2 + ": " + value);
}
var obj = {};
var emul = objectEmulatingUndefined();
f(obj, obj, true);
f(obj, obj, true);
f(emul, obj, false);
f(emul, obj, false);
f(obj, emul, false);
f(obj, emul, false);
f(Object.prototype, obj, false);
f(Object.prototype, obj, false);
f(emul, emul, true);
f(objectEmulatingUndefined(), emul, false);
f(objectEmulatingUndefined(), emul, false);
f(emul, objectEmulatingUndefined(), false);
f(emul, objectEmulatingUndefined(), false);

View File

@ -0,0 +1,23 @@
function f(v1, v2, value)
{
var b = v1 != v2;
assertEq(b, value,
"failed: " + v1 + ", " + v2 + ": " + value);
}
var obj = {};
var emul = objectEmulatingUndefined();
f(obj, obj, false);
f(obj, obj, false);
f(emul, obj, true);
f(emul, obj, true);
f(obj, emul, true);
f(obj, emul, true);
f(Object.prototype, obj, true);
f(Object.prototype, obj, true);
f(emul, emul, false);
f(objectEmulatingUndefined(), emul, true);
f(objectEmulatingUndefined(), emul, true);
f(emul, objectEmulatingUndefined(), true);
f(emul, objectEmulatingUndefined(), true);

View File

@ -0,0 +1,37 @@
function f(v, value)
{
var b = v === null;
assertEq(b, value,
"failed: " + v + " " + value);
}
f({}, false);
f({}, false);
f(null, true);
f(null, true);
f(undefined, false);
f(undefined, false);
f(objectEmulatingUndefined(), false);
f(objectEmulatingUndefined(), false);
f(Object.prototype, false);
f(Object.prototype, false);
function g(v, value)
{
var b = v === null;
assertEq(b, value,
"failed: " + v + " " + value);
}
g({}, false);
g({}, false);
function h(v, value)
{
var b = v === null;
assertEq(b, value,
"failed: " + v + " " + value);
}
h(objectEmulatingUndefined(), false);
h(objectEmulatingUndefined(), false);

View File

@ -0,0 +1,37 @@
function f(v, value)
{
var b = v === undefined;
assertEq(b, value,
"failed: " + v + " " + value);
}
f({}, false);
f({}, false);
f(null, false);
f(null, false);
f(undefined, true);
f(undefined, true);
f(objectEmulatingUndefined(), false);
f(objectEmulatingUndefined(), false);
f(Object.prototype, false);
f(Object.prototype, false);
function g(v, value)
{
var b = v === undefined;
assertEq(b, value,
"failed: " + v + " " + value);
}
g({}, false);
g({}, false);
function h(v, value)
{
var b = v === undefined;
assertEq(b, value,
"failed: " + v + " " + value);
}
h(objectEmulatingUndefined(), false);
h(objectEmulatingUndefined(), false);

View File

@ -0,0 +1,37 @@
function f(v, value)
{
var b = v !== null;
assertEq(b, value,
"failed: " + v + " " + value);
}
f({}, true);
f({}, true);
f(null, false);
f(null, false);
f(undefined, true);
f(undefined, true);
f(objectEmulatingUndefined(), true);
f(objectEmulatingUndefined(), true);
f(Object.prototype, true);
f(Object.prototype, true);
function g(v, value)
{
var b = v !== null;
assertEq(b, value,
"failed: " + v + " " + value);
}
g({}, true);
g({}, true);
function h(v, value)
{
var b = v !== null;
assertEq(b, value,
"failed: " + v + " " + value);
}
h(objectEmulatingUndefined(), true);
h(objectEmulatingUndefined(), true);

View File

@ -0,0 +1,37 @@
function f(v, value)
{
var b = v !== undefined;
assertEq(b, value,
"failed: " + v + " " + value);
}
f({}, true);
f({}, true);
f(null, true);
f(null, true);
f(undefined, false);
f(undefined, false);
f(objectEmulatingUndefined(), true);
f(objectEmulatingUndefined(), true);
f(Object.prototype, true);
f(Object.prototype, true);
function g(v, value)
{
var b = v !== undefined;
assertEq(b, value,
"failed: " + v + " " + value);
}
g({}, true);
g({}, true);
function h(v, value)
{
var b = v !== undefined;
assertEq(b, value,
"failed: " + v + " " + value);
}
h(objectEmulatingUndefined(), true);
h(objectEmulatingUndefined(), true);

View File

@ -378,61 +378,37 @@ js::math_log(JSContext *cx, unsigned argc, Value *vp)
JSBool
js_math_max(JSContext *cx, unsigned argc, Value *vp)
{
double x, z = js_NegativeInfinity;
Value *argv;
unsigned i;
CallArgs args = CallArgsFromVp(argc, vp);
if (argc == 0) {
vp->setDouble(js_NegativeInfinity);
return JS_TRUE;
double x;
double maxval = MOZ_DOUBLE_NEGATIVE_INFINITY();
for (unsigned i = 0; i < args.length(); i++) {
if (!ToNumber(cx, args[i], &x))
return false;
// Math.max(num, NaN) => NaN, Math.max(-0, +0) => +0
if (x > maxval || MOZ_DOUBLE_IS_NaN(x) || (x == maxval && MOZ_DOUBLE_IS_NEGATIVE(maxval)))
maxval = x;
}
argv = vp + 2;
for (i = 0; i < argc; i++) {
if (!ToNumber(cx, argv[i], &x))
return JS_FALSE;
if (MOZ_DOUBLE_IS_NaN(x)) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (x == 0 && x == z) {
if (js_copysign(1.0, z) == -1)
z = x;
} else {
z = (x > z) ? x : z;
}
}
vp->setNumber(z);
return JS_TRUE;
args.rval().setNumber(maxval);
return true;
}
JSBool
js_math_min(JSContext *cx, unsigned argc, Value *vp)
{
double x, z = js_PositiveInfinity;
Value *argv;
unsigned i;
CallArgs args = CallArgsFromVp(argc, vp);
if (argc == 0) {
vp->setDouble(js_PositiveInfinity);
return JS_TRUE;
double x;
double minval = MOZ_DOUBLE_POSITIVE_INFINITY();
for (unsigned i = 0; i < args.length(); i++) {
if (!ToNumber(cx, args[i], &x))
return false;
// Math.min(num, NaN) => NaN, Math.min(-0, +0) => -0
if (x < minval || MOZ_DOUBLE_IS_NaN(x) || (x == minval && MOZ_DOUBLE_IS_NEGATIVE_ZERO(x)))
minval = x;
}
argv = vp + 2;
for (i = 0; i < argc; i++) {
if (!ToNumber(cx, argv[i], &x))
return JS_FALSE;
if (MOZ_DOUBLE_IS_NaN(x)) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (x == 0 && x == z) {
if (js_copysign(1.0, x) == -1)
z = x;
} else {
z = (x < z) ? x : z;
}
}
vp->setNumber(z);
return JS_TRUE;
args.rval().setNumber(minval);
return true;
}
// Disable PGO for Math.pow() and related functions (see bug 791214).

View File

@ -103,6 +103,32 @@ intrinsic_ThrowError(JSContext *cx, unsigned argc, Value *vp)
return false;
}
/**
* Handles an assertion failure in self-hosted code just like an assertion
* failure in C++ code. Information about the failure can be provided in args[0].
*/
static JSBool
intrinsic_AssertionFailed(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
#ifdef DEBUG
if (argc > 0) {
// try to dump the informative string
JSString *str = ToString(cx, args[0]);
if (str) {
const jschar *chars = str->getChars(cx);
if (chars) {
fprintf(stderr, "Self-hosted JavaScript assertion info: ");
JSString::dumpChars(chars, str->length());
fputc('\n', stderr);
}
}
}
#endif
JS_ASSERT(false);
return false;
}
/*
* Used to decompile values in the nearest non-builtin stack frame, falling
* back to decompiling in the current frame. Helpful for printing higher-order
@ -144,10 +170,12 @@ JSFunctionSpec intrinsic_functions[] = {
JS_FN("ToInteger", intrinsic_ToInteger, 1,0),
JS_FN("IsCallable", intrinsic_IsCallable, 1,0),
JS_FN("ThrowError", intrinsic_ThrowError, 4,0),
JS_FN("AssertionFailed", intrinsic_AssertionFailed, 1,0),
JS_FN("MakeConstructible", intrinsic_MakeConstructible, 1,0),
JS_FN("DecompileArg", intrinsic_DecompileArg, 2,0),
JS_FS_END
};
bool
JSRuntime::initSelfHosting(JSContext *cx)
{

View File

@ -115,7 +115,7 @@ FrameLayerBuilder::DisplayItemData::UpdateContents(Layer* aLayer, LayerState aSt
return;
}
nsAutoTArray<nsIFrame*, 4> copy = mFrameList;
nsAutoTArray<nsIFrame*, 4> copy(mFrameList);
if (!copy.RemoveElement(aItem->GetUnderlyingFrame())) {
AddFrame(aItem->GetUnderlyingFrame());
}

View File

@ -14,10 +14,10 @@
#include "nsQueryFrame.h"
#include "nsIContent.h"
#include "nsStyleContext.h"
#include "nsTArrayForwardDeclare.h"
class nsBaseContentList;
class nsIFrame;
template <class T, class A> class nsTArray;
/**
* Any source for anonymous content can implement this interface to provide it.

View File

@ -42,7 +42,6 @@ parent:
async NotifyCompositorTransaction();
async CancelDefaultPanZoom();
async DetectScrollableSubframe();
async __delete__();

View File

@ -38,12 +38,6 @@ RenderFrameChild::CancelDefaultPanZoom()
SendCancelDefaultPanZoom();
}
void
RenderFrameChild::DetectScrollableSubframe()
{
SendDetectScrollableSubframe();
}
PLayersChild*
RenderFrameChild::AllocPLayers()
{

View File

@ -20,7 +20,6 @@ public:
virtual ~RenderFrameChild() {}
void CancelDefaultPanZoom();
void DetectScrollableSubframe();
void Destroy();

View File

@ -810,15 +810,6 @@ RenderFrameParent::RecvCancelDefaultPanZoom()
return true;
}
bool
RenderFrameParent::RecvDetectScrollableSubframe()
{
if (mPanZoomController) {
mPanZoomController->DetectScrollableSubframe();
}
return true;
}
PLayersParent*
RenderFrameParent::AllocPLayers()
{

View File

@ -109,7 +109,6 @@ protected:
virtual bool RecvNotifyCompositorTransaction() MOZ_OVERRIDE;
virtual bool RecvCancelDefaultPanZoom() MOZ_OVERRIDE;
virtual bool RecvDetectScrollableSubframe() MOZ_OVERRIDE;
virtual PLayersParent* AllocPLayers() MOZ_OVERRIDE;
virtual bool DeallocPLayers(PLayersParent* aLayers) MOZ_OVERRIDE;

View File

@ -31,7 +31,6 @@ class nsMediaList;
class nsMediaQueryResultCacheKey;
class nsCSSStyleSheet;
class nsPresContext;
template<class E, class A> class nsTArray;
namespace mozilla {
namespace css {

View File

@ -582,6 +582,9 @@
#
'defines' : [
# CPR timers are needed by SIP, but are disabled for now
# to avoid the extra timer thread and stale cleanup code
# 'CPR_TIMERS_ENABLED',
],
'cflags_mozilla': [

View File

@ -9,10 +9,29 @@
#include "CSFLog.h"
#include "base/basictypes.h"
#include "prtypes.h"
#include "prlog.h"
static PRLogModuleInfo *gLogModuleInfo = NULL;
PRLogModuleInfo *GetSignalingLogInfo()
{
if (gLogModuleInfo == NULL)
gLogModuleInfo = PR_NewLogModule("signaling");
return gLogModuleInfo;
}
static PRLogModuleInfo *gWebRTCLogModuleInfo = NULL;
int gWebrtcTraceLoggingOn = 0;
PRLogModuleInfo *GetWebRTCLogInfo()
{
if (gWebRTCLogModuleInfo == NULL)
gWebRTCLogModuleInfo = PR_NewLogModule("webrtc_trace");
return gWebRTCLogModuleInfo;
}
void CSFLogV(CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, va_list args)
{
#ifdef STDOUT_LOGGING
@ -25,8 +44,7 @@ void CSFLogV(CSFLogLevel priority, const char* sourceFile, int sourceLine, const
vsnprintf(message, MAX_MESSAGE_LENGTH, format, args);
if (gLogModuleInfo == NULL)
gLogModuleInfo = PR_NewLogModule("ikran");
GetSignalingLogInfo();
switch(priority)
{

View File

@ -6,6 +6,7 @@
#define CSFLOG_H
#include <stdarg.h>
#include "prlog.h"
typedef enum{
CSF_LOG_CRITICAL =1,
@ -33,6 +34,11 @@ extern "C"
#endif
void CSFLog( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, ...);
void CSFLogV( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, va_list args);
PRLogModuleInfo *GetSignalingLogInfo();
PRLogModuleInfo *GetWebRTCLogInfo();
extern int gWebrtcTraceLoggingOn;
#ifdef __cplusplus
}
#endif

View File

@ -93,6 +93,21 @@ MediaConduitErrorCode WebrtcAudioConduit::Init()
return kMediaConduitSessionNotInited;
}
PRLogModuleInfo *logs = GetWebRTCLogInfo();
if (!gWebrtcTraceLoggingOn && logs && logs->level > 0) {
// no need to a critical section or lock here
gWebrtcTraceLoggingOn = 1;
const char *file = PR_GetEnv("WEBRTC_TRACE_FILE");
if (!file) {
file = "WebRTC.log";
}
CSFLogDebug(logTag, "%s Logging webrtc to %s level %d", __FUNCTION__,
file, logs->level);
mVoiceEngine->SetTraceFilter(logs->level);
mVoiceEngine->SetTraceFile(file);
}
if(!(mPtrVoEBase = VoEBase::GetInterface(mVoiceEngine)))
{
CSFLogError(logTag, "%s Unable to initialize VoEBase", __FUNCTION__);

View File

@ -80,7 +80,6 @@ WebrtcVideoConduit::~WebrtcVideoConduit()
{
mPtrRTP->Release();
}
if(mVideoEngine)
{
webrtc::VideoEngine::Delete(mVideoEngine);
@ -101,11 +100,20 @@ MediaConduitErrorCode WebrtcVideoConduit::Init()
return kMediaConduitSessionNotInited;
}
#if 0
// TRACING
mVideoEngine->SetTraceFilter(webrtc::kTraceAll);
mVideoEngine->SetTraceFile( "Vievideotrace.out" );
#endif
PRLogModuleInfo *logs = GetWebRTCLogInfo();
if (!gWebrtcTraceLoggingOn && logs && logs->level > 0) {
// no need to a critical section or lock here
gWebrtcTraceLoggingOn = 1;
const char *file = PR_GetEnv("WEBRTC_TRACE_FILE");
if (!file) {
file = "WebRTC.log";
}
CSFLogDebug(logTag, "%s Logging webrtc to %s level %d", __FUNCTION__,
file, logs->level);
mVideoEngine->SetTraceFilter(logs->level);
mVideoEngine->SetTraceFile(file);
}
if( !(mPtrViEBase = ViEBase::GetInterface(mVideoEngine)))
{

View File

@ -216,7 +216,7 @@ ccInit ()
/*
* below should move to cprPreInit. keep it here until then
*/
#ifdef _WIN32
#if defined(_WIN32) && defined(CPR_TIMERS_ENABLED)
cprTimerSystemInit();
#endif

View File

@ -37,17 +37,16 @@
/* SIP Message queue waiting thread and the main thread IPC names */
#ifdef __ANDROID__
#define SIP_MSG_IPC_PATH "/data/data/com.cisco.telephony.provider/"
#define SIP_IPC_TEMP_PATH "/data/data/com.cisco.telephony.provider/SIP-%d"
#else
#define SIP_MSG_IPC_PATH "/tmp/"
#define SIP_IPC_TEMP_PATH "/tmp/SIP-%d"
#endif
#define SIP_MSG_SERV_NAME "SIP-Main-%d"
#define SIP_MSG_CLNT_NAME "SIP-MsgQ-%d"
#define SIP_MSG_SERV_NAME "Main"
#define SIP_MSG_CLNT_NAME "MsgQ"
#define SIP_PAUSE_WAIT_IPC_LISTEN_READY_TIME 50 /* 50ms. */
#define SIP_MAX_WAIT_FOR_IPC_LISTEN_READY 1200 /* 50 * 1200 = 1 minutes */
/*---------------------------------------------------------
*
* Local Variables
@ -74,9 +73,6 @@ typedef struct sip_int_msg_t_ {
/* Internal message queue (array) */
static sip_int_msg_t sip_int_msgq_buf[MAX_SIP_MESSAGES] = {{0,0},{0,0}};
/* Main thread and message queue waiting thread IPC names */
static const char *sip_IPC_serv_name = SIP_MSG_IPC_PATH SIP_MSG_SERV_NAME;
static const char *sip_IPC_clnt_name = SIP_MSG_IPC_PATH SIP_MSG_CLNT_NAME;
static cpr_sockaddr_un_t sip_serv_sock_addr;
static cpr_sockaddr_un_t sip_clnt_sock_addr;
@ -163,7 +159,7 @@ static cpr_socket_t sip_create_IPC_sock (const char *name)
cpr_set_sockun_addr(&addr, name, getpid());
/* make sure file doesn't already exist */
unlink( (char *)addr.sun_path);
unlink(addr.sun_path);
/* do the bind */
if (cprBind(sock, (cpr_sockaddr_t *)&addr,
@ -240,20 +236,16 @@ void sip_platform_task_msgqwait (void *arg)
/*
* Adjust relative priority of SIP thread.
*/
#ifndef WIN32
(void) cprAdjustRelativeThreadPriority(SIP_THREAD_RELATIVE_PRIORITY);
#else
/* Use default priority */
(void) cprAdjustRelativeThreadPriority(0);
#endif
/*
* The main thread is ready. set global client socket address
* so that the server can send back response.
*/
cpr_set_sockun_addr(&sip_clnt_sock_addr, sip_IPC_clnt_name, getpid());
cpr_set_sockun_addr(&sip_clnt_sock_addr,
SIP_IPC_TEMP_PATH "/" SIP_MSG_CLNT_NAME, getpid());
sip_ipc_clnt_socket = sip_create_IPC_sock(sip_IPC_clnt_name);
sip_ipc_clnt_socket = sip_create_IPC_sock(sip_clnt_sock_addr.sun_path);
if (sip_ipc_clnt_socket == INVALID_SOCKET) {
CCSIP_DEBUG_ERROR(SIP_F_PREFIX"sip_create_IPC_sock() failed,"
@ -323,6 +315,8 @@ void sip_platform_task_msgqwait (void *arg)
}
}
}
cprCloseSocket(sip_ipc_clnt_socket);
unlink(sip_clnt_sock_addr.sun_path); // removes tmp file
}
/**
@ -370,6 +364,21 @@ static void sip_process_int_msg (void)
msg = int_msg->msg;
syshdr = int_msg->syshdr;
if (msg != NULL && syshdr != NULL) {
if (syshdr->Cmd == THREAD_UNLOAD) {
/*
* Cleanup here, as SIPTaskProcessListEvent wont return.
* - Remove last tmp file and tmp dir.
*/
cprCloseSocket(sip_ipc_serv_socket);
unlink(sip_serv_sock_addr.sun_path);
char stmpdir[sizeof(sip_serv_sock_addr.sun_path)];
PR_snprintf(stmpdir, sizeof(stmpdir), SIP_IPC_TEMP_PATH, getpid());
if (rmdir(stmpdir) != 0) {
CCSIP_DEBUG_ERROR(SIP_F_PREFIX"failed to remove temp dir\n",
fname);
}
}
SIPTaskProcessListEvent(syshdr->Cmd, msg, syshdr->Usr.UsrPtr,
syshdr->Len);
cprReleaseSysHeader(syshdr);
@ -435,23 +444,28 @@ sip_platform_task_loop (void *arg)
/*
* Adjust relative priority of SIP thread.
*/
#ifndef WIN32
(void) cprAdjustRelativeThreadPriority(SIP_THREAD_RELATIVE_PRIORITY);
#else
/* Use default priority */
(void) cprAdjustRelativeThreadPriority(0);
#endif
/*
* Setup IPC socket addresses for main thread (server)
*/
cpr_set_sockun_addr(&sip_serv_sock_addr, sip_IPC_serv_name, getpid());
{
char stmpdir[sizeof(sip_serv_sock_addr.sun_path)];
PR_snprintf(stmpdir, sizeof(stmpdir), SIP_IPC_TEMP_PATH, getpid());
if (mkdir(stmpdir, 0700) != 0) {
CCSIP_DEBUG_ERROR(SIP_F_PREFIX"failed to create temp dir\n", fname);
return;
}
}
cpr_set_sockun_addr(&sip_serv_sock_addr,
SIP_IPC_TEMP_PATH "/" SIP_MSG_SERV_NAME, getpid());
/*
* Create IPC between the message queue thread and this main
* thread.
*/
sip_ipc_serv_socket = sip_create_IPC_sock(sip_IPC_serv_name);
sip_ipc_serv_socket = sip_create_IPC_sock(sip_serv_sock_addr.sun_path);
if (sip_ipc_serv_socket == INVALID_SOCKET) {
CCSIP_DEBUG_ERROR(SIP_F_PREFIX"sip_create_IPC_sock() failed:"
@ -480,6 +494,7 @@ sip_platform_task_loop (void *arg)
/*
* Main Event Loop
* - Forever-loop exits in sip_process_int_msg()::THREAD_UNLOAD
*/
while (TRUE) {
/*

View File

@ -171,14 +171,13 @@ cprPreInit (void)
CPR_ERROR("%s: MsgQueue Mutex init failure %d\n", fname, returnCode);
return CPR_FAILURE;
}
#ifdef CPR_TIMERS_ENABLED
returnCode = cpr_timer_pre_init();
if (returnCode != 0) {
CPR_ERROR("%s: timer pre init failed %d\n", fname, returnCode);
return CPR_FAILURE;
}
#endif
return CPR_SUCCESS;
}

View File

@ -765,7 +765,7 @@ cpr_inet_pton (int af, const char *src, void *dst)
*
* @param[in] addr - socket fd to bind with the IPC address.
* @param[in] name - pointer to the name of socket to bind to.
*
* @param[in] pid - process id (only used if name contains %d)
*
* @pre (name != NULL)
*/
@ -774,7 +774,7 @@ void cpr_set_sockun_addr (cpr_sockaddr_un_t *addr, const char *name, pid_t pid)
/* Bind to the local socket */
memset(addr, 0, sizeof(cpr_sockaddr_un_t));
addr->sun_family = AF_UNIX;
snprintf((char *) addr->sun_path, sizeof(addr->sun_path), "%s_%d", name, pid);
snprintf(addr->sun_path, sizeof(addr->sun_path), name, pid);
}
/* int

View File

@ -52,6 +52,7 @@
*/
#include "cpr.h"
#include "cpr_assert.h"
#include "cpr_socket.h"
#include "cpr_stdlib.h"
#include "cpr_stdio.h"
@ -226,14 +227,10 @@ cprSleep (uint32_t duration)
static cprRC_t addTimerToList (cpr_timer_t *cprTimerPtr, uint32_t duration, void *data)
{
// TODO(ekr@rtfm.com): Put this back in when you figure out why it causes crashes
return CPR_SUCCESS;
#if 0
static const char fname[] = "addTimerToList";
#ifdef CPR_TIMERS_ENABLED
timer_ipc_t tmr_cmd = {0};
timer_ipc_t tmr_rsp={0};
API_ENTER();
CPR_INFO("%s: cprTimerptr=0x%x dur=%d user_data=%p\n",
@ -254,7 +251,7 @@ static cprRC_t addTimerToList (cpr_timer_t *cprTimerPtr, uint32_t duration, void
}
} else {
CPR_ERROR("can not make IPC connection, client_sock is invalid %s\n", fname);
CPR_ERROR("can not make IPC connection, client_sock is invalid %s\n", __FUNCTION__);
API_RETURN(CPR_FAILURE);
}
@ -270,7 +267,11 @@ static cprRC_t addTimerToList (cpr_timer_t *cprTimerPtr, uint32_t duration, void
//CPR_INFO("received response from the timer result=%d\n", tmr_rsp.u.result);
API_RETURN(tmr_rsp.u.result);
}
#else
cprAssert(FALSE, CPR_FAILURE);
CPR_ERROR("CPR Timers are disabled! %s\n", __FUNCTION__);
#endif
return CPR_SUCCESS;
}

View File

@ -175,14 +175,13 @@ cprPreInit (void)
CPR_ERROR("%s: MsgQueue Mutex init failure %d\n", fname, returnCode);
return CPR_FAILURE;
}
#if CPR_TIMERS_ENABLED
returnCode = cpr_timer_pre_init();
if (returnCode != 0) {
CPR_ERROR("%s: timer pre init failed %d\n", fname, returnCode);
return CPR_FAILURE;
}
#endif
return CPR_SUCCESS;
}

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