Merge inbound to m-c. a=merge

This commit is contained in:
Ryan VanderMeulen 2014-06-23 10:42:32 -04:00
commit adb70139cc
570 changed files with 9590 additions and 6766 deletions

View File

@ -1303,7 +1303,7 @@ DocAccessible::GetAccessibleByUniqueIDInSubtree(void* aUniqueID)
Accessible* Accessible*
DocAccessible::GetAccessibleOrContainer(nsINode* aNode) const DocAccessible::GetAccessibleOrContainer(nsINode* aNode) const
{ {
if (!aNode || !aNode->IsInDoc()) if (!aNode || !aNode->GetCrossShadowCurrentDoc())
return nullptr; return nullptr;
nsINode* currNode = aNode; nsINode* currNode = aNode;

View File

@ -75,6 +75,9 @@ this.ContentControl.prototype = {
JSON.stringify(aMessage.json)]; JSON.stringify(aMessage.json)];
}); });
// If we get an explicit message, we should immediately cancel any autoMove
this.cancelAutoMove();
try { try {
let func = this['handle' + aMessage.name.slice(9)]; // 'AccessFu:'.length let func = this['handle' + aMessage.name.slice(9)]; // 'AccessFu:'.length
if (func) { if (func) {
@ -381,8 +384,7 @@ this.ContentControl.prototype = {
* - moveMethod: pivot move method to use, default is 'moveNext', * - moveMethod: pivot move method to use, default is 'moveNext',
*/ */
autoMove: function cc_autoMove(aAnchor, aOptions = {}) { autoMove: function cc_autoMove(aAnchor, aOptions = {}) {
let win = this.window; this.cancelAutoMove();
win.clearTimeout(this._autoMove);
let moveFunc = () => { let moveFunc = () => {
let vc = this.vc; let vc = this.vc;
@ -432,12 +434,17 @@ this.ContentControl.prototype = {
}; };
if (aOptions.delay) { if (aOptions.delay) {
this._autoMove = win.setTimeout(moveFunc, aOptions.delay); this._autoMove = this.window.setTimeout(moveFunc, aOptions.delay);
} else { } else {
moveFunc(); moveFunc();
} }
}, },
cancelAutoMove: function cc_cancelAutoMove() {
this.window.clearTimeout(this._autoMove);
this._autoMove = 0;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
Ci.nsIMessageListener Ci.nsIMessageListener
]) ])

View File

@ -218,6 +218,7 @@ protected:
#undef CreateEvent #undef CreateEvent
#undef GetClassName #undef GetClassName
#undef GetBinaryType #undef GetBinaryType
#undef RemoveDirectory
#endif #endif
#endif #endif

View File

@ -14,7 +14,6 @@
src="../role.js"></script> src="../role.js"></script>
<script type="application/javascript"> <script type="application/javascript">
SpecialPowers.setBoolPref("dom.webcomponents.enabled", true);
function doTest() function doTest()
{ {
testElm("component", { testElm("component", {
@ -29,7 +28,6 @@
] ]
}); });
SpecialPowers.clearUserPref("dom.webcomponents.enabled");
SimpleTest.finish(); SimpleTest.finish();
} }

View File

@ -6,6 +6,7 @@ support-files = zoom_tree.xul
skip-if = (os == "android" || appname == "b2g") skip-if = (os == "android" || appname == "b2g")
[test_general.html] [test_general.html]
[test_menu.xul] [test_menu.xul]
[test_shadowroot.html]
[test_zoom.html] [test_zoom.html]
[test_zoom_text.html] [test_zoom_text.html]
[test_zoom_tree.xul] [test_zoom_tree.xul]

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<title>ShadowRoot hit tests</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../layout.js"></script>
<script type="application/javascript">
function doTest()
{
var componentAcc = getAccessible('component1');
testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild,
componentAcc.firstChild);
componentAcc = getAccessible('component2');
testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild,
componentAcc.firstChild);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Test getChildAtPoint works for shadow DOM content"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1027315">
Mozilla Bug 1027315
</a><br/>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div role="group" class="components" id="component1" style="display: inline-block;">
<!--
<div role="button" id="component-child"
style="width: 100px; height: 100px; background-color: pink;">
</div>
-->
</div>
<div role="group" class="components" id="component2" style="display: inline-block;">
<!--
<button>Hello world</button>
-->
</div>
<script>
// This routine adds the comment children of each 'component' to its
// shadow root.
var components = document.querySelectorAll('.components');
for (var i = 0; i < components.length; i++) {
var component = components[i];
var shadow = component.createShadowRoot();
for (var child = component.firstChild; child; child = child.nextSibling) {
if (child.nodeType === 8)
shadow.innerHTML = child.data;
}
}
</script>
</body>
</html>

View File

@ -218,8 +218,10 @@ pref("app.update.incompatible.mode", 0);
// Whether or not to attempt using the service for updates. // Whether or not to attempt using the service for updates.
#ifdef MOZ_MAINTENANCE_SERVICE #ifdef MOZ_MAINTENANCE_SERVICE
#ifndef HAVE_64BIT_OS
pref("app.update.service.enabled", true); pref("app.update.service.enabled", true);
#endif #endif
#endif
// Symmetric (can be overridden by individual extensions) update preferences. // Symmetric (can be overridden by individual extensions) update preferences.
// e.g. // e.g.

View File

@ -757,13 +757,6 @@ var gBrowserInit = {
var mustLoadSidebar = false; var mustLoadSidebar = false;
if (!gMultiProcessBrowser) {
// There is a Content:Click message manually sent from content.
Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService)
.addSystemEventListener(gBrowser, "click", contentAreaClick, true);
}
gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver, false); gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver, false);
// Note that the XBL binding is untrusted // Note that the XBL binding is untrusted
@ -802,6 +795,15 @@ var gBrowserInit = {
window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow =
new nsBrowserAccess(); new nsBrowserAccess();
if (!gMultiProcessBrowser) {
// There is a Content:Click message manually sent from content.
Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService)
.addSystemEventListener(gBrowser, "click", contentAreaClick, true);
} else {
gBrowser.updateBrowserRemoteness(gBrowser.mCurrentBrowser, true);
}
// hook up UI through progress listener // hook up UI through progress listener
gBrowser.addProgressListener(window.XULBrowserWindow); gBrowser.addProgressListener(window.XULBrowserWindow);
gBrowser.addTabsProgressListener(window.TabsProgressListener); gBrowser.addTabsProgressListener(window.TabsProgressListener);
@ -2623,7 +2625,7 @@ function getWebNavigation()
function BrowserReloadWithFlags(reloadFlags) { function BrowserReloadWithFlags(reloadFlags) {
let url = gBrowser.currentURI.spec; let url = gBrowser.currentURI.spec;
if (gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, url)) { if (gBrowser.updateBrowserRemotenessByURL(gBrowser.selectedBrowser, url)) {
// If the remoteness has changed, the new browser doesn't have any // If the remoteness has changed, the new browser doesn't have any
// information of what was loaded before, so we need to load the previous // information of what was loaded before, so we need to load the previous
// URL again. // URL again.

View File

@ -1374,16 +1374,13 @@
]]></body> ]]></body>
</method> </method>
#ifdef MAKE_E10S_WORK
<method name="updateBrowserRemoteness"> <method name="updateBrowserRemoteness">
<parameter name="aBrowser"/> <parameter name="aBrowser"/>
<parameter name="aURL"/> <parameter name="aShouldBeRemote"/>
<body> <body>
<![CDATA[ <![CDATA[
let shouldBeRemote = this._shouldBrowserBeRemote(aURL);
let isRemote = aBrowser.getAttribute("remote") == "true"; let isRemote = aBrowser.getAttribute("remote") == "true";
if (isRemote == shouldBeRemote) if (isRemote == aShouldBeRemote)
return false; return false;
let wasActive = document.activeElement == aBrowser; let wasActive = document.activeElement == aBrowser;
@ -1397,13 +1394,13 @@
// Change the "remote" attribute. // Change the "remote" attribute.
let parent = aBrowser.parentNode; let parent = aBrowser.parentNode;
parent.removeChild(aBrowser); parent.removeChild(aBrowser);
aBrowser.setAttribute("remote", shouldBeRemote ? "true" : "false"); aBrowser.setAttribute("remote", aShouldBeRemote ? "true" : "false");
parent.appendChild(aBrowser); parent.appendChild(aBrowser);
// Restore the progress listener. // Restore the progress listener.
aBrowser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL); aBrowser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
if (shouldBeRemote) if (aShouldBeRemote)
tab.setAttribute("remote", "true"); tab.setAttribute("remote", "true");
else else
tab.removeAttribute("remote"); tab.removeAttribute("remote");
@ -1416,6 +1413,18 @@
</body> </body>
</method> </method>
#ifdef MAKE_E10S_WORK
<method name="updateBrowserRemotenessByURL">
<parameter name="aBrowser"/>
<parameter name="aURL"/>
<body>
<![CDATA[
let shouldBeRemote = this._shouldBrowserBeRemote(aURL);
return this.updateBrowserRemoteness(aBrowser, shouldBeRemote);
]]>
</body>
</method>
<!-- <!--
Returns true if we want to load the content for this URL in a Returns true if we want to load the content for this URL in a
remote process. Eventually this should just check whether aURL remote process. Eventually this should just check whether aURL
@ -2726,14 +2735,14 @@
<body> <body>
<![CDATA[ <![CDATA[
#ifdef MAKE_E10S_WORK #ifdef MAKE_E10S_WORK
this.updateBrowserRemoteness(this.mCurrentBrowser, aURI); this.updateBrowserRemotenessByURL(this.mCurrentBrowser, aURI);
try { try {
#endif #endif
return this.mCurrentBrowser.loadURI(aURI, aReferrerURI, aCharset); return this.mCurrentBrowser.loadURI(aURI, aReferrerURI, aCharset);
#ifdef MAKE_E10S_WORK #ifdef MAKE_E10S_WORK
} catch (e) { } catch (e) {
let url = this.mCurrentBrowser.currentURI.spec; let url = this.mCurrentBrowser.currentURI.spec;
this.updateBrowserRemoteness(this.mCurrentBrowser, url); this.updateBrowserRemotenessByURL(this.mCurrentBrowser, url);
throw e; throw e;
} }
#endif #endif
@ -2751,14 +2760,14 @@
<body> <body>
<![CDATA[ <![CDATA[
#ifdef MAKE_E10S_WORK #ifdef MAKE_E10S_WORK
this.updateBrowserRemoteness(this.mCurrentBrowser, aURI); this.updateBrowserRemotenessByURL(this.mCurrentBrowser, aURI);
try { try {
#endif #endif
return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData); return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
#ifdef MAKE_E10S_WORK #ifdef MAKE_E10S_WORK
} catch (e) { } catch (e) {
let url = this.mCurrentBrowser.currentURI.spec; let url = this.mCurrentBrowser.currentURI.spec;
this.updateBrowserRemoteness(this.mCurrentBrowser, url); this.updateBrowserRemotenessByURL(this.mCurrentBrowser, url);
throw e; throw e;
} }
#endif #endif
@ -3281,7 +3290,7 @@
let uri = browser.currentURI; let uri = browser.currentURI;
let icon = browser.mIconURL; let icon = browser.mIconURL;
this.updateBrowserRemoteness(browser, "about:tabcrashed"); this.updateBrowserRemotenessByURL(browser, "about:tabcrashed");
browser.setAttribute("crashedPageTitle", title); browser.setAttribute("crashedPageTitle", title);
browser.docShell.displayLoadError(Cr.NS_ERROR_CONTENT_CRASHED, uri, null); browser.docShell.displayLoadError(Cr.NS_ERROR_CONTENT_CRASHED, uri, null);

View File

@ -5,7 +5,8 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Conversation</title> <!-- Title is set in conversation.js -->
<title></title>
<link rel="stylesheet" type="text/css" href="loop/shared/css/common.css"> <link rel="stylesheet" type="text/css" href="loop/shared/css/common.css">
<link rel="stylesheet" type="text/css" href="loop/shared/css/conversation.css"> <link rel="stylesheet" type="text/css" href="loop/shared/css/conversation.css">
</head> </head>

View File

@ -8,9 +8,7 @@ var loop = loop || {};
loop.conversation = (function(OT, mozL10n) { loop.conversation = (function(OT, mozL10n) {
"use strict"; "use strict";
var sharedViews = loop.shared.views, var sharedViews = loop.shared.views;
// aliasing translation function as __ for concision
__ = mozL10n.get;
/** /**
* App router. * App router.
@ -174,6 +172,8 @@ loop.conversation = (function(OT, mozL10n) {
// else to ensure the L10n environment is setup correctly. // else to ensure the L10n environment is setup correctly.
mozL10n.initialize(window.navigator.mozLoop); mozL10n.initialize(window.navigator.mozLoop);
document.title = mozL10n.get("incoming_call_title");
router = new ConversationRouter({ router = new ConversationRouter({
conversation: new loop.shared.models.ConversationModel({}, {sdk: OT}), conversation: new loop.shared.models.ConversationModel({}, {sdk: OT}),
notifier: new sharedViews.NotificationListView({el: "#messages"}) notifier: new sharedViews.NotificationListView({el: "#messages"})

View File

@ -35,6 +35,57 @@ describe("loop.conversation", function() {
sandbox.restore(); sandbox.restore();
}); });
describe("#init", function() {
var conversation, oldTitle;
beforeEach(function() {
oldTitle = document.title;
sandbox.stub(document.mozL10n, "initialize");
sandbox.stub(document.mozL10n, "get").returns("Fake title");
sandbox.stub(loop.conversation.ConversationRouter.prototype,
"initialize");
sandbox.stub(loop.shared.models.ConversationModel.prototype,
"initialize");
sandbox.stub(loop.shared.views.NotificationListView.prototype,
"initialize");
sandbox.stub(Backbone.history, "start");
});
afterEach(function() {
document.title = oldTitle;
});
it("should initalize L10n", function() {
loop.conversation.init();
sinon.assert.calledOnce(document.mozL10n.initialize);
sinon.assert.calledWithExactly(document.mozL10n.initialize,
window.navigator.mozLoop);
});
it("should set the document title", function() {
loop.conversation.init();
expect(document.title).to.be.equal("Fake title");
});
it("should create the router", function() {
loop.conversation.init();
sinon.assert.calledOnce(
loop.conversation.ConversationRouter.prototype.initialize);
});
it("should start Backbone history", function() {
loop.conversation.init();
sinon.assert.calledOnce(Backbone.history.start);
});
});
describe("ConversationRouter", function() { describe("ConversationRouter", function() {
var conversation; var conversation;

View File

@ -2534,7 +2534,7 @@ let SessionStoreInternal = {
// attribute so that it runs in a content process. // attribute so that it runs in a content process.
let activePageData = tabData.entries[activeIndex] || null; let activePageData = tabData.entries[activeIndex] || null;
let uri = activePageData ? activePageData.url || null : null; let uri = activePageData ? activePageData.url || null : null;
tabbrowser.updateBrowserRemoteness(browser, uri); tabbrowser.updateBrowserRemotenessByURL(browser, uri);
// Start a new epoch and include the epoch in the restoreHistory // Start a new epoch and include the epoch in the restoreHistory
// message. If a message is received that relates to a previous epoch, we // message. If a message is received that relates to a previous epoch, we

View File

@ -4,6 +4,9 @@ ac_add_options --enable-signmar
ac_add_options --disable-unified-compilation ac_add_options --disable-unified-compilation
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_L10N_CHECK=0
. $topsrcdir/build/unix/mozconfig.linux32 . $topsrcdir/build/unix/mozconfig.linux32
# Needed to enable breakpad in application.ini # Needed to enable breakpad in application.ini

View File

@ -2,6 +2,9 @@ ac_add_options --enable-debug
ac_add_options --enable-dmd ac_add_options --enable-dmd
ac_add_options --enable-signmar ac_add_options --enable-signmar
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_L10N_CHECK=0
. $topsrcdir/build/unix/mozconfig.linux . $topsrcdir/build/unix/mozconfig.linux
# Needed to enable breakpad in application.ini # Needed to enable breakpad in application.ini

View File

@ -1,3 +1,10 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_CHECK=0
. "$topsrcdir/build/mozconfig.common" . "$topsrcdir/build/mozconfig.common"
ac_add_options --enable-debug ac_add_options --enable-debug

View File

@ -1,3 +1,8 @@
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/linux64/nightly" . "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
ac_add_options --disable-unified-compilation ac_add_options --disable-unified-compilation

View File

@ -9,9 +9,9 @@ MOZ_UPDATER=1
MOZ_PHOENIX=1 MOZ_PHOENIX=1
if test "$OS_ARCH" = "WINNT"; then if test "$OS_ARCH" = "WINNT"; then
MOZ_MAINTENANCE_SERVICE=1
if ! test "$HAVE_64BIT_OS"; then if ! test "$HAVE_64BIT_OS"; then
MOZ_VERIFY_MAR_SIGNATURE=1 MOZ_VERIFY_MAR_SIGNATURE=1
MOZ_MAINTENANCE_SERVICE=1
if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \ if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
"$MOZ_UPDATE_CHANNEL" = "aurora" -o \ "$MOZ_UPDATE_CHANNEL" = "aurora" -o \
"$MOZ_UPDATE_CHANNEL" = "beta" -o \ "$MOZ_UPDATE_CHANNEL" = "beta" -o \

View File

@ -1566,7 +1566,7 @@ Experiments.ExperimentEntry.prototype = {
wantComponents: false, wantComponents: false,
}; };
let sandbox = Cu.Sandbox(nullprincipal); let sandbox = Cu.Sandbox(nullprincipal, options);
try { try {
Cu.evalInSandbox(jsfilter, sandbox); Cu.evalInSandbox(jsfilter, sandbox);
} catch (e) { } catch (e) {

View File

@ -75,14 +75,11 @@ SetOverwrite on
!define MaintUninstallKey \ !define MaintUninstallKey \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService" "Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService"
; The HAVE_64BIT_OS define also means that we have an x64 build, ; Always install into the 32-bit location even if we have a 64-bit build.
; not just an x64 OS. ; This is because we use only 1 service for all Firefox channels.
!ifdef HAVE_64BIT_OS ; Allow either x86 and x64 builds to exist at this location, depending on
; See below, we actually abort the install for x64 builds currently. ; what is the latest build.
InstallDir "$PROGRAMFILES64\${MaintFullName}\"
!else
InstallDir "$PROGRAMFILES32\${MaintFullName}\" InstallDir "$PROGRAMFILES32\${MaintFullName}\"
!endif
ShowUnInstDetails nevershow ShowUnInstDetails nevershow
################################################################################ ################################################################################
@ -121,13 +118,6 @@ Function .onInit
SetSilent silent SetSilent silent
!ifdef HAVE_64BIT_OS
; We plan to eventually enable 64bit native builds to use the maintenance
; service, but for the initial release, to reduce testing and development,
; 64-bit builds will not install the maintenanceservice.
Abort
!endif
; On Windows 2000 we do not install the maintenance service. ; On Windows 2000 we do not install the maintenance service.
; We won't run this installer from the parent installer, but just in case ; We won't run this installer from the parent installer, but just in case
; someone tries to execute it on Windows 2000... ; someone tries to execute it on Windows 2000...
@ -205,8 +195,7 @@ Section "MaintenanceService"
"$INSTDIR\Uninstall.exe,0" "$INSTDIR\Uninstall.exe,0"
WriteRegStr HKLM "${MaintUninstallKey}" "DisplayVersion" "${AppVersion}" WriteRegStr HKLM "${MaintUninstallKey}" "DisplayVersion" "${AppVersion}"
WriteRegStr HKLM "${MaintUninstallKey}" "Publisher" "Mozilla" WriteRegStr HKLM "${MaintUninstallKey}" "Publisher" "Mozilla"
WriteRegStr HKLM "${MaintUninstallKey}" "Comments" \ WriteRegStr HKLM "${MaintUninstallKey}" "Comments" "${BrandFullName}"
"${BrandFullName} ${AppVersion} (${ARCH} ${AB_CD})"
WriteRegDWORD HKLM "${MaintUninstallKey}" "NoModify" 1 WriteRegDWORD HKLM "${MaintUninstallKey}" "NoModify" 1
${GetSize} "$INSTDIR" "/S=0K" $R2 $R3 $R4 ${GetSize} "$INSTDIR" "/S=0K" $R2 $R3 $R4
WriteRegDWORD HKLM "${MaintUninstallKey}" "EstimatedSize" $R2 WriteRegDWORD HKLM "${MaintUninstallKey}" "EstimatedSize" $R2

View File

@ -1,16 +1,30 @@
# 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/.
# Panel Strings
get_link_to_share=Get a link and invite someone to talk get_link_to_share=Get a link and invite someone to talk
share_link_url=Share the link below with your friend to start your call!
do_not_disturb=Do not disturb
get_a_call_url=Get a call url get_a_call_url=Get a call url
new_url=New url new_url=New url
unable_retrieve_url=Sorry, we were unable to retrieve a call url.
share_link_url=Share the link below with your friend to start your call!
caller.placeholder=Identify this call caller.placeholder=Identify this call
cannot_start_call_session_not_ready=Can't start call, session is not ready.
network_disconnected=The network connection terminated abruptly. unable_retrieve_url=Sorry, we were unable to retrieve a call url.
peer_ended_conversation=Your peer ended the conversation.
stop=Stop # Conversation Window Strings
call_has_ended=Your call has ended.
close_window=Close this window incoming_call_title=Incoming Call…
do_not_disturb=Do not disturb
incoming_call=Incoming call incoming_call=Incoming call
accept_button=Accept accept_button=Accept
decline_button=Decline decline_button=Decline
stop=Stop
peer_ended_conversation=Your peer ended the conversation.
call_has_ended=Your call has ended.
close_window=Close this window
cannot_start_call_session_not_ready=Can't start call, session is not ready.
network_disconnected=The network connection terminated abruptly.

View File

@ -79,7 +79,7 @@ this.TabCrashReporter = {
continue; continue;
let url = browser.currentURI.spec; let url = browser.currentURI.spec;
window.gBrowser.updateBrowserRemoteness(browser, url); window.gBrowser.updateBrowserRemotenessByURL(browser, url);
browser.loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); browser.loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
} }
} }

View File

@ -85,6 +85,7 @@ function initApp() {
blocklistFile.remove(false); blocklistFile.remove(false);
var source = do_get_file("blocklist.xml"); var source = do_get_file("blocklist.xml");
source.copyTo(gProfD, "blocklist.xml"); source.copyTo(gProfD, "blocklist.xml");
blocklistFile.lastModifiedTime = Date.now();
let internalManager = Cc["@mozilla.org/addons/integration;1"]. let internalManager = Cc["@mozilla.org/addons/integration;1"].

View File

@ -18,7 +18,6 @@ dnl MOZ_ARG_WITH_BOOL( NAME, HELP, IF-YES [, IF-NO [, ELSE])
dnl MOZ_ARG_WITHOUT_BOOL( NAME, HELP, IF-NO [, IF-YES [, ELSE]) dnl MOZ_ARG_WITHOUT_BOOL( NAME, HELP, IF-NO [, IF-YES [, ELSE])
dnl MOZ_ARG_WITH_STRING( NAME, HELP, IF-SET [, ELSE]) dnl MOZ_ARG_WITH_STRING( NAME, HELP, IF-SET [, ELSE])
dnl MOZ_ARG_HEADER(Comment) dnl MOZ_ARG_HEADER(Comment)
dnl MOZ_CHECK_PTHREADS( NAME, IF-YES [, ELSE ])
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
@ -80,39 +79,6 @@ dnl MOZ_ARG_HEADER(Comment)
dnl This is used by webconfig to group options dnl This is used by webconfig to group options
define(MOZ_ARG_HEADER, [# $1]) define(MOZ_ARG_HEADER, [# $1])
dnl
dnl Apparently, some systems cannot properly check for the pthread
dnl library unless <pthread.h> is included so we need to test
dnl using it
dnl
dnl MOZ_CHECK_PTHREADS(lib, success, failure)
AC_DEFUN([MOZ_CHECK_PTHREADS],
[
AC_MSG_CHECKING([for pthread_create in -l$1])
echo "
#include <pthread.h>
#include <stdlib.h>
void *foo(void *v) { int a = 1; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
exit(0);
}" > dummy.c ;
echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5;
${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5;
_res=$? ;
rm -f dummy.c dummy${ac_exeext} ;
if test "$_res" = "0"; then
AC_MSG_RESULT([yes])
[$2]
else
AC_MSG_RESULT([no])
[$3]
fi
])
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
AC_DEFUN([MOZ_READ_MOZCONFIG], AC_DEFUN([MOZ_READ_MOZCONFIG],
[AC_REQUIRE([AC_INIT_BINSH])dnl [AC_REQUIRE([AC_INIT_BINSH])dnl

View File

@ -474,7 +474,7 @@ class Automation(object):
os.unlink(pwfilePath) os.unlink(pwfilePath)
return 0 return 0
def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, dmdPath=None): def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, dmdPath=None, lsanPath=None):
if xrePath == None: if xrePath == None:
xrePath = self.DIST_BIN xrePath = self.DIST_BIN
if env == None: if env == None:

View File

@ -448,7 +448,7 @@ def systemMemory():
""" """
return int(os.popen("free").readlines()[1].split()[1]) return int(os.popen("free").readlines()[1].split()[1])
def environment(xrePath, env=None, crashreporter=True, debugger=False, dmdPath=None): def environment(xrePath, env=None, crashreporter=True, debugger=False, dmdPath=None, lsanPath=None):
"""populate OS environment variables for mochitest""" """populate OS environment variables for mochitest"""
env = os.environ.copy() if env is None else env env = os.environ.copy() if env is None else env
@ -521,11 +521,30 @@ def environment(xrePath, env=None, crashreporter=True, debugger=False, dmdPath=N
# the amount of resources required to do the tests. Standard options # the amount of resources required to do the tests. Standard options
# will otherwise lead to OOM conditions on the current test slaves. # will otherwise lead to OOM conditions on the current test slaves.
message = "INFO | runtests.py | ASan running in %s configuration" message = "INFO | runtests.py | ASan running in %s configuration"
asanOptions = []
if totalMemory <= 1024 * 1024 * 4: if totalMemory <= 1024 * 1024 * 4:
message = message % 'low-memory' message = message % 'low-memory'
env["ASAN_OPTIONS"] = "quarantine_size=50331648:malloc_context_size=5" asanOptions = ['quarantine_size=50331648', 'malloc_context_size=5']
else: else:
message = message % 'default memory' message = message % 'default memory'
if lsanPath:
log.info("LSan enabled.")
asanOptions.append('detect_leaks=1')
lsanOptions = ["exitcode=0"]
suppressionsFile = os.path.join(lsanPath, 'lsan_suppressions.txt')
if os.path.exists(suppressionsFile):
log.info("LSan using suppression file " + suppressionsFile)
lsanOptions.append("suppressions=" + suppressionsFile)
else:
log.info("WARNING | runtests.py | LSan suppressions file does not exist! " + suppressionsFile)
env["LSAN_OPTIONS"] = ':'.join(lsanOptions)
# Run shutdown GCs and CCs to avoid spurious leaks.
env['MOZ_CC_RUN_DURING_SHUTDOWN'] = '1'
if len(asanOptions):
env['ASAN_OPTIONS'] = ':'.join(asanOptions)
except OSError,err: except OSError,err:
log.info("Failed determine available memory, disabling ASan low-memory configuration: %s", err.strerror) log.info("Failed determine available memory, disabling ASan low-memory configuration: %s", err.strerror)
except: except:
@ -678,3 +697,98 @@ class ShutdownLeaks(object):
counted.add(url) counted.add(url)
return sorted(counts, key=itemgetter(1), reverse=True) return sorted(counts, key=itemgetter(1), reverse=True)
class LSANLeaks(object):
"""
Parses the log when running an LSAN build, looking for interesting stack frames
in allocation stacks, and prints out reports.
"""
def __init__(self, logger):
self.logger = logger
self.inReport = False
self.foundFrames = set([])
self.recordMoreFrames = None
self.currStack = None
self.maxNumRecordedFrames = 4
# Don't various allocation-related stack frames, as they do not help much to
# distinguish different leaks.
unescapedSkipList = [
"malloc", "js_malloc", "malloc_", "__interceptor_malloc", "moz_malloc", "moz_xmalloc",
"calloc", "js_calloc", "calloc_", "__interceptor_calloc", "moz_calloc", "moz_xcalloc",
"realloc","js_realloc", "realloc_", "__interceptor_realloc", "moz_realloc", "moz_xrealloc",
"new",
"js::MallocProvider",
]
self.skipListRegExp = re.compile("^" + "|".join([re.escape(f) for f in unescapedSkipList]) + "$")
self.startRegExp = re.compile("==\d+==ERROR: LeakSanitizer: detected memory leaks")
self.stackFrameRegExp = re.compile(" #\d+ 0x[0-9a-f]+ in ([^(</]+)")
self.sysLibStackFrameRegExp = re.compile(" #\d+ 0x[0-9a-f]+ \(([^+]+)\+0x[0-9a-f]+\)")
def log(self, line):
if re.match(self.startRegExp, line):
self.inReport = True
return
if not self.inReport:
return
if line.startswith("Direct leak"):
self._finishStack()
self.recordMoreFrames = True
self.currStack = []
return
if line.startswith("Indirect leak"):
self._finishStack()
# Only report direct leaks, in the hope that they are less flaky.
self.recordMoreFrames = False
return
if line.startswith("SUMMARY: AddressSanitizer"):
self._finishStack()
self.inReport = False
return
if not self.recordMoreFrames:
return
stackFrame = re.match(self.stackFrameRegExp, line)
if stackFrame:
# Split the frame to remove any return types.
frame = stackFrame.group(1).split()[-1]
if not re.match(self.skipListRegExp, frame):
self._recordFrame(frame)
return
sysLibStackFrame = re.match(self.sysLibStackFrameRegExp, line)
if sysLibStackFrame:
# System library stack frames will never match the skip list,
# so don't bother checking if they do.
self._recordFrame(sysLibStackFrame.group(1))
# If we don't match either of these, just ignore the frame.
# We'll end up with "unknown stack" if everything is ignored.
def process(self):
for f in self.foundFrames:
self.logger("TEST-UNEXPECTED-FAIL | LeakSanitizer | leak at " + f)
def _finishStack(self):
if self.recordMoreFrames and len(self.currStack) == 0:
self.currStack = ["unknown stack"]
if self.currStack:
self.foundFrames.add(", ".join(self.currStack))
self.currStack = None
self.recordMoreFrames = False
self.numRecordedFrames = 0
def _recordFrame(self, frame):
self.currStack.append(frame)
self.numRecordedFrames += 1
if self.numRecordedFrames >= self.maxNumRecordedFrames:
self.recordMoreFrames = False

View File

@ -4,7 +4,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys, os, sha, json, re import sys
import os
import sha
import json
import re
import errno
from argparse import ArgumentParser from argparse import ArgumentParser
def getFileHashAndSize(filename): def getFileHashAndSize(filename):
@ -51,6 +56,7 @@ def getUrlProperties(filename):
url_re = re.compile(r'''^(https?://.*?\.(?:tar\.bz2|dmg|zip|apk|rpm|mar|tar\.gz))$''') url_re = re.compile(r'''^(https?://.*?\.(?:tar\.bz2|dmg|zip|apk|rpm|mar|tar\.gz))$''')
properties = {} properties = {}
try:
with open(filename) as f: with open(filename) as f:
for line in f: for line in f:
m = url_re.match(line) m = url_re.match(line)
@ -60,6 +66,10 @@ def getUrlProperties(filename):
if condition(m): if condition(m):
properties.update({prop: m}) properties.update({prop: m})
break break
except IOError as e:
if e.errno != errno.ENOENT:
raise
properties = {prop: 'UNKNOWN' for prop, condition in property_conditions}
return properties return properties
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -48,7 +48,7 @@ class RemoteAutomation(Automation):
self._remoteLog = logfile self._remoteLog = logfile
# Set up what we need for the remote environment # Set up what we need for the remote environment
def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, dmdPath=None): def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, dmdPath=None, lsanPath=None):
# Because we are running remote, we don't want to mimic the local env # Because we are running remote, we don't want to mimic the local env
# so no copying of os.environ # so no copying of os.environ
if env is None: if env is None:

View File

@ -17,43 +17,35 @@ include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
# the uploaded files. # the uploaded files.
AUTOMATION_UPLOAD_OUTPUT = $(DIST)/automation-upload.txt AUTOMATION_UPLOAD_OUTPUT = $(DIST)/automation-upload.txt
# Helper variables to convert from MOZ_AUTOMATION_* variables to the
# corresponding the make target
tier_BUILD_SYMBOLS = buildsymbols
tier_CHECK = check
tier_L10N_CHECK = l10n-check
tier_PACKAGE = package
tier_PACKAGE_TESTS = package-tests
tier_UPDATE_PACKAGING = update-packaging
tier_UPLOAD_SYMBOLS = uploadsymbols
tier_UPLOAD = upload
# Automation build steps. Everything in MOZ_AUTOMATION_TIERS also gets used in # Automation build steps. Everything in MOZ_AUTOMATION_TIERS also gets used in
# TIERS for mach display. As such, the MOZ_AUTOMATION_TIERS are roughly sorted # TIERS for mach display. As such, the MOZ_AUTOMATION_TIERS are roughly sorted
# here in the order that they will be executed (since mach doesn't know of the # here in the order that they will be executed (since mach doesn't know of the
# dependencies between them). # dependencies between them).
moz_automation_symbols = PACKAGE_TESTS BUILD_SYMBOLS UPLOAD_SYMBOLS PACKAGE UPDATE_PACKAGING CHECK L10N_CHECK UPLOAD
MOZ_AUTOMATION_TIERS += package-tests MOZ_AUTOMATION_TIERS := $(foreach sym,$(moz_automation_symbols),$(if $(filter 1,$(MOZ_AUTOMATION_$(sym))),$(tier_$(sym))))
MOZ_AUTOMATION_TIERS += buildsymbols
ifdef NIGHTLY_BUILD
MOZ_AUTOMATION_TIERS += uploadsymbols
endif
ifdef MOZ_UPDATE_PACKAGING
MOZ_AUTOMATION_TIERS += update-packaging
automation/upload: automation/update-packaging
automation/update-packaging: automation/package
endif
MOZ_AUTOMATION_TIERS += package
MOZ_AUTOMATION_TIERS += check
ifndef MOZ_ASAN
MOZ_AUTOMATION_TIERS += l10n-check
automation/l10n-check: automation/package
endif
MOZ_AUTOMATION_TIERS += upload
automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
$(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) --upload-output $(AUTOMATION_UPLOAD_OUTPUT)
# Dependencies between automation build steps # Dependencies between automation build steps
automation/uploadsymbols: automation/buildsymbols automation/uploadsymbols: automation/buildsymbols
automation/update-packaging: automation/package
automation/l10n-check: automation/package
automation/upload: automation/package automation/upload: automation/package
automation/upload: automation/package-tests automation/upload: automation/package-tests
automation/upload: automation/buildsymbols automation/upload: automation/buildsymbols
automation/upload: automation/update-packaging
# automation/package and automation/check should depend on build (which is # automation/package and automation/check should depend on build (which is
# implicit due to the way client.mk invokes automation/build), but buildsymbols # implicit due to the way client.mk invokes automation/build), but buildsymbols
@ -61,6 +53,9 @@ automation/upload: automation/buildsymbols
automation/package: automation/buildsymbols automation/package: automation/buildsymbols
automation/check: automation/buildsymbols automation/check: automation/buildsymbols
automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
$(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) --upload-output $(AUTOMATION_UPLOAD_OUTPUT)
# make check runs with the keep-going flag so we can see all the failures # make check runs with the keep-going flag so we can see all the failures
AUTOMATION_EXTRA_CMDLINE-check = -k AUTOMATION_EXTRA_CMDLINE-check = -k
@ -68,7 +63,16 @@ AUTOMATION_EXTRA_CMDLINE-check = -k
# properties. # properties.
AUTOMATION_EXTRA_CMDLINE-upload = 2>&1 | tee $(AUTOMATION_UPLOAD_OUTPUT) AUTOMATION_EXTRA_CMDLINE-upload = 2>&1 | tee $(AUTOMATION_UPLOAD_OUTPUT)
# The commands only run if the corresponding MOZ_AUTOMATION_* variable is
# enabled. This means, for example, if we enable MOZ_AUTOMATION_UPLOAD, then
# 'buildsymbols' will only run if MOZ_AUTOMATION_BUILD_SYMBOLS is also set.
# However, the target automation/buildsymbols will still be executed in this
# case because it is a prerequisite of automation/upload.
define automation_commands
$(call BUILDSTATUS,TIER_START $1)
@$(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1)
$(call BUILDSTATUS,TIER_FINISH $1)
endef
automation/%: automation/%:
$(call BUILDSTATUS,TIER_START $*) $(if $(filter $*,$(MOZ_AUTOMATION_TIERS)),$(call automation_commands,$*))
@$(MAKE) $* $(AUTOMATION_EXTRA_CMDLINE-$*)
$(call BUILDSTATUS,TIER_FINISH $*)

View File

@ -0,0 +1,21 @@
# 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/.
# Common mozconfig for automation builds.
#
# We export MOZ_AUTOMATION_* variables here to trigger various steps in
# automation builds. For example, if MOZ_AUTOMATION_PACKAGE is set, then the
# package step will run. This file contains the default settings, which can be
# overridden by setting them earlier in the appropriate mozconfig.
mk_add_options "export MOZ_AUTOMATION_BUILD_SYMBOLS=${MOZ_AUTOMATION_BUILD_SYMBOLS-1}"
mk_add_options "export MOZ_AUTOMATION_CHECK=${MOZ_AUTOMATION_CHECK-1}"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
mk_add_options "export MOZ_AUTOMATION_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
mk_add_options "export MOZ_AUTOMATION_TALOS_SENDCHANGE=${MOZ_AUTOMATION_TALOS_SENDCHANGE-1}"
mk_add_options "export MOZ_AUTOMATION_UNITTEST_SENDCHANGE=${MOZ_AUTOMATION_UNITTEST_SENDCHANGE-1}"
mk_add_options "export MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-0}"
mk_add_options "export MOZ_AUTOMATION_UPLOAD=${MOZ_AUTOMATION_UPLOAD-1}"
mk_add_options "export MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-0}"

View File

@ -15,3 +15,5 @@ mk_add_options AUTOCLOBBER=1
ac_add_options --enable-crashreporter ac_add_options --enable-crashreporter
ac_add_options --enable-release ac_add_options --enable-release
. "$topsrcdir/build/mozconfig.automation"

View File

@ -0,0 +1,108 @@
### !!! Please do not add suppressions for new leaks in Gecko code, unless they are intentional !!!
###
### Some of these leak in every test run.
###
# LSan runs with a shallow stack depth and no debug symbols, so some small intentional
# leaks in system libraries show up with this. You do not want this enabled
# when running locally with a deep stack, as it can catch too much.
leak:libc.so
# nsComponentManagerImpl intentionally leaks factory entries, and probably some other stuff.
leak:nsComponentManagerImpl
# These two variants are needed when fast unwind is disabled and stack depth is limited.
leak:mozJSComponentLoader::LoadModule
leak:nsNativeModuleLoader::LoadModule
# Bug 980109 - Freeing this properly on shutdown is hard.
leak:profiler_init
# Bug 981220 - Pixman fails to free TLS memory.
leak:pixman_implementation_lookup_composite
# Bug 987918 - Font shutdown leaks when CLEANUP_MEMORY is not enabled.
leak:libfontconfig.so
leak:GI___strdup
# The symbol is really __GI___strdup, but if you have the leading _, it doesn't suppress it.
###
### Many leaks only affect some test suites. The suite annotations are not checked.
###
# Bug 800200 - JSD1 is leaking, but it is about to be removed, so ignore it. m4
leak:jsd_CreateLock
leak:jsdScript::GetExecutableLines
leak:jsdService::ActivateDebugger
# Bug 979928 - WebRTC is leaky. m2, m3
leak:/media/mtransport/
leak:/media/webrtc/signaling/
# Bug 981195 - Small leak in the parser. m4
leak:TypeCompartment::fixObjectType
# Bug 982111 - WebM is leaking. m1
leak:nestegg_read_packet
# Bug 987385 - Various plugin leaks. m3
leak:mozilla::plugins::PPluginInstanceParent::CallNPP_HandleEvent
leak:mozilla::plugins::PPluginModuleParent::OnCallReceived
# Bug 987925 - Small leak under PK11_ChangePW. m5
leak:sec_asn1e_allocate_item
leak:PORT_Strdup_Util
# Bug 1021302 - Leak of fds allocated in nsSocketTransport::BuildSocket(). m1, m5, dt, oth
leak:nsSocketTransport::BuildSocket
leak:nsServerSocket::OnSocketReady
# Bug 1021350 - Small leak under event_base_once. m1, m4, bc3
leak:event_base_once
# Bug 1021854 - nsFileStreamBase::DoOpen() leaking fds. bc1, oth
leak:nsLocalFile::OpenNSPRFileDesc
# Bug 1021932 - AllocateArrayBufferContents leaks. m1
# Bug 1023583 - Leak of array buffer data involving web audio and XHR::OnStopRequest(). m1
# Bug 1023585 - Leak of array buffer in JSStructuredCloneWriter::transferOwnership(). m1
leak:AllocateArrayBufferContents
# Bug 1022010 - Small leak under _render_glyph_outline. bc1
leak:_render_glyph_outline
# Bug 1022042 - compareVariants in the test plugin leaks identifiers. oth
leak:compareVariants(_NPP*,
# Bug 1022954 - ScriptSource leaks sourceMapURL_ sometimes. dt
leak:ScriptSource::setSourceMapURL
# Bug 1023548 - Small leak under SECITEM_AllocItem_Util. bc1, bc3
leak:SECITEM_AllocItem_Util
# This is a one-time leak, so it is probably okay to ignore. bc1, oth
leak:GlobalPrinters::InitializeGlobalPrinters
leak:nsPSPrinterList::GetPrinterList
# Bug 1028456 - More leaks with _PR_Getfd, in nsLocalFile::CopyToNative and do_create. bc1, bc3
leak:_PR_Getfd
###
### Leaks with system libraries in their stacks. These show up across a number of tests.
### Better symbols and disabling fast stackwalking may help diagnose these.
###
leak:libcairo.so
leak:libdricore.so
leak:libGL.so
leak:libglib-2.0.so
leak:libp11-kit.so
leak:libpulse.so
leak:libpulsecommon-1.1.so
leak:libresolv.so
leak:libstdc++.so
leak:libXrandr.so
leak:pthread_setspecific_internal
leak:swrast_dri.so

View File

@ -1,3 +1,9 @@
if [ "x$IS_NIGHTLY" = "xyes" ]; then
MOZ_AUTOMATION_UPDATE_PACKAGING=1
fi
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/build/mozconfig.common" . "$topsrcdir/build/mozconfig.common"
# Use Clang as specified in manifest # Use Clang as specified in manifest

View File

@ -1,3 +1,8 @@
if [ "x$IS_NIGHTLY" = "xyes" ]; then
MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
MOZ_AUTOMATION_UPDATE_PACKAGING=1
fi
. "$topsrcdir/build/mozconfig.common" . "$topsrcdir/build/mozconfig.common"
# some b2g desktop builds still happen on i686 machines, and the tooltool # some b2g desktop builds still happen on i686 machines, and the tooltool

View File

@ -16,7 +16,8 @@
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsString.h" #include "nsString.h"
#include "nsCSSStyleSheet.h" #include "mozilla/CSSStyleSheet.h"
#include "mozilla/dom/URL.h"
#include "nsIConsoleService.h" #include "nsIConsoleService.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
@ -27,9 +28,12 @@
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsIScriptError.h" #include "nsIScriptError.h"
#include "nsIWindowMediator.h" #include "nsIWindowMediator.h"
#include "mozilla/dom/URL.h"
nsChromeRegistry* nsChromeRegistry::gChromeRegistry; nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
// DO NOT use namespace mozilla; it'll break due to a naming conflict between
// mozilla::TextRange and a TextRange in OSX headers.
using mozilla::CSSStyleSheet;
using mozilla::dom::IsChromeURI; using mozilla::dom::IsChromeURI;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -294,7 +298,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult)
if (!baseURI) { if (!baseURI) {
LogMessage("No chrome package registered for chrome://%s/%s/%s", LogMessage("No chrome package registered for chrome://%s/%s/%s",
package.get(), provider.get(), path.get()); package.get(), provider.get(), path.get());
return NS_ERROR_FAILURE; return NS_ERROR_FILE_NOT_FOUND;
} }
return NS_NewURI(aResult, path, nullptr, baseURI); return NS_NewURI(aResult, path, nullptr, baseURI);
@ -415,7 +419,7 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindow* aWindow)
if (IsChromeURI(uri)) { if (IsChromeURI(uri)) {
// Reload the sheet. // Reload the sheet.
nsRefPtr<nsCSSStyleSheet> newSheet; nsRefPtr<CSSStyleSheet> newSheet;
rv = document->LoadChromeSheetSync(uri, true, rv = document->LoadChromeSheetSync(uri, true,
getter_AddRefs(newSheet)); getter_AddRefs(newSheet));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
@ -454,12 +458,12 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindow* aWindow)
// Iterate over our old sheets and kick off a sync load of the new // Iterate over our old sheets and kick off a sync load of the new
// sheet if and only if it's a chrome URL. // sheet if and only if it's a chrome URL.
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(oldSheets[i]); nsRefPtr<CSSStyleSheet> sheet = do_QueryObject(oldSheets[i]);
nsIURI* uri = sheet ? sheet->GetOriginalURI() : nullptr; nsIURI* uri = sheet ? sheet->GetOriginalURI() : nullptr;
if (uri && IsChromeURI(uri)) { if (uri && IsChromeURI(uri)) {
// Reload the sheet. // Reload the sheet.
nsRefPtr<nsCSSStyleSheet> newSheet; nsRefPtr<CSSStyleSheet> newSheet;
// XXX what about chrome sheets that have a title or are disabled? This // XXX what about chrome sheets that have a title or are disabled? This
// only works by sheer dumb luck. // only works by sheer dumb luck.
document->LoadChromeSheetSync(uri, false, getter_AddRefs(newSheet)); document->LoadChromeSheetSync(uri, false, getter_AddRefs(newSheet));

View File

@ -272,7 +272,7 @@ nsChromeRegistryChrome::GetSelectedLocale(const nsACString& aPackage,
PL_DHASH_LOOKUP)); PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_FREE(entry)) if (PL_DHASH_ENTRY_IS_FREE(entry))
return NS_ERROR_FAILURE; return NS_ERROR_FILE_NOT_FOUND;
aLocale = entry->locales.GetSelected(mSelectedLocale, nsProviderArray::LOCALE); aLocale = entry->locales.GetSelected(mSelectedLocale, nsProviderArray::LOCALE);
if (aLocale.IsEmpty()) if (aLocale.IsEmpty())
@ -560,7 +560,7 @@ nsChromeRegistryChrome::GetFlagsFromPackage(const nsCString& aPackage,
& (nsACString&) aPackage, & (nsACString&) aPackage,
PL_DHASH_LOOKUP)); PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_FREE(entry)) if (PL_DHASH_ENTRY_IS_FREE(entry))
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_FILE_NOT_FOUND;
*aFlags = entry->flags; *aFlags = entry->flags;
return NS_OK; return NS_OK;

View File

@ -2804,13 +2804,13 @@ darwin*)
MOZ_USE_PTHREADS=1 MOZ_USE_PTHREADS=1
;; ;;
*) *)
MOZ_CHECK_PTHREADS(pthreads, AC_CHECK_LIB(pthreads, pthread_create,
MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads", MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
MOZ_CHECK_PTHREADS(pthread, AC_CHECK_LIB(pthread, pthread_create,
MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread", MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
MOZ_CHECK_PTHREADS(c_r, AC_CHECK_LIB(c_r, pthread_create,
MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r", MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
MOZ_CHECK_PTHREADS(c, AC_CHECK_LIB(c, pthread_create,
MOZ_USE_PTHREADS=1 MOZ_USE_PTHREADS=1
) )
) )
@ -7801,49 +7801,6 @@ AC_SUBST(PROFILE_GEN_LDFLAGS)
AC_SUBST(PROFILE_USE_CFLAGS) AC_SUBST(PROFILE_USE_CFLAGS)
AC_SUBST(PROFILE_USE_LDFLAGS) AC_SUBST(PROFILE_USE_LDFLAGS)
AC_LANG_CPLUSPLUS
dnl ========================================================
dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
dnl ========================================================
_SAVE_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
AC_CACHE_CHECK(for correct overload resolution with const and templates,
ac_nscap_nonconst_opeq_bug,
[AC_TRY_COMPILE([
template <class T>
class Pointer
{
public:
T* myPtr;
};
template <class T, class U>
int operator==(const Pointer<T>& rhs, U* lhs)
{
return rhs.myPtr == lhs;
}
template <class T, class U>
int operator==(const Pointer<T>& rhs, const U* lhs)
{
return rhs.myPtr == lhs;
}
],
[
Pointer<int> foo;
const int* bar;
return foo == bar;
],
ac_nscap_nonconst_opeq_bug="no",
ac_nscap_nonconst_opeq_bug="yes")])
CXXFLAGS="$_SAVE_CXXFLAGS"
if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
fi
fi # ! SKIP_COMPILER_CHECKS fi # ! SKIP_COMPILER_CHECKS
AC_DEFINE(CPP_THROW_NEW, [throw()]) AC_DEFINE(CPP_THROW_NEW, [throw()])
@ -7875,7 +7832,7 @@ else
echo '#include <stdio.h>' > dummy-hello.c echo '#include <stdio.h>' > dummy-hello.c
changequote(,) changequote(,)
dnl This output is localized, split at the first double space or colon and space. dnl This output is localized, split at the first double space or colon and space.
_CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*stdio.h\)$" _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'` CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
_CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'` _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
changequote([,]) changequote([,])

View File

@ -124,6 +124,7 @@ public:
// nsIWeakReference // nsIWeakReference
NS_DECL_NSIWEAKREFERENCE NS_DECL_NSIWEAKREFERENCE
virtual size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const;
void NoticeNodeDestruction() void NoticeNodeDestruction()
{ {

View File

@ -29,7 +29,6 @@
class imgIRequest; class imgIRequest;
class nsAString; class nsAString;
class nsBindingManager; class nsBindingManager;
class nsCSSStyleSheet;
class nsIDocShell; class nsIDocShell;
class nsDocShell; class nsDocShell;
class nsDOMNavigationTiming; class nsDOMNavigationTiming;
@ -83,6 +82,7 @@ class nsIGlobalObject;
struct nsCSSSelectorList; struct nsCSSSelectorList;
namespace mozilla { namespace mozilla {
class CSSStyleSheet;
class ErrorResult; class ErrorResult;
class EventStates; class EventStates;
@ -122,6 +122,7 @@ class TouchList;
class TreeWalker; class TreeWalker;
class UndoManager; class UndoManager;
class XPathEvaluator; class XPathEvaluator;
class XPathResult;
template<typename> class OwningNonNull; template<typename> class OwningNonNull;
template<typename> class Sequence; template<typename> class Sequence;
@ -779,7 +780,7 @@ public:
* TODO We can get rid of the whole concept of delayed loading if we fix * TODO We can get rid of the whole concept of delayed loading if we fix
* bug 77999. * bug 77999.
*/ */
virtual void EnsureOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet) = 0; virtual void EnsureOnDemandBuiltInUASheet(mozilla::CSSStyleSheet* aSheet) = 0;
/** /**
* Get the number of (document) stylesheets * Get the number of (document) stylesheets
@ -1836,7 +1837,7 @@ public:
* DO NOT USE FOR UNTRUSTED CONTENT. * DO NOT USE FOR UNTRUSTED CONTENT.
*/ */
virtual nsresult LoadChromeSheetSync(nsIURI* aURI, bool aIsAgentSheet, virtual nsresult LoadChromeSheetSync(nsIURI* aURI, bool aIsAgentSheet,
nsCSSStyleSheet** aSheet) = 0; mozilla::CSSStyleSheet** aSheet) = 0;
/** /**
* Returns true if the locale used for the document specifies a direction of * Returns true if the locale used for the document specifies a direction of
@ -2274,10 +2275,10 @@ public:
mozilla::ErrorResult& rv); mozilla::ErrorResult& rv);
already_AddRefed<nsIDOMXPathNSResolver> already_AddRefed<nsIDOMXPathNSResolver>
CreateNSResolver(nsINode* aNodeResolver, mozilla::ErrorResult& rv); CreateNSResolver(nsINode* aNodeResolver, mozilla::ErrorResult& rv);
already_AddRefed<nsISupports> already_AddRefed<mozilla::dom::XPathResult>
Evaluate(const nsAString& aExpression, nsINode* aContextNode, Evaluate(JSContext* aCx, const nsAString& aExpression, nsINode* aContextNode,
nsIDOMXPathNSResolver* aResolver, uint16_t aType, nsIDOMXPathNSResolver* aResolver, uint16_t aType,
nsISupports* aResult, mozilla::ErrorResult& rv); JS::Handle<JSObject*> aResult, mozilla::ErrorResult& rv);
// Touch event handlers already on nsINode // Touch event handlers already on nsINode
already_AddRefed<mozilla::dom::Touch> already_AddRefed<mozilla::dom::Touch>
CreateTouch(nsIDOMWindow* aView, mozilla::dom::EventTarget* aTarget, CreateTouch(nsIDOMWindow* aView, mozilla::dom::EventTarget* aTarget,

View File

@ -16,7 +16,10 @@ class nsIURI;
{ 0xb2, 0xe9, 0x63, 0x52, 0x8c, 0x87, 0x99, 0x7a } } { 0xb2, 0xe9, 0x63, 0x52, 0x8c, 0x87, 0x99, 0x7a } }
class nsIStyleSheet; class nsIStyleSheet;
class nsCSSStyleSheet;
namespace mozilla {
class CSSStyleSheet;
} // namespace mozilla
class nsIStyleSheetLinkingElement : public nsISupports { class nsIStyleSheetLinkingElement : public nsISupports {
public: public:
@ -29,7 +32,7 @@ public:
* @param aStyleSheet the style sheet associated with this * @param aStyleSheet the style sheet associated with this
* element. * element.
*/ */
NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aStyleSheet) = 0; NS_IMETHOD SetStyleSheet(mozilla::CSSStyleSheet* aStyleSheet) = 0;
/** /**
* Used to obtain the style sheet linked in by this element. * Used to obtain the style sheet linked in by this element.

View File

@ -25,19 +25,19 @@ public:
uint32_t Length() const uint32_t Length() const
{ {
return mIsContentElement ? mContentElement->MatchedNodes().Length() return mIsContentElement ? mContentElement->MatchedNodes().Length()
: mChildrenElement->mInsertedChildren.Length(); : mChildrenElement->InsertedChildrenLength();
} }
nsIContent* operator[](int32_t aIndex) const nsIContent* operator[](int32_t aIndex) const
{ {
return mIsContentElement ? mContentElement->MatchedNodes()[aIndex] return mIsContentElement ? mContentElement->MatchedNodes()[aIndex]
: mChildrenElement->mInsertedChildren[aIndex]; : mChildrenElement->InsertedChild(aIndex);
} }
bool IsEmpty() const bool IsEmpty() const
{ {
return mIsContentElement ? mContentElement->MatchedNodes().IsEmpty() return mIsContentElement ? mContentElement->MatchedNodes().IsEmpty()
: mChildrenElement->mInsertedChildren.IsEmpty(); : !mChildrenElement->HasInsertedChildren();
} }
protected: protected:
bool mIsContentElement; bool mIsContentElement;

View File

@ -1236,15 +1236,11 @@ EventSource::DispatchAllMessageEvents()
return; return;
} }
// We need a parent object so that we can enter its compartment. AutoJSAPI jsapi;
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject()); if (NS_WARN_IF(!jsapi.InitUsingWin(GetOwner()))) {
if (NS_WARN_IF(!parentObject)) {
return; return;
} }
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, parentObject->GetGlobalJSObject());
while (mMessagesToDispatch.GetSize() > 0) { while (mMessagesToDispatch.GetSize() > 0) {
nsAutoPtr<Message> nsAutoPtr<Message>

View File

@ -500,6 +500,12 @@ nsNodeWeakReference::QueryReferent(const nsIID& aIID, void** aInstancePtr)
NS_ERROR_NULL_POINTER; NS_ERROR_NULL_POINTER;
} }
size_t
nsNodeWeakReference::SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const
{
return aMallocSizeOf(this);
}
NS_IMPL_CYCLE_COLLECTION(nsNodeSupportsWeakRefTearoff, mNode) NS_IMPL_CYCLE_COLLECTION(nsNodeSupportsWeakRefTearoff, mNode)

View File

@ -137,7 +137,7 @@ ShadowRoot::StyleSheetChanged()
} }
void void
ShadowRoot::InsertSheet(nsCSSStyleSheet* aSheet, ShadowRoot::InsertSheet(CSSStyleSheet* aSheet,
nsIContent* aLinkingContent) nsIContent* aLinkingContent)
{ {
nsCOMPtr<nsIStyleSheetLinkingElement> nsCOMPtr<nsIStyleSheetLinkingElement>
@ -168,7 +168,7 @@ ShadowRoot::InsertSheet(nsCSSStyleSheet* aSheet,
} }
void void
ShadowRoot::RemoveSheet(nsCSSStyleSheet* aSheet) ShadowRoot::RemoveSheet(CSSStyleSheet* aSheet)
{ {
mProtoBinding->RemoveStyleSheet(aSheet); mProtoBinding->RemoveStyleSheet(aSheet);
@ -719,7 +719,7 @@ ShadowRootStyleSheetList::~ShadowRootStyleSheetList()
MOZ_COUNT_DTOR(ShadowRootStyleSheetList); MOZ_COUNT_DTOR(ShadowRootStyleSheetList);
} }
nsCSSStyleSheet* CSSStyleSheet*
ShadowRootStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound) ShadowRootStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
{ {
aFound = aIndex < mShadowRoot->mProtoBinding->SheetCount(); aFound = aIndex < mShadowRoot->mProtoBinding->SheetCount();

View File

@ -48,8 +48,8 @@ public:
void AddToIdTable(Element* aElement, nsIAtom* aId); void AddToIdTable(Element* aElement, nsIAtom* aId);
void RemoveFromIdTable(Element* aElement, nsIAtom* aId); void RemoveFromIdTable(Element* aElement, nsIAtom* aId);
void InsertSheet(nsCSSStyleSheet* aSheet, nsIContent* aLinkingContent); void InsertSheet(CSSStyleSheet* aSheet, nsIContent* aLinkingContent);
void RemoveSheet(nsCSSStyleSheet* aSheet); void RemoveSheet(CSSStyleSheet* aSheet);
bool ApplyAuthorStyles(); bool ApplyAuthorStyles();
void SetApplyAuthorStyles(bool aApplyAuthorStyles); void SetApplyAuthorStyles(bool aApplyAuthorStyles);
StyleSheetList* StyleSheets(); StyleSheetList* StyleSheets();
@ -187,7 +187,7 @@ public:
} }
virtual uint32_t Length() MOZ_OVERRIDE; virtual uint32_t Length() MOZ_OVERRIDE;
virtual nsCSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE; virtual CSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE;
protected: protected:
nsRefPtr<ShadowRoot> mShadowRoot; nsRefPtr<ShadowRoot> mShadowRoot;

View File

@ -5,8 +5,8 @@
#include "mozilla/dom/StyleSheetList.h" #include "mozilla/dom/StyleSheetList.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/dom/StyleSheetListBinding.h" #include "mozilla/dom/StyleSheetListBinding.h"
#include "nsCSSStyleSheet.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {

View File

@ -9,10 +9,11 @@
#include "nsIDOMStyleSheetList.h" #include "nsIDOMStyleSheetList.h"
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
class nsCSSStyleSheet;
class nsINode; class nsINode;
namespace mozilla { namespace mozilla {
class CSSStyleSheet;
namespace dom { namespace dom {
class StyleSheetList : public nsIDOMStyleSheetList class StyleSheetList : public nsIDOMStyleSheetList
@ -34,8 +35,8 @@ public:
virtual nsINode* GetParentObject() const = 0; virtual nsINode* GetParentObject() const = 0;
virtual uint32_t Length() = 0; virtual uint32_t Length() = 0;
virtual nsCSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) = 0; virtual CSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) = 0;
nsCSSStyleSheet* Item(uint32_t aIndex) CSSStyleSheet* Item(uint32_t aIndex)
{ {
bool dummy = false; bool dummy = false;
return IndexedGetter(aIndex, dummy); return IndexedGetter(aIndex, dummy);

View File

@ -865,14 +865,11 @@ WebSocket::CreateAndDispatchMessageEvent(const nsACString& aData,
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return NS_OK; return NS_OK;
nsCOMPtr<nsIGlobalObject> globalObject = do_QueryInterface(GetOwner()); AutoJSAPI jsapi;
if (NS_WARN_IF(!globalObject)) { if (NS_WARN_IF(!jsapi.InitUsingWin(GetOwner()))) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, globalObject->GetGlobalJSObject());
// Create appropriate JS object for message // Create appropriate JS object for message
JS::Rooted<JS::Value> jsData(cx); JS::Rooted<JS::Value> jsData(cx);

View File

@ -207,7 +207,7 @@ nsContentSink::Init(nsIDocument* aDoc,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContentSink::StyleSheetLoaded(nsCSSStyleSheet* aSheet, nsContentSink::StyleSheetLoaded(CSSStyleSheet* aSheet,
bool aWasAlternate, bool aWasAlternate,
nsresult aStatus) nsresult aStatus)
{ {

View File

@ -86,7 +86,8 @@ class nsContentSink : public nsICSSLoaderObserver,
NS_DECL_NSITIMERCALLBACK NS_DECL_NSITIMERCALLBACK
// nsICSSLoaderObserver // nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate, NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) MOZ_OVERRIDE; nsresult aStatus) MOZ_OVERRIDE;
virtual nsresult ProcessMETATag(nsIContent* aContent); virtual nsresult ProcessMETATag(nsIContent* aContent);

View File

@ -6411,15 +6411,12 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
nsIDocument* aDocument) nsIDocument* aDocument)
{ {
NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)"); NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)");
nsCOMPtr<nsIGlobalObject> globalObject =
do_QueryInterface(aDocument->GetWindow());
if (NS_WARN_IF(!globalObject)) {
return true;
}
AutoJSAPI jsapi; AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(aDocument->GetWindow()))) {
return true;
}
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, globalObject->GetGlobalJSObject());
// The pattern has to match the entire value. // The pattern has to match the entire value.
aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0); aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0);

View File

@ -383,14 +383,11 @@ nsDOMDataChannel::DoOnMessageAvailable(const nsACString& aData,
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIGlobalObject> globalObject = do_QueryInterface(GetOwner()); AutoJSAPI jsapi;
if (NS_WARN_IF(!globalObject)) { if (NS_WARN_IF(!jsapi.InitUsingWin(GetOwner()))) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, globalObject->GetGlobalJSObject());
JS::Rooted<JS::Value> jsData(cx); JS::Rooted<JS::Value> jsData(cx);

View File

@ -218,6 +218,7 @@
#include "nsISecurityConsoleMessage.h" #include "nsISecurityConsoleMessage.h"
#include "nsCharSeparatedTokenizer.h" #include "nsCharSeparatedTokenizer.h"
#include "mozilla/dom/XPathEvaluator.h" #include "mozilla/dom/XPathEvaluator.h"
#include "mozilla/dom/XPathResult.h"
#include "nsIDocumentEncoder.h" #include "nsIDocumentEncoder.h"
#include "nsIDocumentActivity.h" #include "nsIDocumentActivity.h"
#include "nsIStructuredCloneContainer.h" #include "nsIStructuredCloneContainer.h"
@ -761,7 +762,7 @@ nsDOMStyleSheetList::Length()
return mLength; return mLength;
} }
nsCSSStyleSheet* CSSStyleSheet*
nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound) nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
{ {
if (!mDocument || aIndex >= (uint32_t)mDocument->GetNumberOfStyleSheets()) { if (!mDocument || aIndex >= (uint32_t)mDocument->GetNumberOfStyleSheets()) {
@ -773,7 +774,7 @@ nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
nsIStyleSheet *sheet = mDocument->GetStyleSheetAt(aIndex); nsIStyleSheet *sheet = mDocument->GetStyleSheetAt(aIndex);
NS_ASSERTION(sheet, "Must have a sheet"); NS_ASSERTION(sheet, "Must have a sheet");
return static_cast<nsCSSStyleSheet*>(sheet); return static_cast<CSSStyleSheet*>(sheet);
} }
void void
@ -3970,7 +3971,7 @@ nsDocument::RemoveChildAt(uint32_t aIndex, bool aNotify)
} }
void void
nsDocument::EnsureOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet) nsDocument::EnsureOnDemandBuiltInUASheet(CSSStyleSheet* aSheet)
{ {
// Contains() takes nsISupport*, so annoyingly we have to cast here // Contains() takes nsISupport*, so annoyingly we have to cast here
if (mOnDemandBuiltInUASheets.Contains(static_cast<nsIStyleSheet*>(aSheet))) { if (mOnDemandBuiltInUASheets.Contains(static_cast<nsIStyleSheet*>(aSheet))) {
@ -3982,7 +3983,7 @@ nsDocument::EnsureOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet)
} }
void void
nsDocument::AddOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet) nsDocument::AddOnDemandBuiltInUASheet(CSSStyleSheet* aSheet)
{ {
// Contains() takes nsISupport*, so annoyingly we have to cast here // Contains() takes nsISupport*, so annoyingly we have to cast here
MOZ_ASSERT(!mOnDemandBuiltInUASheets.Contains(static_cast<nsIStyleSheet*>(aSheet))); MOZ_ASSERT(!mOnDemandBuiltInUASheets.Contains(static_cast<nsIStyleSheet*>(aSheet)));
@ -4280,7 +4281,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetUR
// Loading the sheet sync. // Loading the sheet sync.
nsRefPtr<mozilla::css::Loader> loader = new mozilla::css::Loader(); nsRefPtr<mozilla::css::Loader> loader = new mozilla::css::Loader();
nsRefPtr<nsCSSStyleSheet> sheet; nsRefPtr<CSSStyleSheet> sheet;
nsresult rv = loader->LoadSheetSync(aSheetURI, aType == eAgentSheet, nsresult rv = loader->LoadSheetSync(aSheetURI, aType == eAgentSheet,
true, getter_AddRefs(sheet)); true, getter_AddRefs(sheet));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -9331,7 +9332,7 @@ namespace {
class StubCSSLoaderObserver MOZ_FINAL : public nsICSSLoaderObserver { class StubCSSLoaderObserver MOZ_FINAL : public nsICSSLoaderObserver {
public: public:
NS_IMETHOD NS_IMETHOD
StyleSheetLoaded(nsCSSStyleSheet*, bool, nsresult) StyleSheetLoaded(CSSStyleSheet*, bool, nsresult)
{ {
return NS_OK; return NS_OK;
} }
@ -9357,7 +9358,7 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset,
nsresult nsresult
nsDocument::LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet, nsDocument::LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
nsCSSStyleSheet** sheet) CSSStyleSheet** sheet)
{ {
return CSSLoader()->LoadSheetSync(uri, isAgentSheet, isAgentSheet, sheet); return CSSLoader()->LoadSheetSync(uri, isAgentSheet, isAgentSheet, sheet);
} }
@ -9706,10 +9707,10 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
} }
int32_t sheetsCount = GetNumberOfStyleSheets(); int32_t sheetsCount = GetNumberOfStyleSheets();
for (int32_t i = 0; i < sheetsCount; ++i) { for (int32_t i = 0; i < sheetsCount; ++i) {
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(GetStyleSheetAt(i)); nsRefPtr<CSSStyleSheet> sheet = do_QueryObject(GetStyleSheetAt(i));
if (sheet) { if (sheet) {
if (sheet->IsApplicable()) { if (sheet->IsApplicable()) {
nsRefPtr<nsCSSStyleSheet> clonedSheet = nsRefPtr<CSSStyleSheet> clonedSheet =
sheet->Clone(nullptr, nullptr, clonedDoc, nullptr); sheet->Clone(nullptr, nullptr, clonedDoc, nullptr);
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!"); NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
if (clonedSheet) { if (clonedSheet) {
@ -9722,11 +9723,11 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
sheetsCount = thisAsDoc->mOnDemandBuiltInUASheets.Count(); sheetsCount = thisAsDoc->mOnDemandBuiltInUASheets.Count();
// Iterate backwards to maintain order // Iterate backwards to maintain order
for (int32_t i = sheetsCount - 1; i >= 0; --i) { for (int32_t i = sheetsCount - 1; i >= 0; --i) {
nsRefPtr<nsCSSStyleSheet> sheet = nsRefPtr<CSSStyleSheet> sheet =
do_QueryObject(thisAsDoc->mOnDemandBuiltInUASheets[i]); do_QueryObject(thisAsDoc->mOnDemandBuiltInUASheets[i]);
if (sheet) { if (sheet) {
if (sheet->IsApplicable()) { if (sheet->IsApplicable()) {
nsRefPtr<nsCSSStyleSheet> clonedSheet = nsRefPtr<CSSStyleSheet> clonedSheet =
sheet->Clone(nullptr, nullptr, clonedDoc, nullptr); sheet->Clone(nullptr, nullptr, clonedDoc, nullptr);
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!"); NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
if (clonedSheet) { if (clonedSheet) {
@ -12104,13 +12105,14 @@ nsIDocument::CreateNSResolver(nsINode* aNodeResolver,
return XPathEvaluator()->CreateNSResolver(aNodeResolver, rv); return XPathEvaluator()->CreateNSResolver(aNodeResolver, rv);
} }
already_AddRefed<nsISupports> already_AddRefed<XPathResult>
nsIDocument::Evaluate(const nsAString& aExpression, nsINode* aContextNode, nsIDocument::Evaluate(JSContext* aCx, const nsAString& aExpression,
nsIDOMXPathNSResolver* aResolver, uint16_t aType, nsINode* aContextNode, nsIDOMXPathNSResolver* aResolver,
nsISupports* aResult, ErrorResult& rv) uint16_t aType, JS::Handle<JSObject*> aResult,
ErrorResult& rv)
{ {
return XPathEvaluator()->Evaluate(aExpression, aContextNode, aResolver, aType, return XPathEvaluator()->Evaluate(aCx, aExpression, aContextNode, aResolver,
aResult, rv); aType, aResult, rv);
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@ -457,7 +457,8 @@ public:
} }
virtual uint32_t Length() MOZ_OVERRIDE; virtual uint32_t Length() MOZ_OVERRIDE;
virtual nsCSSStyleSheet* IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE; virtual mozilla::CSSStyleSheet*
IndexedGetter(uint32_t aIndex, bool& aFound) MOZ_OVERRIDE;
protected: protected:
int32_t mLength; int32_t mLength;
@ -780,7 +781,7 @@ public:
virtual Element* FindContentForSubDocument(nsIDocument *aDocument) const MOZ_OVERRIDE; virtual Element* FindContentForSubDocument(nsIDocument *aDocument) const MOZ_OVERRIDE;
virtual Element* GetRootElementInternal() const MOZ_OVERRIDE; virtual Element* GetRootElementInternal() const MOZ_OVERRIDE;
virtual void EnsureOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet) MOZ_OVERRIDE; virtual void EnsureOnDemandBuiltInUASheet(mozilla::CSSStyleSheet* aSheet) MOZ_OVERRIDE;
/** /**
* Get the (document) style sheets owned by this document. * Get the (document) style sheets owned by this document.
@ -932,7 +933,7 @@ public:
virtual nsViewportInfo GetViewportInfo(const mozilla::ScreenIntSize& aDisplaySize) MOZ_OVERRIDE; virtual nsViewportInfo GetViewportInfo(const mozilla::ScreenIntSize& aDisplaySize) MOZ_OVERRIDE;
private: private:
void AddOnDemandBuiltInUASheet(nsCSSStyleSheet* aSheet); void AddOnDemandBuiltInUASheet(mozilla::CSSStyleSheet* aSheet);
nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const; nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const;
void SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages); void SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages);
@ -1080,7 +1081,7 @@ public:
const nsAString& aCrossOriginAttr) MOZ_OVERRIDE; const nsAString& aCrossOriginAttr) MOZ_OVERRIDE;
virtual nsresult LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet, virtual nsresult LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
nsCSSStyleSheet** sheet) MOZ_OVERRIDE; mozilla::CSSStyleSheet** sheet) MOZ_OVERRIDE;
virtual nsISupports* GetCurrentContentSink() MOZ_OVERRIDE; virtual nsISupports* GetCurrentContentSink() MOZ_OVERRIDE;

View File

@ -2069,14 +2069,23 @@ nsFrameLoader::TryRemoteBrowser()
return false; return false;
} }
nsCOMPtr<nsIDocShellTreeItem> parentAsItem(parentWin->GetDocShell()); nsCOMPtr<nsIDocShell> parentDocShell = parentWin->GetDocShell();
if (!parentAsItem) { if (!parentDocShell) {
return false; return false;
} }
TabParent* openingTab = static_cast<TabParent*>(parentDocShell->GetOpener());
ContentParent* openerContentParent = nullptr;
if (openingTab &&
openingTab->Manager() &&
openingTab->Manager()->IsContentParent()) {
openerContentParent = openingTab->Manager()->AsContentParent();
}
// <iframe mozbrowser> gets to skip these checks. // <iframe mozbrowser> gets to skip these checks.
if (!OwnerIsBrowserOrAppFrame()) { if (!OwnerIsBrowserOrAppFrame()) {
if (parentAsItem->ItemType() != nsIDocShellTreeItem::typeChrome) { if (parentDocShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
return false; return false;
} }
@ -2096,7 +2105,7 @@ nsFrameLoader::TryRemoteBrowser()
uint32_t chromeFlags = 0; uint32_t chromeFlags = 0;
nsCOMPtr<nsIDocShellTreeOwner> parentOwner; nsCOMPtr<nsIDocShellTreeOwner> parentOwner;
if (NS_FAILED(parentAsItem->GetTreeOwner(getter_AddRefs(parentOwner))) || if (NS_FAILED(parentDocShell->GetTreeOwner(getter_AddRefs(parentOwner))) ||
!parentOwner) { !parentOwner) {
return false; return false;
} }
@ -2133,11 +2142,11 @@ nsFrameLoader::TryRemoteBrowser()
NS_ENSURE_TRUE(rv, false); NS_ENSURE_TRUE(rv, false);
nsCOMPtr<Element> ownerElement = mOwnerContent; nsCOMPtr<Element> ownerElement = mOwnerContent;
mRemoteBrowser = ContentParent::CreateBrowserOrApp(context, ownerElement); mRemoteBrowser = ContentParent::CreateBrowserOrApp(context, ownerElement, openerContentParent);
if (mRemoteBrowser) { if (mRemoteBrowser) {
mChildID = mRemoteBrowser->Manager()->ChildID(); mChildID = mRemoteBrowser->Manager()->ChildID();
nsCOMPtr<nsIDocShellTreeItem> rootItem; nsCOMPtr<nsIDocShellTreeItem> rootItem;
parentAsItem->GetRootTreeItem(getter_AddRefs(rootItem)); parentDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
nsCOMPtr<nsIDOMWindow> rootWin = rootItem->GetWindow(); nsCOMPtr<nsIDOMWindow> rootWin = rootItem->GetWindow();
nsCOMPtr<nsIDOMChromeWindow> rootChromeWin = do_QueryInterface(rootWin); nsCOMPtr<nsIDOMChromeWindow> rootChromeWin = do_QueryInterface(rootWin);
@ -2155,6 +2164,7 @@ nsFrameLoader::TryRemoteBrowser()
eCaseMatters)) { eCaseMatters)) {
unused << mRemoteBrowser->SendSetUpdateHitRegion(true); unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
} }
parentDocShell->SetOpenedRemote(mRemoteBrowser);
} }
return true; return true;
} }

View File

@ -887,16 +887,13 @@ nsScriptLoader::AttemptAsyncScriptParse(nsScriptLoadRequest* aRequest)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
nsCOMPtr<nsIScriptContext> context = globalObject->GetScriptContext(); AutoJSAPI jsapi;
if (!context) { if (!jsapi.InitWithLegacyErrorReporting(globalObject)) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
AutoJSAPIWithErrorsReportedToWindow jsapi(context);
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JS::Rooted<JSObject*> global(cx, globalObject->GetGlobalJSObject()); JS::Rooted<JSObject*> global(cx, globalObject->GetGlobalJSObject());
JSAutoCompartment ac(cx, global);
JS::CompileOptions options(cx); JS::CompileOptions options(cx);
FillCompileOptionsForRequest(aRequest, global, &options); FillCompileOptionsForRequest(aRequest, global, &options);

View File

@ -12,12 +12,12 @@
#include "nsStyleLinkElement.h" #include "nsStyleLinkElement.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Loader.h" #include "mozilla/css/Loader.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "mozilla/dom/FragmentOrElement.h" #include "mozilla/dom/FragmentOrElement.h"
#include "mozilla/dom/ShadowRoot.h" #include "mozilla/dom/ShadowRoot.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsCSSStyleSheet.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMComment.h" #include "nsIDOMComment.h"
@ -60,7 +60,7 @@ nsStyleLinkElement::Traverse(nsCycleCollectionTraversalCallback &cb)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsStyleLinkElement::SetStyleSheet(nsCSSStyleSheet* aStyleSheet) nsStyleLinkElement::SetStyleSheet(CSSStyleSheet* aStyleSheet)
{ {
if (mStyleSheet) { if (mStyleSheet) {
mStyleSheet->SetOwningNode(nullptr); mStyleSheet->SetOwningNode(nullptr);
@ -262,7 +262,7 @@ UpdateIsElementInStyleScopeFlagOnSubtree(Element* aElement)
static Element* static Element*
GetScopeElement(nsIStyleSheet* aSheet) GetScopeElement(nsIStyleSheet* aSheet)
{ {
nsRefPtr<nsCSSStyleSheet> cssStyleSheet = do_QueryObject(aSheet); nsRefPtr<CSSStyleSheet> cssStyleSheet = do_QueryObject(aSheet);
if (!cssStyleSheet) { if (!cssStyleSheet) {
return nullptr; return nullptr;
} }

View File

@ -14,11 +14,11 @@
#define nsStyleLinkElement_h___ #define nsStyleLinkElement_h___
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/CORSMode.h"
#include "mozilla/CSSStyleSheet.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIStyleSheetLinkingElement.h" #include "nsIStyleSheetLinkingElement.h"
#include "nsCSSStyleSheet.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "mozilla/CORSMode.h"
class nsIDocument; class nsIDocument;
class nsIURI; class nsIURI;
@ -37,10 +37,10 @@ public:
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE = 0; NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE = 0;
nsCSSStyleSheet* GetSheet() const { return mStyleSheet; } mozilla::CSSStyleSheet* GetSheet() const { return mStyleSheet; }
// nsIStyleSheetLinkingElement // nsIStyleSheetLinkingElement
NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aStyleSheet) MOZ_OVERRIDE; NS_IMETHOD SetStyleSheet(mozilla::CSSStyleSheet* aStyleSheet) MOZ_OVERRIDE;
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) MOZ_OVERRIDE; NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) MOZ_OVERRIDE;
NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) MOZ_OVERRIDE; NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) MOZ_OVERRIDE;
NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver, NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver,
@ -122,7 +122,7 @@ private:
bool* aIsAlternate, bool* aIsAlternate,
bool aForceUpdate); bool aForceUpdate);
nsRefPtr<nsCSSStyleSheet> mStyleSheet; nsRefPtr<mozilla::CSSStyleSheet> mStyleSheet;
protected: protected:
bool mDontLoadStyle; bool mDontLoadStyle;
bool mUpdatesEnabled; bool mUpdatesEnabled;

View File

@ -4,16 +4,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ArrayUtils.h"
#include "nsTreeSanitizer.h" #include "nsTreeSanitizer.h"
#include "nsCSSParser.h"
#include "nsCSSProperty.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/css/Declaration.h" #include "mozilla/css/Declaration.h"
#include "mozilla/css/StyleRule.h" #include "mozilla/css/StyleRule.h"
#include "mozilla/css/Rule.h" #include "mozilla/css/Rule.h"
#include "nsCSSParser.h"
#include "nsCSSProperty.h"
#include "nsUnicharInputStream.h" #include "nsUnicharInputStream.h"
#include "nsCSSStyleSheet.h"
#include "nsIDOMCSSRule.h" #include "nsIDOMCSSRule.h"
#include "nsAttrName.h" #include "nsAttrName.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
@ -1098,7 +1098,7 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
// -moz-binding is blacklisted. // -moz-binding is blacklisted.
bool didSanitize = false; bool didSanitize = false;
// Create a sheet to hold the parsed CSS // Create a sheet to hold the parsed CSS
nsRefPtr<nsCSSStyleSheet> sheet = new nsCSSStyleSheet(CORS_NONE); nsRefPtr<CSSStyleSheet> sheet = new CSSStyleSheet(CORS_NONE);
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI); sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
sheet->SetPrincipal(aDocument->NodePrincipal()); sheet->SetPrincipal(aDocument->NodePrincipal());
// Create the CSS parser, and parse the CSS text. // Create the CSS parser, and parse the CSS text.

View File

@ -2325,7 +2325,6 @@ CanvasRenderingContext2D::SetFont(const nsAString& font,
fontStyle->mFont.sizeAdjust, fontStyle->mFont.sizeAdjust,
fontStyle->mFont.systemFont, fontStyle->mFont.systemFont,
printerFont, printerFont,
fontStyle->mFont.variant == NS_STYLE_FONT_VARIANT_SMALL_CAPS,
fontStyle->mFont.synthesis & NS_FONT_SYNTHESIS_WEIGHT, fontStyle->mFont.synthesis & NS_FONT_SYNTHESIS_WEIGHT,
fontStyle->mFont.synthesis & NS_FONT_SYNTHESIS_STYLE, fontStyle->mFont.synthesis & NS_FONT_SYNTHESIS_STYLE,
fontStyle->mFont.languageOverride); fontStyle->mFont.languageOverride);

View File

@ -263,6 +263,10 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
nsIInputStream** aStream, nsIInputStream** aStream,
imgIEncoder* aEncoder) imgIEncoder* aEncoder)
{ {
if (aSize.IsEmpty()) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIInputStream> imgStream; nsCOMPtr<nsIInputStream> imgStream;
// get image bytes // get image bytes

View File

@ -7,6 +7,7 @@
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/MathAlgorithms.h"
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@ -293,16 +294,6 @@ public:
} }
} }
template<typename U>
static U NextPowerOfTwo(U x) {
U result = 1;
while (result < x)
result <<= 1;
MOZ_ASSERT(result >= x);
MOZ_ASSERT((result & (result - 1)) == 0);
return result;
}
// Updates the tree from the parent's buffer contents. Fallible, as it // Updates the tree from the parent's buffer contents. Fallible, as it
// may have to resize the tree storage. // may have to resize the tree storage.
bool Update(size_t firstByte, size_t lastByte); bool Update(size_t firstByte, size_t lastByte);
@ -365,7 +356,7 @@ bool WebGLElementArrayCacheTree<T>::Update(size_t firstByte, size_t lastByte)
// is as follows: // is as follows:
size_t numLeavesNonPOT = (numberOfElements + sElementsPerLeaf - 1) / sElementsPerLeaf; size_t numLeavesNonPOT = (numberOfElements + sElementsPerLeaf - 1) / sElementsPerLeaf;
// It only remains to round that up to the next power of two: // It only remains to round that up to the next power of two:
requiredNumLeaves = NextPowerOfTwo(numLeavesNonPOT); requiredNumLeaves = RoundUpPow2(numLeavesNonPOT);
} }
// Step #0: if needed, resize our tree data storage. // Step #0: if needed, resize our tree data storage.

View File

@ -81,7 +81,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLLinkElement)
bool bool
HTMLLinkElement::Disabled() HTMLLinkElement::Disabled()
{ {
nsCSSStyleSheet* ss = GetSheet(); CSSStyleSheet* ss = GetSheet();
return ss && ss->Disabled(); return ss && ss->Disabled();
} }
@ -95,11 +95,10 @@ HTMLLinkElement::GetMozDisabled(bool* aDisabled)
void void
HTMLLinkElement::SetDisabled(bool aDisabled) HTMLLinkElement::SetDisabled(bool aDisabled)
{ {
nsCSSStyleSheet* ss = GetSheet(); CSSStyleSheet* ss = GetSheet();
if (ss) { if (ss) {
ss->SetDisabled(aDisabled); ss->SetDisabled(aDisabled);
} }
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@ -69,7 +69,7 @@ HTMLStyleElement::GetMozDisabled(bool* aDisabled)
bool bool
HTMLStyleElement::Disabled() HTMLStyleElement::Disabled()
{ {
nsCSSStyleSheet* ss = GetSheet(); CSSStyleSheet* ss = GetSheet();
return ss && ss->Disabled(); return ss && ss->Disabled();
} }
@ -83,7 +83,7 @@ HTMLStyleElement::SetMozDisabled(bool aDisabled)
void void
HTMLStyleElement::SetDisabled(bool aDisabled) HTMLStyleElement::SetDisabled(bool aDisabled)
{ {
nsCSSStyleSheet* ss = GetSheet(); CSSStyleSheet* ss = GetSheet();
if (ss) { if (ss) {
ss->SetDisabled(aDisabled); ss->SetDisabled(aDisabled);
} }

View File

@ -190,6 +190,11 @@ HTML_TAG("param", "Param");
HTML_TAG("plaintext", ""); HTML_TAG("plaintext", "");
HTML_TAG("pre", "Pre"); HTML_TAG("pre", "Pre");
HTML_TAG("q", "Quote"); HTML_TAG("q", "Quote");
HTML_TAG("rb", "");
HTML_TAG("rp", "");
HTML_TAG("rt", "");
HTML_TAG("rtc", "");
HTML_TAG("ruby", "");
HTML_TAG("s", ""); HTML_TAG("s", "");
HTML_TAG("samp", ""); HTML_TAG("samp", "");
HTML_TAG("script", "Script", [ "nsIScriptLoaderObserver" ], []); HTML_TAG("script", "Script", [ "nsIScriptLoaderObserver" ], []);

View File

@ -2756,7 +2756,7 @@ nsHTMLDocument::EditingStateChanged()
rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_STRING("resource://gre/res/contenteditable.css")); rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_STRING("resource://gre/res/contenteditable.css"));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsCSSStyleSheet> sheet; nsRefPtr<CSSStyleSheet> sheet;
rv = LoadChromeSheetSync(uri, true, getter_AddRefs(sheet)); rv = LoadChromeSheetSync(uri, true, getter_AddRefs(sheet));
NS_ENSURE_TRUE(sheet, rv); NS_ENSURE_TRUE(sheet, rv);

View File

@ -360,9 +360,11 @@ public:
AudioNodeSizes& aUsage) const AudioNodeSizes& aUsage) const
{ {
aUsage.mEngine = SizeOfIncludingThis(aMallocSizeOf); aUsage.mEngine = SizeOfIncludingThis(aMallocSizeOf);
if (HasNode()) {
aUsage.mDomNode = mNode->SizeOfIncludingThis(aMallocSizeOf); aUsage.mDomNode = mNode->SizeOfIncludingThis(aMallocSizeOf);
aUsage.mNodeType = mNode->NodeType(); aUsage.mNodeType = mNode->NodeType();
} }
}
private: private:
dom::AudioNode* mNode; dom::AudioNode* mNode;

View File

@ -429,6 +429,7 @@ MediaDecoder::MediaDecoder() :
mIgnoreProgressData(false), mIgnoreProgressData(false),
mInfiniteStream(false), mInfiniteStream(false),
mOwner(nullptr), mOwner(nullptr),
mPlaybackStatistics(new MediaChannelStatistics()),
mPinnedForSeek(false), mPinnedForSeek(false),
mShuttingDown(false), mShuttingDown(false),
mPausedForPlaybackRateNull(false), mPausedForPlaybackRateNull(false),
@ -940,7 +941,7 @@ double MediaDecoder::ComputePlaybackRate(bool* aReliable)
*aReliable = true; *aReliable = true;
return length * static_cast<double>(USECS_PER_S) / mDuration; return length * static_cast<double>(USECS_PER_S) / mDuration;
} }
return mPlaybackStatistics.GetRateAtLastStop(aReliable); return mPlaybackStatistics->GetRateAtLastStop(aReliable);
} }
void MediaDecoder::UpdatePlaybackRate() void MediaDecoder::UpdatePlaybackRate()
@ -1032,7 +1033,7 @@ void MediaDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
return; return;
} }
if (aOffset >= mDecoderPosition) { if (aOffset >= mDecoderPosition) {
mPlaybackStatistics.AddBytes(aBytes); mPlaybackStatistics->AddBytes(aBytes);
} }
mDecoderPosition = aOffset + aBytes; mDecoderPosition = aOffset + aBytes;
} }

View File

@ -718,14 +718,14 @@ public:
// Records activity stopping on the channel. The monitor must be held. // Records activity stopping on the channel. The monitor must be held.
virtual void NotifyPlaybackStarted() { virtual void NotifyPlaybackStarted() {
GetReentrantMonitor().AssertCurrentThreadIn(); GetReentrantMonitor().AssertCurrentThreadIn();
mPlaybackStatistics.Start(); mPlaybackStatistics->Start();
} }
// Used to estimate rates of data passing through the decoder's channel. // Used to estimate rates of data passing through the decoder's channel.
// Records activity stopping on the channel. The monitor must be held. // Records activity stopping on the channel. The monitor must be held.
virtual void NotifyPlaybackStopped() { virtual void NotifyPlaybackStopped() {
GetReentrantMonitor().AssertCurrentThreadIn(); GetReentrantMonitor().AssertCurrentThreadIn();
mPlaybackStatistics.Stop(); mPlaybackStatistics->Stop();
} }
// The actual playback rate computation. The monitor must be held. // The actual playback rate computation. The monitor must be held.
@ -1194,7 +1194,7 @@ protected:
// Data needed to estimate playback data rate. The timeline used for // Data needed to estimate playback data rate. The timeline used for
// this estimate is "decode time" (where the "current time" is the // this estimate is "decode time" (where the "current time" is the
// time of the last decoded video frame). // time of the last decoded video frame).
MediaChannelStatistics mPlaybackStatistics; nsRefPtr<MediaChannelStatistics> mPlaybackStatistics;
// True when our media stream has been pinned. We pin the stream // True when our media stream has been pinned. We pin the stream
// while seeking. // while seeking.

View File

@ -21,12 +21,6 @@ class TimeRanges;
class RequestSampleCallback; class RequestSampleCallback;
class MediaDecoderReader; class MediaDecoderReader;
template <>
struct HasDangerousPublicDestructor<MediaDecoderReader>
{
static const bool value = true;
};
// Encapsulates the decoding and reading of media data. Reading can either // Encapsulates the decoding and reading of media data. Reading can either
// synchronous and done on the calling "decode" thread, or asynchronous and // synchronous and done on the calling "decode" thread, or asynchronous and
// performed on a background thread, with the result being returned by // performed on a background thread, with the result being returned by
@ -38,7 +32,6 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader)
MediaDecoderReader(AbstractMediaDecoder* aDecoder); MediaDecoderReader(AbstractMediaDecoder* aDecoder);
virtual ~MediaDecoderReader();
// Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE // Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE
// on failure. // on failure.
@ -181,6 +174,7 @@ public:
MediaInfo GetMediaInfo() { return mInfo; } MediaInfo GetMediaInfo() { return mInfo; }
protected: protected:
virtual ~MediaDecoderReader();
// Overrides of this function should decodes an unspecified amount of // Overrides of this function should decodes an unspecified amount of
// audio data, enqueuing the audio data in mAudioQueue. Returns true // audio data, enqueuing the audio data in mAudioQueue. Returns true

View File

@ -38,12 +38,6 @@ namespace mozilla {
class MediaDecoder; class MediaDecoder;
class MediaChannelStatistics; class MediaChannelStatistics;
template<>
struct HasDangerousPublicDestructor<MediaChannelStatistics>
{
static const bool value = true;
};
/** /**
* This class is useful for estimating rates of data passing through * This class is useful for estimating rates of data passing through
* some channel. The idea is that activity on the channel "starts" * some channel. The idea is that activity on the channel "starts"
@ -119,6 +113,7 @@ public:
return static_cast<double>(mAccumulatedBytes)/seconds; return static_cast<double>(mAccumulatedBytes)/seconds;
} }
private: private:
~MediaChannelStatistics() {}
int64_t mAccumulatedBytes; int64_t mAccumulatedBytes;
TimeDuration mAccumulatedTime; TimeDuration mAccumulatedTime;
TimeStamp mLastStartTime; TimeStamp mLastStartTime;

View File

@ -2786,7 +2786,8 @@ MediaStreamGraphImpl::CollectReports(nsIHandleReportCallback* aHandleReport,
for (size_t i = 0; i < mAudioStreamSizes.Length(); i++) { for (size_t i = 0; i < mAudioStreamSizes.Length(); i++) {
const AudioNodeSizes& usage = mAudioStreamSizes[i]; const AudioNodeSizes& usage = mAudioStreamSizes[i];
const char* const nodeType = usage.mNodeType.get(); const char* const nodeType = usage.mNodeType.IsEmpty() ?
"<unknown>" : usage.mNodeType.get();
nsPrintfCString domNodePath("explicit/webaudio/audio-node/%s/dom-nodes", nsPrintfCString domNodePath("explicit/webaudio/audio-node/%s/dom-nodes",
nodeType); nodeType);

View File

@ -232,6 +232,7 @@ public:
*/ */
struct AudioNodeSizes struct AudioNodeSizes
{ {
AudioNodeSizes() : mDomNode(0), mStream(0), mEngine(0), mNodeType() {}
size_t mDomNode; size_t mDomNode;
size_t mStream; size_t mStream;
size_t mEngine; size_t mEngine;

View File

@ -87,6 +87,9 @@ FFmpegDataDecoder::Init()
// FFmpeg will call back to this to negotiate a video pixel format. // FFmpeg will call back to this to negotiate a video pixel format.
mCodecContext.get_format = ChoosePixelFormat; mCodecContext.get_format = ChoosePixelFormat;
mCodecContext.extradata = mExtraData.begin();
mCodecContext.extradata_size = mExtraData.length();
AVDictionary* opts = nullptr; AVDictionary* opts = nullptr;
if (avcodec_open2(&mCodecContext, codec, &opts) < 0) { if (avcodec_open2(&mCodecContext, codec, &opts) < 0) {
NS_WARNING("Couldn't initialise ffmpeg decoder"); NS_WARNING("Couldn't initialise ffmpeg decoder");

View File

@ -10,6 +10,7 @@
#include "FFmpegDecoderModule.h" #include "FFmpegDecoderModule.h"
#include "FFmpegRuntimeLinker.h" #include "FFmpegRuntimeLinker.h"
#include "FFmpegCompat.h" #include "FFmpegCompat.h"
#include "mozilla/Vector.h"
namespace mozilla namespace mozilla
{ {
@ -31,6 +32,7 @@ public:
protected: protected:
MediaTaskQueue* mTaskQueue; MediaTaskQueue* mTaskQueue;
AVCodecContext mCodecContext; AVCodecContext mCodecContext;
Vector<uint8_t> mExtraData;
private: private:
static bool sFFmpegInitDone; static bool sFFmpegInitDone;

View File

@ -33,6 +33,7 @@ FFmpegH264Decoder::FFmpegH264Decoder(
, mImageContainer(aImageContainer) , mImageContainer(aImageContainer)
{ {
MOZ_COUNT_CTOR(FFmpegH264Decoder); MOZ_COUNT_CTOR(FFmpegH264Decoder);
mExtraData.append(aConfig.extra_data.begin(), aConfig.extra_data.length());
} }
nsresult nsresult

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WMFAudioOutputSource.h" #include "WMFAudioOutputSource.h"
#include "mp4_demuxer/DecoderData.h"
#include "VideoUtils.h" #include "VideoUtils.h"
#include "WMFUtils.h" #include "WMFUtils.h"
#include "nsTArray.h" #include "nsTArray.h"
@ -127,6 +128,14 @@ WMFAudioOutputSource::Init()
return decoder.forget(); return decoder.forget();
} }
HRESULT
WMFAudioOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
{
const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
uint32_t length = aSample->size;
return mDecoder->Input(data, length, aSample->composition_timestamp);
}
HRESULT HRESULT
WMFAudioOutputSource::Output(int64_t aStreamOffset, WMFAudioOutputSource::Output(int64_t aStreamOffset,
nsAutoPtr<MediaData>& aOutData) nsAutoPtr<MediaData>& aOutData)

View File

@ -22,6 +22,8 @@ public:
virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE; virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE;
virtual HRESULT Input(mp4_demuxer::MP4Sample* aSample) MOZ_OVERRIDE;
// Note WMF's AAC decoder sometimes output negatively timestamped samples, // Note WMF's AAC decoder sometimes output negatively timestamped samples,
// presumably they're the preroll samples, and we strip them. We may return // presumably they're the preroll samples, and we strip them. We may return
// a null aOutput in this case. // a null aOutput in this case.

View File

@ -70,7 +70,8 @@ WMFDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConf
MediaTaskQueue* aVideoTaskQueue, MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MediaDataDecoderCallback* aCallback)
{ {
return new WMFMediaDataDecoder(new WMFVideoOutputSource(aLayersBackend, return new WMFMediaDataDecoder(new WMFVideoOutputSource(aConfig,
aLayersBackend,
aImageContainer, aImageContainer,
sDXVAEnabled), sDXVAEnabled),
aVideoTaskQueue, aVideoTaskQueue,

View File

@ -67,11 +67,9 @@ WMFMediaDataDecoder::Input(mp4_demuxer::MP4Sample* aSample)
void void
WMFMediaDataDecoder::ProcessDecode(mp4_demuxer::MP4Sample* aSample) WMFMediaDataDecoder::ProcessDecode(mp4_demuxer::MP4Sample* aSample)
{ {
const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data); HRESULT hr = mSource->Input(aSample);
uint32_t length = aSample->size;
HRESULT hr = mDecoder->Input(data, length, aSample->composition_timestamp);
if (FAILED(hr)) { if (FAILED(hr)) {
NS_WARNING("WMFAudioDecoder failed to input data"); NS_WARNING("WMFOutputSource rejected sample");
mCallback->Error(); mCallback->Error();
return; return;
} }

View File

@ -13,6 +13,8 @@
#include "MFTDecoder.h" #include "MFTDecoder.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
class mp4_demuxer::MP4Sample;
namespace mozilla { namespace mozilla {
// Encapsulates the initialization of the MFTDecoder appropriate for decoding // Encapsulates the initialization of the MFTDecoder appropriate for decoding
@ -26,6 +28,11 @@ public:
// Returns nullptr on failure. // Returns nullptr on failure.
virtual TemporaryRef<MFTDecoder> Init() = 0; virtual TemporaryRef<MFTDecoder> Init() = 0;
// Submit a compressed sample for decoding.
// This should forward to the MFTDecoder after performing
// any required sample formatting.
virtual HRESULT Input(mp4_demuxer::MP4Sample* aSample) = 0;
// Produces decoded output, if possible. Blocks until output can be produced, // Produces decoded output, if possible. Blocks until output can be produced,
// or until no more is able to be produced. // or until no more is able to be produced.
// Returns S_OK on success, or MF_E_TRANSFORM_NEED_MORE_INPUT if there's not // Returns S_OK on success, or MF_E_TRANSFORM_NEED_MORE_INPUT if there's not

View File

@ -13,6 +13,8 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "Layers.h" #include "Layers.h"
#include "mozilla/layers/LayersTypes.h" #include "mozilla/layers/LayersTypes.h"
#include "mp4_demuxer/AnnexB.h"
#include "mp4_demuxer/DecoderData.h"
#include "prlog.h" #include "prlog.h"
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
@ -30,12 +32,15 @@ using mozilla::layers::LayersBackend;
namespace mozilla { namespace mozilla {
WMFVideoOutputSource::WMFVideoOutputSource(mozilla::layers::LayersBackend aLayersBackend, WMFVideoOutputSource::WMFVideoOutputSource(
const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer, mozilla::layers::ImageContainer* aImageContainer,
bool aDXVAEnabled) bool aDXVAEnabled)
: mVideoStride(0) : mVideoStride(0)
, mVideoWidth(0) , mVideoWidth(0)
, mVideoHeight(0) , mVideoHeight(0)
, mConfig(aConfig)
, mImageContainer(aImageContainer) , mImageContainer(aImageContainer)
, mDXVAEnabled(aDXVAEnabled) , mDXVAEnabled(aDXVAEnabled)
, mLayersBackend(aLayersBackend) , mLayersBackend(aLayersBackend)
@ -138,6 +143,17 @@ WMFVideoOutputSource::Init()
return decoder.forget(); return decoder.forget();
} }
HRESULT
WMFVideoOutputSource::Input(mp4_demuxer::MP4Sample* aSample)
{
// We must prepare samples in AVC Annex B.
mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b);
// Forward sample data to the decoder.
const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
uint32_t length = aSample->size;
return mDecoder->Input(data, length, aSample->composition_timestamp);
}
HRESULT HRESULT
WMFVideoOutputSource::ConfigureVideoFrameGeometry() WMFVideoOutputSource::ConfigureVideoFrameGeometry()
{ {

View File

@ -20,13 +20,16 @@ class DXVA2Manager;
class WMFVideoOutputSource : public WMFOutputSource { class WMFVideoOutputSource : public WMFOutputSource {
public: public:
WMFVideoOutputSource(mozilla::layers::LayersBackend aLayersBackend, WMFVideoOutputSource(const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer, mozilla::layers::ImageContainer* aImageContainer,
bool aDXVAEnabled); bool aDXVAEnabled);
~WMFVideoOutputSource(); ~WMFVideoOutputSource();
virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE; virtual TemporaryRef<MFTDecoder> Init() MOZ_OVERRIDE;
virtual HRESULT Input(mp4_demuxer::MP4Sample* aSample) MOZ_OVERRIDE;
virtual HRESULT Output(int64_t aStreamOffset, virtual HRESULT Output(int64_t aStreamOffset,
nsAutoPtr<MediaData>& aOutput) MOZ_OVERRIDE; nsAutoPtr<MediaData>& aOutput) MOZ_OVERRIDE;
@ -51,6 +54,8 @@ private:
uint32_t mVideoHeight; uint32_t mVideoHeight;
nsIntRect mPictureRegion; nsIntRect mPictureRegion;
const mp4_demuxer::VideoDecoderConfig& mConfig;
RefPtr<MFTDecoder> mDecoder; RefPtr<MFTDecoder> mDecoder;
RefPtr<layers::ImageContainer> mImageContainer; RefPtr<layers::ImageContainer> mImageContainer;
nsAutoPtr<DXVA2Manager> mDXVA2Manager; nsAutoPtr<DXVA2Manager> mDXVA2Manager;

View File

@ -14,7 +14,6 @@
#include "mozilla/DOMEventTargetHelper.h" #include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/MediaSourceBinding.h" #include "mozilla/dom/MediaSourceBinding.h"
#include "mozilla/Monitor.h" #include "mozilla/Monitor.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsCycleCollectionNoteChild.h" #include "nsCycleCollectionNoteChild.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"

View File

@ -14,6 +14,7 @@
#include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/TimeRanges.h" #include "mozilla/dom/TimeRanges.h"
#include "mozilla/mozalloc.h" #include "mozilla/mozalloc.h"
#include "nsAutoPtr.h"
#include "nsISupports.h" #include "nsISupports.h"
#include "nsIThread.h" #include "nsIThread.h"
#include "prlog.h" #include "prlog.h"
@ -414,7 +415,7 @@ MediaSourceReader::CreateSubDecoder(const nsACString& aType,
// XXX: Why/when is mDecoder null here, since it should be equal to aParentDecoder?! // XXX: Why/when is mDecoder null here, since it should be equal to aParentDecoder?!
nsRefPtr<SubBufferDecoder> decoder = nsRefPtr<SubBufferDecoder> decoder =
new SubBufferDecoder(new SourceBufferResource(nullptr, aType), aParentDecoder); new SubBufferDecoder(new SourceBufferResource(nullptr, aType), aParentDecoder);
nsAutoPtr<MediaDecoderReader> reader(DecoderTraits::CreateReader(aType, decoder)); nsRefPtr<MediaDecoderReader> reader(DecoderTraits::CreateReader(aType, decoder));
if (!reader) { if (!reader) {
return nullptr; return nullptr;
} }
@ -428,7 +429,7 @@ MediaSourceReader::CreateSubDecoder(const nsACString& aType,
reader->Init(nullptr); reader->Init(nullptr);
ReentrantMonitorAutoEnter mon(aParentDecoder->GetReentrantMonitor()); ReentrantMonitorAutoEnter mon(aParentDecoder->GetReentrantMonitor());
MSE_DEBUG("Registered subdecoder %p subreader %p", decoder.get(), reader.get()); MSE_DEBUG("Registered subdecoder %p subreader %p", decoder.get(), reader.get());
decoder->SetReader(reader.forget()); decoder->SetReader(reader);
mPendingDecoders.AppendElement(decoder); mPendingDecoders.AppendElement(decoder);
if (NS_FAILED(static_cast<MediaSourceDecoder*>(mDecoder)->EnqueueDecoderInitialization())) { if (NS_FAILED(static_cast<MediaSourceDecoder*>(mDecoder)->EnqueueDecoderInitialization())) {
MSE_DEBUG("%p: Failed to enqueue decoder initialization task", this); MSE_DEBUG("%p: Failed to enqueue decoder initialization task", this);

View File

@ -12,7 +12,6 @@
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h" #include "mozilla/DOMEventTargetHelper.h"
#include "nsAutoPtr.h"
#include "nsCycleCollectionNoteChild.h" #include "nsCycleCollectionNoteChild.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsISupports.h" #include "nsISupports.h"

View File

@ -86,7 +86,7 @@ public:
private: private:
MediaSourceDecoder* mParentDecoder; MediaSourceDecoder* mParentDecoder;
nsAutoPtr<MediaDecoderReader> mReader; nsRefPtr<MediaDecoderReader> mReader;
int64_t mMediaDuration; int64_t mMediaDuration;
int64_t mMediaStartTime; int64_t mMediaStartTime;
}; };

View File

@ -5,6 +5,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Base64.h" #include "mozilla/Base64.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsISocketTransport.h" #include "nsISocketTransport.h"
@ -228,7 +229,7 @@ ServeResourceEvent::Run() {
start = strtoll(s+byteRange.Length(), nullptr, 10); start = strtoll(s+byteRange.Length(), nullptr, 10);
// Clamp 'start' to be between 0 and the resource length. // Clamp 'start' to be between 0 and the resource length.
start = std::max(0ll, std::min(resource->GetLength(), start)); start = std::max(int64_t(0), std::min(resource->GetLength(), start));
} }
} }
@ -268,7 +269,7 @@ ServeResourceEvent::Run() {
static_assert (buffer_size > 1024, static_assert (buffer_size > 1024,
"buffer_size must be large enough " "buffer_size must be large enough "
"to hold response headers"); "to hold response headers");
snprintf(b, buffer_size, "Content-Length: %lld\r\n", contentlength); snprintf(b, buffer_size, "Content-Length: %" PRId64 "\r\n", contentlength);
rv = WriteAll(b, strlen(b)); rv = WriteAll(b, strlen(b));
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; } if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }
} }
@ -279,7 +280,8 @@ ServeResourceEvent::Run() {
static_assert (buffer_size > 1024, static_assert (buffer_size > 1024,
"buffer_size must be large enough " "buffer_size must be large enough "
"to hold response headers"); "to hold response headers");
snprintf(b, buffer_size, "Content-Range: bytes %lld-%lld/%lld\r\n", snprintf(b, buffer_size, "Content-Range: "
"bytes %" PRId64 "-%" PRId64 "/%" PRId64 "\r\n",
start, resource->GetLength() - 1, resource->GetLength()); start, resource->GetLength() - 1, resource->GetLength());
rv = WriteAll(b, strlen(b)); rv = WriteAll(b, strlen(b));
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; } if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }

View File

@ -437,6 +437,7 @@ AudioContext::DecodeAudioData(const ArrayBuffer& aBuffer,
const Optional<OwningNonNull<DecodeErrorCallback> >& aFailureCallback) const Optional<OwningNonNull<DecodeErrorCallback> >& aFailureCallback)
{ {
AutoJSAPI jsapi; AutoJSAPI jsapi;
jsapi.Init();
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, aBuffer.Obj()); JSAutoCompartment ac(cx, aBuffer.Obj());

View File

@ -126,15 +126,11 @@ public:
// which is strongly referenced by the runnable that called // which is strongly referenced by the runnable that called
// AudioDestinationNode::FireOfflineCompletionEvent. // AudioDestinationNode::FireOfflineCompletionEvent.
// We need the global for the context so that we can enter its compartment. AutoJSAPI jsapi;
JSObject* global = context->GetGlobalJSObject(); if (NS_WARN_IF(!jsapi.InitUsingWin(aNode->GetOwner()))) {
if (NS_WARN_IF(!global)) {
return; return;
} }
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
// Create the input buffer // Create the input buffer
ErrorResult rv; ErrorResult rv;

View File

@ -41,16 +41,12 @@ already_AddRefed<AudioBuffer>
AudioProcessingEvent::LazilyCreateBuffer(uint32_t aNumberOfChannels, AudioProcessingEvent::LazilyCreateBuffer(uint32_t aNumberOfChannels,
ErrorResult& aRv) ErrorResult& aRv)
{ {
// We need the global for the context so that we can enter its compartment. AutoJSAPI jsapi;
JSObject* global = mNode->Context()->GetGlobalJSObject(); if (NS_WARN_IF(!jsapi.InitUsingWin(mNode->GetOwner()))) {
if (NS_WARN_IF(!global)) {
aRv.Throw(NS_ERROR_UNEXPECTED); aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr; return nullptr;
} }
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
nsRefPtr<AudioBuffer> buffer = nsRefPtr<AudioBuffer> buffer =
AudioBuffer::Create(mNode->Context(), aNumberOfChannels, AudioBuffer::Create(mNode->Context(), aNumberOfChannels,

View File

@ -16,6 +16,7 @@
#include "DecoderTraits.h" #include "DecoderTraits.h"
#include "AudioContext.h" #include "AudioContext.h"
#include "AudioBuffer.h" #include "AudioBuffer.h"
#include "nsAutoPtr.h"
#include "nsIScriptObjectPrincipal.h" #include "nsIScriptObjectPrincipal.h"
#include "nsIScriptError.h" #include "nsIScriptError.h"
#include "nsMimeTypes.h" #include "nsMimeTypes.h"
@ -151,7 +152,7 @@ private:
nsCOMPtr<nsIThreadPool> mThreadPool; nsCOMPtr<nsIThreadPool> mThreadPool;
nsCOMPtr<nsIPrincipal> mPrincipal; nsCOMPtr<nsIPrincipal> mPrincipal;
nsRefPtr<BufferDecoder> mBufferDecoder; nsRefPtr<BufferDecoder> mBufferDecoder;
nsAutoPtr<MediaDecoderReader> mDecoderReader; nsRefPtr<MediaDecoderReader> mDecoderReader;
}; };
NS_IMETHODIMP NS_IMETHODIMP
@ -412,15 +413,11 @@ WebAudioDecodeJob::AllocateBuffer()
MOZ_ASSERT(!mOutput); MOZ_ASSERT(!mOutput);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
// We need the global for the context so that we can enter its compartment. AutoJSAPI jsapi;
JSObject* global = mContext->GetGlobalJSObject(); if (NS_WARN_IF(!jsapi.InitUsingWin(mContext->GetOwner()))) {
if (NS_WARN_IF(!global)) {
return false; return false;
} }
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
// Now create the AudioBuffer // Now create the AudioBuffer
ErrorResult rv; ErrorResult rv;
@ -450,6 +447,7 @@ MediaBufferDecoder::AsyncDecodeMedia(const char* aContentType, uint8_t* aBuffer,
new ReportResultTask(aDecodeJob, new ReportResultTask(aDecodeJob,
&WebAudioDecodeJob::OnFailure, &WebAudioDecodeJob::OnFailure,
WebAudioDecodeJob::UnknownContent); WebAudioDecodeJob::UnknownContent);
JS_free(nullptr, aBuffer);
NS_DispatchToMainThread(event); NS_DispatchToMainThread(event);
return; return;
} }
@ -459,6 +457,7 @@ MediaBufferDecoder::AsyncDecodeMedia(const char* aContentType, uint8_t* aBuffer,
new ReportResultTask(aDecodeJob, new ReportResultTask(aDecodeJob,
&WebAudioDecodeJob::OnFailure, &WebAudioDecodeJob::OnFailure,
WebAudioDecodeJob::UnknownError); WebAudioDecodeJob::UnknownError);
JS_free(nullptr, aBuffer);
NS_DispatchToMainThread(event); NS_DispatchToMainThread(event);
return; return;
} }

View File

@ -9,7 +9,6 @@
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIThreadPool.h" #include "nsIThreadPool.h"
#include "nsString.h" #include "nsString.h"
#include "nsTArray.h" #include "nsTArray.h"

View File

@ -402,15 +402,11 @@ private:
return NS_OK; return NS_OK;
} }
// Get the global for the context so that we can enter its compartment. AutoJSAPI jsapi;
JSObject* global = node->Context()->GetGlobalJSObject(); if (NS_WARN_IF(!jsapi.InitUsingWin(node->GetOwner()))) {
if (NS_WARN_IF(!global)) {
return NS_OK; return NS_OK;
} }
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
// Create the input buffer // Create the input buffer
nsRefPtr<AudioBuffer> inputBuffer; nsRefPtr<AudioBuffer> inputBuffer;

View File

@ -40,15 +40,15 @@ LoadManagerSingleton::LoadManagerSingleton(int aLoadMeasurementInterval,
int aAveragingMeasurements, int aAveragingMeasurements,
float aHighLoadThreshold, float aHighLoadThreshold,
float aLowLoadThreshold) float aLowLoadThreshold)
: mLoadSum(0.0f), : mLock("LoadManager"),
mLoadSumMeasurements(0), mCurrentState(webrtc::kLoadNormal),
mOveruseActive(false), mOveruseActive(false),
mLoadSum(0.0f),
mLoadSumMeasurements(0),
mLoadMeasurementInterval(aLoadMeasurementInterval), mLoadMeasurementInterval(aLoadMeasurementInterval),
mAveragingMeasurements(aAveragingMeasurements), mAveragingMeasurements(aAveragingMeasurements),
mHighLoadThreshold(aHighLoadThreshold), mHighLoadThreshold(aHighLoadThreshold),
mLowLoadThreshold(aLowLoadThreshold), mLowLoadThreshold(aLowLoadThreshold)
mCurrentState(webrtc::kLoadNormal),
mLock("LoadManager")
{ {
#if defined(PR_LOGGING) #if defined(PR_LOGGING)
if (!gLoadManagerLog) if (!gLoadManagerLog)

View File

@ -54,8 +54,8 @@ private:
nsRefPtr<LoadMonitor> mLoadMonitor; nsRefPtr<LoadMonitor> mLoadMonitor;
// This protexts access to the mObservers list, the current state, pretty much all // This protects access to the mObservers list, the current state, and
// the other members (below) // pretty much all the other members (below).
Mutex mLock; Mutex mLock;
nsTArray<webrtc::CPULoadStateObserver*> mObservers; nsTArray<webrtc::CPULoadStateObserver*> mObservers;
webrtc::CPULoadState mCurrentState; webrtc::CPULoadState mCurrentState;

View File

@ -29,9 +29,9 @@ LoadManagerSingleton::Get() {
int averagingSeconds = int averagingSeconds =
mozilla::Preferences::GetInt("media.navigator.load_adapt.avg_seconds", 3); mozilla::Preferences::GetInt("media.navigator.load_adapt.avg_seconds", 3);
float highLoadThreshold = float highLoadThreshold =
mozilla::Preferences::GetFloat("media.navigator.load_adapt.high_load", 0.90); mozilla::Preferences::GetFloat("media.navigator.load_adapt.high_load", 0.90f);
float lowLoadThreshold = float lowLoadThreshold =
mozilla::Preferences::GetFloat("media.navigator.load_adapt.low_load", 0.40); mozilla::Preferences::GetFloat("media.navigator.load_adapt.low_load", 0.40f);
sSingleton = new LoadManagerSingleton(loadMeasurementInterval, sSingleton = new LoadManagerSingleton(loadMeasurementInterval,
averagingSeconds, averagingSeconds,

View File

@ -267,13 +267,13 @@ class MediaEngineWebRTCAudioSource : public MediaEngineAudioSource,
public: public:
MediaEngineWebRTCAudioSource(webrtc::VoiceEngine* aVoiceEnginePtr, int aIndex, MediaEngineWebRTCAudioSource(webrtc::VoiceEngine* aVoiceEnginePtr, int aIndex,
const char* name, const char* uuid) const char* name, const char* uuid)
: mVoiceEngine(aVoiceEnginePtr) : mSamples(0)
, mVoiceEngine(aVoiceEnginePtr)
, mMonitor("WebRTCMic.Monitor") , mMonitor("WebRTCMic.Monitor")
, mCapIndex(aIndex) , mCapIndex(aIndex)
, mChannel(-1) , mChannel(-1)
, mInitDone(false) , mInitDone(false)
, mStarted(false) , mStarted(false)
, mSamples(0)
, mEchoOn(false), mAgcOn(false), mNoiseOn(false) , mEchoOn(false), mAgcOn(false), mNoiseOn(false)
, mEchoCancel(webrtc::kEcDefault) , mEchoCancel(webrtc::kEcDefault)
, mAGC(webrtc::kAgcDefault) , mAGC(webrtc::kAgcDefault)
@ -319,6 +319,13 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_THREADSAFE_ISUPPORTS
protected:
// mSamples is an int to avoid conversions when comparing/etc to
// samplingFreq & length. Making mSamples protected instead of private is a
// silly way to avoid -Wunused-private-field warnings when PR_LOGGING is not
// #defined. mSamples is not actually expected to be used by a derived class.
int mSamples;
private: private:
static const unsigned int KMaxDeviceNameLength = 128; static const unsigned int KMaxDeviceNameLength = 128;
static const unsigned int KMaxUniqueIdLength = 256; static const unsigned int KMaxUniqueIdLength = 256;
@ -344,7 +351,6 @@ private:
TrackID mTrackID; TrackID mTrackID;
bool mInitDone; bool mInitDone;
bool mStarted; bool mStarted;
int mSamples; // int to avoid conversions when comparing/etc to samplingFreq & length
nsString mDeviceName; nsString mDeviceName;
nsString mDeviceUUID; nsString mDeviceUUID;

View File

@ -6,6 +6,7 @@
#include "PeerIdentity.h" #include "PeerIdentity.h"
#include "mozilla/DebugOnly.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIIDNService.h" #include "nsIIDNService.h"
#include "nsNetCID.h" #include "nsNetCID.h"
@ -76,9 +77,9 @@ PeerIdentity::GetNormalizedHost(const nsCOMPtr<nsIIDNService>& aIdnService,
const nsAString& aHost, const nsAString& aHost,
nsACString& aNormalizedHost) nsACString& aNormalizedHost)
{ {
nsCString chost = NS_ConvertUTF16toUTF8(aHost); const nsCString chost = NS_ConvertUTF16toUTF8(aHost);
nsresult rv = aIdnService->ConvertUTF8toACE(chost, aNormalizedHost); DebugOnly<nsresult> rv = aIdnService->ConvertUTF8toACE(chost, aNormalizedHost);
NS_WARN_IF(NS_FAILED(rv)); NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to convert UTF-8 host to ASCII");
} }
} /* namespace mozilla */ } /* namespace mozilla */

View File

@ -57,3 +57,11 @@ include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'gklayout' FINAL_LIBRARY = 'gklayout'
if CONFIG['OS_ARCH'] == 'WINNT': if CONFIG['OS_ARCH'] == 'WINNT':
DEFINES['NOMINMAX'] = True DEFINES['NOMINMAX'] = True
if CONFIG['_MSC_VER']:
CXXFLAGS += [
'-wd4275', # non dll-interface class used as base for dll-interface class
]
FAIL_ON_WARNINGS = True

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