Merge autoland to central, a=merge

This commit is contained in:
Wes Kocher 2016-08-23 14:38:33 -07:00
Родитель 3de1ea925a d63783b351
Коммит dc25121c45
32 изменённых файлов: 215 добавлений и 159 удалений

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

@ -266,6 +266,17 @@ toolbar[customizing] > .overflow-button {
.titlebar-placeholder[type="fullscreen-button"]:-moz-locale-dir(rtl) { .titlebar-placeholder[type="fullscreen-button"]:-moz-locale-dir(rtl) {
-moz-box-ordinal-group: 0; -moz-box-ordinal-group: 0;
} }
/* In private windows, the #titlebar-content is higher because of the
* private browsing indicator. With the margin-top the titlebar buttons
* align to the top correctly in that case, but only if we don't stretch
* the box they're in because the container is too high, so we override
* the default alignment value (stretch).
*/
#main-window[tabsintitlebar] > #titlebar > #titlebar-content > #titlebar-buttonbox-container {
-moz-box-align: start;
}
%else %else
/* On non-OSX, these should be start-aligned */ /* On non-OSX, these should be start-aligned */
#titlebar-buttonbox-container { #titlebar-buttonbox-container {

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

@ -715,12 +715,12 @@ nsDefaultCommandLineHandler.prototype = {
// instances where users explicitly decide to "open with" the browser. // instances where users explicitly decide to "open with" the browser.
// Note that users who launch firefox manually with the -url flag will // Note that users who launch firefox manually with the -url flag will
// get erroneously counted. // get erroneously counted.
try {
if (cmdLine.findFlag("url", false) && if (cmdLine.findFlag("url", false) &&
ShellService.isDefaultBrowser(false, false)) { ShellService.isDefaultBrowser(false, false)) {
try {
Services.telemetry.getHistogramById("FX_STARTUP_EXTERNAL_CONTENT_HANDLER").add(); Services.telemetry.getHistogramById("FX_STARTUP_EXTERNAL_CONTENT_HANDLER").add();
} catch (e) {}
} }
} catch (e) {}
var urilist = []; var urilist = [];

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

@ -101,7 +101,13 @@ XPCOMUtils.defineLazyServiceGetter(ShellServiceInternal, "shellService",
*/ */
this.ShellService = new Proxy(ShellServiceInternal, { this.ShellService = new Proxy(ShellServiceInternal, {
get(target, name) { get(target, name) {
return name in target ? target[name] : if (name in target) {
target.shellService[name]; return target[name];
}
if (target.shellService) {
return target.shellService[name];
}
Services.console.logStringMessage(`${name} not found in ShellService: ${target.shellService}`);
return undefined;
} }
}); });

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

@ -32,16 +32,6 @@
margin-top: 6px; margin-top: 6px;
} }
/* In private windows, the #titlebar-content is higher because of the
* private browsing indicator. With the margin-top the titlebar buttons
* align to the top correctly in that case, but only if we don't stretch
* the box they're in because the container is too high, so we override
* the default alignment value (stretch).
*/
#main-window[tabsintitlebar] > #titlebar > #titlebar-content > #titlebar-buttonbox-container {
-moz-box-align: start;
}
/* Square back and forward buttons. Need !important on these because there /* Square back and forward buttons. Need !important on these because there
are a lot of more specific selectors sprinkled around elsewhere for changing are a lot of more specific selectors sprinkled around elsewhere for changing
background / shadows for different states */ background / shadows for different states */

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

@ -11,6 +11,7 @@
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "nsJSPrincipals.h" #include "nsJSPrincipals.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/ChromeUtilsBinding.h" #include "mozilla/dom/ChromeUtilsBinding.h"
class nsIContentSecurityPolicy; class nsIContentSecurityPolicy;
@ -45,11 +46,11 @@ public:
// |!key1=value1&key2=value2|. If there are no non-default attributes, this // |!key1=value1&key2=value2|. If there are no non-default attributes, this
// returns an empty string. // returns an empty string.
void CreateSuffix(nsACString& aStr) const; void CreateSuffix(nsACString& aStr) const;
bool PopulateFromSuffix(const nsACString& aStr); MOZ_MUST_USE bool PopulateFromSuffix(const nsACString& aStr);
// Populates the attributes from a string like // Populates the attributes from a string like
// |uri!key1=value1&key2=value2| and returns the uri without the suffix. // |uri!key1=value1&key2=value2| and returns the uri without the suffix.
bool PopulateFromOrigin(const nsACString& aOrigin, MOZ_MUST_USE bool PopulateFromOrigin(const nsACString& aOrigin,
nsACString& aOriginNoSuffix); nsACString& aOriginNoSuffix);
// Helper function to match mIsPrivateBrowsing to existing private browsing // Helper function to match mIsPrivateBrowsing to existing private browsing

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

@ -139,7 +139,9 @@ ReadSuffixAndSpec(JSStructuredCloneReader* aReader,
return false; return false;
} }
aAttrs.PopulateFromSuffix(suffix); if (!aAttrs.PopulateFromSuffix(suffix)) {
return false;
}
aSpec.SetLength(specLength); aSpec.SetLength(specLength);
if (!JS_ReadBytes(aReader, aSpec.BeginWriting(), specLength)) { if (!JS_ReadBytes(aReader, aSpec.BeginWriting(), specLength)) {

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

@ -13,7 +13,8 @@ TestSuffix(const PrincipalOriginAttributes& attrs)
attrs.CreateSuffix(suffix); attrs.CreateSuffix(suffix);
PrincipalOriginAttributes attrsFromSuffix; PrincipalOriginAttributes attrsFromSuffix;
attrsFromSuffix.PopulateFromSuffix(suffix); bool success = attrsFromSuffix.PopulateFromSuffix(suffix);
EXPECT_TRUE(success);
EXPECT_EQ(attrs, attrsFromSuffix); EXPECT_EQ(attrs, attrsFromSuffix);
} }

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

@ -426,9 +426,13 @@ PrefBranch.prototype = {
* Helper function to initialize the root PrefBranch. * Helper function to initialize the root PrefBranch.
*/ */
_initializeRoot: function () { _initializeRoot: function () {
if (localStorage.length === 0) { if (localStorage.length === 0 && Services._defaultPrefsEnabled) {
// FIXME - this is where we'll load devtools.js to install the /* eslint-disable no-eval */
// default prefs. let devtools = require("raw!prefs!devtools/client/preferences/devtools");
eval(devtools);
let all = require("raw!prefs!modules/libpref/init/all");
eval(all);
/* eslint-enable no-eval */
} }
// Read the prefs from local storage and create the local // Read the prefs from local storage and create the local
@ -449,12 +453,25 @@ PrefBranch.prototype = {
}; };
const Services = { const Services = {
_prefs: null,
// For use by tests. If set to false before Services.prefs is used,
// this will disable the reading of the default prefs.
_defaultPrefsEnabled: true,
/** /**
* An implementation of nsIPrefService that is based on local * An implementation of nsIPrefService that is based on local
* storage. Only the subset of nsIPrefService that is actually used * storage. Only the subset of nsIPrefService that is actually used
* by devtools is implemented here. * by devtools is implemented here. This is lazily instantiated so
* that the tests have a chance to disable the loading of default
* prefs.
*/ */
prefs: new PrefBranch(null, "", ""), get prefs() {
if (!this._prefs) {
this._prefs = new PrefBranch(null, "", "");
}
return this._prefs;
},
/** /**
* An implementation of Services.appinfo that holds just the * An implementation of Services.appinfo that holds just the
@ -582,7 +599,5 @@ function pref(name, value) {
} }
module.exports = Services; module.exports = Services;
// This is exported to silence eslint and, at some point, perhaps to // This is exported to silence eslint.
// provide it when loading devtools.js in order to install the default
// preferences.
exports.pref = pref; exports.pref = pref;

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

@ -52,6 +52,9 @@ localStorage.setItem("Services.prefs:devtools.branch2.someint", JSON.stringify({
"use strict"; "use strict";
function do_tests() { function do_tests() {
// We can't load the defaults in this context.
Services._defaultPrefsEnabled = false;
is(Services.prefs.getBoolPref("devtools.branch1.somebool"), false, is(Services.prefs.getBoolPref("devtools.branch1.somebool"), false,
"bool pref value"); "bool pref value");
Services.prefs.setBoolPref("devtools.branch1.somebool", true); Services.prefs.setBoolPref("devtools.branch1.somebool", true);

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

@ -87,9 +87,7 @@ struct ParamTraits<SerializedLoadContext>
!ReadParam(aMsg, aIter, &suffix)) { !ReadParam(aMsg, aIter, &suffix)) {
return false; return false;
} }
aResult->mOriginAttributes.PopulateFromSuffix(suffix); return aResult->mOriginAttributes.PopulateFromSuffix(suffix);
return true;
} }
}; };

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

@ -2436,7 +2436,8 @@ ContentChild::RecvAddPermission(const IPC::Permission& permission)
// the permission manager does that internally. // the permission manager does that internally.
nsAutoCString originNoSuffix; nsAutoCString originNoSuffix;
PrincipalOriginAttributes attrs; PrincipalOriginAttributes attrs;
attrs.PopulateFromOrigin(permission.origin, originNoSuffix); bool success = attrs.PopulateFromOrigin(permission.origin, originNoSuffix);
NS_ENSURE_TRUE(success, false);
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix); nsresult rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix);

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

@ -369,7 +369,10 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
showAccelerators = ipcContext.showAccelerators(); showAccelerators = ipcContext.showAccelerators();
showFocusRings = ipcContext.showFocusRings(); showFocusRings = ipcContext.showFocusRings();
originSuffix = ipcContext.originSuffix(); originSuffix = ipcContext.originSuffix();
originAttributes.PopulateFromSuffix(originSuffix); if (!originAttributes.PopulateFromSuffix(originSuffix)) {
mInvalidReason = "Populate originAttributes from originSuffix failed.";
return;
}
break; break;
} }
case IPCTabContext::TUnsafeIPCTabContext: { case IPCTabContext::TUnsafeIPCTabContext: {

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

@ -55,7 +55,8 @@ Scheme0Scope(DOMStorageCacheBridge* aCache)
PrincipalOriginAttributes oa; PrincipalOriginAttributes oa;
if (!suffix.IsEmpty()) { if (!suffix.IsEmpty()) {
oa.PopulateFromSuffix(suffix); DebugOnly<bool> success = oa.PopulateFromSuffix(suffix);
MOZ_ASSERT(success);
} }
if (oa.mAppId != nsIScriptSecurityManager::NO_APP_ID || oa.mInIsolatedMozBrowser) { if (oa.mAppId != nsIScriptSecurityManager::NO_APP_ID || oa.mInIsolatedMozBrowser) {
@ -763,7 +764,8 @@ OriginAttrsPatternMatchSQLFunction::OnFunctionCall(
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
PrincipalOriginAttributes oa; PrincipalOriginAttributes oa;
oa.PopulateFromSuffix(suffix); bool success = oa.PopulateFromSuffix(suffix);
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
bool result = mPattern.Matches(oa); bool result = mPattern.Matches(oa);
RefPtr<nsVariant> outVar(new nsVariant()); RefPtr<nsVariant> outVar(new nsVariant());

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

@ -235,6 +235,7 @@ ScaledFontBase::GetGlyphDesignMetrics(const uint16_t* aGlyphs, uint32_t aNumGlyp
} }
#endif #endif
} }
cairo_font_options_destroy(options);
} }
} }

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

@ -106,6 +106,7 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback, AppStateL
if (camera != null) { if (camera != null) {
mResumeCapture = true; mResumeCapture = true;
stopCapture(); stopCapture();
GeckoAppShell.notifyObservers("VideoCapture:Paused", null);
} }
} }
@ -114,6 +115,7 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback, AppStateL
if (mResumeCapture) { if (mResumeCapture) {
startCapture(mCaptureWidth, mCaptureHeight, mCaptureMinFPS, mCaptureMaxFPS); startCapture(mCaptureWidth, mCaptureHeight, mCaptureMinFPS, mCaptureMaxFPS);
mResumeCapture = false; mResumeCapture = false;
GeckoAppShell.notifyObservers("VideoCapture:Resumed", null);
} }
} }

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

@ -472,7 +472,10 @@ pref("plugin.default.state", 1);
// product URLs // product URLs
// The breakpad report server to link to in about:crashes // The breakpad report server to link to in about:crashes
pref("breakpad.reportURL", "https://crash-stats.mozilla.com/report/index/"); pref("breakpad.reportURL", "https://crash-stats.mozilla.com/report/index/");
pref("app.support.baseURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/"); pref("app.support.baseURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/");
pref("app.supportURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/mobile-help");
pref("app.faqURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/faq");
// URL for feedback page // URL for feedback page
// This should be kept in sync with the "feedback_link" string defined in strings.xml.in // This should be kept in sync with the "feedback_link" string defined in strings.xml.in
@ -489,8 +492,6 @@ pref("app.releaseNotesURL", "https://www.mozilla.com/%LOCALE%/mobile/%VERSION%be
pref("app.releaseNotesURL", "https://www.mozilla.com/%LOCALE%/mobile/%VERSION%/releasenotes/"); pref("app.releaseNotesURL", "https://www.mozilla.com/%LOCALE%/mobile/%VERSION%/releasenotes/");
#endif #endif
pref("app.faqURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/faq");
// Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror) // Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
pref("security.alternate_certificate_error_page", "certerror"); pref("security.alternate_certificate_error_page", "certerror");

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

@ -85,8 +85,8 @@
<string name="url_bar_default_text">&url_bar_default_text2;</string> <string name="url_bar_default_text">&url_bar_default_text2;</string>
<!-- https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/ --> <!-- https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/mobile-help -->
<string name="help_link">https://support.mozilla.org/1/mobile/&formatS1;/&formatS2;/&formatS3;/</string> <string name="help_link">https://support.mozilla.org/1/mobile/&formatS1;/&formatS2;/&formatS3;/mobile-help</string>
<string name="help_menu">&help_menu;</string> <string name="help_menu">&help_menu;</string>
<string name="quit">&quit;</string> <string name="quit">&quit;</string>

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

@ -46,6 +46,13 @@ var WebrtcUI = {
this.notify(); this.notify();
break; break;
} }
} else if (aTopic === "VideoCapture:Paused") {
if (this._notificationId) {
Notifications.cancel(this._notificationId);
this._notificationId = null;
}
} else if (aTopic === "VideoCapture:Resumed") {
this.notify();
} }
}, },

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

@ -45,7 +45,7 @@ function init() {
let links = [ let links = [
{id: "releaseNotesURL", pref: "app.releaseNotesURL"}, {id: "releaseNotesURL", pref: "app.releaseNotesURL"},
{id: "supportURL", pref: "app.support.baseURL"}, {id: "supportURL", pref: "app.supportURL"},
{id: "faqURL", pref: "app.faqURL"}, {id: "faqURL", pref: "app.faqURL"},
{id: "privacyURL", pref: "app.privacyURL"}, {id: "privacyURL", pref: "app.privacyURL"},
{id: "creditsURL", pref: "app.creditsURL"}, {id: "creditsURL", pref: "app.creditsURL"},

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

@ -166,7 +166,9 @@ if (AppConstants.MOZ_WEBRTC) {
lazilyLoadedObserverScripts.push( lazilyLoadedObserverScripts.push(
["WebrtcUI", ["getUserMedia:request", ["WebrtcUI", ["getUserMedia:request",
"PeerConnection:request", "PeerConnection:request",
"recording-device-events"], "chrome://browser/content/WebrtcUI.js"]) "recording-device-events",
"VideoCapture:Paused",
"VideoCapture:Resumed"], "chrome://browser/content/WebrtcUI.js"])
} }
lazilyLoadedObserverScripts.forEach(function (aScript) { lazilyLoadedObserverScripts.forEach(function (aScript) {

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

@ -7,6 +7,7 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "mozilla/unused.h"
#include "mozilla/net/CookieServiceChild.h" #include "mozilla/net/CookieServiceChild.h"
#include "mozilla/net/NeckoCommon.h" #include "mozilla/net/NeckoCommon.h"
@ -491,7 +492,8 @@ public:
nsAutoCString suffix; nsAutoCString suffix;
row->GetUTF8String(IDX_ORIGIN_ATTRIBUTES, suffix); row->GetUTF8String(IDX_ORIGIN_ATTRIBUTES, suffix);
tuple->key.mOriginAttributes.PopulateFromSuffix(suffix); DebugOnly<bool> success = tuple->key.mOriginAttributes.PopulateFromSuffix(suffix);
MOZ_ASSERT(success);
tuple->cookie = tuple->cookie =
gCookieService->GetCookieFromRow(row, tuple->key.mOriginAttributes); gCookieService->GetCookieFromRow(row, tuple->key.mOriginAttributes);
@ -864,7 +866,8 @@ SetAppIdFromOriginAttributesSQLFunction::OnFunctionCall(
rv = aFunctionArguments->GetUTF8String(0, suffix); rv = aFunctionArguments->GetUTF8String(0, suffix);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
attrs.PopulateFromSuffix(suffix); bool success = attrs.PopulateFromSuffix(suffix);
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
RefPtr<nsVariant> outVar(new nsVariant()); RefPtr<nsVariant> outVar(new nsVariant());
rv = outVar->SetAsInt32(attrs.mAppId); rv = outVar->SetAsInt32(attrs.mAppId);
@ -896,7 +899,8 @@ SetInBrowserFromOriginAttributesSQLFunction::OnFunctionCall(
rv = aFunctionArguments->GetUTF8String(0, suffix); rv = aFunctionArguments->GetUTF8String(0, suffix);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
attrs.PopulateFromSuffix(suffix); bool success = attrs.PopulateFromSuffix(suffix);
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
RefPtr<nsVariant> outVar(new nsVariant()); RefPtr<nsVariant> outVar(new nsVariant());
rv = outVar->SetAsInt32(attrs.mInIsolatedMozBrowser); rv = outVar->SetAsInt32(attrs.mInIsolatedMozBrowser);
@ -2798,7 +2802,9 @@ nsCookieService::EnsureReadComplete()
nsAutoCString suffix; nsAutoCString suffix;
NeckoOriginAttributes attrs; NeckoOriginAttributes attrs;
stmt->GetUTF8String(IDX_ORIGIN_ATTRIBUTES, suffix); stmt->GetUTF8String(IDX_ORIGIN_ATTRIBUTES, suffix);
attrs.PopulateFromSuffix(suffix); // If PopulateFromSuffix failed we just ignore the OA attributes
// that we don't support
Unused << attrs.PopulateFromSuffix(suffix);
nsCookieKey key(baseDomain, attrs); nsCookieKey key(baseDomain, attrs);
if (mDefaultDBState->readSet.GetEntry(key)) if (mDefaultDBState->readSet.GetEntry(key))

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

@ -82,7 +82,8 @@ NS_IMETHODIMP PackagedAppVerifier::Init(nsIPackagedAppVerifierListener* aListene
mIsFirstResource = true; mIsFirstResource = true;
mManifest = EmptyCString(); mManifest = EmptyCString();
NeckoOriginAttributes().PopulateFromOrigin(aPackageOrigin, mPackageOrigin); bool success = NeckoOriginAttributes().PopulateFromOrigin(aPackageOrigin, mPackageOrigin);
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
mBypassVerification = (mPackageOrigin == mBypassVerification = (mPackageOrigin ==
Preferences::GetCString("network.http.signed-packages.trusted-origin")); Preferences::GetCString("network.http.signed-packages.trusted-origin"));

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

@ -21,6 +21,7 @@ if CONFIG['HOST_OS_ARCH'] == 'WINNT':
HOST_OS_LIBS += [ HOST_OS_LIBS += [
'ws2_32', 'ws2_32',
] ]
USE_STATIC_LIBS = True
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'/toolkit/mozapps/update/updater', '/toolkit/mozapps/update/updater',

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

@ -4,6 +4,8 @@ set -x -e
echo "running as" $(id) echo "running as" $(id)
. /home/worker/scripts/xvfb.sh
#### ####
# Taskcluster friendly wrapper for performing fx desktop l10n repacks via mozharness. # Taskcluster friendly wrapper for performing fx desktop l10n repacks via mozharness.
# Based on ./build-linux.sh # Based on ./build-linux.sh
@ -43,37 +45,14 @@ if [[ -z ${MOZHARNESS_CONFIG} ]]; then fail "MOZHARNESS_CONFIG is not set"; fi
cleanup() { cleanup() {
local rv=$? local rv=$?
if [ -n "$xvfb_pid" ]; then cleanup_xvfb
kill $xvfb_pid || true
fi
exit $rv exit $rv
} }
trap cleanup EXIT INT trap cleanup EXIT INT
# run mozharness in XVfb, if necessary; this is an array to maintain the quoting in the -s argument # run XVfb in the background, if necessary
if $NEED_XVFB; then if $NEED_XVFB; then
# Some mozharness scripts set DISPLAY=:2 start_xvfb '1024x768x24' 2
Xvfb :2 -screen 0 1024x768x24 &
export DISPLAY=:2
xvfb_pid=$!
# Only error code 255 matters, because it signifies that no
# display could be opened. As long as we can open the display
# tests should work. We'll retry a few times with a sleep before
# failing.
retry_count=0
max_retries=2
xvfb_test=0
until [ $retry_count -gt $max_retries ]; do
xvinfo || xvfb_test=$?
if [ $xvfb_test != 255 ]; then
retry_count=$(($max_retries + 1))
else
retry_count=$(($retry_count + 1))
echo "Failed to start Xvfb, retry: $retry_count"
sleep 2
fi
done
if [ $xvfb_test == 255 ]; then fail "xvfb did not start properly"; fi
fi fi
# set up mozharness configuration, via command line, env, etc. # set up mozharness configuration, via command line, env, etc.

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

@ -4,6 +4,8 @@ set -x -e
echo "running as" $(id) echo "running as" $(id)
. /home/worker/scripts/xvfb.sh
#### ####
# Taskcluster friendly wrapper for performing fx desktop builds via mozharness. # Taskcluster friendly wrapper for performing fx desktop builds via mozharness.
#### ####
@ -54,37 +56,14 @@ if [[ -z ${MOZHARNESS_CONFIG} ]]; then fail "MOZHARNESS_CONFIG is not set"; fi
cleanup() { cleanup() {
local rv=$? local rv=$?
if [ -n "$xvfb_pid" ]; then cleanup_xvfb
kill $xvfb_pid || true
fi
exit $rv exit $rv
} }
trap cleanup EXIT INT trap cleanup EXIT INT
# run mozharness in XVfb, if necessary; this is an array to maintain the quoting in the -s argument # run XVfb in the background, if necessary
if $NEED_XVFB; then if $NEED_XVFB; then
# Some mozharness scripts set DISPLAY=:2 start_xvfb '1024x768x24' 2
Xvfb :2 -screen 0 1024x768x24 &
export DISPLAY=:2
xvfb_pid=$!
# Only error code 255 matters, because it signifies that no
# display could be opened. As long as we can open the display
# tests should work. We'll retry a few times with a sleep before
# failing.
retry_count=0
max_retries=2
xvfb_test=0
until [ $retry_count -gt $max_retries ]; do
xvinfo || xvfb_test=$?
if [ $xvfb_test != 255 ]; then
retry_count=$(($max_retries + 1))
else
retry_count=$(($retry_count + 1))
echo "Failed to start Xvfb, retry: $retry_count"
sleep 2
fi
done
if [ $xvfb_test == 255 ]; then fail "xvfb did not start properly"; fi
fi fi
# set up mozharness configuration, via command line, env, etc. # set up mozharness configuration, via command line, env, etc.

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

@ -4,6 +4,8 @@ set -x -e
echo "running as" $(id) echo "running as" $(id)
. /home/worker/scripts/xvfb.sh
#### ####
# Taskcluster friendly wrapper for performing fx desktop tests via mozharness. # Taskcluster friendly wrapper for performing fx desktop tests via mozharness.
#### ####
@ -43,13 +45,7 @@ cleanup() {
# To share X issues # To share X issues
cp /home/worker/.xsession-errors ~/artifacts/public/xsession-errors.log cp /home/worker/.xsession-errors ~/artifacts/public/xsession-errors.log
fi fi
# When you call this script with START_VNC or TASKCLUSTER_INTERACTIVE cleanup_xvfb
# we make sure we do not kill xvfb so you do not lose your connection
xvfb_pid=`pidof Xvfb`
if [ -n "$xvfb_pid" ] && [ $START_VNC == false ] && [ $TASKCLUSTER_INTERACTIVE == false ] ; then
kill $xvfb_pid || true
screen -XS xvfb quit || true
fi
exit $rv exit $rv
} }
trap cleanup EXIT INT trap cleanup EXIT INT
@ -73,29 +69,9 @@ if $NEED_PULSEAUDIO; then
pactl load-module module-null-sink pactl load-module module-null-sink
fi fi
# run Xvfb in the background, if necessary # run XVfb in the background, if necessary
if $NEED_XVFB; then if $NEED_XVFB; then
screen -dmS xvfb Xvfb :0 -nolisten tcp -screen 0 1600x1200x24 \ start_xvfb '1600x1200x24' 0
> ~/artifacts/public/xvfb.log 2>&1
export DISPLAY=:0
# Only error code 255 matters, because it signifies that no
# display could be opened. As long as we can open the display
# tests should work. We'll retry a few times with a sleep before
# failing.
retry_count=0
max_retries=2
xvfb_test=0
until [ $retry_count -gt $max_retries ]; do
xvinfo || xvfb_test=$?
if [ $xvfb_test != 255 ]; then
retry_count=$(($max_retries + 1))
else
retry_count=$(($retry_count + 1))
echo "Failed to start Xvfb, retry: $retry_count"
sleep 2
fi
done
if [ $xvfb_test == 255 ]; then fail "xvfb did not start properly"; fi
fi fi
if $START_VNC; then if $START_VNC; then

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

@ -4,6 +4,8 @@ set -x -e
echo "running as" $(id) echo "running as" $(id)
. /home/worker/scripts/xvfb.sh
#### ####
# Taskcluster friendly wrapper for performing fx desktop tests via mozharness. # Taskcluster friendly wrapper for performing fx desktop tests via mozharness.
#### ####
@ -43,13 +45,7 @@ cleanup() {
# To share X issues # To share X issues
cp /home/worker/.xsession-errors ~/artifacts/public/xsession-errors.log cp /home/worker/.xsession-errors ~/artifacts/public/xsession-errors.log
fi fi
# When you call this script with START_VNC or TASKCLUSTER_INTERACTIVE cleanup_xvfb
# we make sure we do not kill xvfb so you do not lose your connection
xvfb_pid=`pidof Xvfb`
if [ -n "$xvfb_pid" ] && [ $START_VNC == false ] && [ $TASKCLUSTER_INTERACTIVE == false ] ; then
kill $xvfb_pid || true
screen -XS xvfb quit || true
fi
exit $rv exit $rv
} }
trap cleanup EXIT INT trap cleanup EXIT INT
@ -66,30 +62,9 @@ if ! [ -d mozharness ]; then
fail "mozharness zip did not contain mozharness/" fail "mozharness zip did not contain mozharness/"
fi fi
# run Xvfb in the background, if necessary # run XVfb in the background, if necessary
if $NEED_XVFB; then if $NEED_XVFB; then
screen -dmS xvfb Xvfb :0 -nolisten tcp -screen 0 1600x1200x24 \ start_xvfb '1600x1200x24' 0
> ~/artifacts/public/xvfb.log 2>&1
export DISPLAY=:0
# Only error code 255 matters, because it signifies that no
# display could be opened. As long as we can open the display
# tests should work. We'll retry a few times with a sleep before
# failing.
retry_count=0
max_retries=2
xvfb_test=0
until [ $retry_count -gt $max_retries ]; do
xvinfo || xvfb_test=$?
if [ $xvfb_test != 255 ]; then
retry_count=$(($max_retries + 1))
else
retry_count=$(($retry_count + 1))
echo "Failed to start Xvfb, retry: $retry_count"
sleep 2
fi
done
if [ $xvfb_test == 255 ]; then fail "xvfb did not start properly"; fi
fi fi
if $START_VNC; then if $START_VNC; then

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

@ -11,6 +11,10 @@ VOLUME /home/worker/tooltool-cache
ADD bin /home/worker/bin ADD bin /home/worker/bin
RUN chmod +x /home/worker/bin/* RUN chmod +x /home/worker/bin/*
# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb
# %include testing/docker/recipes/xvfb.sh
ADD topsrcdir/testing/docker/recipes/xvfb.sh /home/worker/scripts/xvfb.sh
# Add configuration # Add configuration
COPY dot-config /home/worker/.config COPY dot-config /home/worker/.config
@ -33,5 +37,9 @@ ADD buildprops.json /home/worker/
RUN wget -O /builds/tooltool.py https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py RUN wget -O /builds/tooltool.py https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py
RUN chmod +x /builds/tooltool.py RUN chmod +x /builds/tooltool.py
# Move installation to base centos6-build image once Bug 1272629 is fixed
# Install the screen package here to use with xvfb.
RUN yum install -y screen
# Set a default command useful for debugging # Set a default command useful for debugging
CMD ["/bin/bash", "--login"] CMD ["/bin/bash", "--login"]

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

@ -10,6 +10,10 @@ ADD topsrcdir/testing/docker/recipes/tooltool.py /setup/tooltool.py
# %include testing/docker/recipes/install-mercurial.sh # %include testing/docker/recipes/install-mercurial.sh
ADD topsrcdir/testing/docker/recipes/install-mercurial.sh /tmp/install-mercurial.sh ADD topsrcdir/testing/docker/recipes/install-mercurial.sh /tmp/install-mercurial.sh
# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb
# %include testing/docker/recipes/xvfb.sh
ADD topsrcdir/testing/docker/recipes/xvfb.sh /home/worker/scripts/xvfb.sh
# %include testing/docker/recipes/ubuntu1204-test-system-setup.sh # %include testing/docker/recipes/ubuntu1204-test-system-setup.sh
ADD topsrcdir/testing/docker/recipes/ubuntu1204-test-system-setup.sh /setup/system-setup.sh ADD topsrcdir/testing/docker/recipes/ubuntu1204-test-system-setup.sh /setup/system-setup.sh
RUN bash /setup/system-setup.sh RUN bash /setup/system-setup.sh

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

@ -14,6 +14,10 @@ ADD topsrcdir/testing/docker/recipes/install-mercurial.sh /setup/install-mercuri
ADD topsrcdir/testing/docker/recipes/ubuntu1604-test-system-setup.sh /setup/system-setup.sh ADD topsrcdir/testing/docker/recipes/ubuntu1604-test-system-setup.sh /setup/system-setup.sh
RUN bash /setup/system-setup.sh RUN bash /setup/system-setup.sh
# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb
# %include testing/docker/recipes/xvfb.sh
ADD topsrcdir/testing/docker/recipes/xvfb.sh /home/worker/scripts/xvfb.sh
# %include testing/docker/recipes/run-task # %include testing/docker/recipes/run-task
ADD topsrcdir/testing/docker/recipes/run-task /home/worker/bin/run-task ADD topsrcdir/testing/docker/recipes/run-task /home/worker/bin/run-task

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

@ -0,0 +1,75 @@
#! /bin/bash -x
set -x
fail() {
echo # make sure error message is on a new line
echo "[xvfb.sh:error]" "${@}"
exit 1
}
cleanup_xvfb() {
# When you call this script with START_VNC or TASKCLUSTER_INTERACTIVE
# we make sure we do not kill xvfb so you do not lose your connection
local xvfb_pid=`pidof Xvfb`
local vnc=${START_VNC:-false}
local interactive=${TASKCLUSTER_INTERACTIVE:-false}
if [ -n "$xvfb_pid" ] && [[ $vnc == false ]] && [[ $interactive == false ]] ; then
kill $xvfb_pid || true
screen -XS xvfb quit || true
fi
}
# Attempt to start xvfb in a screen session with the given resolution and display
# number. Up to 5 attempts will be made to start xvfb with a short delay
# between retries
try_xvfb() {
screen -dmS xvfb Xvfb :$2 -nolisten tcp -screen 0 $1 \
> ~/artifacts/xvfb/xvfb.log 2>&1
export DISPLAY=:$2
# Only error code 255 matters, because it signifies that no
# display could be opened. As long as we can open the display
# tests should work. We'll retry a few times with a sleep before
# failing.
local retry_count=0
local max_retries=5
xvfb_test=0
until [ $retry_count -gt $max_retries ]; do
xvinfo || xvfb_test=$?
if [ $xvfb_test != 255 ]; then
retry_count=$(($max_retries + 1))
else
retry_count=$(($retry_count + 1))
echo "Failed to start Xvfb, retry: $retry_count"
sleep 2
fi
done
if [ $xvfb_test == 255 ]; then
return 1
else
return 0
fi
}
start_xvfb() {
set +e
mkdir -p ~/artifacts/xvfb
local retry_count=0
local max_retries=2
local success=1
until [ $retry_count -gt $max_retries ]; do
try_xvfb $1 $2
success=$?
if [ $success -eq 0 ]; then
retry_count=$(($max_retries + 1))
else
retry_count=$(($retry_count + 1))
sleep 10
fi
done
set -e
if [ $success -eq 1 ]; then
fail "Could not start xvfb after ${max_retries} attempts"
fi
}

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

@ -114,7 +114,9 @@ config = {
"--appname=%(binary_path)s", "--appname=%(binary_path)s",
"--utility-path=tests/bin", "--utility-path=tests/bin",
"--extra-profile-file=tests/bin/plugins", "--extra-profile-file=tests/bin/plugins",
"--symbols-path=%(symbols_path)s" "--symbols-path=%(symbols_path)s",
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--cleanup-crashes", "--cleanup-crashes",
], ],
"run_filename": "runreftest.py", "run_filename": "runreftest.py",