Merge mozilla-central to fx-team on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2014-07-29 11:19:53 +02:00
commit 44c50c6899
402 changed files with 10579 additions and 4655 deletions

View File

@ -68,27 +68,19 @@ def print_header_file(fd, conf):
initializers = []
for a in attributes:
initializers.append("m%s(a%s)" % (firstCap(a.name), firstCap(a.name)))
fd.write(" %s\n {}\n" % ", ".join(initializers))
fd.write(" ~%s() {}\n\n" % classname)
fd.write(" %s\n {}\n\n" % ", ".join(initializers))
fd.write(" NS_DECL_CYCLE_COLLECTING_ISUPPORTS\n")
fd.write(" NS_DECL_CYCLE_COLLECTION_CLASS(%s)\n" % (classname))
for iface in filter(lambda i: i.name != "nsISupports", baseinterfaces):
fd.write(" NS_DECL_%s\n" % iface.name.upper())
fd.write("private:\n")
fd.write("\nprivate:\n")
fd.write(" ~%s() {}\n\n" % classname)
for a in attributes:
fd.write(" %s\n" % attributeVariableTypeAndName(a))
fd.write("};\n\n")
fd.write("namespace mozilla {\n"
"template<>\n"
"struct HasDangerousPublicDestructor<%s>\n"
"{\n"
" static const bool value = true;\n"
"};\n"
"}\n" % classname)
fd.write("#endif\n")
def interfaceAttributeTypes(idl):

View File

@ -1,248 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=2 autoindent cindent expandtab: */
/* 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/. */
#include "nsXULAppAPI.h"
#include "application.ini.h"
#include "nsXPCOMGlue.h"
#include "nsStringGlue.h"
#include "nsCOMPtr.h"
#include "nsIFile.h"
#include "BinaryPath.h"
#include "nsAutoPtr.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <dlfcn.h>
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
#define ASSERT(x) if (!(x)) { MOZ_CRASH(); }
// Functions being loaded by XPCOMGlue
XRE_ProcLoaderServiceRunType XRE_ProcLoaderServiceRun;
XRE_ProcLoaderClientInitType XRE_ProcLoaderClientInit;
XRE_ProcLoaderPreloadType XRE_ProcLoaderPreload;
extern XRE_CreateAppDataType XRE_CreateAppData;
extern XRE_GetFileFromPathType XRE_GetFileFromPath;
static const nsDynamicFunctionLoad kXULFuncs[] = {
{ "XRE_ProcLoaderServiceRun", (NSFuncPtr*) &XRE_ProcLoaderServiceRun },
{ "XRE_ProcLoaderClientInit", (NSFuncPtr*) &XRE_ProcLoaderClientInit },
{ "XRE_ProcLoaderPreload", (NSFuncPtr*) &XRE_ProcLoaderPreload },
{ "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
{ "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
{ nullptr, nullptr }
};
static int
GetDirnameSlash(const char *aPath, char *aOutDir, int aMaxLen)
{
char *lastSlash = strrchr(aPath, XPCOM_FILE_PATH_SEPARATOR[0]);
if (lastSlash == nullptr) {
return 0;
}
int cpsz = lastSlash - aPath + 1; // include slash
if (aMaxLen <= cpsz) {
return 0;
}
strncpy(aOutDir, aPath, cpsz);
aOutDir[cpsz] = 0;
return cpsz;
}
static bool
GetXPCOMPath(const char *aProgram, char *aOutPath, int aMaxLen)
{
nsAutoArrayPtr<char> progBuf(new char[aMaxLen]);
nsresult rv = mozilla::BinaryPath::Get(aProgram, progBuf);
NS_ENSURE_SUCCESS(rv, false);
int len = GetDirnameSlash(progBuf, aOutPath, aMaxLen);
NS_ENSURE_TRUE(!!len, false);
NS_ENSURE_TRUE((len + sizeof(XPCOM_DLL)) < aMaxLen, false);
char *afterSlash = aOutPath + len;
strcpy(afterSlash, XPCOM_DLL);
return true;
}
static bool
LoadLibxul(const char *aXPCOMPath)
{
nsresult rv;
XPCOMGlueEnablePreload();
rv = XPCOMGlueStartup(aXPCOMPath);
NS_ENSURE_SUCCESS(rv, false);
rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
NS_ENSURE_SUCCESS(rv, false);
return true;
}
/**
* Return true if |arg| matches the given argument name.
*/
static bool
IsArg(const char* arg, const char* s)
{
if (*arg == '-') {
if (*++arg == '-') {
++arg;
}
return !strcasecmp(arg, s);
}
#if defined(XP_WIN)
if (*arg == '/') {
return !strcasecmp(++arg, s);
}
#endif
return false;
}
static already_AddRefed<nsIFile>
GetAppIni(int argc, const char *argv[])
{
nsCOMPtr<nsIFile> appini;
nsresult rv;
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
// Note that -app must be the *first* argument.
const char *appDataFile = getenv("XUL_APP_FILE");
if (appDataFile && *appDataFile) {
rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
NS_ENSURE_SUCCESS(rv, nullptr);
} else if (argc > 1 && IsArg(argv[1], "app")) {
if (argc == 2) {
return nullptr;
}
rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(appini));
NS_ENSURE_SUCCESS(rv, nullptr);
char appEnv[MAXPATHLEN];
snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
if (putenv(appEnv)) {
return nullptr;
}
}
return appini.forget();
}
static bool
LoadStaticData(int argc, const char *argv[])
{
char xpcomPath[MAXPATHLEN];
bool ok = GetXPCOMPath(argv[0], xpcomPath, MAXPATHLEN);
NS_ENSURE_TRUE(ok, false);
ok = LoadLibxul(xpcomPath);
NS_ENSURE_TRUE(ok, false);
char progDir[MAXPATHLEN];
ok = GetDirnameSlash(xpcomPath, progDir, MAXPATHLEN);
NS_ENSURE_TRUE(ok, false);
nsCOMPtr<nsIFile> appini = GetAppIni(argc, argv);
const nsXREAppData *appData;
if (appini) {
nsresult rv =
XRE_CreateAppData(appini, const_cast<nsXREAppData**>(&appData));
NS_ENSURE_SUCCESS(rv, false);
} else {
appData = &sAppData;
}
XRE_ProcLoaderPreload(progDir, appData);
if (appini) {
XRE_FreeAppData(const_cast<nsXREAppData*>(appData));
}
return true;
}
/**
* Fork and run parent and child process.
*
* The parent is the b2g process and child for Nuwa.
*/
static int
RunProcesses(int argc, const char *argv[])
{
/*
* The original main() of the b2g process. It is renamed to
* b2g_main() for the b2g loader.
*/
int b2g_main(int argc, const char *argv[]);
int ipcSockets[2] = {-1, -1};
int r = socketpair(AF_LOCAL, SOCK_STREAM, 0, ipcSockets);
ASSERT(r == 0);
int parentSock = ipcSockets[0];
int childSock = ipcSockets[1];
r = fcntl(parentSock, F_SETFL, O_NONBLOCK);
ASSERT(r != -1);
r = fcntl(childSock, F_SETFL, O_NONBLOCK);
ASSERT(r != -1);
pid_t pid = fork();
ASSERT(pid >= 0);
bool isChildProcess = pid == 0;
close(isChildProcess ? parentSock : childSock);
if (isChildProcess) {
/* The Nuwa process */
/* This provides the IPC service of loading Nuwa at the process.
* The b2g process would send a IPC message of loading Nuwa
* as the replacement of forking and executing plugin-container.
*/
return XRE_ProcLoaderServiceRun(getppid(), childSock, argc, argv);
}
// The b2g process
int childPid = pid;
XRE_ProcLoaderClientInit(childPid, parentSock);
return b2g_main(argc, argv);
}
/**
* B2G Loader is responsible for loading the b2g process and the
* Nuwa process. It forks into the parent process, for the b2g
* process, and the child process, for the Nuwa process.
*
* The loader loads libxul and performs initialization of static data
* before forking, so relocation of libxul and static data can be
* shared between the b2g process, the Nuwa process, and the content
* processes.
*/
int
main(int argc, const char* argv[])
{
const char *program = argv[0];
/*
* Before fork(), libxul and static data of Gecko are loaded for
* sharing.
*/
bool ok = LoadStaticData(argc, argv);
if (!ok) {
return 255;
}
return RunProcesses(argc, argv);
}

View File

@ -9,11 +9,6 @@ if not CONFIG['LIBXUL_SDK']:
PROGRAM = CONFIG['MOZ_APP_NAME'] + "-bin"
else:
PROGRAM = CONFIG['MOZ_APP_NAME']
if CONFIG['MOZ_B2G_LOADER']:
SOURCES += [
'B2GLoader.cpp',
]
SOURCES += [
'nsBrowserApp.cpp',
]

View File

@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "nsCOMPtr.h"
#include "nsIFile.h"
@ -164,22 +163,9 @@ static int do_main(int argc, char* argv[])
return XRE_main(argc, argv, &sAppData, 0);
}
#ifdef MOZ_B2G_LOADER
/*
* The main() in B2GLoader.cpp is the new main function instead of the
* main() here if it is enabled. So, rename it to b2g_man().
*/
#define main b2g_main
#define _CONST const
#else
#define _CONST
#endif
int main(int argc, _CONST char* argv[])
int main(int argc, char* argv[])
{
#ifndef MOZ_B2G_LOADER
char exePath[MAXPATHLEN];
#endif
#ifdef MOZ_WIDGET_GONK
// This creates a ThreadPool for binder ipc. A ThreadPool is necessary to
@ -189,9 +175,7 @@ int main(int argc, _CONST char* argv[])
android::ProcessState::self()->startThreadPool();
#endif
nsresult rv;
#ifndef MOZ_B2G_LOADER
rv = mozilla::BinaryPath::Get(argv[0], exePath);
nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
if (NS_FAILED(rv)) {
Output("Couldn't calculate the application directory.\n");
return 255;
@ -202,7 +186,6 @@ int main(int argc, _CONST char* argv[])
return 255;
strcpy(++lastSlash, XPCOM_DLL);
#endif // MOZ_B2G_LOADER
#if defined(XP_UNIX)
// If the b2g app is launched from adb shell, then the shell will wind
@ -226,9 +209,6 @@ int main(int argc, _CONST char* argv[])
DllBlocklist_Initialize();
#endif
// B2G loader has already initialized Gecko so we can't initialize
// it again here.
#ifndef MOZ_B2G_LOADER
// We do this because of data in bug 771745
XPCOMGlueEnablePreload();
@ -239,7 +219,6 @@ int main(int argc, _CONST char* argv[])
}
// Reset exePath so that it is the directory name and not the xpcom dll name
*lastSlash = 0;
#endif // MOZ_B2G_LOADER
rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
if (NS_FAILED(rv)) {
@ -274,25 +253,7 @@ int main(int argc, _CONST char* argv[])
int result;
{
ScopedLogging log;
char **_argv;
/*
* Duplicate argument vector to conform non-const argv of
* do_main() since XRE_main() is very stupid with non-const argv.
*/
_argv = new char *[argc + 1];
for (int i = 0; i < argc; i++) {
_argv[i] = strdup(argv[i]);
MOZ_ASSERT(_argv[i] != nullptr);
}
_argv[argc] = nullptr;
result = do_main(argc, _argv);
for (int i = 0; i < argc; i++) {
free(_argv[i]);
}
delete[] _argv;
result = do_main(argc, argv);
}
return result;

View File

@ -59,7 +59,6 @@ MOZ_B2G=1
if test "$OS_TARGET" = "Android"; then
MOZ_NUWA_PROCESS=1
MOZ_B2G_LOADER=1
fi
MOZ_FOLD_LIBS=1

View File

@ -14,6 +14,3 @@ ifdef MOZ_MAINTENANCE_SERVICE
$(MAKE) -C installer/windows maintenanceservice_installer
endif
endif
check::
$(PYTHON) $(topsrcdir)/build/compare-mozconfig/compare-mozconfigs-wrapper.py

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += [
DIRS += [
'content',
]

View File

@ -15,19 +15,27 @@
body {
margin: 0;
padding: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans;
font-size: 14px;
font-family: "Lucida Grande", sans-serif;
font-size: 12px;
background: #fbfbfb;
}
button {
font-size: .9em; /* for some reason, text is larger within <button> */
/* Resetting default <button> font properties; eg. strangely enough, FF mac
wants to use Helvetica/12px whatever we define for parent elements */
font-family: "Lucida Grande", sans-serif;
font-size: 1em;
}
img {
border: none;
}
h1, h2, h3 {
font-family: "Open Sans", sans-serif;
color: #666;
}
/* Helpers */
/**
@ -73,14 +81,24 @@ img {
border: none;
color: #fff;
text-decoration: none;
height: 26px;
padding: 0 0.5em;
padding: .3em .6em;
border: 1px solid transparent;
border-radius: 2px;
cursor: pointer;
font-size: .9em;
text-align: center;
}
button.btn {
/* for some reason, buttons respond differently to setting padding than
regular links */
padding: .3em .3em .3em .5em;
}
.btn-large {
padding: .4em 1.6em;
}
.btn-info {
background-color: #0096dd;
border: 1px solid #0095dd;
@ -310,3 +328,39 @@ img {
.linux h1 {
font-family: 'Ubuntu Bold';
}
/* Web panel */
.info-panel {
border-radius: 4px;
background: #fff;
padding: 20px 0;
border: 1px solid #e7e7e7;
box-shadow: 0 2px 0 rgba(0, 0, 0, .03);
margin-bottom: 25px;
}
.info-panel h1 {
font-size: 1.2em;
font-weight: 700;
padding: 20px 0;
text-align: center;
margin: 0;
}
.info-panel h4 {
color: #aaa;
text-align: center;
font-weight: 300;
margin: 0;
}
/* Logos */
.firefox-logo {
background: transparent url(../img/firefox-logo.png) no-repeat center center;
background-size: contain;
width: 100px;
height: 100px;
margin: 0px auto; /* horizontal block centering */
}

View File

@ -194,6 +194,24 @@
font-weight: normal;
}
/* Expired call url page */
.expired-url-info {
width: 400px;
margin: 0 auto;
}
.promote-firefox {
text-align: center;
font-size: 18px;
line-height: 24px;
margin: 2em 0;
}
.promote-firefox h3 {
font-weight: 300;
}
/* Block incoming call */
.native-dropdown-menu {

View File

@ -3,10 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Panel styles */
body {
font-size: 12px;
}
.panel {
/* XXX the Social API panel behaves weirdly on inner element size changes,
adding unwanted scrollbars; quickfix is to hide these for now. */

View File

@ -17,7 +17,10 @@
width: 600px;
margin: 1em auto;
background: #fff;
font-family: Helvetica, Arial, sans;
font-size: 12px;
}
h2 {
margin-top: 3em;
}
</style>
</head>
@ -102,8 +105,8 @@
<div class="conversation">
<ul class="controls">
<li><button class="btn btn-hangup" title="Hangup"></button></li>
<li><button class="btn media-control btn-mute-video streaming" title="Mute video"></button></li>
<li><button class="btn media-control btn-mute-audio" title="Mute audio"></button></li>
<li><button class="btn media-control local-media btn-mute-video" title="Mute video"></button></li>
<li><button class="btn media-control local-media btn-mute-audio" title="Mute audio"></button></li>
</ul>
<div class="media nested">
<div class="remote_wrapper">
@ -119,8 +122,8 @@
<div class="conversation">
<ul class="controls">
<li><button class="btn btn-hangup" title="Hangup"></button></li>
<li><button class="btn media-control btn-mute-video streaming" title="Mute video"></button></li>
<li><button class="btn media-control btn-mute-audio" title="Mute audio"></button></li>
<li><button class="btn media-control local-media btn-mute-video" title="Mute video"></button></li>
<li><button class="btn media-control local-media btn-mute-audio" title="Mute audio"></button></li>
</ul>
<div class="media nested">
<div class="remote_wrapper">
@ -150,8 +153,8 @@
<div class="conversation">
<ul class="controls">
<li><button class="btn btn-hangup" title="Hangup"></button></li>
<li><button class="btn media-control btn-mute-video" title="Mute video"></button></li>
<li><button class="btn media-control btn-mute-audio" title="Mute audio"></button></li>
<li><button class="btn media-control local-media btn-mute-video" title="Mute video"></button></li>
<li><button class="btn media-control local-media btn-mute-audio" title="Mute audio"></button></li>
</ul>
</div>
</div>
@ -162,8 +165,8 @@
<div class="conversation">
<ul class="controls">
<li><button class="btn btn-hangup" title="Hangup"></button></li>
<li><button class="btn media-control btn-mute-video" title="Mute video"></button></li>
<li><button class="btn media-control btn-mute-audio muted" title="Mute audio"></button></li>
<li><button class="btn media-control local-media btn-mute-video" title="Mute video"></button></li>
<li><button class="btn media-control local-media btn-mute-audio muted" title="Mute audio"></button></li>
</ul>
</div>
</div>
@ -174,33 +177,25 @@
<div class="conversation">
<ul class="controls">
<li><button class="btn btn-hangup" title="Hangup"></button></li>
<li><button class="btn media-control btn-mute-video muted" title="Mute video"></button></li>
<li><button class="btn media-control btn-mute-audio" title="Mute audio"></button></li>
<li><button class="btn media-control local-media btn-mute-video muted" title="Mute video"></button></li>
<li><button class="btn media-control local-media btn-mute-audio" title="Mute audio"></button></li>
</ul>
</div>
</div>
<h3>Local audio streaming</h3>
<h2>Expired call url view</h2>
<div style="width: 204px; min-height: 26px">
<div class="conversation">
<ul class="controls">
<li><button class="btn btn-hangup" title="Hangup"></button></li>
<li><button class="btn media-control btn-mute-video" title="Mute video"></button></li>
<li><button class="btn media-control btn-mute-audio streaming" title="Mute audio"></button></li>
</ul>
<div class="expired-url-info">
<div class="info-panel">
<div class="firefox-logo"></div>
<h1 >Oops!</h1>
<h4 >This URL is unavailable.</h4>
</div>
</div>
<h3>Local video streaming</h3>
<div style="width: 204px; min-height: 26px">
<div class="conversation">
<ul class="controls">
<li><button class="btn btn-hangup" title="Hangup"></button></li>
<li><button class="btn media-control btn-mute-video streaming" title="Mute video"></button></li>
<li><button class="btn media-control btn-mute-audio" title="Mute audio"></button></li>
</ul>
<div class="promote-firefox">
<h3>Download Firefox to make free audio and video calls!</h3>
<p>
<a class="btn btn-large btn-success" href="https://www.mozilla.org/firefox/" data-reactid=".0.1.1.0">Get Firefox</a>
</p>
</div>
</div>
@ -230,6 +225,16 @@
<button class="btn btn-error">error</button>
</p>
<h3>Large buttons</h3>
<p>
<a class="btn btn-large">default</a>
<a class="btn btn-large btn-info">info</a>
<a class="btn btn-large btn-success">success</a>
<a class="btn btn-large btn-warning">warning</a>
<a class="btn btn-large btn-error">error</a>
</p>
<h2>Alerts</h2>
<div class="alert alert-error">
@ -242,6 +247,12 @@
<p class="message">Oops! This is a warning.</p>
</div>
<h2>Logos</h2>
<h3>Centered Firefox logo</h3>
<div class="firefox-logo"></div>
<h2>Incoming call</h2>
<div class="incoming-call">

View File

@ -32,15 +32,51 @@ loop.webapp = (function($, _, OT, webL10n) {
template: _.template('<p data-l10n-id="welcome"></p>')
});
/**
* Firefox promotion interstitial. Will display only to non-Firefox users.
*/
var PromoteFirefoxView = React.createClass({displayName: 'PromoteFirefoxView',
propTypes: {
helper: React.PropTypes.object.isRequired
},
render: function() {
if (this.props.helper.isFirefox(navigator.userAgent)) {
return React.DOM.div(null );
}
return (
React.DOM.div( {className:"promote-firefox"},
React.DOM.h3(null, __("promote_firefox_hello_heading")),
React.DOM.p(null,
React.DOM.a( {className:"btn btn-large btn-success",
href:"https://www.mozilla.org/firefox/"},
__("get_firefox_button")
)
)
)
);
}
});
/**
* Expired call URL view.
*/
var CallUrlExpiredView = React.createClass({displayName: 'CallUrlExpiredView',
propTypes: {
helper: React.PropTypes.object.isRequired
},
render: function() {
/* jshint ignore:start */
return (
// XXX proper UX/design should be implemented here (see bug 1000131)
React.DOM.div(null, __("call_url_unavailable_notification"))
React.DOM.div( {className:"expired-url-info"},
React.DOM.div( {className:"info-panel"},
React.DOM.div( {className:"firefox-logo"} ),
React.DOM.h1(null, __("call_url_unavailable_notification_heading")),
React.DOM.h4(null, __("call_url_unavailable_notification_message"))
),
PromoteFirefoxView( {helper:this.props.helper} )
)
);
/* jshint ignore:end */
}
@ -135,7 +171,12 @@ loop.webapp = (function($, _, OT, webL10n) {
"call/:token": "initiate"
},
initialize: function() {
initialize: function(options) {
this.helper = options.helper;
if (!this.helper) {
throw new Error("WebappRouter requires an helper object");
}
// Load default view
this.loadView(new HomeView());
@ -193,7 +234,7 @@ loop.webapp = (function($, _, OT, webL10n) {
},
expired: function() {
this.loadReactComponent(CallUrlExpiredView());
this.loadReactComponent(CallUrlExpiredView({helper: this.helper}));
},
/**
@ -238,8 +279,14 @@ loop.webapp = (function($, _, OT, webL10n) {
this._iOSRegex = /^(iPad|iPhone|iPod)/;
}
WebappHelper.prototype.isIOS = function isIOS(platform) {
return this._iOSRegex.test(platform);
WebappHelper.prototype = {
isFirefox: function(platform) {
return platform.indexOf("Firefox") !== -1;
},
isIOS: function(platform) {
return this._iOSRegex.test(platform);
}
};
/**
@ -248,6 +295,7 @@ loop.webapp = (function($, _, OT, webL10n) {
function init() {
var helper = new WebappHelper();
router = new WebappRouter({
helper: helper,
notifier: new sharedViews.NotificationListView({el: "#messages"}),
conversation: new sharedModels.ConversationModel({}, {
sdk: OT,
@ -267,8 +315,9 @@ loop.webapp = (function($, _, OT, webL10n) {
CallUrlExpiredView: CallUrlExpiredView,
ConversationFormView: ConversationFormView,
HomeView: HomeView,
WebappHelper: WebappHelper,
init: init,
PromoteFirefoxView: PromoteFirefoxView,
WebappHelper: WebappHelper,
WebappRouter: WebappRouter
};
})(jQuery, _, window.OT, document.webL10n);

View File

@ -32,15 +32,51 @@ loop.webapp = (function($, _, OT, webL10n) {
template: _.template('<p data-l10n-id="welcome"></p>')
});
/**
* Firefox promotion interstitial. Will display only to non-Firefox users.
*/
var PromoteFirefoxView = React.createClass({
propTypes: {
helper: React.PropTypes.object.isRequired
},
render: function() {
if (this.props.helper.isFirefox(navigator.userAgent)) {
return <div />;
}
return (
<div className="promote-firefox">
<h3>{__("promote_firefox_hello_heading")}</h3>
<p>
<a className="btn btn-large btn-success"
href="https://www.mozilla.org/firefox/">
{__("get_firefox_button")}
</a>
</p>
</div>
);
}
});
/**
* Expired call URL view.
*/
var CallUrlExpiredView = React.createClass({
propTypes: {
helper: React.PropTypes.object.isRequired
},
render: function() {
/* jshint ignore:start */
return (
// XXX proper UX/design should be implemented here (see bug 1000131)
<div>{__("call_url_unavailable_notification")}</div>
<div className="expired-url-info">
<div className="info-panel">
<div className="firefox-logo" />
<h1>{__("call_url_unavailable_notification_heading")}</h1>
<h4>{__("call_url_unavailable_notification_message")}</h4>
</div>
<PromoteFirefoxView helper={this.props.helper} />
</div>
);
/* jshint ignore:end */
}
@ -135,7 +171,12 @@ loop.webapp = (function($, _, OT, webL10n) {
"call/:token": "initiate"
},
initialize: function() {
initialize: function(options) {
this.helper = options.helper;
if (!this.helper) {
throw new Error("WebappRouter requires an helper object");
}
// Load default view
this.loadView(new HomeView());
@ -193,7 +234,7 @@ loop.webapp = (function($, _, OT, webL10n) {
},
expired: function() {
this.loadReactComponent(CallUrlExpiredView());
this.loadReactComponent(CallUrlExpiredView({helper: this.helper}));
},
/**
@ -238,8 +279,14 @@ loop.webapp = (function($, _, OT, webL10n) {
this._iOSRegex = /^(iPad|iPhone|iPod)/;
}
WebappHelper.prototype.isIOS = function isIOS(platform) {
return this._iOSRegex.test(platform);
WebappHelper.prototype = {
isFirefox: function(platform) {
return platform.indexOf("Firefox") !== -1;
},
isIOS: function(platform) {
return this._iOSRegex.test(platform);
}
};
/**
@ -248,6 +295,7 @@ loop.webapp = (function($, _, OT, webL10n) {
function init() {
var helper = new WebappHelper();
router = new WebappRouter({
helper: helper,
notifier: new sharedViews.NotificationListView({el: "#messages"}),
conversation: new sharedModels.ConversationModel({}, {
sdk: OT,
@ -267,8 +315,9 @@ loop.webapp = (function($, _, OT, webL10n) {
CallUrlExpiredView: CallUrlExpiredView,
ConversationFormView: ConversationFormView,
HomeView: HomeView,
WebappHelper: WebappHelper,
init: init,
PromoteFirefoxView: PromoteFirefoxView,
WebappHelper: WebappHelper,
WebappRouter: WebappRouter
};
})(jQuery, _, window.OT, document.webL10n);

View File

@ -19,7 +19,10 @@ incompatible_device=Incompatible device
sorry_device_unsupported=Sorry, Loop does not currently support your device.
use_firefox_windows_mac_linux=Please open this page using the latest Firefox on Windows, Android, Mac or Linux.
connection_error_see_console_notification=Call failed; see console for details.
call_url_unavailable_notification=This URL is unavailable.
call_url_unavailable_notification_heading=Oops!
call_url_unavailable_notification_message=This URL is unavailable.
promote_firefox_hello_heading=Download Firefox to make free audio and video calls!
get_firefox_button=Get Firefox
[fr]
call_has_ended=L'appel est terminé.
@ -41,4 +44,7 @@ use_latest_firefox.innerHTML=Veuillez essayer ce lien dans un navigateur accepta
incompatible_device=Plateforme non supportée
sorry_device_unsupported=Désolé, Loop ne fonctionne actuellement pas sur votre appareil.
use_firefox_windows_mac_linux=Merci d'ouvrir cette page avec une version récente de Firefox pour Windows, Android, Mac ou Linux.
call_url_unavailable_notification=Cette URL n'est pas disponible.
call_url_unavailable_notification_heading=Oups !
call_url_unavailable_notification_message=Cette URL n'est pas disponible.
promote_firefox_hello_heading=Téléchargez Firefox pour passer des appels audio et vidéo gratuitement !
get_firefox_button=Téléchargez Firefox

View File

@ -5,6 +5,7 @@
/* global loop, sinon */
var expect = chai.expect;
var TestUtils = React.addons.TestUtils;
describe("loop.webapp", function() {
"use strict";
@ -76,6 +77,7 @@ describe("loop.webapp", function() {
pendingCallTimeout: 1000
});
router = new loop.webapp.WebappRouter({
helper: {},
conversation: conversation,
notifier: notifier
});
@ -359,6 +361,26 @@ describe("loop.webapp", function() {
});
});
describe("PromoteFirefoxView", function() {
describe("#render", function() {
it("should not render when using Firefox", function() {
var comp = TestUtils.renderIntoDocument(loop.webapp.PromoteFirefoxView({
helper: {isFirefox: function() { return true; }}
}));
expect(comp.getDOMNode().querySelectorAll("h3").length).eql(0);
});
it("should render when not using Firefox", function() {
var comp = TestUtils.renderIntoDocument(loop.webapp.PromoteFirefoxView({
helper: {isFirefox: function() { return false; }}
}));
expect(comp.getDOMNode().querySelectorAll("h3").length).eql(1);
});
});
});
describe("WebappHelper", function() {
var helper;
@ -378,5 +400,18 @@ describe("loop.webapp", function() {
expect(helper.isIOS("MacIntel")).eql(false);
});
});
describe("#isFirefox", function() {
it("should detect Firefox", function() {
expect(helper.isFirefox("Firefox")).eql(true);
expect(helper.isFirefox("Gecko/Firefox")).eql(true);
expect(helper.isFirefox("Firefox/Gecko")).eql(true);
expect(helper.isFirefox("Gecko/Firefox/Chuck Norris")).eql(true);
});
it("shouldn't detect Firefox with other platforms", function() {
expect(helper.isFirefox("Opera")).eql(false);
});
});
});
});

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += [
DIRS += [
'about',
'customizableui',
'dirprovider',

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += ['in-content']
DIRS += ['in-content']
BROWSER_CHROME_MANIFESTS += [
'in-content/tests/browser.ini',

View File

@ -9,4 +9,6 @@ ac_add_options --enable-update-packaging
export MOZILLA_OFFICIAL=1
ac_add_options --disable-stdcxx-compat
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -9,4 +9,6 @@ ac_add_options --enable-update-packaging
export MOZILLA_OFFICIAL=1
ac_add_options --disable-stdcxx-compat
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += [
DIRS += [
'content',
'components',
'themes',

View File

@ -6,7 +6,7 @@
CONFIGURE_SUBST_FILES += ['installer/Makefile']
PARALLEL_DIRS += [
DIRS += [
'base',
'components',
'experiments',

View File

@ -44,3 +44,7 @@ for var in ('MOZ_CRASHREPORTER', 'MOZ_PROFILE_MIGRATOR',
if CONFIG[var]:
DEFINES[var] = True
if CONFIG['MOZ_BUILD_APP'] == 'browser':
PYTHON_UNIT_TESTS += [
'compare-mozconfig/compare-mozconfigs-wrapper.py',
]

View File

@ -16,6 +16,10 @@ endif
include $(topsrcdir)/config/config.mk
# L10n jobs are doing make -C config manually before anything else,
# and need nsinstall to be built as a consequence.
export:: host
ifneq (WINNT,$(HOST_OS_ARCH))
ifdef COMPILE_ENVIRONMENT
# Ensure nsinstall is atomically created
@ -39,8 +43,6 @@ HEADERS_TARGET := export
INSTALL_TARGETS += HEADERS
endif
PYTHON_UNIT_TESTS := $(wildcard $(srcdir)/tests/unit-*.py)
include $(topsrcdir)/config/rules.mk
HOST_CFLAGS += -DUNICODE -D_UNICODE

View File

@ -65,6 +65,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
NO_DIST_INSTALL \
PARALLEL_DIRS \
PROGRAM \
PYTHON_UNIT_TESTS \
RESOURCE_FILES \
SDK_HEADERS \
SDK_LIBRARY \
@ -757,8 +758,8 @@ CREATE_PRECOMPLETE_CMD = $(PYTHON) $(abspath $(topsrcdir)/config/createprecomple
# MDDEPDIR is the subdirectory where dependency files are stored
MDDEPDIR := .deps
EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/expandlibs_exec.py $(if $@,--depend $(MDDEPDIR)/$@.pp --target $@)
EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/expandlibs_gen.py $(if $@,--depend $(MDDEPDIR)/$@.pp)
EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/expandlibs_exec.py
EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/expandlibs_gen.py
EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)

View File

@ -133,13 +133,5 @@ class ExpandArgs(list):
return objs
return [arg]
class ExpandLibsDeps(ExpandArgs):
'''Same as ExpandArgs, but also adds the library descriptor to the list'''
def _expand_desc(self, arg):
objs = super(ExpandLibsDeps, self)._expand_desc(arg)
if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
objs += [relativize(arg + conf.LIBS_DESC_SUFFIX)]
return objs
if __name__ == '__main__':
print " ".join(ExpandArgs(sys.argv[1:]))

View File

@ -28,8 +28,6 @@ from expandlibs import (
relativize,
isDynamicLib,
isObject,
ensureParentDir,
ExpandLibsDeps,
)
import expandlibs_config as conf
from optparse import OptionParser
@ -315,10 +313,6 @@ def print_command(out, args):
def main():
parser = OptionParser()
parser.add_option("--depend", dest="depend", metavar="FILE",
help="generate dependencies for the given execution and store it in the given file")
parser.add_option("--target", dest="target", metavar="FILE",
help="designate the target for dependencies")
parser.add_option("--extract", action="store_true", dest="extract",
help="when a library has no descriptor file, extract it first, when possible")
parser.add_option("--uselist", action="store_true", dest="uselist",
@ -330,15 +324,6 @@ def main():
(options, args) = parser.parse_args()
if not options.target:
options.depend = False
if options.depend:
deps = ExpandLibsDeps(args)
# Filter out common command wrappers
while os.path.basename(deps[0]) in ['ccache', 'distcc']:
deps.pop(0)
# Remove command
deps.pop(0)
with ExpandArgsMore(args) as args:
if options.extract:
args.extract()
@ -361,19 +346,6 @@ def main():
sys.stderr.flush()
if proc.returncode:
exit(proc.returncode)
if not options.depend:
return
ensureParentDir(options.depend)
mk = Makefile()
deps = [dep for dep in deps if os.path.isfile(dep) and dep != options.target
and os.path.abspath(dep) != os.path.abspath(options.depend)]
no_dynamic_lib = [dep for dep in deps if not isDynamicLib(dep)]
mk.create_rule([options.target]).add_dependencies(no_dynamic_lib)
if len(deps) != len(no_dynamic_lib):
mk.create_rule(['%s_order_only' % options.target]).add_dependencies(dep for dep in deps if isDynamicLib(dep))
with open(options.depend, 'w') as depfile:
mk.dump(depfile, removal_guard=True)
if __name__ == '__main__':
main()

View File

@ -9,7 +9,7 @@ from __future__ import with_statement
import sys
import os
import expandlibs_config as conf
from expandlibs import LibDescriptor, isObject, ensureParentDir, ExpandLibsDeps
from expandlibs import LibDescriptor, isObject, ensureParentDir
from optparse import OptionParser
def generate(args):
@ -29,8 +29,6 @@ def generate(args):
if __name__ == '__main__':
parser = OptionParser()
parser.add_option("--depend", dest="depend", metavar="FILE",
help="generate dependencies for the given execution and store it in the given file")
parser.add_option("-o", dest="output", metavar="FILE",
help="send output to the given file")
@ -41,10 +39,3 @@ if __name__ == '__main__':
ensureParentDir(options.output)
with open(options.output, 'w') as outfile:
print >>outfile, generate(args)
if options.depend:
ensureParentDir(options.depend)
with open(options.depend, 'w') as depfile:
deps = ExpandLibsDeps(args)
depfile.write("%s : %s\n" % (options.output, ' '.join(deps)))
for dep in deps:
depfile.write("%s :\n" % dep)

View File

@ -46,4 +46,4 @@ external_dirs += [
'media/libsoundtouch',
]
PARALLEL_DIRS += ['../../' + i for i in external_dirs]
DIRS += ['../../' + i for i in external_dirs]

View File

@ -51,19 +51,17 @@ ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $
SIMPLE_PROGRAMS \
LIBRARY \
SHARED_LIBRARY \
SHARED_LIBRARY_LIBS \
LIBS \
DEF_FILE \
IMPORT_LIBRARY \
STATIC_LIBS \
SHARED_LIBS \
EXTRA_DSO_LDOPTS \
DEPENDENT_LIBS \
)
@echo --------------------------------------------------------------------------------
endif
$(LOOP_OVER_PARALLEL_DIRS)
$(LOOP_OVER_DIRS)
$(LOOP_OVER_TOOL_DIRS)
showbuild:
$(call print_vars,\

View File

@ -5,10 +5,10 @@
# 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/.
binaries libs:: $(SUBMAKEFILES) $(TARGETS)
ifndef NO_DIST_INSTALL
ifdef SHARED_LIBRARY
ifdef IS_COMPONENT
target:: $(SUBMAKEFILES) $(SHARED_LIBRARY)
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
ifndef NO_COMPONENTS_MANIFEST
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/components.manifest')
@ -23,7 +23,7 @@ ifndef NO_DIST_INSTALL
ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
PROGRAMS_EXECUTABLES = $(SIMPLE_PROGRAMS) $(PROGRAM)
PROGRAMS_DEST ?= $(FINAL_TARGET)
PROGRAMS_TARGET := binaries libs target
PROGRAMS_TARGET := target
INSTALL_TARGETS += PROGRAMS
endif
@ -34,7 +34,7 @@ $(error Shipping static component libs makes no sense.)
else
DIST_LIBRARY_FILES = $(LIBRARY)
DIST_LIBRARY_DEST ?= $(DIST)/lib
DIST_LIBRARY_TARGET = binaries libs target
DIST_LIBRARY_TARGET = target
INSTALL_TARGETS += DIST_LIBRARY
endif
endif # DIST_INSTALL
@ -45,7 +45,7 @@ ifdef SHARED_LIBRARY
ifndef IS_COMPONENT
SHARED_LIBRARY_FILES = $(SHARED_LIBRARY)
SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)
SHARED_LIBRARY_TARGET = binaries libs target
SHARED_LIBRARY_TARGET = target
INSTALL_TARGETS += SHARED_LIBRARY
ifneq (,$(filter WINNT,$(OS_ARCH)))
@ -57,7 +57,7 @@ IMPORT_LIB_FILES = $(SHARED_LIBRARY)
endif
IMPORT_LIB_DEST ?= $(DIST)/lib
IMPORT_LIB_TARGET = binaries libs target
IMPORT_LIB_TARGET = target
ifdef IMPORT_LIB_FILES
INSTALL_TARGETS += IMPORT_LIB
endif
@ -68,30 +68,17 @@ endif # SHARED_LIBRARY
ifneq (,$(strip $(HOST_SIMPLE_PROGRAMS)$(HOST_PROGRAM)))
HOST_PROGRAMS_EXECUTABLES = $(HOST_SIMPLE_PROGRAMS) $(HOST_PROGRAM)
HOST_PROGRAMS_DEST ?= $(DIST)/host/bin
HOST_PROGRAMS_TARGET = binaries libs host
HOST_PROGRAMS_TARGET = host
INSTALL_TARGETS += HOST_PROGRAMS
endif
ifdef HOST_LIBRARY
HOST_LIBRARY_FILES = $(HOST_LIBRARY)
HOST_LIBRARY_DEST ?= $(DIST)/host/lib
HOST_LIBRARY_TARGET = binaries libs host
HOST_LIBRARY_TARGET = host
INSTALL_TARGETS += HOST_LIBRARY
endif
endif # !NO_DIST_INSTALL
BINARIES_INSTALL_TARGETS := $(foreach category,$(INSTALL_TARGETS),$(if $(filter binaries,$($(category)_TARGET)),$(category)))
# Fill a dependency file with all the binaries installed somewhere in $(DIST)
# and with dependencies on the relevant backend files.
BINARIES_PP := $(MDDEPDIR)/binaries.pp
$(BINARIES_PP): Makefile $(wildcard backend.mk) $(call mkdir_deps,$(MDDEPDIR))
@echo '$(strip $(foreach category,$(BINARIES_INSTALL_TARGETS),\
$(foreach file,$($(category)_FILES) $($(category)_EXECUTABLES),\
$($(category)_DEST)/$(notdir $(file)): $(file)%\
)\
))binaries: Makefile $(wildcard backend.mk)' | tr % '\n' > $@
# EOF

View File

@ -28,3 +28,10 @@ if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
if CONFIG['MOZ_SHARED_ICU']:
DEFINES['MOZ_SHARED_ICU'] = True
PYTHON_UNIT_TESTS += [
'tests/unit-expandlibs.py',
'tests/unit-mozunit.py',
'tests/unit-nsinstall.py',
'tests/unit-printprereleasesuffix.py',
]

View File

@ -33,8 +33,11 @@ clean distclean export::
$(MAKE) -C $(DEPTH)/nsprpub $@ $(EXTRA_MAKE_FLAGS)
target::
$(MAKE) -C $(DEPTH)/nsprpub libs $(EXTRA_MAKE_FLAGS)
$(MAKE) -C $(DEPTH)/nsprpub install prefix=$(ABS_DIST)/sdk exec_prefix=$(ABS_DIST)/sdk bindir=$(ABS_DIST)/sdk/dummy includedir=$(ABS_DIST)/include/nspr libdir=$(ABS_DIST)/sdk/lib datadir=$(ABS_DIST)/sdk/dummy DESTDIR= $(EXTRA_MAKE_FLAGS)
# nspr's libs and install rule re-export headers, and that can race with other
# compilations, so use a separate directory here. The headers are exported
# during export anyways.
$(MAKE) -C $(DEPTH)/nsprpub libs $(EXTRA_MAKE_FLAGS) dist_includedir=$(ABS_DIST)/nspr-include
$(MAKE) -C $(DEPTH)/nsprpub install prefix=$(ABS_DIST)/sdk exec_prefix=$(ABS_DIST)/sdk bindir=$(ABS_DIST)/sdk/dummy includedir=$(ABS_DIST)/nspr-include libdir=$(ABS_DIST)/sdk/lib datadir=$(ABS_DIST)/sdk/dummy DESTDIR= $(EXTRA_MAKE_FLAGS)
$(INSTALL) $(DEPTH)/nsprpub/config/nspr-config $(DIST)/sdk/bin
$(RM) -rf $(DIST)/sdk/dummy
ifneq (,$(filter WINNT,$(OS_ARCH))) # {

View File

@ -36,17 +36,21 @@ ifndef TIERS
BUILDSTATUS =
endif
# Main rules (export, compile, binaries, libs and tools) call recurse_* rules.
# Main rules (export, compile, libs and tools) call recurse_* rules.
# This wrapping is only really useful for build status.
compile binaries libs export tools::
compile libs export tools::
$(call BUILDSTATUS,TIER_START $@)
+$(MAKE) recurse_$@
$(call BUILDSTATUS,TIER_FINISH $@)
# Special rule that does install-manifests (cf. Makefile.in) + compile
binaries::
+$(MAKE) recurse_compile
# Carefully avoid $(eval) type of rule generation, which makes pymake slower
# than necessary.
# Get current tier and corresponding subtiers from the data in root.mk.
CURRENT_TIER := $(filter $(foreach tier,compile binaries libs export tools,recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
CURRENT_TIER := $(filter $(foreach tier,compile libs export tools,recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
ifneq (,$(filter-out 0 1,$(words $(CURRENT_TIER))))
$(error $(CURRENT_TIER) not supported on the same make command line)
endif
@ -71,11 +75,6 @@ endif
# TIERS (like for js/src).
CURRENT_DIRS := $($(CURRENT_TIER)_dirs)
ifneq (,$(filter binaries libs,$(CURRENT_TIER)))
WANT_STAMPS = 1
STAMP_TOUCH = $(TOUCH) $(@D)/binaries
endif
# The compile tier has different rules from other tiers.
ifeq ($(CURRENT_TIER),compile)
@ -91,16 +90,13 @@ else
# current tier.
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
$(call SUBMAKE,$(CURRENT_TIER),$*)
# Ensure existing stamps are up-to-date, but don't create one if submake didn't create one.
$(if $(wildcard $@),@$(STAMP_TOUCH))
ifndef STAMP_TOUCH
.PHONY: $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS))
endif
# Dummy rules for possibly inexisting dependencies for the above tier targets
$(addsuffix /Makefile,$(CURRENT_DIRS)) $(addsuffix /backend.mk,$(CURRENT_DIRS)):
ifeq ($(CURRENT_TIER),export)
# At least build/export requires config/export for buildid, but who knows what
# else, so keep this global dependency to make config/export first for now.
$(addsuffix /$(CURRENT_TIER),$(filter-out config,$(CURRENT_DIRS))): config/$(CURRENT_TIER)
@ -110,7 +106,6 @@ $(addsuffix /$(CURRENT_TIER),$(filter-out config,$(CURRENT_DIRS))): config/$(CUR
# is done with the config/host target. Note the config/host target only exists if
# nsinstall is actually built, which it is not on Windows, because we use
# nsinstall.py there.
ifeq ($(CURRENT_TIER),export)
ifneq (,$(filter config/host, $(compile_targets)))
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): config/host
@ -123,46 +118,12 @@ endif
endif # ifeq ($(CURRENT_TIER),compile)
ifdef COMPILE_ENVIRONMENT
# Disable dependency aggregation on PGO builds because of bug 934166.
ifeq (,$(MOZ_PGO)$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE))
ifneq (,$(filter libs binaries,$(CURRENT_TIER)))
# When doing a "libs" build, target_libs.mk ensures the interesting dependency data
# is available in the "binaries" stamp. Once recursion is done, aggregate all that
# dependency info so that stamps depend on relevant files and relevant other stamps.
# When doing a "binaries" build, the aggregate dependency file and those stamps are
# used and allow to skip recursing directories where changes are not going to require
# rebuild. A few directories, however, are still traversed all the time, mostly, the
# gyp managed ones and js/src.
# A few things that are not traversed by a "binaries" build, but should, in an ideal
# world, are nspr, nss, icu and ffi.
recurse_$(CURRENT_TIER):
@$(MAKE) binaries-deps
# Creating binaries-deps.mk directly would make us build it twice: once when beginning
# the build because of the include, and once at the end because of the stamps.
binaries-deps:
@$(call py_action,link_deps,-o $@.mk --group-by-depfile --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) --guard $(addprefix ',$(addsuffix ', $(wildcard $(addsuffix /binaries,$(CURRENT_DIRS))))))
@$(TOUCH) $@
ifeq (recurse_binaries,$(MAKECMDGOALS))
$(call include_deps,binaries-deps.mk)
endif
endif
DIST_GARBAGE += binaries-deps.mk binaries-deps
endif
endif
else
# Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above
ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
compile binaries libs export tools::
compile libs export tools::
else
#########################
@ -181,27 +142,14 @@ libs export tools::
else
define CREATE_SUBTIER_TRAVERSAL_RULE
PARALLEL_DIRS_$(1) = $$(addsuffix _$(1),$$(PARALLEL_DIRS))
.PHONY: $(1) $$(PARALLEL_DIRS_$(1))
ifdef PARALLEL_DIRS
$$(PARALLEL_DIRS_$(1)): %_$(1): %/Makefile
+@$$(call SUBMAKE,$(1),$$*)
endif
.PHONY: $(1)
$(1):: $$(SUBMAKEFILES)
ifdef PARALLEL_DIRS
+@$(MAKE) $$(PARALLEL_DIRS_$(1))
endif
$$(LOOP_OVER_DIRS)
endef
$(foreach subtier,export binaries libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
tools export:: $(SUBMAKEFILES)
$(LOOP_OVER_TOOL_DIRS)
$(foreach subtier,export libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
endif # ifdef TIERS
@ -209,32 +157,6 @@ endif # ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
endif # ifeq (.,$(DEPTH))
ifdef COMPILE_ENVIRONMENT
# Aggregate all dependency files relevant to a binaries build except in
# the mozilla top-level directory.
ifneq (.,$(DEPTH))
ALL_DEP_FILES := \
$(BINARIES_PP) \
$(addsuffix .pp,$(addprefix $(MDDEPDIR)/,$(sort \
$(TARGETS) \
$(filter-out $(SOBJS) $(ASOBJS) $(EXCLUDED_OBJS),$(OBJ_TARGETS)) \
))) \
$(NULL)
endif
binaries libs:: $(TARGETS) $(BINARIES_PP)
# Disable dependency aggregation on PGO builds because of bug 934166.
ifeq (,$(MOZ_PGO)$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE))
ifneq (.,$(DEPTH))
@$(if $^,$(call py_action,link_deps,-o binaries --group-all --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) $(ALL_DEP_FILES)))
endif
endif
endif
recurse:
@$(RECURSED_COMMAND)
$(LOOP_OVER_PARALLEL_DIRS)
$(LOOP_OVER_DIRS)
$(LOOP_OVER_TOOL_DIRS)

View File

@ -63,9 +63,8 @@ testxpcobjdir = $(DEPTH)/_tests/xpcshell
ifdef ENABLE_TESTS
# Add test directories to the regular directories list. TEST_DIRS should
# arguably have the same status as TOOL_DIRS and other *_DIRS variables. It is
# coded this way until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +="
# convention.
# arguably have the same status as other *_DIRS variables. It is coded this way
# until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +=" convention.
#
# The current developer workflow expects tests to be updated when processing
# the default target. If we ever change this implementation, the behavior
@ -83,12 +82,12 @@ ifdef COMPILE_ENVIRONMENT
# which stuff links.
SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS)
INCLUDES += -I$(DIST)/include/testing
LIBS += $(NSPR_LIBS)
EXTRA_LIBS += $(NSPR_LIBS)
ifndef MOZ_PROFILE_GENERATE
CPP_UNIT_TESTS_FILES = $(CPP_UNIT_TESTS)
CPP_UNIT_TESTS_DEST = $(DIST)/cppunittests
CPP_UNIT_TESTS_TARGET = binaries libs target
CPP_UNIT_TESTS_TARGET = target
INSTALL_TARGETS += CPP_UNIT_TESTS
endif
@ -235,7 +234,6 @@ endif
# Don't build SIMPLE_PROGRAMS during the MOZ_PROFILE_GENERATE pass
ifdef MOZ_PROFILE_GENERATE
EXCLUDED_OBJS := $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX))
SIMPLE_PROGRAMS :=
endif
@ -350,17 +348,6 @@ LOOP_OVER_DIRS = \
$(foreach dir,$(DIRS),$(call SUBMAKE,$@,$(dir)))
endif
# we only use this for the makefiles target and other stuff that doesn't matter
ifneq (,$(strip $(PARALLEL_DIRS)))
LOOP_OVER_PARALLEL_DIRS = \
$(foreach dir,$(PARALLEL_DIRS),$(call SUBMAKE,$@,$(dir)))
endif
ifneq (,$(strip $(TOOL_DIRS)))
LOOP_OVER_TOOL_DIRS = \
$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,$@,$(dir)))
endif
#
# Now we can differentiate between objects used to build a library, and
# objects used to build an executable in the same directory.
@ -578,11 +565,7 @@ everything::
$(MAKE) clean
$(MAKE) all
ifneq (,$(filter-out %.$(LIB_SUFFIX),$(SHARED_LIBRARY_LIBS)))
$(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only)
endif
HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
STATIC_LIBS_DEPS := $(addsuffix .$(LIBS_DESC_SUFFIX),$(STATIC_LIBS))
# Dependencies which, if modified, should cause everything to rebuild
GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
@ -600,13 +583,6 @@ target:: $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS)
include $(topsrcdir)/config/makefiles/target_binaries.mk
endif
ifdef IS_TOOL_DIR
# One would think "tools:: libs" would work, but it turns out that combined with
# bug 907365, this makes make forget to run some rules sometimes.
tools::
@$(MAKE) libs
endif
##############################################
ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE))
ifdef MOZ_PROFILE_USE
@ -677,7 +653,7 @@ clean clobber realclean clobber_all distclean::
-$(call SUBMAKE,$@,$(dir)))
else
clean clobber realclean clobber_all distclean::
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
$(foreach dir,$(DIRS),-$(call SUBMAKE,$@,$(dir)))
endif
distclean::
@ -696,11 +672,11 @@ alltags:
# PROGRAM = Foo
# creates OBJS, links with LIBS to create Foo
#
$(PROGRAM): $(PROGOBJS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
$(REPORT_BUILD)
@$(RM) $@.manifest
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
$(EXPAND_LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
$(EXPAND_LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(PROGOBJS) $(RESFILE) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS)
ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
if test -f '$(srcdir)/$@.manifest'; then \
@ -721,7 +697,7 @@ ifdef MOZ_PROFILE_GENERATE
touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
endif
else # !WINNT || GNU_CC
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE) $(STLPORT_LIBS)
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE) $(STLPORT_LIBS)
$(call CHECK_BINARY,$@)
endif # WINNT && !GNU_CC
@ -732,7 +708,7 @@ ifdef MOZ_POST_PROGRAM_COMMAND
$(MOZ_POST_PROGRAM_COMMAND) $@
endif
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD)
ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
$(EXPAND_LIBS_EXEC) -- $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
@ -766,10 +742,10 @@ endif
# SIMPLE_PROGRAMS = Foo Bar
# creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
#
$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(STATIC_LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD)
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
$(EXPAND_LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
$(EXPAND_LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS)
ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
@ -777,7 +753,7 @@ ifdef MSMANIFEST_TOOL
fi
endif # MSVC with manifest tool
else
$(EXPAND_CCC) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS) $(STLPORT_LIBS)
$(EXPAND_CCC) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS) $(STLPORT_LIBS)
$(call CHECK_BINARY,$@)
endif # WINNT && !GNU_CC
@ -788,7 +764,7 @@ ifdef MOZ_POST_PROGRAM_COMMAND
$(MOZ_POST_PROGRAM_COMMAND) $@
endif
$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD)
ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
$(EXPAND_LIBS_EXEC) -- $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
@ -803,19 +779,18 @@ endif
ifdef DTRACE_PROBE_OBJ
EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
OBJS += $(DTRACE_PROBE_OBJ)
EXCLUDED_OBJS += $(DTRACE_PROBE_OBJ)
endif
$(filter %.$(LIB_SUFFIX),$(LIBRARY)): $(OBJS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(filter %.$(LIB_SUFFIX),$(LIBRARY)): $(OBJS) $(STATIC_LIBS_DEPS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS)) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD)
$(RM) $(LIBRARY)
$(EXPAND_AR) $(AR_FLAGS) $(OBJS) $(SHARED_LIBRARY_LIBS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS))
$(EXPAND_AR) $(AR_FLAGS) $(OBJS) $(STATIC_LIBS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS))
$(filter-out %.$(LIB_SUFFIX),$(LIBRARY)): $(filter %.$(LIB_SUFFIX),$(LIBRARY)) $(OBJS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(filter-out %.$(LIB_SUFFIX),$(LIBRARY)): $(filter %.$(LIB_SUFFIX),$(LIBRARY)) $(OBJS) $(STATIC_LIBS_DEPS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS)) $(EXTRA_DEPS) $(GLOBAL_DEPS)
# When we only build a library descriptor, blow out any existing library
$(REPORT_BUILD)
$(if $(filter %.$(LIB_SUFFIX),$(LIBRARY)),,$(RM) $(REAL_LIBRARY))
$(EXPAND_LIBS_GEN) -o $@ $(OBJS) $(SHARED_LIBRARY_LIBS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS))
$(EXPAND_LIBS_GEN) -o $@ $(OBJS) $(STATIC_LIBS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS))
ifeq ($(OS_ARCH),WINNT)
# Import libraries are created by the rules creating shared libraries.
@ -850,7 +825,7 @@ endif
# symlinks back to the originals. The symlinks are a no-op for stabs debugging,
# so no need to conditionalize on OS version or debugging format.
$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(LIBRARY) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(STATIC_LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD)
ifndef INCREMENTAL_LINKER
$(RM) $@
@ -859,10 +834,10 @@ ifdef DTRACE_LIB_DEPENDENT
ifndef XP_MACOSX
dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
endif
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(EXTRA_LIBS) $(OS_LIBS) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(EXTRA_LIBS) $(OS_LIBS) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
@$(RM) $(DTRACE_PROBE_OBJ)
else # ! DTRACE_LIB_DEPENDENT
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(EXTRA_LIBS) $(OS_LIBS) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(EXTRA_LIBS) $(OS_LIBS) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
endif # DTRACE_LIB_DEPENDENT
$(call CHECK_BINARY,$@)
@ -1273,17 +1248,19 @@ ifneq (,$(SDK_LIBRARY))
ifndef NO_DIST_INSTALL
SDK_LIBRARY_FILES := $(SDK_LIBRARY)
SDK_LIBRARY_DEST := $(SDK_LIB_DIR)
SDK_LIBRARY_TARGET := binaries libs target
SDK_LIBRARY_TARGET := target
INSTALL_TARGETS += SDK_LIBRARY
endif
endif # SDK_LIBRARY
# SDK_BINARY is still used in various makefiles for non-products of the
# compilation, so we need to keep that running on the libs tier.
ifneq (,$(strip $(SDK_BINARY)))
ifndef NO_DIST_INSTALL
SDK_BINARY_FILES := $(SDK_BINARY)
SDK_BINARY_DEST := $(SDK_BIN_DIR)
# SDK_BINARY_TARGET is set in xpcom/idl-parser/Makefile.in
SDK_BINARY_TARGET ?= binaries libs target
SDK_BINARY_TARGET ?= libs target
INSTALL_TARGETS += SDK_BINARY
endif
endif # SDK_BINARY
@ -1293,9 +1270,7 @@ endif # SDK_BINARY
chrome::
$(MAKE) realchrome
$(LOOP_OVER_PARALLEL_DIRS)
$(LOOP_OVER_DIRS)
$(LOOP_OVER_TOOL_DIRS)
$(FINAL_TARGET)/chrome: $(call mkdir_deps,$(FINAL_TARGET)/chrome)
@ -1341,6 +1316,8 @@ DIST_FILES_FLAGS := $(XULAPP_DEFINES)
PP_TARGETS += DIST_FILES
endif
# When you move this out of the tools tier, please remove the corresponding
# hacks in recursivemake.py that check if Makefile.in sets the variable.
ifneq ($(XPI_PKGNAME),)
tools realchrome::
ifdef STRIP_XPI
@ -1376,6 +1353,7 @@ endif
cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
endif
# See comment above about moving this out of the tools tier.
ifdef INSTALL_EXTENSION_ID
ifndef XPI_NAME
$(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
@ -1401,7 +1379,7 @@ endif
# it.
ifneq (,$(filter-out all chrome default export realchrome clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
MDDEPEND_FILES := $(strip $(wildcard $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES) $(addsuffix .pp,$(notdir $(sort $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS))) $(TARGETS)))))
MDDEPEND_FILES := $(strip $(wildcard $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES) $(addsuffix .pp,$(notdir $(sort $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS)))))))
ifneq (,$(MDDEPEND_FILES))
$(call include_deps,$(MDDEPEND_FILES))
@ -1620,7 +1598,7 @@ endif
# Fake targets. Always run these rules, even if a file/directory with that
# name already exists.
#
.PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE
.PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) FORCE
# Used as a dependency to force targets to rebuild
FORCE:
@ -1632,7 +1610,6 @@ tags: TAGS
TAGS: $(CSRCS) $(CPPSRCS) $(wildcard *.h)
-etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
$(LOOP_OVER_PARALLEL_DIRS)
$(LOOP_OVER_DIRS)
ifndef INCLUDED_DEBUGMAKE_MK #{
@ -1648,9 +1625,7 @@ documentation:
ifdef ENABLE_TESTS
check::
$(LOOP_OVER_PARALLEL_DIRS)
$(LOOP_OVER_DIRS)
$(LOOP_OVER_TOOL_DIRS)
endif

View File

@ -36,7 +36,7 @@ config_unix = {
config = sys.modules['expandlibs_config'] = imp.new_module('expandlibs_config')
from expandlibs import LibDescriptor, ExpandArgs, relativize, ExpandLibsDeps
from expandlibs import LibDescriptor, ExpandArgs, relativize
from expandlibs_gen import generate
from expandlibs_exec import ExpandArgsMore, SectionFinder
@ -196,24 +196,6 @@ class TestExpandArgs(TestExpandInit):
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
class TestExpandLibsDeps(TestExpandInit):
def test_expandlibsdeps(self):
'''Test library expansion for dependencies'''
# Dependency list for a library with a descriptor is equivalent to
# the arguments expansion, to which we add each descriptor
args = self.arg_files + [self.tmpfile('liby', Lib('y'))]
self.assertRelEqual(ExpandLibsDeps(args), ExpandArgs(args) + [self.tmpfile('libx', Lib('x') + config.LIBS_DESC_SUFFIX), self.tmpfile('liby', Lib('y') + config.LIBS_DESC_SUFFIX)])
# When a library exists at the same time as a descriptor, the
# descriptor is not a dependency
self.touch([self.tmpfile('libx', Lib('x'))])
args = self.arg_files + [self.tmpfile('liby', Lib('y'))]
self.assertRelEqual(ExpandLibsDeps(args), ExpandArgs(args) + [self.tmpfile('liby', Lib('y') + config.LIBS_DESC_SUFFIX)])
self.touch([self.tmpfile('liby', Lib('y'))])
args = self.arg_files + [self.tmpfile('liby', Lib('y'))]
self.assertRelEqual(ExpandLibsDeps(args), ExpandArgs(args))
class TestExpandArgsMore(TestExpandInit):
def test_makelist(self):
'''Test grouping object files in lists'''

View File

@ -8631,14 +8631,6 @@ if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
AC_DEFINE(MOZ_NUWA_PROCESS)
fi
AC_SUBST(MOZ_NUWA_PROCESS)
if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
if test -z "$MOZ_NUWA_PROCESS"; then
AC_MSG_ERROR([B2G loader works with Nuwa]);
fi
export MOZ_B2G_LOADER
AC_DEFINE(MOZ_B2G_LOADER)
fi
AC_SUBST(MOZ_B2G_LOADER)
AC_SUBST(NSPR_CFLAGS)
AC_SUBST(NSPR_LIBS)

View File

@ -4,5 +4,5 @@
# 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/.
PARALLEL_DIRS += ['public', 'src']
TEST_TOOL_DIRS += ['test']
DIRS += ['public', 'src']
TEST_DIRS += ['test']

View File

@ -2313,7 +2313,7 @@ private:
class MOZ_STACK_CLASS nsAutoScriptBlocker {
public:
nsAutoScriptBlocker(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
explicit nsAutoScriptBlocker(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
nsContentUtils::AddScriptBlocker();
}

View File

@ -209,7 +209,7 @@ ImportLoader::Open()
nsIPrincipal* principal = Principal();
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_SCRIPT,
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_SUBDOCUMENT,
mURI,
principal,
mImportParent,

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_TOOL_DIRS += [
TEST_DIRS += [
'csp',
'websocket_hybi',
]

View File

@ -4,5 +4,5 @@
# 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/.
PARALLEL_DIRS += ['public', 'src']
DIRS += ['public', 'src']
TEST_DIRS += ['test']

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += ['public', 'src']
DIRS += ['public', 'src']
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

View File

@ -4,4 +4,4 @@
# 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/.
PARALLEL_DIRS += ['content', 'document']
DIRS += ['content', 'document']

View File

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
PARALLEL_DIRS += ['fmp4_muxer']
DIRS += ['fmp4_muxer']
EXPORTS += [
'ContainerWriter.h',

View File

@ -21,7 +21,7 @@ SOURCES += [
]
if CONFIG['MOZ_WMF']:
PARALLEL_DIRS += [ 'wmf' ];
DIRS += [ 'wmf' ];
if CONFIG['MOZ_FFMPEG']:
EXPORTS += [
@ -31,7 +31,7 @@ if CONFIG['MOZ_FFMPEG']:
'ffmpeg/FFmpegLog.cpp',
'ffmpeg/FFmpegRuntimeLinker.cpp',
]
PARALLEL_DIRS += [
DIRS += [
'ffmpeg/libav53',
'ffmpeg/libav54',
'ffmpeg/libav55',

View File

@ -42,6 +42,12 @@ GMPChild::~GMPChild()
{
}
void
GMPChild::CheckThread()
{
MOZ_ASSERT(mGMPMessageLoop == MessageLoop::current());
}
bool
GMPChild::Init(const std::string& aPluginPath,
base::ProcessHandle aParentProcessHandle,

View File

@ -7,13 +7,15 @@
#define GMPChild_h_
#include "mozilla/gmp/PGMPChild.h"
#include "GMPSharedMemManager.h"
#include "gmp-entrypoints.h"
#include "prlink.h"
namespace mozilla {
namespace gmp {
class GMPChild : public PGMPChild
class GMPChild : public PGMPChild,
public GMPSharedMem
{
public:
GMPChild();
@ -26,6 +28,9 @@ public:
bool LoadPluginLibrary(const std::string& aPluginPath);
MessageLoop* GMPMessageLoop();
// GMPSharedMem
virtual void CheckThread() MOZ_OVERRIDE;
private:
virtual PCrashReporterChild* AllocPCrashReporterChild(const NativeThreadId& aThread) MOZ_OVERRIDE;
virtual bool DeallocPCrashReporterChild(PCrashReporterChild*) MOZ_OVERRIDE;

View File

@ -52,7 +52,8 @@ namespace gmp {
GMPParent::GMPParent()
: mState(GMPStateNotLoaded)
, mProcess(nullptr)
, mDeleteProcessOnUnload(false)
, mDeleteProcessOnlyOnUnload(false)
, mAbnormalShutdownInProgress(false)
{
}
@ -62,12 +63,28 @@ GMPParent::~GMPParent()
MOZ_ASSERT(NS_IsMainThread());
}
void
GMPParent::CheckThread()
{
MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
}
nsresult
GMPParent::Init(nsIFile* aPluginDir)
GMPParent::CloneFrom(const GMPParent* aOther)
{
MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
MOZ_ASSERT(aOther->mDirectory && aOther->mService, "null plugin directory");
return Init(aOther->mService, aOther->mDirectory);
}
nsresult
GMPParent::Init(GeckoMediaPluginService *aService, nsIFile* aPluginDir)
{
MOZ_ASSERT(aPluginDir);
MOZ_ASSERT(aService);
MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
mService = aService;
mDirectory = aPluginDir;
nsAutoString leafname;
@ -111,6 +128,7 @@ GMPParent::LoadProcess()
mProcess = nullptr;
return NS_ERROR_FAILURE;
}
LOGD(("%s::%s: Created new process %p", __CLASS__, __FUNCTION__, (void *)mProcess));
}
mState = GMPStateLoaded;
@ -123,7 +141,7 @@ GMPParent::CloseIfUnused()
{
MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
if ((mDeleteProcessOnUnload ||
if ((mDeleteProcessOnlyOnUnload ||
mState == GMPStateLoaded ||
mState == GMPStateUnloading) &&
mVideoDecoders.IsEmpty() &&
@ -138,7 +156,7 @@ GMPParent::CloseActive(bool aDieWhenUnloaded)
{
LOGD(("%s::%s: %p state %d", __CLASS__, __FUNCTION__, this, mState));
if (aDieWhenUnloaded) {
mDeleteProcessOnUnload = true; // don't allow this to go back...
mDeleteProcessOnlyOnUnload = true; // don't allow this to go back...
}
if (mState == GMPStateLoaded) {
mState = GMPStateUnloading;
@ -171,19 +189,23 @@ GMPParent::Shutdown()
LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this));
MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
if (mAbnormalShutdownInProgress) {
return;
}
MOZ_ASSERT(mVideoDecoders.IsEmpty() && mVideoEncoders.IsEmpty());
if (mState == GMPStateNotLoaded || mState == GMPStateClosing) {
return;
}
// XXX Get rid of mDeleteProcessOnUnload and do this on all Shutdowns once
// Bug 1043671 is fixed (backout this patch)
if (mDeleteProcessOnUnload) {
mState = GMPStateClosing;
DeleteProcess();
} else {
mState = GMPStateNotLoaded;
}
mState = GMPStateClosing;
DeleteProcess();
// XXX Get rid of mDeleteProcessOnlyOnUnload and this code when
// Bug 1043671 is fixed
if (!mDeleteProcessOnlyOnUnload) {
// Destroy ourselves and rise from the fire to save memory
nsRefPtr<GMPParent> self(this);
mService->ReAddOnGMPThread(self);
} // else we've been asked to die and stay dead
MOZ_ASSERT(mState == GMPStateNotLoaded);
}
@ -191,8 +213,12 @@ void
GMPParent::DeleteProcess()
{
LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this));
// Don't Close() twice!
// Probably remove when bug 1043671 is resolved
MOZ_ASSERT(mState == GMPStateClosing);
Close();
mProcess->Delete();
LOGD(("%s::%s: Shut down process %p", __CLASS__, __FUNCTION__, (void *) mProcess));
mProcess = nullptr;
mState = GMPStateNotLoaded;
}
@ -276,6 +302,7 @@ GMPParent::State() const
}
#ifdef DEBUG
// Not changing to use mService since we'll be removing it
nsIThread*
GMPParent::GMPThread()
{
@ -447,11 +474,15 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
#endif
// warn us off trying to close again
mState = GMPStateClosing;
mAbnormalShutdownInProgress = true;
CloseActive(false);
// Normal Shutdown() will delete the process on unwind.
if (AbnormalShutdown == aWhy) {
NS_DispatchToCurrentThread(NS_NewRunnableMethod(this, &GMPParent::DeleteProcess));
mState = GMPStateClosing;
nsRefPtr<GMPParent> self(this);
// Note: final destruction will be Dispatched to ourself
mService->ReAddOnGMPThread(self);
}
}

View File

@ -7,6 +7,7 @@
#define GMPParent_h_
#include "GMPProcessParent.h"
#include "GMPService.h"
#include "GMPDecryptorParent.h"
#include "GMPVideoDecoderParent.h"
#include "GMPVideoEncoderParent.h"
@ -50,14 +51,17 @@ enum GMPState {
GMPStateClosing
};
class GMPParent MOZ_FINAL : public PGMPParent
class GMPParent MOZ_FINAL : public PGMPParent,
public GMPSharedMem
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(GMPParent)
GMPParent();
nsresult Init(nsIFile* aPluginDir);
nsresult Init(GeckoMediaPluginService *aService, nsIFile* aPluginDir);
nsresult CloneFrom(const GMPParent* aOther);
nsresult LoadProcess();
// Called internally to close this if we don't need it
@ -114,8 +118,12 @@ public:
return nsCOMPtr<nsIFile>(mDirectory).forget();
}
// GMPSharedMem
virtual void CheckThread() MOZ_OVERRIDE;
private:
~GMPParent();
nsRefPtr<GeckoMediaPluginService> mService;
bool EnsureProcessLoaded();
nsresult ReadGMPMetaData();
#ifdef MOZ_CRASHREPORTER
@ -144,7 +152,8 @@ private:
nsCString mVersion;
nsTArray<nsAutoPtr<GMPCapability>> mCapabilities;
GMPProcessParent* mProcess;
bool mDeleteProcessOnUnload;
bool mDeleteProcessOnlyOnUnload;
bool mAbnormalShutdownInProgress;
nsTArray<nsRefPtr<GMPVideoDecoderParent>> mVideoDecoders;
nsTArray<nsRefPtr<GMPVideoEncoderParent>> mVideoEncoders;

View File

@ -17,6 +17,7 @@
#include "nsIConsoleService.h"
#include "mozilla/unused.h"
#include "GMPDecryptorParent.h"
#include "runnable_utils.h"
namespace mozilla {
@ -41,6 +42,11 @@ GetGMPLog()
#define LOG(leve1, msg)
#endif
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPService"
namespace gmp {
static StaticRefPtr<GeckoMediaPluginService> sSingletonService;
@ -466,10 +472,39 @@ private:
nsRefPtr<GMPParent> mParent;
};
GMPParent*
GeckoMediaPluginService::ClonePlugin(const GMPParent* aOriginal)
{
MOZ_ASSERT(aOriginal);
// The GMPParent inherits from IToplevelProtocol, which must be created
// on the main thread to be threadsafe. See Bug 1035653.
nsRefPtr<CreateGMPParentTask> task(new CreateGMPParentTask());
if (!NS_IsMainThread()) {
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
MOZ_ASSERT(mainThread);
mozilla::SyncRunnable::DispatchToThread(mainThread, task);
}
nsRefPtr<GMPParent> gmp = task->GetParent();
nsresult rv = gmp->CloneFrom(aOriginal);
if (NS_FAILED(rv)) {
NS_WARNING("Can't Create GMPParent");
return nullptr;
}
MutexAutoLock lock(mMutex);
mPlugins.AppendElement(gmp);
return gmp.get();
}
void
GeckoMediaPluginService::AddOnGMPThread(const nsAString& aDirectory)
{
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
LOGD(("%s::%s: %s", __CLASS__, __FUNCTION__, NS_LossyConvertUTF16toASCII(aDirectory).get()));
nsCOMPtr<nsIFile> directory;
nsresult rv = NS_NewLocalFile(aDirectory, false, getter_AddRefs(directory));
@ -484,7 +519,7 @@ GeckoMediaPluginService::AddOnGMPThread(const nsAString& aDirectory)
MOZ_ASSERT(mainThread);
mozilla::SyncRunnable::DispatchToThread(mainThread, task);
nsRefPtr<GMPParent> gmp = task->GetParent();
rv = gmp->Init(directory);
rv = gmp->Init(this, directory);
if (NS_FAILED(rv)) {
NS_WARNING("Can't Create GMPParent");
return;
@ -498,6 +533,7 @@ void
GeckoMediaPluginService::RemoveOnGMPThread(const nsAString& aDirectory)
{
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
LOGD(("%s::%s: %s", __CLASS__, __FUNCTION__, NS_LossyConvertUTF16toASCII(aDirectory).get()));
nsCOMPtr<nsIFile> directory;
nsresult rv = NS_NewLocalFile(aDirectory, false, getter_AddRefs(directory));
@ -520,5 +556,30 @@ GeckoMediaPluginService::RemoveOnGMPThread(const nsAString& aDirectory)
cs->LogStringMessage(MOZ_UTF16("Removing GMP which was never added."));
}
// May remove when Bug 1043671 is fixed
static void Dummy(nsRefPtr<GMPParent>& aOnDeathsDoor)
{
// exists solely to do nothing and let the Runnable kill the GMPParent
// when done.
}
void
GeckoMediaPluginService::ReAddOnGMPThread(nsRefPtr<GMPParent>& aOld)
{
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, (void*) aOld));
nsRefPtr<GMPParent> gmp = ClonePlugin(aOld);
// Note: both are now in the list
// Until we give up the GMPThread, we're safe even if we unlock temporarily
// since off-main-thread users just test for existance; they don't modify the list.
MutexAutoLock lock(mMutex);
mPlugins.RemoveElement(aOld);
// Schedule aOld to be destroyed. We can't destroy it from here since we
// may be inside ActorDestroyed() for it.
NS_DispatchToCurrentThread(WrapRunnableNM(&Dummy, aOld));
}
} // namespace gmp
} // namespace mozilla

View File

@ -50,6 +50,11 @@ private:
void AddOnGMPThread(const nsAString& aSearchDir);
void RemoveOnGMPThread(const nsAString& aSearchDir);
protected:
friend class GMPParent;
void ReAddOnGMPThread(nsRefPtr<GMPParent>& aOld);
private:
GMPParent* ClonePlugin(const GMPParent* aOriginal);
class PathRunnable : public nsRunnable
{

View File

@ -19,44 +19,12 @@ namespace gmp {
// Compressed (encoded) data goes from the Decoder parent to the child;
// pool there, and then return with Encoded() frames and goes into the parent
// pool.
static StaticAutoPtr<nsTArray<ipc::Shmem>> sGmpFreelist[GMPSharedMemManager::kGMPNumTypes];
static uint32_t sGMPShmemManagerCount = 0;
GMPSharedMemManager::GMPSharedMemManager()
{
if (!sGMPShmemManagerCount) {
for (uint32_t i = 0; i < GMPSharedMemManager::kGMPNumTypes; i++) {
sGmpFreelist[i] = new nsTArray<ipc::Shmem>();
}
}
sGMPShmemManagerCount++;
}
GMPSharedMemManager::~GMPSharedMemManager()
{
MOZ_ASSERT(sGMPShmemManagerCount > 0);
sGMPShmemManagerCount--;
if (!sGMPShmemManagerCount) {
for (uint32_t i = 0; i < GMPSharedMemManager::kGMPNumTypes; i++) {
sGmpFreelist[i] = nullptr;
}
}
}
static nsTArray<ipc::Shmem>&
GetGmpFreelist(GMPSharedMemManager::GMPMemoryClasses aTypes)
{
return *(sGmpFreelist[aTypes]);
}
static uint32_t sGmpAllocated[GMPSharedMemManager::kGMPNumTypes]; // 0's
bool
GMPSharedMemManager::MgrAllocShmem(GMPMemoryClasses aClass, size_t aSize,
GMPSharedMemManager::MgrAllocShmem(GMPSharedMem::GMPMemoryClasses aClass, size_t aSize,
ipc::Shmem::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aMem)
{
CheckThread();
mData->CheckThread();
// first look to see if we have a free buffer large enough
for (uint32_t i = 0; i < GetGmpFreelist(aClass).Length(); i++) {
@ -73,15 +41,15 @@ GMPSharedMemManager::MgrAllocShmem(GMPMemoryClasses aClass, size_t aSize,
aSize = (aSize + (pagesize-1)) & ~(pagesize-1); // round up to page size
bool retval = Alloc(aSize, aType, aMem);
if (retval) {
sGmpAllocated[aClass]++;
mData->mGmpAllocated[aClass]++;
}
return retval;
}
bool
GMPSharedMemManager::MgrDeallocShmem(GMPMemoryClasses aClass, ipc::Shmem& aMem)
GMPSharedMemManager::MgrDeallocShmem(GMPSharedMem::GMPMemoryClasses aClass, ipc::Shmem& aMem)
{
CheckThread();
mData->CheckThread();
size_t size = aMem.Size<uint8_t>();
size_t total = 0;
@ -91,7 +59,7 @@ GMPSharedMemManager::MgrDeallocShmem(GMPMemoryClasses aClass, ipc::Shmem& aMem)
Dealloc(GetGmpFreelist(aClass)[0]);
GetGmpFreelist(aClass).RemoveElementAt(0);
// The allocation numbers will be fubar on the Child!
sGmpAllocated[aClass]--;
mData->mGmpAllocated[aClass]--;
}
for (uint32_t i = 0; i < GetGmpFreelist(aClass).Length(); i++) {
MOZ_ASSERT(GetGmpFreelist(aClass)[i].IsWritable());
@ -107,9 +75,9 @@ GMPSharedMemManager::MgrDeallocShmem(GMPMemoryClasses aClass, ipc::Shmem& aMem)
}
uint32_t
GMPSharedMemManager::NumInUse(GMPMemoryClasses aClass)
GMPSharedMemManager::NumInUse(GMPSharedMem::GMPMemoryClasses aClass)
{
return sGmpAllocated[aClass] - GetGmpFreelist(aClass).Length();
return mData->mGmpAllocated[aClass] - GetGmpFreelist(aClass).Length();
}
}

View File

@ -12,7 +12,9 @@
namespace mozilla {
namespace gmp {
class GMPSharedMemManager
class GMPSharedMemManager;
class GMPSharedMem
{
public:
typedef enum {
@ -28,24 +30,50 @@ public:
// (perhaps temporarily).
static const uint32_t kGMPBufLimit = 20;
GMPSharedMemManager();
virtual ~GMPSharedMemManager();
virtual bool MgrAllocShmem(GMPMemoryClasses aClass, size_t aSize,
ipc::Shmem::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aMem);
virtual bool MgrDeallocShmem(GMPMemoryClasses aClass, ipc::Shmem& aMem);
// So we can know if data is "piling up" for the plugin - I.e. it's hung or crashed
virtual uint32_t NumInUse(GMPMemoryClasses aClass);
GMPSharedMem()
{
for (size_t i = 0; i < sizeof(mGmpAllocated)/sizeof(mGmpAllocated[0]); i++) {
mGmpAllocated[i] = 0;
}
}
virtual ~GMPSharedMem() {}
// Parent and child impls will differ here
virtual void CheckThread() = 0;
protected:
friend class GMPSharedMemManager;
nsTArray<ipc::Shmem> mGmpFreelist[GMPSharedMem::kGMPNumTypes];
uint32_t mGmpAllocated[GMPSharedMem::kGMPNumTypes];
};
class GMPSharedMemManager
{
public:
GMPSharedMemManager(GMPSharedMem *aData) : mData(aData) {}
virtual ~GMPSharedMemManager() {}
virtual bool MgrAllocShmem(GMPSharedMem::GMPMemoryClasses aClass, size_t aSize,
ipc::Shmem::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aMem);
virtual bool MgrDeallocShmem(GMPSharedMem::GMPMemoryClasses aClass, ipc::Shmem& aMem);
// So we can know if data is "piling up" for the plugin - I.e. it's hung or crashed
virtual uint32_t NumInUse(GMPSharedMem::GMPMemoryClasses aClass);
// These have to be implemented using the AllocShmem/etc provided by the IPDL-generated interfaces,
// so have the Parent/Child implement them.
virtual bool Alloc(size_t aSize, ipc::Shmem::SharedMemory::SharedMemoryType aType, ipc::Shmem* aMem) = 0;
virtual void Dealloc(ipc::Shmem& aMem) = 0;
private:
nsTArray<ipc::Shmem>& GetGmpFreelist(GMPSharedMem::GMPMemoryClasses aTypes)
{
return mData->mGmpFreelist[aTypes];
}
GMPSharedMem *mData;
};
} // namespace gmp

View File

@ -14,7 +14,8 @@ namespace mozilla {
namespace gmp {
GMPVideoDecoderChild::GMPVideoDecoderChild(GMPChild* aPlugin)
: mPlugin(aPlugin),
: GMPSharedMemManager(aPlugin),
mPlugin(aPlugin),
mVideoDecoder(nullptr),
mVideoHost(MOZ_THIS_IN_INITIALIZER_LIST())
{
@ -104,12 +105,6 @@ GMPVideoDecoderChild::Error(GMPErr aError)
SendError(aError);
}
void
GMPVideoDecoderChild::CheckThread()
{
MOZ_ASSERT(mPlugin->GMPMessageLoop() == MessageLoop::current());
}
bool
GMPVideoDecoderChild::RecvInitDecode(const GMPVideoCodec& aCodecSettings,
const nsTArray<uint8_t>& aCodecSpecific,
@ -154,7 +149,7 @@ bool
GMPVideoDecoderChild::RecvChildShmemForPool(Shmem& aFrameBuffer)
{
if (aFrameBuffer.IsWritable()) {
mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMemManager::kGMPFrameData,
mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPFrameData,
aFrameBuffer);
}
return true;

View File

@ -39,8 +39,7 @@ public:
virtual void Error(GMPErr aError) MOZ_OVERRIDE;
// GMPSharedMemManager
virtual void CheckThread();
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem)
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) MOZ_OVERRIDE
{
#ifndef SHMEM_ALLOC_IN_CHILD
return CallNeedShmem(aSize, aMem);
@ -52,7 +51,7 @@ public:
#endif
#endif
}
virtual void Dealloc(Shmem& aMem)
virtual void Dealloc(Shmem& aMem) MOZ_OVERRIDE
{
#ifndef SHMEM_ALLOC_IN_CHILD
SendParentShmemForPool(aMem);

View File

@ -50,7 +50,8 @@ namespace gmp {
// Dead: mIsOpen == false
GMPVideoDecoderParent::GMPVideoDecoderParent(GMPParent* aPlugin)
: mIsOpen(false)
: GMPSharedMemManager(aPlugin)
, mIsOpen(false)
, mPlugin(aPlugin)
, mCallback(nullptr)
, mVideoHost(MOZ_THIS_IN_INITIALIZER_LIST())
@ -132,8 +133,8 @@ GMPVideoDecoderParent::Decode(GMPVideoEncodedFrame* aInputFrame,
// Very rough kill-switch if the plugin stops processing. If it's merely
// hung and continues, we'll come back to life eventually.
// 3* is because we're using 3 buffers per frame for i420 data for now.
if (NumInUse(kGMPFrameData) > 3*GMPSharedMemManager::kGMPBufLimit ||
NumInUse(kGMPEncodedData) > GMPSharedMemManager::kGMPBufLimit) {
if ((NumInUse(GMPSharedMem::kGMPFrameData) > 3*GMPSharedMem::kGMPBufLimit) ||
(NumInUse(GMPSharedMem::kGMPEncodedData) > GMPSharedMem::kGMPBufLimit)) {
return NS_ERROR_FAILURE;
}
@ -228,12 +229,6 @@ GMPVideoDecoderParent::ActorDestroy(ActorDestroyReason aWhy)
mVideoHost.ActorDestroyed();
}
void
GMPVideoDecoderParent::CheckThread()
{
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
}
bool
GMPVideoDecoderParent::RecvDecoded(const GMPVideoi420FrameData& aDecodedFrame)
{
@ -331,7 +326,7 @@ bool
GMPVideoDecoderParent::RecvParentShmemForPool(Shmem& aEncodedBuffer)
{
if (aEncodedBuffer.IsWritable()) {
mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMemManager::kGMPEncodedData,
mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPEncodedData,
aEncodedBuffer);
}
return true;
@ -343,7 +338,7 @@ GMPVideoDecoderParent::AnswerNeedShmem(const uint32_t& aFrameBufferSize,
{
ipc::Shmem mem;
if (!mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMemManager::kGMPFrameData,
if (!mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPFrameData,
aFrameBufferSize,
ipc::SharedMemory::TYPE_BASIC, &mem))
{

View File

@ -20,8 +20,8 @@ namespace gmp {
class GMPParent;
class GMPVideoDecoderParent MOZ_FINAL : public PGMPVideoDecoderParent
, public GMPSharedMemManager
, public GMPVideoDecoderProxy
, public GMPSharedMemManager
{
public:
NS_INLINE_DECL_REFCOUNTING(GMPVideoDecoderParent)
@ -46,8 +46,7 @@ public:
virtual const uint64_t ParentID() MOZ_OVERRIDE { return reinterpret_cast<uint64_t>(mPlugin.get()); }
// GMPSharedMemManager
virtual void CheckThread();
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem)
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) MOZ_OVERRIDE
{
#ifdef GMP_SAFE_SHMEM
return AllocShmem(aSize, aType, aMem);
@ -55,7 +54,7 @@ public:
return AllocUnsafeShmem(aSize, aType, aMem);
#endif
}
virtual void Dealloc(Shmem& aMem)
virtual void Dealloc(Shmem& aMem) MOZ_OVERRIDE
{
DeallocShmem(aMem);
}

View File

@ -108,7 +108,7 @@ void
GMPVideoEncodedFrameImpl::DestroyBuffer()
{
if (mHost && mBuffer.IsWritable()) {
mHost->SharedMemMgr()->MgrDeallocShmem(GMPSharedMemManager::kGMPEncodedData, mBuffer);
mHost->SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPEncodedData, mBuffer);
}
mBuffer = ipc::Shmem();
}
@ -120,7 +120,7 @@ GMPVideoEncodedFrameImpl::CreateEmptyFrame(uint32_t aSize)
DestroyBuffer();
} else if (aSize > AllocatedSize()) {
DestroyBuffer();
if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMemManager::kGMPEncodedData, aSize,
if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData, aSize,
ipc::SharedMemory::TYPE_BASIC, &mBuffer) ||
!Buffer()) {
return GMPAllocErr;
@ -228,7 +228,7 @@ GMPVideoEncodedFrameImpl::SetAllocatedSize(uint32_t aNewSize)
}
ipc::Shmem new_mem;
if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMemManager::kGMPEncodedData, aNewSize,
if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData, aNewSize,
ipc::SharedMemory::TYPE_BASIC, &new_mem) ||
!new_mem.get<uint8_t>()) {
return;

View File

@ -14,7 +14,8 @@ namespace mozilla {
namespace gmp {
GMPVideoEncoderChild::GMPVideoEncoderChild(GMPChild* aPlugin)
: mPlugin(aPlugin),
: GMPSharedMemManager(aPlugin),
mPlugin(aPlugin),
mVideoEncoder(nullptr),
mVideoHost(MOZ_THIS_IN_INITIALIZER_LIST())
{
@ -65,12 +66,6 @@ GMPVideoEncoderChild::Error(GMPErr aError)
SendError(aError);
}
void
GMPVideoEncoderChild::CheckThread()
{
MOZ_ASSERT(mPlugin->GMPMessageLoop() == MessageLoop::current());
}
bool
GMPVideoEncoderChild::RecvInitEncode(const GMPVideoCodec& aCodecSettings,
const nsTArray<uint8_t>& aCodecSpecific,
@ -117,7 +112,7 @@ bool
GMPVideoEncoderChild::RecvChildShmemForPool(Shmem& aEncodedBuffer)
{
if (aEncodedBuffer.IsWritable()) {
mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMemManager::kGMPEncodedData,
mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPEncodedData,
aEncodedBuffer);
}
return true;

View File

@ -35,8 +35,7 @@ public:
virtual void Error(GMPErr aError) MOZ_OVERRIDE;
// GMPSharedMemManager
virtual void CheckThread();
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem)
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) MOZ_OVERRIDE
{
#ifndef SHMEM_ALLOC_IN_CHILD
return CallNeedShmem(aSize, aMem);
@ -48,7 +47,7 @@ public:
#endif
#endif
}
virtual void Dealloc(Shmem& aMem)
virtual void Dealloc(Shmem& aMem) MOZ_OVERRIDE
{
#ifndef SHMEM_ALLOC_IN_CHILD
SendParentShmemForPool(aMem);

View File

@ -55,7 +55,8 @@ namespace gmp {
// Dead: mIsOpen == false
GMPVideoEncoderParent::GMPVideoEncoderParent(GMPParent *aPlugin)
: mIsOpen(false),
: GMPSharedMemManager(aPlugin),
mIsOpen(false),
mPlugin(aPlugin),
mCallback(nullptr),
mVideoHost(MOZ_THIS_IN_INITIALIZER_LIST())
@ -138,8 +139,8 @@ GMPVideoEncoderParent::Encode(GMPVideoi420Frame* aInputFrame,
// Very rough kill-switch if the plugin stops processing. If it's merely
// hung and continues, we'll come back to life eventually.
// 3* is because we're using 3 buffers per frame for i420 data for now.
if (NumInUse(kGMPFrameData) > 3*GMPSharedMemManager::kGMPBufLimit ||
NumInUse(kGMPEncodedData) > GMPSharedMemManager::kGMPBufLimit) {
if ((NumInUse(GMPSharedMem::kGMPFrameData) > 3*GMPSharedMem::kGMPBufLimit) ||
(NumInUse(GMPSharedMem::kGMPEncodedData) > GMPSharedMem::kGMPBufLimit)) {
return GMPGenericErr;
}
@ -249,12 +250,6 @@ GMPVideoEncoderParent::ActorDestroy(ActorDestroyReason aWhy)
mVideoHost.ActorDestroyed();
}
void
GMPVideoEncoderParent::CheckThread()
{
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
}
bool
GMPVideoEncoderParent::RecvEncoded(const GMPVideoEncodedFrameData& aEncodedFrame,
const nsTArray<uint8_t>& aCodecSpecificInfo)
@ -290,7 +285,7 @@ bool
GMPVideoEncoderParent::RecvParentShmemForPool(Shmem& aFrameBuffer)
{
if (aFrameBuffer.IsWritable()) {
mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMemManager::kGMPFrameData,
mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPFrameData,
aFrameBuffer);
}
return true;
@ -302,7 +297,7 @@ GMPVideoEncoderParent::AnswerNeedShmem(const uint32_t& aEncodedBufferSize,
{
ipc::Shmem mem;
if (!mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMemManager::kGMPEncodedData,
if (!mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData,
aEncodedBufferSize,
ipc::SharedMemory::TYPE_BASIC, &mem))
{

View File

@ -47,8 +47,7 @@ public:
virtual const uint64_t ParentID() MOZ_OVERRIDE { return reinterpret_cast<uint64_t>(mPlugin.get()); }
// GMPSharedMemManager
virtual void CheckThread();
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem)
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) MOZ_OVERRIDE
{
#ifdef GMP_SAFE_SHMEM
return AllocShmem(aSize, aType, aMem);
@ -56,7 +55,7 @@ public:
return AllocUnsafeShmem(aSize, aType, aMem);
#endif
}
virtual void Dealloc(Shmem& aMem)
virtual void Dealloc(Shmem& aMem) MOZ_OVERRIDE
{
DeallocShmem(aMem);
}

View File

@ -84,7 +84,7 @@ GMPPlaneImpl::MaybeResize(int32_t aNewSize) {
}
ipc::Shmem new_mem;
if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMemManager::kGMPFrameData, aNewSize,
if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPFrameData, aNewSize,
ipc::SharedMemory::TYPE_BASIC, &new_mem) ||
!new_mem.get<uint8_t>()) {
return GMPAllocErr;
@ -105,7 +105,7 @@ void
GMPPlaneImpl::DestroyBuffer()
{
if (mHost && mBuffer.IsWritable()) {
mHost->SharedMemMgr()->MgrDeallocShmem(GMPSharedMemManager::kGMPFrameData, mBuffer);
mHost->SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPFrameData, mBuffer);
}
mBuffer = ipc::Shmem();
}

View File

@ -3,7 +3,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += [
DIRS += [
'test'
]

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += [
DIRS += [
'encoder',
'gmp',
'mediasource',
@ -13,45 +13,45 @@ PARALLEL_DIRS += [
'webvtt'
]
TEST_TOOL_DIRS += ['compiledtest']
TEST_DIRS += ['compiledtest']
if CONFIG['MOZ_RAW']:
PARALLEL_DIRS += ['raw']
DIRS += ['raw']
if CONFIG['MOZ_WAVE']:
PARALLEL_DIRS += ['wave']
DIRS += ['wave']
if CONFIG['MOZ_WEBM']:
PARALLEL_DIRS += ['webm']
DIRS += ['webm']
if CONFIG['MOZ_GSTREAMER']:
PARALLEL_DIRS += ['gstreamer']
DIRS += ['gstreamer']
if CONFIG['MOZ_DIRECTSHOW']:
PARALLEL_DIRS += ['directshow']
DIRS += ['directshow']
if CONFIG['MOZ_ANDROID_OMX']:
PARALLEL_DIRS += ['android']
DIRS += ['android']
if CONFIG['MOZ_WMF']:
PARALLEL_DIRS += ['wmf']
DIRS += ['wmf']
if CONFIG['MOZ_FMP4']:
PARALLEL_DIRS += ['fmp4']
DIRS += ['fmp4']
if CONFIG['MOZ_APPLEMEDIA']:
PARALLEL_DIRS += ['apple']
DIRS += ['apple']
PARALLEL_DIRS += ['webrtc']
DIRS += ['webrtc']
if CONFIG['MOZ_OMX_DECODER']:
PARALLEL_DIRS += ['omx']
PARALLEL_DIRS += ['omx/mediaresourcemanager']
DIRS += ['omx']
DIRS += ['omx/mediaresourcemanager']
PARALLEL_DIRS += ['webspeech']
DIRS += ['webspeech']
if CONFIG['MOZ_EME']:
PARALLEL_DIRS += ['eme']
DIRS += ['eme']
TEST_DIRS += [
'test',

View File

@ -73,12 +73,15 @@ void
MediaStreamAudioSourceNode::PrincipalChanged(DOMMediaStream* ms)
{
bool subsumes = false;
nsIDocument* doc = Context()->GetParentObject()->GetExtantDoc();
if (doc) {
nsIPrincipal* docPrincipal = doc->NodePrincipal();
nsIPrincipal* streamPrincipal = mInputStream->GetPrincipal();
if (NS_FAILED(docPrincipal->Subsumes(streamPrincipal, &subsumes))) {
subsumes = false;
nsPIDOMWindow* parent = Context()->GetParentObject();
if (parent) {
nsIDocument* doc = parent->GetExtantDoc();
if (doc) {
nsIPrincipal* docPrincipal = doc->NodePrincipal();
nsIPrincipal* streamPrincipal = mInputStream->GetPrincipal();
if (NS_FAILED(docPrincipal->Subsumes(streamPrincipal, &subsumes))) {
subsumes = false;
}
}
}
auto stream = static_cast<AudioNodeExternalInputStream*>(mStream.get());

View File

@ -4,9 +4,9 @@
# 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/.
PARALLEL_DIRS += ['blink', 'test']
DIRS += ['blink', 'test']
TEST_TOOL_DIRS += ['compiledtest']
TEST_DIRS += ['compiledtest']
EXPORTS += [
'AudioContext.h',

View File

@ -3,7 +3,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS = ['synth']
DIRS = ['synth']
if CONFIG['MOZ_WEBSPEECH']:
PARALLEL_DIRS += ['recognition']
DIRS += ['recognition']

View File

@ -35,7 +35,7 @@ if CONFIG['MOZ_WEBSPEECH']:
]
if CONFIG['MOZ_SYNTH_PICO']:
PARALLEL_DIRS = ['pico']
DIRS = ['pico']
IPDL_SOURCES += [
'ipc/PSpeechSynthesis.ipdl',

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += [
DIRS += [
'base',
'html',
'media',
@ -12,5 +12,5 @@ PARALLEL_DIRS += [
'xul',
]
TEST_TOOL_DIRS += ['test']
TEST_DIRS += ['test']

View File

@ -4,6 +4,6 @@
# 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/.
PARALLEL_DIRS += ['src']
DIRS += ['src']
MOCHITEST_MANIFESTS += ['test/mochitest.ini']

View File

@ -4,4 +4,4 @@
# 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/.
PARALLEL_DIRS += ['document/src', 'content']
DIRS += ['document/src', 'content']

View File

@ -4,6 +4,6 @@
# 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/.
PARALLEL_DIRS += ['public', 'src']
DIRS += ['public', 'src']
TEST_DIRS += ['test']

View File

@ -4,6 +4,6 @@
# 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/.
PARALLEL_DIRS += ['public', 'src']
DIRS += ['public', 'src']
DIRS += ['test']

View File

@ -7,8 +7,8 @@
# We need to build document even if XUL is disabled, for the nsIController[s]
# interfaces and implementations.
# Likewise for content, because of nsXULAtoms.
PARALLEL_DIRS += ['document', 'content']
DIRS += ['document', 'content']
if CONFIG['MOZ_XUL']:
PARALLEL_DIRS += ['templates']
DIRS += ['templates']

View File

@ -4,6 +4,6 @@
# 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/.
PARALLEL_DIRS += ['public', 'src']
DIRS += ['public', 'src']
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']

View File

@ -4,6 +4,6 @@
# 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/.
PARALLEL_DIRS += ['interfaces', 'src']
DIRS += ['interfaces', 'src']
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += ['src']
DIRS += ['src']
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']

View File

@ -1274,7 +1274,7 @@ private:
FileDescriptor::PlatformHandleType handle =
FileDescriptor::PlatformHandleType(PR_FileDesc2NativeHandle(mFileDesc));
if (!SendOnOpenCacheFile(mFileSize, handle)) {
if (!SendOnOpenCacheFile(mFileSize, FileDescriptor(handle))) {
unused << Send__delete__(this);
}
}

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_TOOL_DIRS += ['tests']
TEST_DIRS += ['tests']
XPIDL_SOURCES += [
'nsIAudioChannelAgent.idl',

View File

@ -196,7 +196,7 @@ private:
class AutoEntryScript : public AutoJSAPI,
protected ScriptSettingsStackEntry {
public:
AutoEntryScript(nsIGlobalObject* aGlobalObject,
explicit AutoEntryScript(nsIGlobalObject* aGlobalObject,
bool aIsMainThread = NS_IsMainThread(),
// Note: aCx is mandatory off-main-thread.
JSContext* aCx = nullptr);
@ -222,7 +222,7 @@ private:
*/
class AutoIncumbentScript : protected ScriptSettingsStackEntry {
public:
AutoIncumbentScript(nsIGlobalObject* aGlobalObject);
explicit AutoIncumbentScript(nsIGlobalObject* aGlobalObject);
private:
JS::AutoHideScriptedCaller mCallerOverride;
};
@ -237,7 +237,7 @@ private:
*/
class AutoNoJSAPI : protected ScriptSettingsStackEntry {
public:
AutoNoJSAPI(bool aIsMainThread = NS_IsMainThread());
explicit AutoNoJSAPI(bool aIsMainThread = NS_IsMainThread());
private:
mozilla::Maybe<AutoCxPusher> mCxPusher;
};

View File

@ -1440,8 +1440,27 @@ namespace dmd {
// See https://wiki.mozilla.org/Performance/MemShrink/DMD for instructions on
// how to use DMD.
static FILE *
OpenDMDOutputFile(JSContext *cx, JS::CallArgs &args)
{
JSString *str = JS::ToString(cx, args.get(0));
if (!str)
return nullptr;
JSAutoByteString pathname(cx, str);
if (!pathname)
return nullptr;
FILE* fp = fopen(pathname.ptr(), "w");
if (!fp) {
JS_ReportError(cx, "DMD can't open %s: %s",
pathname.ptr(), strerror(errno));
return nullptr;
}
return fp;
}
static bool
ReportAndDump(JSContext *cx, unsigned argc, JS::Value *vp)
AnalyzeReports(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!dmd::IsRunning()) {
JS_ReportError(cx, "DMD is not running");
@ -1449,24 +1468,48 @@ ReportAndDump(JSContext *cx, unsigned argc, JS::Value *vp)
}
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JSString *str = JS::ToString(cx, args.get(0));
if (!str)
return false;
JSAutoByteString pathname(cx, str);
if (!pathname)
return false;
FILE* fp = fopen(pathname.ptr(), "w");
FILE *fp = OpenDMDOutputFile(cx, args);
if (!fp) {
JS_ReportError(cx, "DMD can't open %s: %s",
pathname.ptr(), strerror(errno));
return false;
}
dmd::ClearReports();
dmd::RunReportersForThisProcess();
dmd::Writer writer(FpWrite, fp);
dmd::Dump(writer);
dmd::AnalyzeReports(writer);
fclose(fp);
args.rval().setUndefined();
return true;
}
// This will be removed eventually.
static bool
ReportAndDump(JSContext *cx, unsigned argc, JS::Value *vp)
{
JS_ReportWarning(cx, "DMDReportAndDump() is deprecated; "
"please use DMDAnalyzeReports() instead");
return AnalyzeReports(cx, argc, vp);
}
static bool
AnalyzeHeap(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!dmd::IsRunning()) {
JS_ReportError(cx, "DMD is not running");
return false;
}
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
FILE *fp = OpenDMDOutputFile(cx, args);
if (!fp) {
return false;
}
dmd::Writer writer(FpWrite, fp);
dmd::AnalyzeHeap(writer);
fclose(fp);
@ -1478,7 +1521,9 @@ ReportAndDump(JSContext *cx, unsigned argc, JS::Value *vp)
} // namespace mozilla
static const JSFunctionSpec DMDFunctions[] = {
JS_FS("DMDReportAndDump", dmd::ReportAndDump, 1, 0),
JS_FS("DMDReportAndDump", dmd::ReportAndDump, 1, 0),
JS_FS("DMDAnalyzeReports", dmd::AnalyzeReports, 1, 0),
JS_FS("DMDAnalyzeHeap", dmd::AnalyzeHeap, 1, 0),
JS_FS_END
};

View File

@ -124,7 +124,7 @@ class MOZ_STACK_CLASS AutoDontReportUncaught {
bool mWasSet;
public:
AutoDontReportUncaught(JSContext* aContext) : mContext(aContext) {
explicit AutoDontReportUncaught(JSContext* aContext) : mContext(aContext) {
MOZ_ASSERT(aContext);
mWasSet = JS::ContextOptionsRef(mContext).dontReportUncaught();
if (!mWasSet) {

View File

@ -191,7 +191,7 @@ public:
Optional_base<JS::Handle<T>, JS::Rooted<T> >()
{}
Optional(JSContext* cx) :
explicit Optional(JSContext* cx) :
Optional_base<JS::Handle<T>, JS::Rooted<T> >()
{
this->Construct(cx);

View File

@ -415,7 +415,7 @@ public:
NonWindowLike
};
ProtoAndIfaceCache(Kind aKind) : mKind(aKind) {
explicit ProtoAndIfaceCache(Kind aKind) : mKind(aKind) {
MOZ_COUNT_CTOR(ProtoAndIfaceCache);
if (aKind == WindowLike) {
mArrayCache = new ArrayCache();
@ -496,7 +496,7 @@ struct VerifyTraceProtoAndIfaceCacheCalledTracer : public JSTracer
{
bool ok;
VerifyTraceProtoAndIfaceCacheCalledTracer(JSRuntime *rt)
explicit VerifyTraceProtoAndIfaceCacheCalledTracer(JSRuntime *rt)
: JSTracer(rt, VerifyTraceProtoAndIfaceCacheCalled), ok(false)
{}
};
@ -749,7 +749,7 @@ MaybeWrapStringValue(JSContext* cx, JS::MutableHandle<JS::Value> rval)
{
MOZ_ASSERT(rval.isString());
JSString* str = rval.toString();
if (JS::GetGCThingZone(str) != js::GetContextZone(cx)) {
if (JS::GetTenuredGCThingZone(str) != js::GetContextZone(cx)) {
return JS_WrapValue(cx, rval);
}
return true;
@ -2215,7 +2215,7 @@ class MOZ_STACK_CLASS RootedUnion : public T,
private JS::CustomAutoRooter
{
public:
RootedUnion(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
explicit RootedUnion(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
T(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
@ -2232,7 +2232,7 @@ class MOZ_STACK_CLASS NullableRootedUnion : public Nullable<T>,
private JS::CustomAutoRooter
{
public:
NullableRootedUnion(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
explicit NullableRootedUnion(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
Nullable<T>(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{

View File

@ -1461,6 +1461,11 @@ DOMInterfaces = {
'headerFile': 'WebGLExtensions.h'
},
'WebGLExtensionShaderTextureLod': {
'nativeType': 'mozilla::WebGLExtensionShaderTextureLod',
'headerFile': 'WebGLExtensions.h'
},
'WebGLExtensionTextureFilterAnisotropic': {
'nativeType': 'mozilla::WebGLExtensionTextureFilterAnisotropic',
'headerFile': 'WebGLExtensions.h'

View File

@ -5483,7 +5483,8 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
# See comments in WrapNewBindingObject explaining why we need
# to wrap here.
# NB: _setValue(..., type-that-is-any) calls JS_WrapValue(), so is fallible
return (_setValue(result, wrapAsType=type), False)
head = "JS::ExposeValueToActiveJS(%s);\n" % result
return (head + _setValue(result, wrapAsType=type), False)
if (type.isObject() or (type.isSpiderMonkeyInterface() and
not typedArraysAreStructs)):
@ -5492,11 +5493,16 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
if type.nullable():
toValue = "%s"
setter = setObjectOrNull
head = """if (%s) {
JS::ExposeObjectToActiveJS(%s);
}
""" % (result, result)
else:
toValue = "*%s"
setter = setObject
head = "JS::ExposeObjectToActiveJS(%s);\n" % result
# NB: setObject{,OrNull}(..., some-object-type) calls JS_WrapValue(), so is fallible
return (setter(toValue % result, wrapAsType=type), False)
return (head + setter(toValue % result, wrapAsType=type), False)
if not (type.isUnion() or type.isPrimitive() or type.isDictionary() or
type.isDate() or

View File

@ -38,7 +38,7 @@ inline bool IsDOMProxy(JSObject *obj)
class BaseDOMProxyHandler : public js::BaseProxyHandler
{
public:
BaseDOMProxyHandler(const void* aProxyFamily, bool aHasPrototype = false)
explicit BaseDOMProxyHandler(const void* aProxyFamily, bool aHasPrototype = false)
: js::BaseProxyHandler(aProxyFamily, aHasPrototype)
{}

View File

@ -54,3 +54,7 @@ MSG_DEF(MSG_DEFINEPROPERTY_ON_GSP, 0, "Not allowed to define a property on the n
MSG_DEF(MSG_INVALID_URL, 1, "{0} is not a valid URL.")
MSG_DEF(MSG_METADATA_NOT_CONFIGURED, 0, "Either size or lastModified should be true.")
MSG_DEF(MSG_INVALID_READ_SIZE, 0, "0 (Zero) is not a valid read size.")
MSG_DEF(MSG_HEADERS_IMMUTABLE, 0, "Headers are immutable and cannot be modified.")
MSG_DEF(MSG_INVALID_HEADER_NAME, 1, "{0} is an invalid header name.")
MSG_DEF(MSG_INVALID_HEADER_VALUE, 1, "{0} is an invalid header value.")
MSG_DEF(MSG_INVALID_HEADER_SEQUENCE, 0, "Headers require name/value tuples when being initialized by a sequence.")

View File

@ -24,8 +24,6 @@ CPPSRCS += $(globalgen_sources) $(unified_binding_cpp_files)
# Bug 932092 tracks.
LOCAL_INCLUDES += -I$(DIST)/include/mozilla/dom
PYTHON_UNIT_TESTS += $(srcdir)/mozwebidlcodegen/test/test_mozwebidlcodegen.py
include $(topsrcdir)/config/rules.mk
# TODO This list should be emitted to a .pp file via

View File

@ -19,7 +19,7 @@ class MOZ_STACK_CLASS RootedDictionary : public T,
private JS::CustomAutoRooter
{
public:
RootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
explicit RootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
T(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
@ -36,7 +36,7 @@ class MOZ_STACK_CLASS NullableRootedDictionary : public Nullable<T>,
private JS::CustomAutoRooter
{
public:
NullableRootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
explicit NullableRootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
Nullable<T>(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{

View File

@ -96,3 +96,7 @@ SPHINX_PYTHON_PACKAGE_DIRS += ['mozwebidlcodegen']
if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
# This is needed for Window.webidl
DEFINES['HAVE_SIDEBAR'] = True
PYTHON_UNIT_TESTS += [
'mozwebidlcodegen/test/test_mozwebidlcodegen.py',
]

View File

@ -35,6 +35,7 @@ WebGLContext::GetExtensionString(WebGLExtensionID ext)
WEBGL_EXTENSION_IDENTIFIER(EXT_color_buffer_half_float)
WEBGL_EXTENSION_IDENTIFIER(EXT_frag_depth)
WEBGL_EXTENSION_IDENTIFIER(EXT_sRGB)
WEBGL_EXTENSION_IDENTIFIER(EXT_shader_texture_lod)
WEBGL_EXTENSION_IDENTIFIER(EXT_texture_filter_anisotropic)
WEBGL_EXTENSION_IDENTIFIER(OES_element_index_uint)
WEBGL_EXTENSION_IDENTIFIER(OES_standard_derivatives)
@ -155,6 +156,8 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
return WebGLExtensionDrawBuffers::IsSupported(this);
case WebGLExtensionID::EXT_frag_depth:
return WebGLExtensionFragDepth::IsSupported(this);
case WebGLExtensionID::EXT_shader_texture_lod:
return gl->IsExtensionSupported(GLContext::EXT_shader_texture_lod);
default:
// For warnings-as-errors.
break;
@ -334,6 +337,9 @@ WebGLContext::EnableExtension(WebGLExtensionID ext)
case WebGLExtensionID::EXT_blend_minmax:
obj = new WebGLExtensionBlendMinMax(this);
break;
case WebGLExtensionID::EXT_shader_texture_lod:
obj = new WebGLExtensionShaderTextureLod(this);
break;
default:
MOZ_ASSERT(false, "should not get there.");
}

View File

@ -3041,6 +3041,9 @@ WebGLContext::CompileShader(WebGLShader *shader)
if (IsExtensionEnabled(WebGLExtensionID::WEBGL_draw_buffers))
resources.EXT_draw_buffers = 1;
if (IsExtensionEnabled(WebGLExtensionID::EXT_shader_texture_lod))
resources.EXT_shader_texture_lod = 1;
// Tell ANGLE to allow highp in frag shaders. (unless disabled)
// If underlying GLES doesn't have highp in frag shaders, it should complain anyways.
resources.FragmentPrecisionHigh = mDisableFragHighP ? 0 : 1;

View File

@ -0,0 +1,21 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */
#include "WebGLContext.h"
#include "WebGLExtensions.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
using namespace mozilla;
WebGLExtensionShaderTextureLod::WebGLExtensionShaderTextureLod(WebGLContext* context)
: WebGLExtensionBase(context)
{
}
WebGLExtensionShaderTextureLod::~WebGLExtensionShaderTextureLod()
{
}
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionShaderTextureLod)

View File

@ -178,6 +178,16 @@ public:
DECL_WEBGL_EXTENSION_GOOP
};
class WebGLExtensionShaderTextureLod
: public WebGLExtensionBase
{
public:
WebGLExtensionShaderTextureLod(WebGLContext*);
virtual ~WebGLExtensionShaderTextureLod();
DECL_WEBGL_EXTENSION_GOOP
};
class WebGLExtensionTextureFilterAnisotropic
: public WebGLExtensionBase
{

View File

@ -150,6 +150,7 @@ MOZ_BEGIN_ENUM_CLASS(WebGLExtensionID, uint8_t)
EXT_color_buffer_half_float,
EXT_frag_depth,
EXT_sRGB,
EXT_shader_texture_lod,
EXT_texture_filter_anisotropic,
OES_element_index_uint,
OES_standard_derivatives,

View File

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_DIRS += ['test']
TEST_TOOL_DIRS += ['compiledtest']
TEST_DIRS += ['compiledtest']
EXPORTS += [
'nsICanvasRenderingContextInternal.h',
@ -73,6 +73,7 @@ if CONFIG['MOZ_WEBGL']:
'WebGLExtensionFragDepth.cpp',
'WebGLExtensionInstancedArrays.cpp',
'WebGLExtensionLoseContext.cpp',
'WebGLExtensionShaderTextureLod.cpp',
'WebGLExtensionSRGB.cpp',
'WebGLExtensionStandardDerivatives.cpp',
'WebGLExtensionTextureFilterAnisotropic.cpp',

View File

@ -8,3 +8,4 @@ webgl-compressed-texture-etc1.html
webgl-compressed-texture-s3tc.html
--min-version 1.0.2 webgl-depth-texture.html
ext-sRGB.html
ext-shader-texture-lod.html

View File

@ -0,0 +1,280 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL EXT_shader_texture_lod Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<canvas id="canvas" width="256" height="256" style="width: 50px; height: 50px;"> </canvas>
<div id="console"></div>
<!-- Shaders for testing standard derivatives -->
<!-- Shader omitting the required #extension pragma -->
<script id="missingPragmaFragmentShader" type="x-shader/x-fragment">
precision mediump float;
varying vec2 texCoord0v;
void main() {
vec4 color = texture2DLodEXT(tex, texCoord0v, lod);
gl_FragColor = vec4(dx, dy, w, 1.0);
}
</script>
<!-- Shader to test macro definition -->
<script id="macroFragmentShader" type="x-shader/x-fragment">
precision mediump float;
void main() {
#ifdef GL_EXT_shader_texture_lod
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
#else
// Error expected
#error no GL_EXT_shader_texture_lod;
#endif
}
</script>
<!-- Shader with required #extension pragma -->
<script id="testFragmentShader" type="x-shader/x-fragment">
#extension GL_EXT_shader_texture_lod : enable
precision mediump float;
varying vec2 texCoord0v;
uniform float lod;
uniform sampler2D tex;
void main() {
vec4 color = texture2DLodEXT(tex, texCoord0v, lod);
gl_FragColor = color;
}
</script>
<!-- Shaders to link with test fragment shaders -->
<script id="goodVertexShader" type="x-shader/x-vertex">
attribute vec4 vPosition;
attribute vec2 texCoord0;
varying vec2 texCoord0v;
void main() {
texCoord0v = texCoord0;
gl_Position = vPosition;
}
</script>
<!-- Shaders to test output -->
<script id="outputVertexShader" type="x-shader/x-vertex">
attribute vec4 vPosition;
attribute vec2 texCoord0;
varying vec2 texCoord0v;
void main() {
texCoord0v = texCoord0;
gl_Position = vPosition;
}
</script>
<script id="outputFragmentShader" type="x-shader/x-fragment">
#extension GL_EXT_shader_texture_lod : require
precision mediump float;
varying vec2 texCoord0v;
uniform float lod;
uniform sampler2D tex;
void main() {
vec4 color = texture2DLodEXT(tex, texCoord0v, lod);
gl_FragColor = color;
}
</script>
<script>
description("This test verifies the functionality of the EXT_shader_texture_lod extension, if it is available.");
debug("");
var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
shouldBe("canvas.width", "256");
shouldBe("canvas.height", "256");
var gl = wtu.create3DContext(canvas);
var ext = null;
if (!gl) {
testFailed("WebGL context does not exist");
} else {
testPassed("WebGL context exists");
// Run tests with extension disabled
runShaderTests(false);
// Query the extension and store globally so shouldBe can access it
ext = gl.getExtension("EXT_shader_texture_lod");
if (!ext) {
testPassed("No EXT_shader_texture_lod support -- this is legal");
runSupportedTest(false);
} else {
testPassed("Successfully enabled EXT_shader_texture_lod extension");
runSupportedTest(true);
runShaderTests(true);
runOutputTests();
runUniqueObjectTest();
runReferenceCycleTest();
}
}
function runSupportedTest(extensionEnabled) {
var supported = gl.getSupportedExtensions();
if (supported.indexOf("EXT_shader_texture_lod") >= 0) {
if (extensionEnabled) {
testPassed("EXT_shader_texture_lod listed as supported and getExtension succeeded");
} else {
testFailed("EXT_shader_texture_lod listed as supported but getExtension failed");
}
} else {
if (extensionEnabled) {
testFailed("EXT_shader_texture_lod not listed as supported but getExtension succeeded");
} else {
testPassed("EXT_shader_texture_lod not listed as supported and getExtension failed -- this is legal");
}
}
}
function runShaderTests(extensionEnabled) {
debug("");
debug("Testing various shader compiles with extension " + (extensionEnabled ? "enabled" : "disabled"));
// Expect the macro shader to succeed ONLY if enabled
var macroFragmentProgram = wtu.loadProgramFromScriptExpectError(gl, "goodVertexShader", "macroFragmentShader");
if (extensionEnabled) {
if (macroFragmentProgram) {
// Expected result
testPassed("GL_EXT_shader_texture_lod defined in shaders when extension is enabled");
} else {
testFailed("GL_EXT_shader_texture_lod not defined in shaders when extension is enabled");
}
} else {
if (macroFragmentProgram) {
testFailed("GL_EXT_shader_texture_lod defined in shaders when extension is disabled");
} else {
testPassed("GL_EXT_shader_texture_lod not defined in shaders when extension disabled");
}
}
// Always expect the shader missing the #pragma to fail (whether enabled or not)
var missingPragmaFragmentProgram = wtu.loadProgramFromScriptExpectError(gl, "goodVertexShader", "missingPragmaFragmentShader");
if (missingPragmaFragmentProgram) {
testFailed("Shader built-ins allowed without #extension pragma");
} else {
testPassed("Shader built-ins disallowed without #extension pragma");
}
// Try to compile a shader using the built-ins that should only succeed if enabled
var testFragmentProgram = wtu.loadProgramFromScriptExpectError(gl, "goodVertexShader", "testFragmentShader");
if (extensionEnabled) {
if (testFragmentProgram) {
testPassed("Shader built-ins compiled successfully when extension enabled");
} else {
testFailed("Shader built-ins failed to compile when extension enabled");
}
} else {
if (testFragmentProgram) {
testFailed("Shader built-ins compiled successfully when extension disabled");
} else {
testPassed("Shader built-ins failed to compile when extension disabled");
}
}
}
function runOutputTests() {
debug("Testing various draws for valid built-in function behavior");
canvas.width = 256; canvas.height = 256;
gl.viewport(0, 0, canvas.width, canvas.height);
var program = wtu.setupProgram(gl, ["outputVertexShader", "outputFragmentShader"], ['vPosition', 'texCoord0'], [0, 1]);
var quadParameters = wtu.setupUnitQuad(gl, 0, 1);
var colors = [
{name: 'red', color:[255, 0, 0, 255]},
{name: 'green', color:[0, 255, 0, 255]},
{name: 'blue', color:[0, 0, 255, 255]},
{name: 'yellow', color:[255, 255, 0, 255]},
{name: 'magenta', color:[255, 0, 255, 255]},
{name: 'cyan', color:[0, 255, 255, 255]},
{name: 'pink', color:[255, 128, 128, 255]},
{name: 'gray', color:[128, 128, 128, 255]},
{name: 'light green', color:[128, 255, 128, 255]},
];
if (colors.length != 9) {
testFailed("9 colors are needed (9 mips for 256x256 texture), only have " + colors.length);
} else {
testPassed("9 colors found (9 mips for 256x256 texture)");
}
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
gl.texParameteri(
gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);
for (var ii = 0; ii < colors.length; ++ii) {
var color = colors[ii];
var size = Math.pow(2, colors.length - ii - 1);
wtu.fillTexture(gl, tex, size, size, color.color, ii);
}
var loc = gl.getUniformLocation(program, "lod");
for (var ii = 0; ii < colors.length; ++ii) {
gl.uniform1f(loc, ii);
var color = colors[ii];
wtu.drawQuad(gl);
wtu.checkCanvas(
gl, color.color,
"256x256 texture drawn to 256x256 dest with lod = " + ii +
" should be " + color.name);
}
glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors.");
}
function runUniqueObjectTest()
{
debug("Testing that getExtension() returns the same object each time");
gl.getExtension("EXT_shader_texture_lod").myProperty = 2;
gc();
shouldBe('gl.getExtension("EXT_shader_texture_lod").myProperty', '2');
}
function runReferenceCycleTest()
{
// create some reference cycles. The goal is to see if they cause leaks. The point is that
// some browser test runners have instrumentation to detect leaked refcounted objects.
debug("Testing reference cycles between context and extension objects");
var ext = gl.getExtension("EXT_shader_texture_lod");
// create cycle between extension and context, since the context has to hold a reference to the extension
ext.context = gl;
// create a self-cycle on the extension object
ext.ext = ext;
}
debug("");
successfullyParsed = true;
</script>
<script>finishTest();</script>
</body>
</html>

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