Merge mozilla-inbound to mozilla-central. a=merge

This commit is contained in:
Daniel Varga 2019-06-07 12:50:35 +03:00
Родитель 112c11cad5 6ae5d6c65c
Коммит fe7dbedf22
34 изменённых файлов: 302 добавлений и 194 удалений

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

@ -0,0 +1,60 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* This test verifies that group and origin strings for URIs with special
* characters are consistent between calling
* EnsureQuotaForOringin/EnsureOriginIsInitailized and GetQuotaObject in
* PrepareDatastoreOp, so writing to local storage won't cause a crash because
* of a null quota object. See bug 1516333.
*/
async function testSteps() {
/**
* The edge cases are specified in this array of origins. Each edge case must
* contain two properties uri and path (origin directory path relative to the
* profile directory).
*/
const origins = [
{
uri: "file:///test'.html",
path: "storage/default/file++++test'.html",
},
{
uri: "file:///test>.html",
path: "storage/default/file++++test%3E.html",
},
];
for (let origin of origins) {
const principal = getPrincipal(origin.uri);
let originDir = getRelativeFile(origin.path);
info("Checking the origin directory existence");
ok(!originDir.exists(),
`The origin directory ${origin.path} should not exists`);
info("Getting storage");
let storage = getLocalStorage(principal);
info("Adding item");
storage.setItem("foo", "bar");
info("Resetting origin");
// This forces any pending changes to be flushed to disk (including origin
// directory creation).
let request = resetOrigin(principal);
await requestFinished(request);
info("Checking the origin directory existence");
ok(originDir.exists(), `The origin directory ${origin.path} should exist`);
}
}

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

@ -44,4 +44,5 @@ run-sequentially = this test depends on a file produced by test_databaseShadowin
requesttimeoutfactor = 4
[test_stringLength.js]
[test_stringLength2.js]
[test_uri_encoding_edge_cases.js]
[test_usage.js]

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

@ -3729,21 +3729,12 @@ already_AddRefed<QuotaObject> QuotaManager::GetQuotaObject(
fileSize = aFileSize;
}
// Re-escape our parameters above to make sure we get the right quota group.
nsAutoCString group;
rv = NS_EscapeURL(aGroup, esc_Query, group, fallible);
NS_ENSURE_SUCCESS(rv, nullptr);
nsAutoCString origin;
rv = NS_EscapeURL(aOrigin, esc_Query, origin, fallible);
NS_ENSURE_SUCCESS(rv, nullptr);
RefPtr<QuotaObject> result;
{
MutexAutoLock lock(mQuotaMutex);
GroupInfoPair* pair;
if (!mGroupInfoPairs.Get(group, &pair)) {
if (!mGroupInfoPairs.Get(aGroup, &pair)) {
return nullptr;
}
@ -3753,7 +3744,7 @@ already_AddRefed<QuotaObject> QuotaManager::GetQuotaObject(
return nullptr;
}
RefPtr<OriginInfo> originInfo = groupInfo->LockedGetOriginInfo(origin);
RefPtr<OriginInfo> originInfo = groupInfo->LockedGetOriginInfo(aOrigin);
if (!originInfo) {
return nullptr;

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

@ -233,16 +233,17 @@ bool CompositorD3D11::Initialize(nsCString* const out_failureReason) {
hr = dxgiFactory2->CreateSwapChainForHwnd(mDevice, mHwnd, &swapDesc,
nullptr, nullptr,
getter_AddRefs(swapChain));
if (Failed(hr, "create swap chain")) {
*out_failureReason = "FEATURE_FAILURE_D3D11_SWAP_CHAIN";
return false;
if (SUCCEEDED(hr)) {
DXGI_RGBA color = {1.0f, 1.0f, 1.0f, 1.0f};
swapChain->SetBackgroundColor(&color);
mSwapChain = swapChain;
}
}
DXGI_RGBA color = {1.0f, 1.0f, 1.0f, 1.0f};
swapChain->SetBackgroundColor(&color);
mSwapChain = swapChain;
} else
// In some configurations double buffering may have failed with an
// ACCESS_DENIED error.
if (!mSwapChain)
#endif
{
DXGI_SWAP_CHAIN_DESC swapDesc;

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

@ -6,12 +6,14 @@
#include "nsPrintJob.h"
#include "nsDocShell.h"
#include "nsIStringBundle.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/ComputedStyleInlines.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/CustomEvent.h"
#include "mozilla/dom/ScriptSettings.h"
@ -448,6 +450,40 @@ static void MapContentToWebShells(const UniquePtr<nsPrintObject>& aRootPO,
}
}
/**
* Recursively builds the static clone document tree.
* XXXjwatt - uh, CreateStaticClone already takes care of recursively creating
* subdocs (in-process, at least). nsPrintObject::Init creating a static clone
* for subdocs is...broken, surely.
* The outparam aDocList returns a (depth first) flat list of all the
* nsPrintObjects created.
*/
static void BuildDocTree(BrowsingContext* aBrowsingContext,
const UniquePtr<nsPrintObject>& aPO,
nsTArray<nsPrintObject*>* aDocList) {
MOZ_ASSERT(aBrowsingContext, "Pointer is null!");
MOZ_ASSERT(aDocList, "Pointer is null!");
MOZ_ASSERT(aPO, "Pointer is null!");
for (auto& childBC : aBrowsingContext->GetChildren()) {
auto window = childBC->GetDOMWindow();
if (!window) {
// XXXfission - handle OOP-iframes
continue;
}
auto childPO = MakeUnique<nsPrintObject>();
childPO->mParent = aPO.get();
nsresult rv = childPO->Init(childBC->GetDocShell(), window->GetExtantDoc(),
aPO->mPrintPreview);
if (NS_FAILED(rv)) {
MOZ_ASSERT_UNREACHABLE("Init failed?");
}
aPO->mKids.AppendElement(std::move(childPO));
aDocList->AppendElement(aPO->mKids.LastElement().get());
BuildDocTree(childBC, aPO->mKids.LastElement(), aDocList);
}
}
/**
* On platforms that support it, sets the printer name stored in the
* nsIPrintSettings to the default printer if a printer name is not already
@ -815,9 +851,10 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
printData->mPrintObject->mFrameType =
printData->mIsParentAFrameSet ? eFrameSet : eDoc;
// Build the "tree" of PrintObjects
BuildDocTree(printData->mPrintObject->mDocShell, &printData->mPrintDocList,
printData->mPrintObject);
// Builds the static clone doc tree and the "tree" of PrintObjects
BuildDocTree(nsDocShell::Cast(printData->mPrintObject->mDocShell)
->GetBrowsingContext(),
printData->mPrintObject, &printData->mPrintDocList);
}
// The nsAutoScriptBlocker above will now have been destroyed, which may
@ -1241,40 +1278,6 @@ bool nsPrintJob::IsThereARangeSelection(nsPIDOMWindowOuter* aDOMWin) {
return selection->GetRangeAt(0) && !selection->IsCollapsed();
}
//---------------------------------------------------------------------
// Recursively build a list of sub documents to be printed
// that mirrors the document tree
void nsPrintJob::BuildDocTree(nsIDocShell* aParentNode,
nsTArray<nsPrintObject*>* aDocList,
const UniquePtr<nsPrintObject>& aPO) {
NS_ASSERTION(aParentNode, "Pointer is null!");
NS_ASSERTION(aDocList, "Pointer is null!");
NS_ASSERTION(aPO, "Pointer is null!");
int32_t childWebshellCount;
aParentNode->GetChildCount(&childWebshellCount);
if (childWebshellCount > 0) {
for (int32_t i = 0; i < childWebshellCount; i++) {
nsCOMPtr<nsIDocShellTreeItem> child;
aParentNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
nsCOMPtr<nsIContentViewer> viewer;
childAsShell->GetContentViewer(getter_AddRefs(viewer));
if (viewer) {
nsCOMPtr<Document> doc = do_GetInterface(childAsShell);
auto po = MakeUnique<nsPrintObject>();
po->mParent = aPO.get();
nsresult rv = po->Init(childAsShell, doc, aPO->mPrintPreview);
if (NS_FAILED(rv)) MOZ_ASSERT_UNREACHABLE("Init failed?");
aPO->mKids.AppendElement(std::move(po));
aDocList->AppendElement(aPO->mKids.LastElement().get());
BuildDocTree(childAsShell, aDocList, aPO->mKids.LastElement());
}
}
}
}
//---------------------------------------------------------------------
bool nsPrintJob::IsThereAnIFrameSelected(nsIDocShell* aDocShell,
nsPIDOMWindowOuter* aDOMWin,
@ -2704,32 +2707,21 @@ already_AddRefed<nsPIDOMWindowOuter> nsPrintJob::FindFocusedDOMWindow() const {
//---------------------------------------------------------------------
bool nsPrintJob::IsWindowsInOurSubTree(nsPIDOMWindowOuter* window) const {
bool found = false;
// now check to make sure it is in "our" tree of docshells
if (window) {
nsCOMPtr<nsIDocShell> docShell = window->GetDocShell();
if (docShell) {
// get this DocViewer docshell
nsCOMPtr<nsIDocShell> thisDVDocShell(do_QueryReferent(mDocShell));
while (!found) {
if (docShell) {
if (docShell == thisDVDocShell) {
found = true;
break;
}
} else {
break; // at top of tree
nsCOMPtr<nsIDocShell> ourDocShell(do_QueryReferent(mDocShell));
if (ourDocShell) {
BrowsingContext* ourBC =
nsDocShell::Cast(ourDocShell)->GetBrowsingContext();
BrowsingContext* bc = window->GetBrowsingContext();
while (bc) {
if (bc == ourBC) {
return true;
}
nsCOMPtr<nsIDocShellTreeItem> docShellItemParent;
docShell->GetSameTypeParent(getter_AddRefs(docShellItemParent));
docShell = do_QueryInterface(docShellItemParent);
} // while
bc = bc->GetParent();
}
}
} // scriptobj
return found;
}
return false;
}
//-------------------------------------------------------

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

@ -170,9 +170,6 @@ class nsPrintJob final : public nsIObserver,
bool DonePrintingPages(nsPrintObject* aPO, nsresult aResult);
//---------------------------------------------------------------------
void BuildDocTree(nsIDocShell* aParentNode,
nsTArray<nsPrintObject*>* aDocList,
const mozilla::UniquePtr<nsPrintObject>& aPO);
nsresult ReflowDocList(const mozilla::UniquePtr<nsPrintObject>& aPO,
bool aSetPixelScale);

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

@ -107,6 +107,7 @@ var validGradientAndElementValues = [
"linear-gradient(#ffff00, #ef3, rgba(10, 20, 30, 0.4))",
"linear-gradient(rgba(10, 20, 30, 0.4), #ffff00, #ef3)",
"linear-gradient(red, green calc(50% + 20px), blue)",
"linear-gradient(180deg, red, blue)",
"linear-gradient(to top, red, blue)",
"linear-gradient(to bottom, red, blue)",

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

@ -1250,11 +1250,8 @@ pref("dom.storage.enabled", true);
// Whether or not LSNG (Next Generation Local Storage) is enabled.
// See bug 1517090 for enabling this on Nightly.
// See bug 1534736 for changing it to EARLY_BETA_OR_EARLIER.
#ifdef EARLY_BETA_OR_EARLIER
// See bug 1539835 for enabling this unconditionally.
pref("dom.storage.next_gen", true);
#else
pref("dom.storage.next_gen", false);
#endif
pref("dom.storage.default_quota", 5120);
pref("dom.storage.shadow_writes", true);
pref("dom.storage.snapshot_prefill", 16384);

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

@ -389,6 +389,7 @@ impl nsStyleImage {
let angle = Angle::from_gecko_style_coord(&gecko_gradient.mAngle);
let line_direction = match (angle, horizontal_style, vertical_style) {
(Some(a), None, None) => LineDirection::Angle(a),
(None, None, None) => LineDirection::Angle(Angle::from_radians(PI)),
(None, Some(horizontal), Some(vertical)) => {
line_direction(horizontal, vertical)
},

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

@ -14,6 +14,7 @@
#include "mozilla/dom/quota/QuotaObject.h"
#include "mozilla/net/IOActivityMonitor.h"
#include "mozilla/IOInterposer.h"
#include "nsEscape.h"
// The last VFS version for which this file has been updated.
#define LAST_KNOWN_VFS_VERSION 3
@ -318,13 +319,27 @@ already_AddRefed<QuotaObject> GetQuotaObjectFromNameAndParameters(
return nullptr;
}
// Re-escape group and origin to make sure we get the right quota group and
// origin.
nsAutoCString escGroup;
nsresult rv =
NS_EscapeURL(nsDependentCString(group), esc_Query, escGroup, fallible);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
nsAutoCString escOrigin;
rv = NS_EscapeURL(nsDependentCString(origin), esc_Query, escOrigin, fallible);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
QuotaManager* quotaManager = QuotaManager::Get();
MOZ_ASSERT(quotaManager);
return quotaManager->GetQuotaObject(
PersistenceTypeFromText(nsDependentCString(persistenceType)),
nsDependentCString(group), nsDependentCString(origin),
NS_ConvertUTF8toUTF16(zName));
PersistenceTypeFromText(nsDependentCString(persistenceType)), escGroup,
escOrigin, NS_ConvertUTF8toUTF16(zName));
}
void MaybeEstablishQuotaControl(const char* zName, telemetry_file* pFile,

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

@ -1,5 +0,0 @@
[2d.shadow.enable.y.html]
[Shadows are drawn if shadowOffsetY is set]
expected:
if (os == "android") and not e10s: FAIL

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

@ -1,3 +1,3 @@
[first-letter-punctuation-088.xht]
expected:
if (os == "android") and not e10s: FAIL
if (os == "android"): FAIL

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

@ -160,6 +160,8 @@
if not debug and not webrender and e10s and (os == "android") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if not debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "android") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): PASS
FAIL
[test unit: ex - ellipse(closest-side 75ex) - computed]
@ -212,6 +214,7 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): PASS
FAIL
[test unit: vh - ellipse(50vh) - computed]
@ -234,6 +237,7 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): PASS
FAIL
[test unit: vmin - ellipse(50vmin) - computed]
@ -256,6 +260,7 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): PASS
FAIL
[test unit: vmax - ellipse(50vmax) - computed]
@ -278,6 +283,7 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): PASS
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): PASS
FAIL
[test unit: vmin - ellipse(50vmin 100vmin) - inline]

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

@ -890,6 +890,10 @@
[-webkit-appearance: listitem]
expected: FAIL
[-webkit-appearance: listitem (invalid)]
expected:
if os == "android": FAIL
[-webkit-appearance: resizer (invalid)]
expected:
if (os == "android") and not e10s: FAIL

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

@ -9,6 +9,6 @@
[Orientation=Rotated]
expected:
if (os == "win"): PASS
if os == "win": PASS
FAIL

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

@ -683,6 +683,9 @@
[[["defaultparagraphseparator","p"\],["insertparagraph",""\]\] "<blockquote>foo[\]bar</blockquote>" compare innerHTML]
expected: FAIL
[insertparagraph - HTML editing conformance tests]
expected: FAIL
[insertparagraph.html?3001-4000]
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<p><b><a href=foo>foo[\]</a></b></p>" compare innerHTML]

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

@ -1,2 +0,0 @@
[idlharness.https.any.serviceworker.html]
expected: TIMEOUT

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

@ -23,6 +23,7 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): FAIL
[Leading noopener should work]
expected:
@ -43,6 +44,7 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): FAIL
[Interior noopener should work]
expected:
@ -63,6 +65,7 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): FAIL
[window.open() with 'noopener' should not reuse existing target]
expected:

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

@ -28,6 +28,7 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): FAIL
[Check that targeting of rel=noopener with a given name reuses an existing subframe with that name]
expected:
@ -48,4 +49,5 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): FAIL

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

@ -239,4 +239,5 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "aarch64") and (bits == 64): FAIL

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

@ -19,4 +19,5 @@
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "win") and (version == "10.0.17134") and (processor == "aarch64"): TIMEOUT

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

@ -1,4 +1,2 @@
[text-clipped-offscreen-move-onscreen.html]
disabled:
if (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1552460
if (os == "mac"): https://bugzilla.mozilla.org/show_bug.cgi?id=1552460
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1552460

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

@ -1,9 +0,0 @@
[createcredential-pubkeycredparams.https.html]
[Bad pubKeyCredParams: first param has bad alg (0)]
expected:
if (os == "android") and not e10s: FAIL
[Bad pubKeyCredParams: first param has bad alg (42)]
expected:
if (os == "android") and not e10s: FAIL

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

@ -1,6 +1,4 @@
[createcredential-timeout.https.html]
expected:
if os == "android": ERROR
[ensure create credential times out]
expected:
if os == "android": PASS

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

@ -1,7 +0,0 @@
[event-timeout.any.html]
[event-timeout.any.worker.html]
[XMLHttpRequest: timeout event]
expected:
if os == "android": FAIL

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

@ -47,6 +47,7 @@ var snapshotFormatters = {
$("application-box").textContent = data.name;
$("useragent-box").textContent = data.userAgent;
$("os-box").textContent = data.osVersion;
$("binary-box").textContent = Services.dirsvc.get("XREExeF", Ci.nsIFile).path;
$("supportLink").href = data.supportURL;
let version = AppConstants.MOZ_APP_VERSION_DISPLAY;
if (data.vendor)

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

@ -111,6 +111,13 @@
</td>
</tr>
<tr class="no-copy">
<th class="column" data-l10n-id="app-basics-binary"/>
<td id="binary-box">
</td>
</tr>
<tr id="profile-row" class="no-copy">
<th class="column" data-l10n-id="app-basics-profile-dir"/>

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

@ -38,6 +38,8 @@ app-basics-build-id = Build ID
app-basics-update-channel = Update Channel
app-basics-update-history = Update History
app-basics-show-update-history = Show Update History
# Represents the path to the binary used to start the application.
app-basics-binary = Application Binary
app-basics-profile-dir =
{ PLATFORM() ->
[linux] Profile Directory

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

@ -2362,7 +2362,11 @@ static void ExtractCompatVersionInfo(const nsACString& aCompatVersion,
aPlatformBuildID = Substring(aCompatVersion, slashPos + 1);
}
static bool IsNewIDLower(nsACString& oldID, nsACString& newID) {
/**
* Compares two build IDs. Returns 0 if they match, < 0 if newID is considered
* newer than oldID and > 0 if the oldID is considered newer than newID.
*/
static int32_t CompareBuildIDs(nsACString& oldID, nsACString& newID) {
// For Mozilla builds the build ID is a numeric date string. But it is too
// large a number for the version comparator to handle so try to just compare
// them as integer values first.
@ -2394,16 +2398,22 @@ static bool IsNewIDLower(nsACString& oldID, nsACString& newID) {
if (isNumeric) {
nsresult rv;
uint64_t oldVal;
uint64_t newVal;
oldVal = oldID.ToInteger64(&rv);
CheckedInt<uint64_t> oldVal = oldID.ToInteger64(&rv);
if (NS_SUCCEEDED(rv)) {
newVal = newID.ToInteger64(&rv);
if (NS_SUCCEEDED(rv) && oldVal.isValid()) {
CheckedInt<uint64_t> newVal = newID.ToInteger64(&rv);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv) && newVal.isValid()) {
// We have simple numbers for both IDs.
return newVal < oldVal;
if (oldVal.value() == newVal.value()) {
return 0;
}
if (oldVal.value() > newVal.value()) {
return 1;
}
return -1;
}
}
}
@ -2412,8 +2422,8 @@ static bool IsNewIDLower(nsACString& oldID, nsACString& newID) {
// distribution could have modified the build ID in some way. We don't know
// what format this may be so let's just fall back to assuming that it's a
// valid toolkit version.
return Version(PromiseFlatCString(newID).get()) <
Version(PromiseFlatCString(oldID).get());
return CompareVersions(PromiseFlatCString(oldID).get(),
PromiseFlatCString(newID).get());
}
/**
@ -2422,13 +2432,11 @@ static bool IsNewIDLower(nsACString& oldID, nsACString& newID) {
* The aDowngrade parameter is set to true if the old version is "newer" than
* the new version.
*/
bool CheckCompatVersions(const nsACString& aOldCompatVersion,
const nsACString& aNewCompatVersion,
bool* aIsDowngrade) {
int32_t CompareCompatVersions(const nsACString& aOldCompatVersion,
const nsACString& aNewCompatVersion) {
// Quick path for the common case.
if (aOldCompatVersion.Equals(aNewCompatVersion)) {
*aIsDowngrade = false;
return true;
return 0;
}
// The versions differ for some reason so we will only ever return false from
@ -2438,8 +2446,7 @@ bool CheckCompatVersions(const nsACString& aOldCompatVersion,
// cannot tell if this is a downgrade or not so just assume it isn't and let
// the user proceed.
if (aOldCompatVersion.EqualsLiteral("Safe Mode")) {
*aIsDowngrade = false;
return false;
return -1;
}
nsCString oldVersion;
@ -2455,24 +2462,18 @@ bool CheckCompatVersions(const nsACString& aOldCompatVersion,
newPlatformBuildID);
// In most cases the app version will differ and this is an easy check.
if (Version(newVersion.get()) < Version(oldVersion.get())) {
*aIsDowngrade = true;
return false;
int32_t result = CompareVersions(oldVersion.get(), newVersion.get());
if (result != 0) {
return result;
}
// Fall back to build ID comparison.
if (IsNewIDLower(oldAppBuildID, newAppBuildID)) {
*aIsDowngrade = true;
return false;
result = CompareBuildIDs(oldAppBuildID, newAppBuildID);
if (result != 0) {
return result;
}
if (IsNewIDLower(oldPlatformBuildID, newPlatformBuildID)) {
*aIsDowngrade = true;
return false;
}
*aIsDowngrade = false;
return false;
return CompareBuildIDs(oldPlatformBuildID, newPlatformBuildID);
}
/**
@ -2506,7 +2507,9 @@ static bool CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion,
return false;
}
if (!CheckCompatVersions(aLastVersion, aVersion, aIsDowngrade)) {
int32_t result = CompareCompatVersions(aLastVersion, aVersion);
if (result != 0) {
*aIsDowngrade = result > 0;
return false;
}

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

@ -60,9 +60,14 @@ nsresult AppInfoConstructor(nsISupports* aOuter, const nsID& aIID,
// Exported for gtests.
void BuildCompatVersion(const char* aAppVersion, const char* aAppBuildID,
const char* aToolkitBuildID, nsACString& aBuf);
bool CheckCompatVersions(const nsACString& aOldCompatVersion,
const nsACString& aNewCompatVersion,
bool* aIsDowngrade);
/**
* Compares the provided compatibility versions. Returns 0 if they match,
* < 0 if the new version is considered an upgrade from the old version and
* > 0 if the new version is considered a downgrade from the old version.
*/
int32_t CompareCompatVersions(const nsACString& aOldCompatVersion,
const nsACString& aNewCompatVersion);
/**
* Create the nativeappsupport implementation.

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

@ -12,11 +12,10 @@ void CheckCompatVersionCompare(const nsCString& aOldCompatVersion,
bool aExpectedSame, bool aExpectedDowngrade) {
printf("Comparing '%s' to '%s'.\n", aOldCompatVersion.get(), aNewCompatVersion.get());
bool isDowngrade = false;
bool isSame = CheckCompatVersions(aOldCompatVersion, aNewCompatVersion, &isDowngrade);
int32_t result = CompareCompatVersions(aOldCompatVersion, aNewCompatVersion);
ASSERT_EQ(aExpectedSame, isSame) << "Version sameness check should match.";
ASSERT_EQ(aExpectedDowngrade, isDowngrade) << "Version downgrade check should match.";
ASSERT_EQ(aExpectedSame, result == 0) << "Version sameness check should match.";
ASSERT_EQ(aExpectedDowngrade, result > 0) << "Version downgrade check should match.";
}
void CheckExpectedResult(
@ -34,6 +33,7 @@ void CheckExpectedResult(
aExpectedSame, aExpectedDowngrade);
}
// clang-format off
TEST(CompatVersionCompare, CompareVersionChange) {
// Identical
CheckExpectedResult(
@ -124,13 +124,32 @@ TEST(CompatVersionCompare, CompareVersionChange) {
"67.0.5", "20190523030228","20190523030228",
false, false);
CheckExpectedResult(
"67.0.5", "20190523030228","20190523030228",
"67.0.5", "20190523030228", "20190523030228",
"67.0", "20190516215225", "20190516215225",
false, true);
// A newer or equal version should not go on to test the build IDs (bug 1556612).
CheckExpectedResult(
"65.0", "30000000000000", "20000000000000",
"66.0", "20000000000000", "20000000000000",
false, false);
CheckExpectedResult(
"65.0", "20000000000000", "30000000000000",
"66.0", "20000000000000", "20000000000000",
false, false);
CheckExpectedResult(
"66.0", "30000000000000", "20000000000000",
"65.0", "20000000000000", "20000000000000",
false, true);
CheckExpectedResult(
"66.0", "20000000000000", "30000000000000",
"65.0", "20000000000000", "20000000000000",
false, true);
// Check that if the last run was safe mode then we consider this an upgrade.
CheckCompatVersionCompare(
NS_LITERAL_CSTRING("Safe Mode"),
NS_LITERAL_CSTRING("67.0.1_20000000000000/20000000000000"),
false, false);
}
// clang-format on

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

@ -10,6 +10,7 @@
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include "mozilla/CheckedInt.h"
#if defined(XP_WIN) && !defined(UPDATER_NO_STRING_GLUE_STL)
# include <wchar.h>
# include "nsString.h"
@ -39,6 +40,29 @@ struct VersionPartW {
};
#endif
static int32_t ns_strtol(const char* aPart, char** aNext) {
errno = 0;
long result_long = strtol(aPart, aNext, 10);
// Different platforms seem to disagree on what to return when the value
// is out of range so we ensure that it is always what we want it to be.
// We choose 0 firstly because that is the default when the number doesn't
// exist at all and also because it would be easier to recover from should
// you somehow end up in a situation where an old version is invalid. It is
// much easier to create a version either larger or smaller than 0, much
// harder to do the same with INT_MAX.
if (errno != 0) {
return 0;
}
mozilla::CheckedInt<int32_t> result = result_long;
if (!result.isValid()) {
return 0;
}
return result.value();
}
/**
* Parse a version part into a number and "extra text".
*
@ -66,19 +90,7 @@ static char* ParseVP(char* aPart, VersionPart& aResult) {
aResult.numA = INT32_MAX;
aResult.strB = "";
} else {
errno = 0;
aResult.numA = strtol(aPart, const_cast<char**>(&aResult.strB), 10);
// Different platforms seem to disagree on what to return when the value
// is out of range so we ensure that it is always what we want it to be.
// We choose 0 firstly because that is the default when the number doesn't
// exist at all and also because it would be easier to recover from should
// you somehow end up in a situation where an old version is invalid. It is
// much easier to create a version either larger or smaller than 0, much
// harder to do the same with INT_MAX.
if (errno != 0) {
aResult.numA = 0;
}
aResult.numA = ns_strtol(aPart, const_cast<char**>(&aResult.strB));
}
if (!*aResult.strB) {
@ -97,14 +109,7 @@ static char* ParseVP(char* aPart, VersionPart& aResult) {
aResult.strBlen = strlen(aResult.strB);
} else {
aResult.strBlen = numstart - aResult.strB;
errno = 0;
aResult.numC = strtol(numstart, &aResult.extraD, 10);
// See above for the rationale for using 0 here.
if (errno != 0) {
aResult.numC = 0;
}
aResult.numC = ns_strtol(numstart, const_cast<char**>(&aResult.extraD));
if (!*aResult.extraD) {
aResult.extraD = nullptr;
@ -130,6 +135,24 @@ static char* ParseVP(char* aPart, VersionPart& aResult) {
* @returns A pointer to the next versionpart, or null if none.
*/
#ifdef XP_WIN
static int32_t ns_wcstol(const wchar_t* aPart, wchar_t** aNext) {
errno = 0;
long result_long = wcstol(aPart, aNext, 10);
// See above for the rationale for using 0 here.
if (errno != 0) {
return 0;
}
mozilla::CheckedInt<int32_t> result = result_long;
if (!result.isValid()) {
return 0;
}
return result.value();
}
static wchar_t* ParseVP(wchar_t* aPart, VersionPartW& aResult) {
wchar_t* dot;
@ -154,13 +177,7 @@ static wchar_t* ParseVP(wchar_t* aPart, VersionPartW& aResult) {
aResult.numA = INT32_MAX;
aResult.strB = kEmpty;
} else {
errno = 0;
aResult.numA = wcstol(aPart, const_cast<wchar_t**>(&aResult.strB), 10);
// See above for the rationale for using 0 here.
if (errno != 0) {
aResult.numA = 0;
}
aResult.numA = ns_wcstol(aPart, const_cast<wchar_t**>(&aResult.strB));
}
if (!*aResult.strB) {
@ -179,14 +196,7 @@ static wchar_t* ParseVP(wchar_t* aPart, VersionPartW& aResult) {
aResult.strBlen = wcslen(aResult.strB);
} else {
aResult.strBlen = numstart - aResult.strB;
errno = 0;
aResult.numC = wcstol(numstart, &aResult.extraD, 10);
// See above for the rationale for using 0 here.
if (errno != 0) {
aResult.numC = 0;
}
aResult.numC = ns_wcstol(numstart, const_cast<wchar_t**>(&aResult.extraD));
if (!*aResult.extraD) {
aResult.extraD = nullptr;

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

@ -40,9 +40,18 @@
namespace mozilla {
/**
* Compares the version strings provided.
*
* Returns 0 if the versions match, < 0 if aStrB > aStrA and > 0 if
* aStrA > aStrB.
*/
int32_t CompareVersions(const char* aStrA, const char* aStrB);
#ifdef XP_WIN
/**
* As above but for wide character strings.
*/
int32_t CompareVersions(const char16_t* aStrA, const char16_t* aStrB);
#endif

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

@ -2,6 +2,9 @@ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
// Versions to test listed in ascending order, none can be equal
var comparisons = [
"pre",
// A number that is too large to be supported should be normalized to 0.
String(0x1F0000000),
"0.9",
"0.9.1",
"1.0pre1",