зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland a=merge on a CLOSED TREE
This commit is contained in:
Коммит
446b02e5b2
|
@ -94,146 +94,132 @@ SetPrefsFd(int aFd)
|
|||
bool
|
||||
ContentProcess::Init(int aArgc, char* aArgv[])
|
||||
{
|
||||
// If passed in grab the application path for xpcom init
|
||||
bool foundAppdir = false;
|
||||
bool foundChildID = false;
|
||||
bool foundIsForBrowser = false;
|
||||
#ifdef XP_WIN
|
||||
bool foundPrefsHandle = false;
|
||||
#endif
|
||||
bool foundPrefsLen = false;
|
||||
bool foundSchedulerPrefs = false;
|
||||
|
||||
uint64_t childID;
|
||||
bool isForBrowser;
|
||||
|
||||
Maybe<uint64_t> childID;
|
||||
Maybe<bool> isForBrowser;
|
||||
Maybe<base::SharedMemoryHandle> prefsHandle;
|
||||
Maybe<size_t> prefsLen;
|
||||
Maybe<const char*> schedulerPrefs;
|
||||
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
|
||||
// If passed in grab the profile path for sandboxing
|
||||
bool foundProfile = false;
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
#endif
|
||||
|
||||
char* schedulerPrefs = nullptr;
|
||||
base::SharedMemoryHandle prefsHandle = base::SharedMemory::NULLHandle();
|
||||
size_t prefsLen = 0;
|
||||
for (int idx = aArgc; idx > 0; idx--) {
|
||||
if (!aArgv[idx]) {
|
||||
for (int i = 1; i < aArgc; i++) {
|
||||
if (!aArgv[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(aArgv[idx], "-appdir")) {
|
||||
MOZ_ASSERT(!foundAppdir);
|
||||
if (foundAppdir) {
|
||||
continue;
|
||||
if (strcmp(aArgv[i], "-appdir") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
nsCString appDir;
|
||||
appDir.Assign(nsDependentCString(aArgv[idx+1]));
|
||||
nsDependentCString appDir(aArgv[i]);
|
||||
mXREEmbed.SetAppDir(appDir);
|
||||
foundAppdir = true;
|
||||
} else if (!strcmp(aArgv[idx], "-childID")) {
|
||||
MOZ_ASSERT(!foundChildID);
|
||||
if (foundChildID) {
|
||||
continue;
|
||||
|
||||
} else if (strcmp(aArgv[i], "-childID") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
if (idx + 1 < aArgc) {
|
||||
childID = strtoull(aArgv[idx + 1], nullptr, 10);
|
||||
foundChildID = true;
|
||||
char* str = aArgv[i];
|
||||
childID = Some(strtoull(str, &str, 10));
|
||||
if (str[0] != '\0') {
|
||||
return false;
|
||||
}
|
||||
} else if (!strcmp(aArgv[idx], "-isForBrowser") || !strcmp(aArgv[idx], "-notForBrowser")) {
|
||||
MOZ_ASSERT(!foundIsForBrowser);
|
||||
if (foundIsForBrowser) {
|
||||
continue;
|
||||
}
|
||||
isForBrowser = strcmp(aArgv[idx], "-notForBrowser");
|
||||
foundIsForBrowser = true;
|
||||
|
||||
} else if (strcmp(aArgv[i], "-isForBrowser") == 0) {
|
||||
isForBrowser = Some(true);
|
||||
|
||||
} else if (strcmp(aArgv[i], "-notForBrowser") == 0) {
|
||||
isForBrowser = Some(false);
|
||||
|
||||
#ifdef XP_WIN
|
||||
} else if (!strcmp(aArgv[idx], "-prefsHandle")) {
|
||||
char* str = aArgv[idx + 1];
|
||||
MOZ_ASSERT(str[0] != '\0');
|
||||
// ContentParent uses %zu to print a word-sized unsigned integer. So even
|
||||
// though strtoull() returns a long long int, it will fit in a uintptr_t.
|
||||
prefsHandle = reinterpret_cast<HANDLE>(strtoull(str, &str, 10));
|
||||
MOZ_ASSERT(str[0] == '\0');
|
||||
foundPrefsHandle = true;
|
||||
#endif
|
||||
} else if (!strcmp(aArgv[idx], "-prefsLen")) {
|
||||
char* str = aArgv[idx + 1];
|
||||
MOZ_ASSERT(str[0] != '\0');
|
||||
// ContentParent uses %zu to print a word-sized unsigned integer. So even
|
||||
// though strtoull() returns a long long int, it will fit in a uintptr_t.
|
||||
prefsLen = strtoull(str, &str, 10);
|
||||
MOZ_ASSERT(str[0] == '\0');
|
||||
foundPrefsLen = true;
|
||||
} else if (!strcmp(aArgv[idx], "-schedulerPrefs")) {
|
||||
schedulerPrefs = aArgv[idx + 1];
|
||||
foundSchedulerPrefs = true;
|
||||
} else if (!strcmp(aArgv[idx], "-safeMode")) {
|
||||
gSafeMode = true;
|
||||
} else if (strcmp(aArgv[i], "-prefsHandle") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
// ContentParent uses %zu to print a word-sized unsigned integer. So
|
||||
// even though strtoull() returns a long long int, it will fit in a
|
||||
// uintptr_t.
|
||||
char* str = aArgv[i];
|
||||
prefsHandle = Some(reinterpret_cast<HANDLE>(strtoull(str, &str, 10)));
|
||||
if (str[0] != '\0') {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
} else if (strcmp(aArgv[i], "-prefsLen") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
// ContentParent uses %zu to print a word-sized unsigned integer. So
|
||||
// even though strtoull() returns a long long int, it will fit in a
|
||||
// uintptr_t.
|
||||
char* str = aArgv[i];
|
||||
prefsLen = Some(strtoull(str, &str, 10));
|
||||
if (str[0] != '\0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (strcmp(aArgv[i], "-schedulerPrefs") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
schedulerPrefs = Some(aArgv[i]);
|
||||
|
||||
} else if (strcmp(aArgv[i], "-safeMode") == 0) {
|
||||
gSafeMode = true;
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
|
||||
else if (!strcmp(aArgv[idx], "-profile")) {
|
||||
MOZ_ASSERT(!foundProfile);
|
||||
if (foundProfile) {
|
||||
continue;
|
||||
} else if (strcmp(aArgv[i], "-profile") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
bool flag;
|
||||
nsresult rv = XRE_GetFileFromPath(aArgv[idx+1], getter_AddRefs(profileDir));
|
||||
if (NS_FAILED(rv) ||
|
||||
NS_FAILED(profileDir->Exists(&flag)) || !flag) {
|
||||
nsresult rv = XRE_GetFileFromPath(aArgv[i], getter_AddRefs(profileDir));
|
||||
if (NS_FAILED(rv) || NS_FAILED(profileDir->Exists(&flag)) || !flag) {
|
||||
NS_WARNING("Invalid profile directory passed to content process.");
|
||||
profileDir = nullptr;
|
||||
}
|
||||
foundProfile = true;
|
||||
}
|
||||
#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */
|
||||
|
||||
bool allFound = foundAppdir
|
||||
&& foundChildID
|
||||
&& foundIsForBrowser
|
||||
&& foundPrefsLen
|
||||
&& foundSchedulerPrefs
|
||||
#ifdef XP_WIN
|
||||
&& foundPrefsHandle
|
||||
#endif
|
||||
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
|
||||
&& foundProfile
|
||||
#endif
|
||||
&& true;
|
||||
|
||||
if (allFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
// Android is different; get the FD via gPrefsFd instead of a fixed fd.
|
||||
MOZ_RELEASE_ASSERT(gPrefsFd != -1);
|
||||
prefsHandle = base::FileDescriptor(gPrefsFd, /* auto_close */ true);
|
||||
prefsHandle = Some(base::FileDescriptor(gPrefsFd, /* auto_close */ true));
|
||||
#elif XP_UNIX
|
||||
prefsHandle = base::FileDescriptor(kPrefsFileDescriptor,
|
||||
/* auto_close */ true);
|
||||
prefsHandle = Some(base::FileDescriptor(kPrefsFileDescriptor,
|
||||
/* auto_close */ true));
|
||||
#endif
|
||||
|
||||
// Did we find all the mandatory flags?
|
||||
if (childID.isNothing() ||
|
||||
isForBrowser.isNothing() ||
|
||||
prefsHandle.isNothing() ||
|
||||
prefsLen.isNothing() ||
|
||||
schedulerPrefs.isNothing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set up early prefs from the shared memory.
|
||||
base::SharedMemory shm;
|
||||
if (!shm.SetHandle(prefsHandle, /* read_only */ true)) {
|
||||
if (!shm.SetHandle(*prefsHandle, /* read_only */ true)) {
|
||||
NS_ERROR("failed to open shared memory in the child");
|
||||
return false;
|
||||
}
|
||||
if (!shm.Map(prefsLen)) {
|
||||
if (!shm.Map(*prefsLen)) {
|
||||
NS_ERROR("failed to map shared memory in the child");
|
||||
return false;
|
||||
}
|
||||
Preferences::DeserializePreferences(static_cast<char*>(shm.memory()),
|
||||
prefsLen);
|
||||
*prefsLen);
|
||||
|
||||
Scheduler::SetPrefs(schedulerPrefs);
|
||||
Scheduler::SetPrefs(*schedulerPrefs);
|
||||
mContent.Init(IOThreadChild::message_loop(),
|
||||
ParentPid(),
|
||||
IOThreadChild::channel(),
|
||||
childID,
|
||||
isForBrowser);
|
||||
*childID,
|
||||
*isForBrowser);
|
||||
mXREEmbed.Start();
|
||||
#if (defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
|
||||
mContent.SetProfileDir(profileDir);
|
||||
|
|
|
@ -111,79 +111,3 @@ function get_test_plugin_no_symlink() {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
var gGlobalScope = this;
|
||||
function loadAddonManager() {
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm", ns);
|
||||
let head = "../../../../toolkit/mozapps/extensions/test/xpcshell/head_addons.js";
|
||||
let file = do_get_file(head);
|
||||
let uri = ns.Services.io.newFileURI(file);
|
||||
ns.Services.scriptloader.loadSubScript(uri.spec, gGlobalScope);
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
startupManager();
|
||||
}
|
||||
|
||||
// Install addon and return a Promise<boolean> that is
|
||||
// resolve with true on success, false otherwise.
|
||||
function installAddon(relativePath) {
|
||||
return new Promise(resolve => {
|
||||
let success = () => resolve(true);
|
||||
let fail = () => resolve(false);
|
||||
let listener = {
|
||||
onDownloadCancelled: fail,
|
||||
onDownloadFailed: fail,
|
||||
onInstallCancelled: fail,
|
||||
onInstallFailed: fail,
|
||||
onInstallEnded: success,
|
||||
};
|
||||
|
||||
let installCallback = install => {
|
||||
install.addListener(listener);
|
||||
install.install();
|
||||
};
|
||||
|
||||
let file = do_get_file(relativePath, false);
|
||||
AddonManager.getInstallForFile(file, installCallback,
|
||||
"application/x-xpinstall");
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// Uninstall addon and return a Promise<boolean> that is
|
||||
// resolve with true on success, false otherwise.
|
||||
function uninstallAddon(id) {
|
||||
return new Promise(resolve => {
|
||||
|
||||
AddonManager.getAddonByID(id, addon => {
|
||||
if (!addon) {
|
||||
resolve(false);
|
||||
}
|
||||
|
||||
let listener = {};
|
||||
let handler = addon => {
|
||||
if (addon.id !== id) {
|
||||
return;
|
||||
}
|
||||
|
||||
AddonManager.removeAddonListener(listener);
|
||||
resolve(true);
|
||||
};
|
||||
|
||||
listener.onUninstalled = handler;
|
||||
listener.onDisabled = handler;
|
||||
|
||||
AddonManager.addAddonListener(listener);
|
||||
addon.uninstall();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// Returns a Promise<Addon> that is resolved with
|
||||
// the corresponding addon or rejected.
|
||||
function getAddonByID(id) {
|
||||
return new Promise(resolve => {
|
||||
AddonManager.getAddonByID(id, addon => resolve(addon));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ skip-if = toolkit == 'android'
|
|||
head = head_plugins.js
|
||||
tags = addons
|
||||
firefox-appdir = browser
|
||||
support-files =
|
||||
!/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
|
||||
|
||||
[test_allowed_types.js]
|
||||
skip-if = appname == "thunderbird"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/layers/CompositorOptions.h"
|
||||
#include "mozilla/webrender/RenderThread.h"
|
||||
#include "mozilla/widget/CompositorWidget.h"
|
||||
#include "mozilla/widget/WinCompositorWidget.h"
|
||||
|
||||
|
@ -433,7 +434,22 @@ CreateForWidget(const HWND window, const bool isWebRender, const bool requireAcc
|
|||
LOCAL_WGL_ACCELERATION_ARB, LOCAL_WGL_FULL_ACCELERATION_ARB,
|
||||
0
|
||||
};
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(wgl.RootDc(), kAttribs, nullptr, 1,
|
||||
const int kAttribsForWebRender[] = {
|
||||
LOCAL_WGL_DRAW_TO_WINDOW_ARB, true,
|
||||
LOCAL_WGL_SUPPORT_OPENGL_ARB, true,
|
||||
LOCAL_WGL_DOUBLE_BUFFER_ARB, true,
|
||||
LOCAL_WGL_DEPTH_BITS_ARB, 24,
|
||||
LOCAL_WGL_ACCELERATION_ARB, LOCAL_WGL_FULL_ACCELERATION_ARB,
|
||||
0
|
||||
};
|
||||
const int* attribs;
|
||||
if (wr::RenderThread::IsInRenderThread()) {
|
||||
attribs = kAttribsForWebRender;
|
||||
} else {
|
||||
attribs = kAttribs;
|
||||
}
|
||||
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(wgl.RootDc(), attribs, nullptr, 1,
|
||||
&chosenFormat, &foundFormats))
|
||||
{
|
||||
foundFormats = 0;
|
||||
|
@ -449,7 +465,22 @@ CreateForWidget(const HWND window, const bool isWebRender, const bool requireAcc
|
|||
LOCAL_WGL_DOUBLE_BUFFER_ARB, true,
|
||||
0
|
||||
};
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(wgl.RootDc(), kAttribs, nullptr, 1,
|
||||
const int kAttribsForWebRender[] = {
|
||||
LOCAL_WGL_DRAW_TO_WINDOW_ARB, true,
|
||||
LOCAL_WGL_SUPPORT_OPENGL_ARB, true,
|
||||
LOCAL_WGL_DOUBLE_BUFFER_ARB, true,
|
||||
LOCAL_WGL_DEPTH_BITS_ARB, 24,
|
||||
0
|
||||
};
|
||||
|
||||
const int* attribs;
|
||||
if (wr::RenderThread::IsInRenderThread()) {
|
||||
attribs = kAttribsForWebRender;
|
||||
} else {
|
||||
attribs = kAttribs;
|
||||
}
|
||||
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(wgl.RootDc(), attribs, nullptr, 1,
|
||||
&chosenFormat, &foundFormats))
|
||||
{
|
||||
foundFormats = 0;
|
||||
|
|
|
@ -539,8 +539,11 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData)
|
|||
*charmap, mUVSOffset);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !HasGraphiteTables()) {
|
||||
// We assume a Graphite font knows what it's doing,
|
||||
if (NS_SUCCEEDED(rv) && !mIsDataUserFont && !HasGraphiteTables()) {
|
||||
// For downloadable fonts, trust the author and don't
|
||||
// try to munge the cmap based on script shaping support.
|
||||
|
||||
// We also assume a Graphite font knows what it's doing,
|
||||
// and provides whatever shaping is needed for the
|
||||
// characters it supports, so only check/clear the
|
||||
// complex-script ranges for non-Graphite fonts
|
||||
|
|
|
@ -176,8 +176,11 @@ MacOSFontEntry::ReadCMAP(FontInfoData *aFontInfoData)
|
|||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !HasGraphiteTables()) {
|
||||
// We assume a Graphite font knows what it's doing,
|
||||
if (NS_SUCCEEDED(rv) && !mIsDataUserFont && !HasGraphiteTables()) {
|
||||
// For downloadable fonts, trust the author and don't
|
||||
// try to munge the cmap based on script shaping support.
|
||||
|
||||
// We also assume a Graphite font knows what it's doing,
|
||||
// and provides whatever shaping is needed for the
|
||||
// characters it supports, so only check/clear the
|
||||
// complex-script ranges for non-Graphite fonts
|
||||
|
|
|
@ -88,6 +88,9 @@ GeckoChildProcessHost::GeckoChildProcessHost(GeckoProcessType aProcessType,
|
|||
mMonitor("mozilla.ipc.GeckChildProcessHost.mMonitor"),
|
||||
mLaunchOptions(MakeUnique<base::LaunchOptions>()),
|
||||
mProcessState(CREATING_CHANNEL),
|
||||
#ifdef XP_WIN
|
||||
mGroupId(u"-"),
|
||||
#endif
|
||||
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
|
||||
mEnableSandboxLogging(false),
|
||||
mSandboxLevel(0),
|
||||
|
@ -317,9 +320,8 @@ void GeckoChildProcessHost::InitWindowsGroupID()
|
|||
taskbarInfo->GetAvailable(&isSupported);
|
||||
nsAutoString appId;
|
||||
if (isSupported && NS_SUCCEEDED(taskbarInfo->GetDefaultGroupId(appId))) {
|
||||
mGroupId.Append(appId);
|
||||
} else {
|
||||
mGroupId.Assign('-');
|
||||
MOZ_ASSERT(mGroupId.EqualsLiteral("-"));
|
||||
mGroupId.Assign(appId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,11 +91,10 @@ DisplayItemClip::IntersectWith(const DisplayItemClip& aOther)
|
|||
|
||||
void
|
||||
DisplayItemClip::ApplyTo(gfxContext* aContext,
|
||||
int32_t A2D,
|
||||
uint32_t aBegin, uint32_t aEnd)
|
||||
int32_t A2D)
|
||||
{
|
||||
ApplyRectTo(aContext, A2D);
|
||||
ApplyRoundedRectClipsTo(aContext, A2D, aBegin, aEnd);
|
||||
ApplyRoundedRectClipsTo(aContext, A2D, 0, mRoundedClipRects.Length());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -126,30 +125,27 @@ DisplayItemClip::ApplyRoundedRectClipsTo(gfxContext* aContext,
|
|||
void
|
||||
DisplayItemClip::FillIntersectionOfRoundedRectClips(gfxContext* aContext,
|
||||
const Color& aColor,
|
||||
int32_t aAppUnitsPerDevPixel,
|
||||
uint32_t aBegin,
|
||||
uint32_t aEnd) const
|
||||
int32_t aAppUnitsPerDevPixel) const
|
||||
{
|
||||
DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
|
||||
|
||||
aEnd = std::min<uint32_t>(aEnd, mRoundedClipRects.Length());
|
||||
|
||||
if (aBegin >= aEnd) {
|
||||
uint32_t end = mRoundedClipRects.Length();
|
||||
if (!end) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Push clips for any rects that come BEFORE the rect at |aEnd - 1|, if any:
|
||||
ApplyRoundedRectClipsTo(aContext, aAppUnitsPerDevPixel, aBegin, aEnd - 1);
|
||||
ApplyRoundedRectClipsTo(aContext, aAppUnitsPerDevPixel, 0, end - 1);
|
||||
|
||||
// Now fill the rect at |aEnd - 1|:
|
||||
RefPtr<Path> roundedRect = MakeRoundedRectPath(aDrawTarget,
|
||||
aAppUnitsPerDevPixel,
|
||||
mRoundedClipRects[aEnd - 1]);
|
||||
mRoundedClipRects[end - 1]);
|
||||
ColorPattern color(ToDeviceColor(aColor));
|
||||
aDrawTarget.Fill(roundedRect, color);
|
||||
|
||||
// Finally, pop any clips that we may have pushed:
|
||||
for (uint32_t i = aBegin; i < aEnd - 1; ++i) {
|
||||
for (uint32_t i = 0; i < end - 1; ++i) {
|
||||
aContext->PopClip();
|
||||
}
|
||||
}
|
||||
|
@ -358,16 +354,13 @@ AccumulateRectDifference(const nsRect& aR1, const nsRect& aR2, const nsRect& aBo
|
|||
}
|
||||
|
||||
void
|
||||
DisplayItemClip::AddOffsetAndComputeDifference(uint32_t aStart,
|
||||
const nsPoint& aOffset,
|
||||
DisplayItemClip::AddOffsetAndComputeDifference(const nsPoint& aOffset,
|
||||
const nsRect& aBounds,
|
||||
const DisplayItemClip& aOther,
|
||||
uint32_t aOtherStart,
|
||||
const nsRect& aOtherBounds,
|
||||
nsRegion* aDifference)
|
||||
{
|
||||
if (mHaveClipRect != aOther.mHaveClipRect ||
|
||||
aStart != aOtherStart ||
|
||||
mRoundedClipRects.Length() != aOther.mRoundedClipRects.Length()) {
|
||||
aDifference->Or(*aDifference, aBounds);
|
||||
aDifference->Or(*aDifference, aOtherBounds);
|
||||
|
@ -378,7 +371,7 @@ DisplayItemClip::AddOffsetAndComputeDifference(uint32_t aStart,
|
|||
aBounds.Union(aOtherBounds),
|
||||
aDifference);
|
||||
}
|
||||
for (uint32_t i = aStart; i < mRoundedClipRects.Length(); ++i) {
|
||||
for (uint32_t i = 0; i < mRoundedClipRects.Length(); ++i) {
|
||||
if (mRoundedClipRects[i] + aOffset != aOther.mRoundedClipRects[i]) {
|
||||
// The corners make it tricky so we'll just add both rects here.
|
||||
aDifference->Or(*aDifference, mRoundedClipRects[i].mRect.Intersect(aBounds));
|
||||
|
@ -387,27 +380,10 @@ DisplayItemClip::AddOffsetAndComputeDifference(uint32_t aStart,
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DisplayItemClip::GetCommonRoundedRectCount(const DisplayItemClip& aOther,
|
||||
uint32_t aMax) const
|
||||
{
|
||||
uint32_t end = std::min(std::min(mRoundedClipRects.Length(), size_t(aMax)),
|
||||
aOther.mRoundedClipRects.Length());
|
||||
uint32_t clipCount = 0;
|
||||
for (; clipCount < end; ++clipCount) {
|
||||
if (mRoundedClipRects[clipCount] !=
|
||||
aOther.mRoundedClipRects[clipCount]) {
|
||||
return clipCount;
|
||||
}
|
||||
}
|
||||
return clipCount;
|
||||
}
|
||||
|
||||
void
|
||||
DisplayItemClip::AppendRoundedRects(nsTArray<RoundedRect>* aArray, uint32_t aCount) const
|
||||
DisplayItemClip::AppendRoundedRects(nsTArray<RoundedRect>* aArray) const
|
||||
{
|
||||
size_t count = std::min(mRoundedClipRects.Length(), size_t(aCount));
|
||||
aArray->AppendElements(mRoundedClipRects.Elements(), count);
|
||||
aArray->AppendElements(mRoundedClipRects.Elements(), mRoundedClipRects.Length());
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -81,8 +81,7 @@ public:
|
|||
// Apply this |DisplayItemClip| to the given gfxContext. Any saving of state
|
||||
// or clearing of other clips must be done by the caller.
|
||||
// See aBegin/aEnd note on ApplyRoundedRectsTo.
|
||||
void ApplyTo(gfxContext* aContext, int32_t A2D,
|
||||
uint32_t aBegin = 0, uint32_t aEnd = UINT32_MAX);
|
||||
void ApplyTo(gfxContext* aContext, int32_t A2D);
|
||||
|
||||
void ApplyRectTo(gfxContext* aContext, int32_t A2D) const;
|
||||
// Applies the rounded rects in this Clip to aContext
|
||||
|
@ -94,9 +93,7 @@ public:
|
|||
// Draw (fill) the rounded rects in this clip to aContext
|
||||
void FillIntersectionOfRoundedRectClips(gfxContext* aContext,
|
||||
const Color& aColor,
|
||||
int32_t aAppUnitsPerDevPixel,
|
||||
uint32_t aBegin,
|
||||
uint32_t aEnd) const;
|
||||
int32_t aAppUnitsPerDevPixel) const;
|
||||
// 'Draw' (create as a path, does not stroke or fill) aRoundRect to aContext
|
||||
already_AddRefed<Path> MakeRoundedRectPath(DrawTarget& aDrawTarget,
|
||||
int32_t A2D,
|
||||
|
@ -148,8 +145,8 @@ public:
|
|||
|
||||
// Adds the difference between Intersect(*this + aPoint, aBounds) and
|
||||
// Intersect(aOther, aOtherBounds) to aDifference (or a bounding-box thereof).
|
||||
void AddOffsetAndComputeDifference(uint32_t aStart, const nsPoint& aPoint, const nsRect& aBounds,
|
||||
const DisplayItemClip& aOther, uint32_t aOtherStart, const nsRect& aOtherBounds,
|
||||
void AddOffsetAndComputeDifference(const nsPoint& aPoint, const nsRect& aBounds,
|
||||
const DisplayItemClip& aOther, const nsRect& aOtherBounds,
|
||||
nsRegion* aDifference);
|
||||
|
||||
bool operator==(const DisplayItemClip& aOther) const {
|
||||
|
@ -172,14 +169,8 @@ public:
|
|||
|
||||
nsCString ToString() const;
|
||||
|
||||
/**
|
||||
* Find the largest N such that the first N rounded rects in 'this' are
|
||||
* equal to the first N rounded rects in aOther, and N <= aMax.
|
||||
*/
|
||||
uint32_t GetCommonRoundedRectCount(const DisplayItemClip& aOther,
|
||||
uint32_t aMax) const;
|
||||
uint32_t GetRoundedRectCount() const { return mRoundedClipRects.Length(); }
|
||||
void AppendRoundedRects(nsTArray<RoundedRect>* aArray, uint32_t aCount) const;
|
||||
void AppendRoundedRects(nsTArray<RoundedRect>* aArray) const;
|
||||
|
||||
void ToComplexClipRegions(int32_t aAppUnitsPerDevPixel,
|
||||
const layers::StackingContextHelper& aSc,
|
||||
|
|
|
@ -451,7 +451,6 @@ public:
|
|||
mShouldPaintOnContentSide(false),
|
||||
mDTCRequiresTargetConfirmation(false),
|
||||
mImage(nullptr),
|
||||
mCommonClipCount(-1),
|
||||
mNewChildLayersIndex(-1)
|
||||
{}
|
||||
|
||||
|
@ -663,24 +662,10 @@ public:
|
|||
* no part at all.
|
||||
*/
|
||||
DisplayItemClip mItemClip;
|
||||
/**
|
||||
* The first mCommonClipCount rounded rectangle clips are identical for
|
||||
* all items in the layer.
|
||||
* -1 if there are no items in the layer; must be >=0 by the time that this
|
||||
* data is popped from the stack.
|
||||
*/
|
||||
int32_t mCommonClipCount;
|
||||
/**
|
||||
* Index of this layer in mNewChildLayers.
|
||||
*/
|
||||
int32_t mNewChildLayersIndex;
|
||||
/*
|
||||
* Updates mCommonClipCount by checking for rounded rect clips in common
|
||||
* between the clip on a new item (aCurrentClip) and the common clips
|
||||
* on items already in the layer (the first mCommonClipCount rounded rects
|
||||
* in mItemClip).
|
||||
*/
|
||||
void UpdateCommonClipCount(const DisplayItemClip& aCurrentClip);
|
||||
/**
|
||||
* The region of visible content above the layer and below the
|
||||
* next PaintedLayerData currently in the stack, if any.
|
||||
|
@ -1387,12 +1372,8 @@ protected:
|
|||
* aLayer is the layer to be clipped.
|
||||
* relative to the container reference frame
|
||||
* aRoundedRectClipCount is used when building mask layers for PaintedLayers,
|
||||
* SetupMaskLayer will build a mask layer for only the first
|
||||
* aRoundedRectClipCount rounded rects in aClip
|
||||
* Returns the number of rounded rects included in the mask layer.
|
||||
*/
|
||||
uint32_t SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip,
|
||||
uint32_t aRoundedRectClipCount = UINT32_MAX);
|
||||
void SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip);
|
||||
|
||||
/**
|
||||
* If |aClip| has rounded corners, create a mask layer for them, and
|
||||
|
@ -1412,8 +1393,7 @@ protected:
|
|||
|
||||
already_AddRefed<Layer> CreateMaskLayer(
|
||||
Layer *aLayer, const DisplayItemClip& aClip,
|
||||
const Maybe<size_t>& aForAncestorMaskLayer,
|
||||
uint32_t aRoundedRectClipCount = UINT32_MAX);
|
||||
const Maybe<size_t>& aForAncestorMaskLayer);
|
||||
|
||||
/**
|
||||
* Get the display port for an AGR.
|
||||
|
@ -1500,8 +1480,6 @@ class PaintedDisplayItemLayerUserData : public LayerUserData
|
|||
{
|
||||
public:
|
||||
PaintedDisplayItemLayerUserData() :
|
||||
mMaskClipCount(0),
|
||||
mLastCommonClipCount(0),
|
||||
mForcedBackgroundColor(NS_RGBA(0,0,0,0)),
|
||||
mXScale(1.f), mYScale(1.f),
|
||||
mAppUnitsPerDevPixel(0),
|
||||
|
@ -1513,19 +1491,6 @@ public:
|
|||
|
||||
NS_INLINE_DECL_REFCOUNTING(PaintedDisplayItemLayerUserData);
|
||||
|
||||
/**
|
||||
* Record the number of clips in the PaintedLayer's mask layer.
|
||||
* Should not be reset when the layer is recycled since it is used to track
|
||||
* changes in the use of mask layers.
|
||||
*/
|
||||
uint32_t mMaskClipCount;
|
||||
|
||||
/**
|
||||
* Records the number of clips in the PaintedLayer's mask layer during
|
||||
* the previous paint. Used for invalidation.
|
||||
*/
|
||||
uint32_t mLastCommonClipCount;
|
||||
|
||||
/**
|
||||
* A color that should be painted over the bounds of the layer's visible
|
||||
* region before any other content is painted.
|
||||
|
@ -1642,7 +1607,6 @@ struct MaskLayerUserData : public LayerUserData
|
|||
, mAppUnitsPerDevPixel(-1)
|
||||
{ }
|
||||
MaskLayerUserData(const DisplayItemClip& aClip,
|
||||
uint32_t aRoundedRectClipCount,
|
||||
int32_t aAppUnitsPerDevPixel,
|
||||
const ContainerLayerParameters& aParams)
|
||||
: mScaleX(aParams.mXScale)
|
||||
|
@ -1650,7 +1614,7 @@ struct MaskLayerUserData : public LayerUserData
|
|||
, mOffset(aParams.mOffset)
|
||||
, mAppUnitsPerDevPixel(aAppUnitsPerDevPixel)
|
||||
{
|
||||
aClip.AppendRoundedRects(&mRoundedClipRects, aRoundedRectClipCount);
|
||||
aClip.AppendRoundedRects(&mRoundedClipRects);
|
||||
}
|
||||
|
||||
void operator=(MaskLayerUserData&& aOther)
|
||||
|
@ -2485,7 +2449,6 @@ ContainerState::PreparePaintedLayerForUse(PaintedLayer* aLayer,
|
|||
|
||||
aData->mLastPaintOffset = GetTranslationForPaintedLayer(aLayer);
|
||||
aData->mHasExplicitLastPaintOffset = true;
|
||||
aData->mLastCommonClipCount = aData->mMaskClipCount;
|
||||
|
||||
// Set up transform so that 0,0 in the PaintedLayer corresponds to the
|
||||
// (pixel-snapped) top-left of the aAnimatedGeometryRoot.
|
||||
|
@ -2748,18 +2711,6 @@ PaintedLayerDataNode::FindOpaqueBackgroundColorInParentNode() const
|
|||
return mTree.UniformBackgroundColor();
|
||||
}
|
||||
|
||||
void
|
||||
PaintedLayerData::UpdateCommonClipCount(
|
||||
const DisplayItemClip& aCurrentClip)
|
||||
{
|
||||
if (mCommonClipCount >= 0) {
|
||||
mCommonClipCount = mItemClip.GetCommonRoundedRectCount(aCurrentClip, mCommonClipCount);
|
||||
} else {
|
||||
// first item in the layer
|
||||
mCommonClipCount = aCurrentClip.GetRoundedRectCount();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PaintedLayerData::CanOptimizeToImageLayer(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
|
@ -3341,22 +3292,6 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
|
|||
data->mLayer->InvalidateWholeLayer();
|
||||
}
|
||||
userData->mForcedBackgroundColor = backgroundColor;
|
||||
|
||||
// use a mask layer for rounded rect clipping.
|
||||
// data->mCommonClipCount may be -1 if we haven't put any actual
|
||||
// drawable items in this layer (i.e. it's only catching events).
|
||||
uint32_t commonClipCount;
|
||||
commonClipCount = std::max(0, data->mCommonClipCount);
|
||||
|
||||
// if the number of clips we are going to mask has decreased, then aLayer might have
|
||||
// cached graphics which assume the existence of a soon-to-be non-existent mask layer
|
||||
// in that case, invalidate the whole layer.
|
||||
if (commonClipCount < userData->mMaskClipCount) {
|
||||
PaintedLayer* painted = layer->AsPaintedLayer();
|
||||
painted->InvalidateWholeLayer();
|
||||
}
|
||||
|
||||
userData->mMaskClipCount = SetupMaskLayer(layer, data->mItemClip, commonClipCount);
|
||||
} else {
|
||||
// mask layer for image and color layers
|
||||
SetupMaskLayer(layer, data->mItemClip);
|
||||
|
@ -3999,8 +3934,7 @@ ContainerState::SetupMaskLayerForScrolledClip(Layer* aLayer,
|
|||
{
|
||||
if (aClip.GetRoundedRectCount() > 0) {
|
||||
Maybe<size_t> maskLayerIndex = Some(aLayer->GetAncestorMaskLayerCount());
|
||||
if (RefPtr<Layer> maskLayer = CreateMaskLayer(aLayer, aClip, maskLayerIndex,
|
||||
aClip.GetRoundedRectCount())) {
|
||||
if (RefPtr<Layer> maskLayer = CreateMaskLayer(aLayer, aClip, maskLayerIndex)) {
|
||||
aLayer->AddAncestorMaskLayer(maskLayer);
|
||||
return maskLayerIndex;
|
||||
}
|
||||
|
@ -4667,11 +4601,6 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
|||
static_cast<nsDisplayCompositorHitTestInfo*>(item);
|
||||
paintedLayerData->AccumulateHitTestInfo(this, hitTestInfo);
|
||||
} else {
|
||||
// check to see if the new item has rounded rect clips in common with
|
||||
// other items in the layer
|
||||
if (mManager->IsWidgetLayerManager()) {
|
||||
paintedLayerData->UpdateCommonClipCount(itemClip);
|
||||
}
|
||||
paintedLayerData->Accumulate(this, item, itemVisibleRect, itemClip, layerState, aList);
|
||||
|
||||
if (!paintedLayerData->mLayer) {
|
||||
|
@ -4800,10 +4729,8 @@ FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData)
|
|||
if (!combined.IsEmpty() || aData->mLayerState == LAYER_INACTIVE) {
|
||||
geometry = item->AllocateGeometry(mDisplayListBuilder);
|
||||
}
|
||||
aData->mClip.AddOffsetAndComputeDifference(layerData->mMaskClipCount,
|
||||
shift, aData->mGeometry->ComputeInvalidationRegion(),
|
||||
clip, layerData->mLastCommonClipCount,
|
||||
geometry ? geometry->ComputeInvalidationRegion() :
|
||||
aData->mClip.AddOffsetAndComputeDifference(shift, aData->mGeometry->ComputeInvalidationRegion(),
|
||||
clip, geometry ? geometry->ComputeInvalidationRegion() :
|
||||
aData->mGeometry->ComputeInvalidationRegion(),
|
||||
&combined);
|
||||
|
||||
|
@ -5294,7 +5221,7 @@ ContainerState::SetupScrollingMetadata(NewLayerEntry* aEntry)
|
|||
// layer as an additional, separate clip.
|
||||
Maybe<size_t> nextIndex = Some(maskLayers.Length());
|
||||
RefPtr<Layer> maskLayer =
|
||||
CreateMaskLayer(aEntry->mLayer, *clip, nextIndex, clip->GetRoundedRectCount());
|
||||
CreateMaskLayer(aEntry->mLayer, *clip, nextIndex);
|
||||
if (maskLayer) {
|
||||
MOZ_ASSERT(metadata->HasScrollClip());
|
||||
metadata->ScrollClip().SetMaskLayerIndex(nextIndex);
|
||||
|
@ -6020,8 +5947,7 @@ FrameLayerBuilder::PaintItems(nsTArray<AssignedDisplayItem>& aItems,
|
|||
nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* aPresContext,
|
||||
const nsIntPoint& aOffset,
|
||||
float aXScale, float aYScale,
|
||||
int32_t aCommonClipCount)
|
||||
float aXScale, float aYScale)
|
||||
{
|
||||
DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
|
||||
|
||||
|
@ -6070,9 +5996,7 @@ FrameLayerBuilder::PaintItems(nsTArray<AssignedDisplayItem>& aItems,
|
|||
if (currentClipIsSetInContext) {
|
||||
currentClip = *clip;
|
||||
aContext->Save();
|
||||
NS_ASSERTION(aCommonClipCount < 100,
|
||||
"Maybe you really do have more than a hundred clipping rounded rects, or maybe something has gone wrong.");
|
||||
currentClip.ApplyTo(aContext, aPresContext->AppUnitsPerDevPixel(), aCommonClipCount);
|
||||
currentClip.ApplyTo(aContext, aPresContext->AppUnitsPerDevPixel());
|
||||
aContext->NewPath();
|
||||
}
|
||||
}
|
||||
|
@ -6235,8 +6159,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
|
|||
|
||||
layerBuilder->PaintItems(userData->mItems, iterRect, aContext,
|
||||
builder, presContext,
|
||||
offset, userData->mXScale, userData->mYScale,
|
||||
userData->mMaskClipCount);
|
||||
offset, userData->mXScale, userData->mYScale);
|
||||
if (gfxPrefs::GfxLoggingPaintedPixelCountEnabled()) {
|
||||
aLayer->Manager()->AddPaintedPixelCount(iterRect.Area());
|
||||
}
|
||||
|
@ -6251,8 +6174,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
|
|||
|
||||
layerBuilder->PaintItems(userData->mItems, aRegionToDraw.GetBounds(), aContext,
|
||||
builder, presContext,
|
||||
offset, userData->mXScale, userData->mYScale,
|
||||
userData->mMaskClipCount);
|
||||
offset, userData->mXScale, userData->mYScale);
|
||||
if (gfxPrefs::GfxLoggingPaintedPixelCountEnabled()) {
|
||||
aLayer->Manager()->AddPaintedPixelCount(
|
||||
aRegionToDraw.GetBounds().Area());
|
||||
|
@ -6326,26 +6248,23 @@ CalculateBounds(const nsTArray<DisplayItemClip::RoundedRect>& aRects, int32_t aA
|
|||
return gfx::Rect(bounds.ToNearestPixels(aAppUnitsPerDevPixel));
|
||||
}
|
||||
|
||||
uint32_t
|
||||
void
|
||||
ContainerState::SetupMaskLayer(Layer *aLayer,
|
||||
const DisplayItemClip& aClip,
|
||||
uint32_t aRoundedRectClipCount)
|
||||
const DisplayItemClip& aClip)
|
||||
{
|
||||
// don't build an unnecessary mask
|
||||
if (aClip.GetRoundedRectCount() == 0 ||
|
||||
aRoundedRectClipCount == 0) {
|
||||
return 0;
|
||||
if (aClip.GetRoundedRectCount() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Layer> maskLayer =
|
||||
CreateMaskLayer(aLayer, aClip, Nothing(), aRoundedRectClipCount);
|
||||
CreateMaskLayer(aLayer, aClip, Nothing());
|
||||
|
||||
if (!maskLayer) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
aLayer->SetMaskLayer(maskLayer);
|
||||
return aRoundedRectClipCount;
|
||||
}
|
||||
|
||||
static MaskLayerUserData*
|
||||
|
@ -6370,8 +6289,7 @@ SetMaskLayerUserData(Layer* aMaskLayer)
|
|||
already_AddRefed<Layer>
|
||||
ContainerState::CreateMaskLayer(Layer *aLayer,
|
||||
const DisplayItemClip& aClip,
|
||||
const Maybe<size_t>& aForAncestorMaskLayer,
|
||||
uint32_t aRoundedRectClipCount)
|
||||
const Maybe<size_t>& aForAncestorMaskLayer)
|
||||
{
|
||||
// aLayer will never be the container layer created by an nsDisplayMask
|
||||
// because nsDisplayMask propagates the DisplayItemClip to its contents
|
||||
|
@ -6388,7 +6306,7 @@ ContainerState::CreateMaskLayer(Layer *aLayer,
|
|||
MaskLayerUserData* userData = GetMaskLayerUserData(maskLayer.get());
|
||||
|
||||
int32_t A2D = mContainerFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
MaskLayerUserData newData(aClip, aRoundedRectClipCount, A2D, mParameters);
|
||||
MaskLayerUserData newData(aClip, A2D, mParameters);
|
||||
if (*userData == newData) {
|
||||
return maskLayer.forget();
|
||||
}
|
||||
|
@ -6468,9 +6386,7 @@ ContainerState::CreateMaskLayer(Layer *aLayer,
|
|||
// paint the clipping rects with alpha to create the mask
|
||||
aClip.FillIntersectionOfRoundedRectClips(context,
|
||||
Color(1.f, 1.f, 1.f, 1.f),
|
||||
newData.mAppUnitsPerDevPixel,
|
||||
0,
|
||||
aRoundedRectClipCount);
|
||||
newData.mAppUnitsPerDevPixel);
|
||||
|
||||
// build the image and container
|
||||
MOZ_ASSERT(aLayer->Manager() == mManager);
|
||||
|
|
|
@ -666,8 +666,7 @@ protected:
|
|||
nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* aPresContext,
|
||||
const nsIntPoint& aOffset,
|
||||
float aXScale, float aYScale,
|
||||
int32_t aCommonClipCount);
|
||||
float aXScale, float aYScale);
|
||||
|
||||
/**
|
||||
* We accumulate ClippedDisplayItem elements in a hashtable during
|
||||
|
|
|
@ -51,7 +51,7 @@ fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) == clipping-5-image.html
|
|||
fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(skiaContent,1,77) == clipping-5-overflow-hidden.html clipping-5-ref.html
|
||||
fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(Android,5,21) fuzzy-if(skiaContent,1,97) == clipping-5-refi.html clipping-5-ref.html
|
||||
fuzzy-if(true,1,7) fuzzy-if(d2d,55,95) fuzzy-if(cocoaWidget,1,99) fuzzy-if(Android,99,115) fuzzy-if(skiaContent,1,77) == clipping-5-refc.html clipping-5-ref.html # bug 732535
|
||||
fuzzy-if(winWidget,105,71) fuzzy-if(Android,8,469) fuzzy-if(skiaContent,7,58) fuzzy-if(d3d11&&advancedLayers,120,319) fuzzy-if(winWidget&&stylo,144,319) == clipping-6.html clipping-6-ref.html # PaintedLayer and MaskLayer with transforms that aren't identical
|
||||
fuzzy-if(winWidget,105,71) fuzzy-if(Android,8,469) fuzzy-if(skiaContent,21,74) fuzzy-if(d3d11&&advancedLayers,120,319) fuzzy-if(winWidget&&stylo,144,335) == clipping-6.html clipping-6-ref.html # PaintedLayer and MaskLayer with transforms that aren't identical
|
||||
fuzzy-if(true,2,29) fuzzy-if(d2d,46,71) fuzzy-if(Android,255,586) fuzzy-if(skiaContent,28,96) == clipping-7.html clipping-7-ref.html # ColorLayer and MaskLayer with transforms that aren't identical. Reference image rendered without using layers (which causes fuzzy failures).
|
||||
fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) == clipping-and-zindex-1.html clipping-and-zindex-1-ref.html
|
||||
fuzzy-if(cocoaWidget,1,4) fuzzy-if(d2d,59,342) fuzzy-if(d3d11&&advancedLayers&&!d2d,30,3) == intersecting-clipping-1-canvas.html intersecting-clipping-1-refc.html
|
||||
|
|
|
@ -167,12 +167,10 @@ random-if(!cocoaWidget) == 577380.html 577380-ref.html
|
|||
# check ligature in Arial Bold on Windows, for bug 644184; may fail on other platforms depending on fonts
|
||||
random-if(!winWidget) == arial-bold-lam-alef-1.html arial-bold-lam-alef-1-ref.html
|
||||
# Fallback (presentation-forms) shaping with a font that lacks GSUB/GPOS
|
||||
# These tests are not valid with Mac or FT2 font backends because our masking of complex-script ranges
|
||||
# in the 'cmap' will prevent the test font (without GSUB) being used.
|
||||
fails-if(cocoaWidget||Android) == arabic-fallback-1.html arabic-fallback-1-ref.html
|
||||
fails-if(cocoaWidget||Android) == arabic-fallback-2.html arabic-fallback-2-ref.html
|
||||
fails-if(cocoaWidget||Android) == arabic-fallback-3.html arabic-fallback-3-ref.html
|
||||
fails-if(!cocoaWidget&&!Android) != arabic-fallback-4.html arabic-fallback-4-notref.html
|
||||
== arabic-fallback-1.html arabic-fallback-1-ref.html
|
||||
== arabic-fallback-2.html arabic-fallback-2-ref.html
|
||||
== arabic-fallback-3.html arabic-fallback-3-ref.html
|
||||
== arabic-fallback-4.html arabic-fallback-4-ref.html
|
||||
== arabic-marks-1.html arabic-marks-1-ref.html
|
||||
== arabic-final-ligature-spacing.html arabic-final-ligature-spacing-ref.html
|
||||
# harfbuzz fallback mark stacking in the absence of GPOS:
|
||||
|
|
|
@ -3217,9 +3217,7 @@ CheckTelemetryPref()
|
|||
DebugOnly<bool> value;
|
||||
MOZ_ASSERT(NS_SUCCEEDED(Preferences::GetBool(kTelemetryPref, &value)) &&
|
||||
value == TelemetryPrefValue());
|
||||
// njn: uncomment after bug 1436911 lands; it ensures that the locked status
|
||||
// is passed correctly
|
||||
// MOZ_ASSERT(Preferences::IsLocked(kTelemetryPref));
|
||||
MOZ_ASSERT(Preferences::IsLocked(kTelemetryPref));
|
||||
}
|
||||
|
||||
#endif // MOZ_WIDGET_ANDROID
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// is used (from service.js).
|
||||
/* global Service */
|
||||
|
||||
ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");
|
||||
ChromeUtils.import("resource://services-common/async.js");
|
||||
ChromeUtils.import("resource://services-common/utils.js");
|
||||
ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm");
|
||||
|
@ -19,6 +20,8 @@ ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
|
|||
ChromeUtils.import("resource://gre/modules/PlacesSyncUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/ObjectUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/services/sync/utils.js");
|
||||
ChromeUtils.defineModuleGetter(this, "AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
add_task(async function head_setup() {
|
||||
// Initialize logging. This will sometimes be reset by a pref reset,
|
||||
|
@ -79,22 +82,6 @@ function ExtensionsTestPath(path) {
|
|||
return "../../../../toolkit/mozapps/extensions/test/xpcshell" + path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the AddonManager test functions by importing its test file.
|
||||
*
|
||||
* This should be called in the global scope of any test file needing to
|
||||
* interface with the AddonManager. It should only be called once, or the
|
||||
* universe will end.
|
||||
*/
|
||||
function loadAddonTestFunctions() {
|
||||
const path = ExtensionsTestPath("/head_addons.js");
|
||||
let file = do_get_file(path);
|
||||
let uri = Services.io.newFileURI(file);
|
||||
/* import-globals-from ../../../../toolkit/mozapps/extensions/test/xpcshell/head_addons.js */
|
||||
Services.scriptloader.loadSubScript(uri.spec, gGlobalScope);
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
}
|
||||
|
||||
function webExtensionsTestPath(path) {
|
||||
if (path[0] != "/") {
|
||||
throw Error("Path must begin with '/': " + path);
|
||||
|
@ -114,12 +101,6 @@ function loadWebExtensionTestFunctions() {
|
|||
Services.scriptloader.loadSubScript(uri.spec, gGlobalScope);
|
||||
}
|
||||
|
||||
// Returns a promise
|
||||
function getAddonInstall(name) {
|
||||
let f = do_get_file(ExtensionsTestPath("/addons/" + name + ".xpi"));
|
||||
return AddonManager.getInstallForFile(f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs an add-on from an addonInstall
|
||||
*
|
||||
|
@ -146,15 +127,15 @@ async function installAddonFromInstall(install) {
|
|||
/**
|
||||
* Convenience function to install an add-on from the extensions unit tests.
|
||||
*
|
||||
* @param name
|
||||
* String name of add-on to install. e.g. test_install1
|
||||
* @param file
|
||||
* Add-on file to install.
|
||||
* @param reconciler
|
||||
* addons reconciler, if passed we will wait on the events to be
|
||||
* processed before resolving
|
||||
* @return addon object that was installed
|
||||
*/
|
||||
async function installAddon(name, reconciler = null) {
|
||||
let install = await getAddonInstall(name);
|
||||
async function installAddon(file, reconciler = null) {
|
||||
let install = await AddonManager.getInstallForFile(file);
|
||||
Assert.notEqual(null, install);
|
||||
const addon = await installAddonFromInstall(install);
|
||||
if (reconciler) {
|
||||
|
|
|
@ -16,8 +16,9 @@ var prefs = new Preferences();
|
|||
prefs.set("extensions.getAddons.get.url",
|
||||
SERVER_ADDRESS + "/search/guid:%IDS%");
|
||||
|
||||
loadAddonTestFunctions();
|
||||
startupManager();
|
||||
AddonTestUtils.init(this);
|
||||
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
AddonTestUtils.awaitPromise(AddonTestUtils.promiseStartupManager());
|
||||
|
||||
function createAndStartHTTPServer(port = HTTP_PORT) {
|
||||
try {
|
||||
|
|
|
@ -11,6 +11,7 @@ ChromeUtils.import("resource://services-sync/addonsreconciler.js");
|
|||
ChromeUtils.import("resource://services-sync/engines/addons.js");
|
||||
ChromeUtils.import("resource://services-sync/service.js");
|
||||
ChromeUtils.import("resource://services-sync/util.js");
|
||||
ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "Preferences", "resource://gre/modules/Preferences.jsm");
|
||||
|
||||
const prefs = new Preferences();
|
||||
|
@ -23,6 +24,51 @@ let syncID;
|
|||
let reconciler;
|
||||
let tracker;
|
||||
|
||||
AddonTestUtils.init(this);
|
||||
|
||||
const ADDONS = {
|
||||
test_install1: {
|
||||
"install.rdf": {
|
||||
id: "addon1@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
name: "Test 1",
|
||||
description: "Test Description",
|
||||
bootstrap: true,
|
||||
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"}],
|
||||
},
|
||||
"icon.png": "Fake icon image",
|
||||
"icon64.png": "Fake icon image",
|
||||
},
|
||||
test_bootstrap1_1: {
|
||||
"install.rdf": {
|
||||
id: "bootstrap1@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
bootstrap: "true",
|
||||
multiprocessCompatible: "true",
|
||||
name: "Test Bootstrap 1",
|
||||
description: "Test Description",
|
||||
|
||||
iconURL: "chrome://foo/skin/icon.png",
|
||||
aboutURL: "chrome://foo/content/about.xul",
|
||||
optionsURL: "chrome://foo/content/options.xul",
|
||||
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"}],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const XPIS = {};
|
||||
for (let [name, files] of Object.entries(ADDONS)) {
|
||||
XPIS[name] = AddonTestUtils.createTempXPIFile(files);
|
||||
}
|
||||
|
||||
async function resetReconciler() {
|
||||
reconciler._addons = {};
|
||||
reconciler._changes = [];
|
||||
|
@ -33,8 +79,9 @@ async function resetReconciler() {
|
|||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
loadAddonTestFunctions();
|
||||
startupManager();
|
||||
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
AddonTestUtils.overrideCertDB();
|
||||
await AddonTestUtils.promiseStartupManager();
|
||||
|
||||
await Service.engineManager.register(AddonsEngine);
|
||||
engine = Service.engineManager.get("addons");
|
||||
|
@ -56,7 +103,7 @@ add_task(async function setup() {
|
|||
add_task(async function test_addon_install() {
|
||||
_("Ensure basic add-on APIs work as expected.");
|
||||
|
||||
let install = await getAddonInstall("test_bootstrap1_1");
|
||||
let install = await AddonManager.getInstallForFile(XPIS.test_bootstrap1_1);
|
||||
Assert.notEqual(install, null);
|
||||
Assert.equal(install.type, "extension");
|
||||
Assert.equal(install.name, "Test Bootstrap 1");
|
||||
|
@ -71,7 +118,7 @@ add_task(async function test_find_dupe() {
|
|||
// test, so we do it manually.
|
||||
await engine._refreshReconcilerState();
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
|
||||
let record = {
|
||||
id: Utils.makeGUID(),
|
||||
|
@ -122,7 +169,7 @@ add_task(async function test_get_changed_ids() {
|
|||
await tracker.clearChangedIDs();
|
||||
|
||||
_("Ensure reconciler changes are populated.");
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
await tracker.clearChangedIDs(); // Just in case.
|
||||
changes = await engine.getChangedIDs();
|
||||
Assert.equal("object", typeof(changes));
|
||||
|
@ -191,8 +238,7 @@ add_task(async function test_disabled_install_semantics() {
|
|||
amoServer.registerFile("/search/guid:addon1%40tests.mozilla.org",
|
||||
do_get_file("addon1-search.json"));
|
||||
|
||||
let installXPI = ExtensionsTestPath("/addons/test_install1.xpi");
|
||||
amoServer.registerFile("/addon1.xpi", do_get_file(installXPI));
|
||||
amoServer.registerFile("/addon1.xpi", XPIS.test_install1);
|
||||
amoServer.start(8888);
|
||||
|
||||
// Insert an existing record into the server.
|
||||
|
@ -225,7 +271,7 @@ add_task(async function test_disabled_install_semantics() {
|
|||
|
||||
// We fake an app restart and perform another sync, just to make sure things
|
||||
// are sane.
|
||||
restartManager();
|
||||
await AddonTestUtils.promiseRestartManager();
|
||||
|
||||
let collection = server.getCollection(USER, "addons");
|
||||
engine.lastModified = collection.timestamp;
|
||||
|
|
|
@ -10,8 +10,37 @@ ChromeUtils.import("resource://services-sync/engines/addons.js");
|
|||
ChromeUtils.import("resource://services-sync/service.js");
|
||||
ChromeUtils.import("resource://services-sync/util.js");
|
||||
|
||||
loadAddonTestFunctions();
|
||||
startupManager();
|
||||
AddonTestUtils.init(this);
|
||||
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
AddonTestUtils.overrideCertDB();
|
||||
AddonTestUtils.awaitPromise(AddonTestUtils.promiseStartupManager());
|
||||
|
||||
const ADDONS = {
|
||||
test_bootstrap1_1: {
|
||||
"install.rdf": {
|
||||
id: "bootstrap1@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
bootstrap: "true",
|
||||
multiprocessCompatible: "true",
|
||||
name: "Test Bootstrap 1",
|
||||
description: "Test Description",
|
||||
|
||||
iconURL: "chrome://foo/skin/icon.png",
|
||||
aboutURL: "chrome://foo/content/about.xul",
|
||||
optionsURL: "chrome://foo/content/options.xul",
|
||||
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"}],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const XPIS = {};
|
||||
for (let [name, files] of Object.entries(ADDONS)) {
|
||||
XPIS[name] = AddonTestUtils.createTempXPIFile(files);
|
||||
}
|
||||
|
||||
function makeAddonsReconciler() {
|
||||
const log = Service.engineManager.get("addons")._log;
|
||||
|
@ -59,7 +88,7 @@ add_task(async function test_install_detection() {
|
|||
reconciler.startListening();
|
||||
|
||||
let before = new Date();
|
||||
let addon = await installAddon("test_bootstrap1_1");
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1);
|
||||
let after = new Date();
|
||||
|
||||
Assert.equal(1, Object.keys(reconciler.addons).length);
|
||||
|
@ -100,7 +129,7 @@ add_task(async function test_uninstall_detection() {
|
|||
reconciler._addons = {};
|
||||
reconciler._changes = [];
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1");
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1);
|
||||
let id = addon.id;
|
||||
|
||||
reconciler._changes = [];
|
||||
|
|
|
@ -10,6 +10,7 @@ ChromeUtils.import("resource://services-sync/engines/addons.js");
|
|||
ChromeUtils.import("resource://services-sync/service.js");
|
||||
ChromeUtils.import("resource://services-sync/util.js");
|
||||
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const HTTP_PORT = 8888;
|
||||
|
||||
|
@ -31,13 +32,85 @@ function loadSystemAddon() {
|
|||
systemAddonFile.lastModifiedTime = Date.now();
|
||||
// As we're not running in application, we need to setup the features directory
|
||||
// used by system add-ons.
|
||||
registerDirectory("XREAppFeat", distroDir);
|
||||
AddonTestUtils.registerDirectory("XREAppFeat", distroDir);
|
||||
}
|
||||
|
||||
loadAddonTestFunctions();
|
||||
var resHandler = Services.io.getProtocolHandler("resource")
|
||||
.QueryInterface(Ci.nsISubstitutingProtocolHandler);
|
||||
var dataURI = NetUtil.newURI(do_get_file(ExtensionsTestPath("/data"), true));
|
||||
resHandler.setSubstitution("xpcshell-data", dataURI);
|
||||
|
||||
AddonTestUtils.init(this);
|
||||
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
AddonTestUtils.overrideCertDB();
|
||||
|
||||
Services.prefs.setCharPref("extensions.minCompatibleAppVersion", "0");
|
||||
Services.prefs.setCharPref("extensions.minCompatiblePlatformVersion", "0");
|
||||
Services.prefs.setBoolPref("extensions.legacy.enabled", true);
|
||||
|
||||
loadSystemAddon();
|
||||
awaitPromise(overrideBuiltIns({ "system": [SYSTEM_ADDON_ID] }));
|
||||
startupManager();
|
||||
|
||||
AddonTestUtils.awaitPromise(AddonTestUtils.overrideBuiltIns({ "system": [SYSTEM_ADDON_ID] }));
|
||||
AddonTestUtils.awaitPromise(AddonTestUtils.promiseStartupManager());
|
||||
|
||||
const ADDONS = {
|
||||
test_install1: {
|
||||
"install.rdf": {
|
||||
id: "addon1@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
name: "Test 1",
|
||||
description: "Test Description",
|
||||
bootstrap: true,
|
||||
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"}],
|
||||
},
|
||||
"icon.png": "Fake icon image",
|
||||
"icon64.png": "Fake icon image",
|
||||
},
|
||||
test_install3: {
|
||||
"install.rdf": {
|
||||
id: "addon3@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
name: "Real Test 4",
|
||||
description: "Test Description",
|
||||
bootstrap: true,
|
||||
|
||||
updateURL: "http://example.com/data/test_install.rdf",
|
||||
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "0",
|
||||
maxVersion: "0"}],
|
||||
},
|
||||
},
|
||||
test_bootstrap1_1: {
|
||||
"install.rdf": {
|
||||
id: "bootstrap1@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
bootstrap: "true",
|
||||
multiprocessCompatible: "true",
|
||||
name: "Test Bootstrap 1",
|
||||
description: "Test Description",
|
||||
|
||||
iconURL: "chrome://foo/skin/icon.png",
|
||||
aboutURL: "chrome://foo/content/about.xul",
|
||||
optionsURL: "chrome://foo/content/options.xul",
|
||||
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"}],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const XPIS = {};
|
||||
for (let [name, files] of Object.entries(ADDONS)) {
|
||||
XPIS[name] = AddonTestUtils.createTempXPIFile(files);
|
||||
}
|
||||
|
||||
let engine;
|
||||
let tracker;
|
||||
|
@ -87,11 +160,9 @@ function createAndStartHTTPServer(port) {
|
|||
try {
|
||||
let server = new HttpServer();
|
||||
|
||||
let bootstrap1XPI = ExtensionsTestPath("/addons/test_bootstrap1_1.xpi");
|
||||
|
||||
server.registerFile("/search/guid:bootstrap1%40tests.mozilla.org",
|
||||
do_get_file("bootstrap1-search.json"));
|
||||
server.registerFile("/bootstrap1.xpi", do_get_file(bootstrap1XPI));
|
||||
server.registerFile("/bootstrap1.xpi", XPIS.test_bootstrap1_1);
|
||||
|
||||
server.registerFile("/search/guid:missing-xpi%40tests.mozilla.org",
|
||||
do_get_file("missing-xpi-search.json"));
|
||||
|
@ -139,7 +210,7 @@ add_task(async function setup() {
|
|||
add_task(async function test_remove() {
|
||||
_("Ensure removing add-ons from deleted records works.");
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
let record = createRecordForThisApp(addon.syncGUID, addon.id, true, true);
|
||||
|
||||
let failed = await store.applyIncomingBatch([record]);
|
||||
|
@ -152,7 +223,7 @@ add_task(async function test_remove() {
|
|||
add_task(async function test_apply_enabled() {
|
||||
_("Ensures that changes to the userEnabled flag apply.");
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
Assert.ok(addon.isActive);
|
||||
Assert.ok(!addon.userDisabled);
|
||||
|
||||
|
@ -191,7 +262,7 @@ add_task(async function test_apply_enabled() {
|
|||
add_task(async function test_apply_enabled_appDisabled() {
|
||||
_("Ensures that changes to the userEnabled flag apply when the addon is appDisabled.");
|
||||
|
||||
let addon = await installAddon("test_install3"); // this addon is appDisabled by default.
|
||||
let addon = await installAddon(XPIS.test_install3); // this addon is appDisabled by default.
|
||||
Assert.ok(addon.appDisabled);
|
||||
Assert.ok(!addon.isActive);
|
||||
Assert.ok(!addon.userDisabled);
|
||||
|
@ -224,7 +295,7 @@ add_task(async function test_ignore_different_appid() {
|
|||
_("Ensure that incoming records with a different application ID are ignored.");
|
||||
|
||||
// We test by creating a record that should result in an update.
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
Assert.ok(!addon.userDisabled);
|
||||
|
||||
let record = createRecordForThisApp(addon.syncGUID, addon.id, false, false);
|
||||
|
@ -242,7 +313,7 @@ add_task(async function test_ignore_different_appid() {
|
|||
add_task(async function test_ignore_unknown_source() {
|
||||
_("Ensure incoming records with unknown source are ignored.");
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
|
||||
let record = createRecordForThisApp(addon.syncGUID, addon.id, false, false);
|
||||
record.source = "DUMMY_SOURCE";
|
||||
|
@ -259,7 +330,7 @@ add_task(async function test_ignore_unknown_source() {
|
|||
add_task(async function test_apply_uninstall() {
|
||||
_("Ensures that uninstalling an add-on from a record works.");
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
|
||||
let records = [];
|
||||
records.push(createRecordForThisApp(addon.syncGUID, addon.id, true, true));
|
||||
|
@ -278,7 +349,7 @@ add_task(async function test_addon_syncability() {
|
|||
|
||||
Assert.ok(!(await store.isAddonSyncable(null)));
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
Assert.ok((await store.isAddonSyncable(addon)));
|
||||
|
||||
let dummy = {};
|
||||
|
@ -349,9 +420,9 @@ add_task(async function test_get_all_ids() {
|
|||
// So if any tests above ever add a new addon ID, they are going to need to
|
||||
// be added here too.
|
||||
// Assert.equal(0, Object.keys(store.getAllIDs()).length);
|
||||
let addon1 = await installAddon("test_install1", reconciler);
|
||||
let addon2 = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon3 = await installAddon("test_install3", reconciler);
|
||||
let addon1 = await installAddon(XPIS.test_install1, reconciler);
|
||||
let addon2 = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
let addon3 = await installAddon(XPIS.test_install3, reconciler);
|
||||
|
||||
_("Ensure they're syncable.");
|
||||
Assert.ok((await store.isAddonSyncable(addon1)));
|
||||
|
@ -366,7 +437,7 @@ add_task(async function test_get_all_ids() {
|
|||
Assert.ok(addon2.syncGUID in ids);
|
||||
Assert.ok(addon3.syncGUID in ids);
|
||||
|
||||
addon1.install.cancel();
|
||||
await uninstallAddon(addon1, reconciler);
|
||||
await uninstallAddon(addon2, reconciler);
|
||||
await uninstallAddon(addon3, reconciler);
|
||||
});
|
||||
|
@ -374,7 +445,7 @@ add_task(async function test_get_all_ids() {
|
|||
add_task(async function test_change_item_id() {
|
||||
_("Ensures that changeItemID() works properly.");
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
|
||||
let oldID = addon.syncGUID;
|
||||
let newID = Utils.makeGUID();
|
||||
|
@ -393,7 +464,7 @@ add_task(async function test_create() {
|
|||
|
||||
let server = createAndStartHTTPServer(HTTP_PORT);
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
let id = addon.id;
|
||||
await uninstallAddon(addon, reconciler);
|
||||
|
||||
|
@ -506,7 +577,7 @@ add_task(async function test_incoming_system() {
|
|||
add_task(async function test_wipe() {
|
||||
_("Ensures that wiping causes add-ons to be uninstalled.");
|
||||
|
||||
let addon1 = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon1 = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
|
||||
await store.wipe();
|
||||
|
||||
|
@ -520,7 +591,7 @@ add_task(async function test_wipe_and_install() {
|
|||
// This tests the reset sync flow where remote data is replaced by local. The
|
||||
// receiving client will see a wipe followed by a record which should undo
|
||||
// the wipe.
|
||||
let installed = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let installed = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
|
||||
let record = createRecordForThisApp(installed.syncGUID, installed.id, true,
|
||||
false);
|
||||
|
|
|
@ -9,8 +9,15 @@ ChromeUtils.import("resource://services-sync/constants.js");
|
|||
ChromeUtils.import("resource://services-sync/service.js");
|
||||
ChromeUtils.import("resource://services-sync/util.js");
|
||||
|
||||
loadAddonTestFunctions();
|
||||
startupManager();
|
||||
AddonTestUtils.init(this);
|
||||
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
AddonTestUtils.overrideCertDB();
|
||||
|
||||
Services.prefs.setCharPref("extensions.minCompatibleAppVersion", "0");
|
||||
Services.prefs.setCharPref("extensions.minCompatiblePlatformVersion", "0");
|
||||
Services.prefs.setBoolPref("extensions.legacy.enabled", true);
|
||||
|
||||
AddonTestUtils.awaitPromise(AddonTestUtils.promiseStartupManager());
|
||||
Svc.Prefs.set("engine.addons", true);
|
||||
|
||||
let engine;
|
||||
|
@ -20,6 +27,33 @@ let tracker;
|
|||
|
||||
const addon1ID = "addon1@tests.mozilla.org";
|
||||
|
||||
const ADDONS = {
|
||||
test_bootstrap1_1: {
|
||||
"install.rdf": {
|
||||
id: "bootstrap1@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
bootstrap: "true",
|
||||
multiprocessCompatible: "true",
|
||||
name: "Test Bootstrap 1",
|
||||
description: "Test Description",
|
||||
|
||||
iconURL: "chrome://foo/skin/icon.png",
|
||||
aboutURL: "chrome://foo/content/about.xul",
|
||||
optionsURL: "chrome://foo/content/options.xul",
|
||||
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"}],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const XPIS = {};
|
||||
for (let [name, files] of Object.entries(ADDONS)) {
|
||||
XPIS[name] = AddonTestUtils.createTempXPIFile(files);
|
||||
}
|
||||
|
||||
async function cleanup() {
|
||||
tracker.stop();
|
||||
|
||||
|
@ -56,7 +90,7 @@ add_task(async function test_empty() {
|
|||
add_task(async function test_not_tracking() {
|
||||
_("Ensures the tracker doesn't do anything when it isn't tracking.");
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
await uninstallAddon(addon, reconciler);
|
||||
|
||||
Assert.equal(0, Object.keys((await tracker.getChangedIDs())).length);
|
||||
|
@ -73,7 +107,7 @@ add_task(async function test_track_install() {
|
|||
tracker.start();
|
||||
|
||||
Assert.equal(0, tracker.score);
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
let changed = await tracker.getChangedIDs();
|
||||
|
||||
Assert.equal(1, Object.keys(changed).length);
|
||||
|
@ -89,7 +123,7 @@ add_task(async function test_track_uninstall() {
|
|||
|
||||
reconciler.startListening();
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
let guid = addon.syncGUID;
|
||||
Assert.equal(0, tracker.score);
|
||||
|
||||
|
@ -109,7 +143,7 @@ add_task(async function test_track_user_disable() {
|
|||
|
||||
reconciler.startListening();
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
Assert.ok(!addon.userDisabled);
|
||||
Assert.ok(!addon.appDisabled);
|
||||
Assert.ok(addon.isActive);
|
||||
|
@ -153,7 +187,7 @@ add_task(async function test_track_enable() {
|
|||
|
||||
reconciler.startListening();
|
||||
|
||||
let addon = await installAddon("test_bootstrap1_1", reconciler);
|
||||
let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
|
||||
addon.userDisabled = true;
|
||||
await Async.promiseYield();
|
||||
|
||||
|
|
|
@ -11,8 +11,10 @@ ChromeUtils.import("resource://services-sync/util.js");
|
|||
|
||||
const PREFS_GUID = CommonUtils.encodeBase64URL(Services.appinfo.ID);
|
||||
|
||||
loadAddonTestFunctions();
|
||||
startupManager();
|
||||
AddonTestUtils.init(this);
|
||||
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
AddonTestUtils.overrideCertDB();
|
||||
AddonTestUtils.awaitPromise(AddonTestUtils.promiseStartupManager());
|
||||
|
||||
function makePersona(id) {
|
||||
return {
|
||||
|
|
|
@ -11,7 +11,6 @@ support-files =
|
|||
sync_ping_schema.json
|
||||
systemaddon-search.json
|
||||
!/services/common/tests/unit/head_helpers.js
|
||||
!/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
|
||||
!/toolkit/components/extensions/test/xpcshell/head_sync.js
|
||||
|
||||
# The manifest is roughly ordered from low-level to high-level. When making
|
||||
|
|
|
@ -218,29 +218,32 @@ def get_hash(path, hash_type="sha512"):
|
|||
|
||||
class WorkEnv(object):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, mar=None, mbsdiff=None):
|
||||
self.workdir = tempfile.mkdtemp()
|
||||
self.paths = {
|
||||
'unwrap_full_update.pl': os.path.join(self.workdir, 'unwrap_full_update.pl'),
|
||||
'mar': os.path.join(self.workdir, 'mar'),
|
||||
'mbsdiff': os.path.join(self.workdir, 'mbsdiff')
|
||||
}
|
||||
self.urls = {
|
||||
'unwrap_full_update.pl': 'https://hg.mozilla.org/mozilla-central/raw-file/default/'
|
||||
'tools/update-packaging/unwrap_full_update.pl',
|
||||
'mar': 'https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/'
|
||||
'latest-mozilla-central/mar-tools/linux64/mar',
|
||||
'mbsdiff': 'https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/'
|
||||
'latest-mozilla-central/mar-tools/linux64/mbsdiff'
|
||||
}
|
||||
if mar:
|
||||
self.urls['mar'] = mar
|
||||
if mbsdiff:
|
||||
self.urls['mbsdiff'] = mbsdiff
|
||||
|
||||
async def setup(self):
|
||||
await self.download_unwrap()
|
||||
await self.download_martools()
|
||||
|
||||
async def clone(self, workenv):
|
||||
for path in workenv.paths:
|
||||
if os.path.exists(self.paths[path]):
|
||||
os.unlink(self.paths[path])
|
||||
os.link(workenv.paths[path], self.paths[path])
|
||||
|
||||
async def download_unwrap(self):
|
||||
# unwrap_full_update.pl is not too sensitive to the revision
|
||||
url = "https://hg.mozilla.org/mozilla-central/raw-file/default/" \
|
||||
"tools/update-packaging/unwrap_full_update.pl"
|
||||
await retry_download(url, dest=self.paths['unwrap_full_update.pl'], mode=0o755)
|
||||
async def setup(self, mar=None, mbsdiff=None):
|
||||
for filename, url in self.urls.items():
|
||||
if filename not in self.paths:
|
||||
log.info("Been told about %s but don't know where to download it to!", filename)
|
||||
continue
|
||||
await retry_download(url, dest=self.paths[filename], mode=0o755)
|
||||
|
||||
async def download_buildsystem_bits(self, repo, revision):
|
||||
prefix = "{repo}/raw-file/{revision}/tools/update-packaging"
|
||||
|
@ -249,14 +252,6 @@ class WorkEnv(object):
|
|||
url = "{prefix}/{f}".format(prefix=prefix, f=f)
|
||||
await retry_download(url, dest=os.path.join(self.workdir, f), mode=0o755)
|
||||
|
||||
async def download_martools(self):
|
||||
# TODO: check if the tools have to be branch specific
|
||||
prefix = "https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/" \
|
||||
"latest-mozilla-central/mar-tools/linux64"
|
||||
for f in ('mar', 'mbsdiff'):
|
||||
url = "{prefix}/{f}".format(prefix=prefix, f=f)
|
||||
await retry_download(url, dest=self.paths[f], mode=0o755)
|
||||
|
||||
def cleanup(self):
|
||||
shutil.rmtree(self.workdir)
|
||||
|
||||
|
@ -264,8 +259,8 @@ class WorkEnv(object):
|
|||
def env(self):
|
||||
my_env = os.environ.copy()
|
||||
my_env['LC_ALL'] = 'C'
|
||||
my_env['MAR'] = os.path.join(self.workdir, "mar")
|
||||
my_env['MBSDIFF'] = os.path.join(self.workdir, "mbsdiff")
|
||||
my_env['MAR'] = self.paths['mar']
|
||||
my_env['MBSDIFF'] = self.paths['mbsdiff']
|
||||
return my_env
|
||||
|
||||
|
||||
|
@ -401,14 +396,14 @@ async def manage_partial(partial_def, work_env, filename_template, artifacts_dir
|
|||
async def async_main(args, signing_certs):
|
||||
tasks = []
|
||||
|
||||
master_env = WorkEnv()
|
||||
await master_env.setup()
|
||||
|
||||
task = json.load(args.task_definition)
|
||||
# TODO: verify task["extra"]["funsize"]["partials"] with jsonschema
|
||||
for definition in task["extra"]["funsize"]["partials"]:
|
||||
workenv = WorkEnv()
|
||||
await workenv.clone(master_env)
|
||||
workenv = WorkEnv(
|
||||
mar=definition.get('mar_binary'),
|
||||
mbsdiff=definition.get('mbsdiff_binary')
|
||||
)
|
||||
await workenv.setup()
|
||||
tasks.append(asyncio.ensure_future(manage_partial(
|
||||
partial_def=definition,
|
||||
filename_template=args.filename_template,
|
||||
|
@ -418,7 +413,6 @@ async def async_main(args, signing_certs):
|
|||
))
|
||||
|
||||
manifest = await asyncio.gather(*tasks)
|
||||
master_env.cleanup()
|
||||
return manifest
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,35 @@ support-files =
|
|||
classifierHelper.js
|
||||
head.js
|
||||
threathit.sjs
|
||||
!/toolkit/components/url-classifier/tests/mochitest/classifierFrame.html
|
||||
!/toolkit/components/url-classifier/tests/mochitest/cleanWorker.js
|
||||
!/toolkit/components/url-classifier/tests/mochitest/good.js
|
||||
!/toolkit/components/url-classifier/tests/mochitest/evil.css
|
||||
!/toolkit/components/url-classifier/tests/mochitest/evil.css^headers^
|
||||
!/toolkit/components/url-classifier/tests/mochitest/evil.js
|
||||
!/toolkit/components/url-classifier/tests/mochitest/evil.js^headers^
|
||||
!/toolkit/components/url-classifier/tests/mochitest/evilWorker.js
|
||||
!/toolkit/components/url-classifier/tests/mochitest/import.css
|
||||
!/toolkit/components/url-classifier/tests/mochitest/raptor.jpg
|
||||
!/toolkit/components/url-classifier/tests/mochitest/track.html
|
||||
!/toolkit/components/url-classifier/tests/mochitest/trackingRequest.js
|
||||
!/toolkit/components/url-classifier/tests/mochitest/trackingRequest.js^headers^
|
||||
!/toolkit/components/url-classifier/tests/mochitest/unwantedWorker.js
|
||||
!/toolkit/components/url-classifier/tests/mochitest/vp9.webm
|
||||
!/toolkit/components/url-classifier/tests/mochitest/whitelistFrame.html
|
||||
!/toolkit/components/url-classifier/tests/mochitest/workerFrame.html
|
||||
!/toolkit/components/url-classifier/tests/mochitest/ping.sjs
|
||||
!/toolkit/components/url-classifier/tests/mochitest/basic.vtt
|
||||
!/toolkit/components/url-classifier/tests/mochitest/basic.vtt^headers^
|
||||
!/toolkit/components/url-classifier/tests/mochitest/dnt.html
|
||||
!/toolkit/components/url-classifier/tests/mochitest/dnt.sjs
|
||||
!/toolkit/components/url-classifier/tests/mochitest/update.sjs
|
||||
!/toolkit/components/url-classifier/tests/mochitest/bad.css
|
||||
!/toolkit/components/url-classifier/tests/mochitest/bad.css^headers^
|
||||
!/toolkit/components/url-classifier/tests/mochitest/gethashFrame.html
|
||||
!/toolkit/components/url-classifier/tests/mochitest/tracker.js
|
||||
!/toolkit/components/url-classifier/tests/mochitest/seek.webm
|
||||
!/toolkit/components/url-classifier/tests/mochitest/cache.sjs
|
||||
|
||||
[test_lookup_system_principal.html]
|
||||
[test_classified_annotations.html]
|
||||
|
|
|
@ -10,6 +10,11 @@ var AM_Cu = Cu;
|
|||
|
||||
AM_Cu.importGlobalProperties(["TextEncoder"]);
|
||||
|
||||
if (!_TEST_FILE[0].includes("toolkit/mozapps/extensions/test/xpcshell/")) {
|
||||
ok(false, ("head_addons.js may not be loaded by tests outside of " +
|
||||
"the add-on manager component."));
|
||||
}
|
||||
|
||||
const CERTDB_CONTRACTID = "@mozilla.org/security/x509certdb;1";
|
||||
const CERTDB_CID = Components.ID("{fb0bbc5c-452e-4783-b32c-80124693d871}");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче