Merge autoland to mozilla-central a=merge

This commit is contained in:
Razvan Maries 2019-07-23 06:37:01 +03:00
Родитель 86980b4bb2 98278afa46
Коммит 40e889be8f
19 изменённых файлов: 270 добавлений и 127 удалений

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

@ -14,14 +14,7 @@
@import "resource://devtools/client/application/src/components/Worker.css";
@import "resource://devtools/client/application/src/components/WorkerList.css";
@import "resource://devtools/client/application/src/components/WorkerListEmpty.css";
/*
* Reset
*/
* {
box-sizing: border-box;
}
@import "resource://devtools/client/application/src/components/ui/UIButton.css";
html,
body,

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

@ -5,6 +5,8 @@
:root {
/* Typography from Photon */
/* See https://firefox-dev.tools/photon/visuals/typography.html */
--caption-10-font-size: 11px;
--caption-10-font-weight: 400;
--body-10-font-size: 13px;
--body-10-font-weight: 400;
--body-20-font-size: 15px;
@ -27,12 +29,19 @@
/* Global layout vars */
--base-unit: 4px;
/* extra, raw colors */
--blue-50-a30: rgba(10, 132, 255, 0.3);
}
/*
* Reset some tags
*/
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;

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

@ -11,7 +11,7 @@
* | "Source" | script_name debug_link |
| | "Updated" update_time |
* |--------------+-------------+----------------|
* | "Status" | status start_link |
* | "Status" | status start_button |
* +---+----------+-------------+----------------|
*/
@ -62,7 +62,7 @@
.worker__data {
display: grid;
grid-template-columns: auto 1fr;
grid-column-gap: 1rem;
grid-gap: 1rem;
}
.worker__data > * {

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

@ -8,11 +8,11 @@ const {
createFactory,
Component,
} = require("devtools/client/shared/vendor/react");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const {
a,
br,
button,
dd,
dl,
dt,
@ -22,6 +22,7 @@ const {
span,
time,
} = require("devtools/client/shared/vendor/react-dom-factories");
const {
getUnicodeUrl,
getUnicodeUrlPath,
@ -30,6 +31,8 @@ const {
const FluentReact = require("devtools/client/shared/vendor/fluent-react");
const Localized = createFactory(FluentReact.Localized);
const UIButton = createFactory(require("./ui/UIButton"));
loader.lazyRequireGetter(
this,
"DebuggerClient",
@ -136,50 +139,51 @@ class Worker extends Component {
return getUnicodeUrlPath(parts[parts.length - 1]);
}
renderDebugLink() {
renderDebugButton() {
const { isDebugEnabled } = this.props;
const shallDisableLink = !this.isRunning() || !isDebugEnabled;
const linkClass = shallDisableLink ? "disabled-link" : "";
const isDisabled = !this.isRunning() || !isDebugEnabled;
const localizationId = isDebugEnabled
? "serviceworker-worker-debug"
: "serviceworker-worker-debug-forbidden";
const link = Localized(
return Localized(
{
id: localizationId,
// The localized title is only displayed if the debug link is disabled.
attrs: {
title: shallDisableLink,
title: isDisabled,
},
},
a({
onClick: !shallDisableLink ? this.debug : null,
className: `${linkClass} worker__link-debug js-link-debug`,
UIButton({
onClick: this.debug,
className: `js-debug-button`,
disabled: isDisabled,
size: "micro",
})
);
return link;
}
renderStartLink() {
renderStartButton() {
const { isDebugEnabled } = this.props;
const linkClass = !isDebugEnabled ? "disabled-link" : "";
const isDisabled = !isDebugEnabled;
const link = Localized(
return Localized(
{
id: "serviceworker-worker-start2",
// The localized title is only displayed if the debug link is disabled.
attrs: {
title: !isDebugEnabled,
title: !isDisabled,
},
},
a({
UIButton({
onClick: this.start,
className: `worker__link-start js-link-start ${linkClass}`,
className: `js-start-button`,
disabled: isDisabled,
size: "micro",
})
);
return link;
}
render() {
@ -189,11 +193,9 @@ class Worker extends Component {
const unregisterButton = this.isActive()
? Localized(
{ id: "serviceworker-worker-unregister" },
button({
UIButton({
onClick: this.unregister,
className:
"devtools-button worker__unregister-button js-unregister-button",
"data-standalone": true,
className: "worker__unregister-button js-unregister-button",
})
)
: null;
@ -237,7 +239,8 @@ class Worker extends Component {
},
this.formatSource(worker.url)
),
this.renderDebugLink(),
" ",
this.renderDebugButton(),
lastUpdated ? br({}) : null,
lastUpdated ? lastUpdated : null
),
@ -251,7 +254,8 @@ class Worker extends Component {
{ id: "serviceworker-worker-status-" + status },
span({ className: "js-worker-status" })
),
!this.isRunning() ? this.renderStartLink() : null
" ",
!this.isRunning() ? this.renderStartButton() : null
)
)
);

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

@ -2,6 +2,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += [
'ui',
]
DevToolsModules(
'App.css',
'App.js',

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

@ -0,0 +1,71 @@
/* these styles com from Photon. Keep in mind that the "default" style is not used
in panels, and we should use the "micro" instead for default, stand-alone buttons. */
:root.theme-light {
--button-text-color: var(--grey-90);
--button-text-hover-color: var(--grey-90);
--button-text-pressed-color: var(--grey-90);
--button-background-color: var(--grey-90-a10);
--button-background-hover-color: var(--grey-90-a20);
--button-background-pressed-color: var(--grey-90-a30);
}
:root.theme-dark {
--button-text-color: var(--grey-40);
--button-text-hover-color: var(--grey-30);
--button-text-pressed-color: var(--grey-30);
--button-background-color: var(--grey-10-a20);
--button-background-hover-color: var(--grey-10-a25);
--button-background-pressed-color: var(--grey-10-a30);
}
.ui-button {
-moz-appearance: none;
transition: background-color 0.05s ease-in-out;
margin: 0;
height: calc(var(--base-unit) * 6);
padding-inline-start: calc(2 * var(--base-unit));
padding-inline-end: calc(2 * var(--base-unit));
border: none;
border-radius: calc(var(--base-unit) / 2);
color: var(--button-text-color);
background: var(--button-background-color);
font-size: var(--caption-10-font-size);
}
.ui-button:-moz-focusring {
outline: none;
}
.ui-button::-moz-focus-inner {
border: 0;
padding: 0;
}
.ui-button:not(:disabled):hover {
background: var(--button-background-hover-color);
color: var(--button-text-hover-color);
}
.ui-button:not(:disabled):active {
background: var(--button-background-pressed-color);
color: var(--button-text-pressed-color);
}
.ui-button:focus {
box-shadow: 0 0 0 1px var(--blue-50) inset,
0 0 0 1px var(--blue-50),
0 0 0 4px var(--blue-50-a30);
}
.ui-button:disabled {
opacity: 0.4;
}
/* Note: this "micro" variant here is not the same as the "micro" variant
in Photon docs (since we are using that one for our default size) */
.ui-button--micro {
height: auto;
padding: calc(var(--base-unit) * 0.5) var(--base-unit);
}

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

@ -0,0 +1,33 @@
"use strict";
const { PureComponent } = require("devtools/client/shared/vendor/react");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { button } = require("devtools/client/shared/vendor/react-dom-factories");
class UIButton extends PureComponent {
static get propTypes() {
return {
children: PropTypes.node,
className: PropTypes.string,
disabled: PropTypes.bool,
onClick: PropTypes.func,
size: PropTypes.oneOf(["micro"]),
};
}
render() {
const { className, disabled, onClick, size } = this.props;
const sizeClass = size ? `ui-button--${size}` : "";
return button(
{
className: `ui-button ${className || ""} ${sizeClass}`,
onClick,
disabled,
},
this.props.children
);
}
}
module.exports = UIButton;

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

@ -0,0 +1,8 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'UIButton.css',
'UIButton.js',
)

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

@ -27,16 +27,17 @@ add_task(async function() {
await waitUntil(() => getWorkerContainers(doc).length === 1);
const container = getWorkerContainers(doc)[0];
info("Wait until the debug link is displayed and enabled");
await waitUntil(() =>
container.querySelector(".js-link-debug:not(.worker__debug-link--disabled)")
);
info("Wait until the debug button is displayed and enabled");
await waitUntil(() => {
const button = container.querySelector(".js-debug-button");
return button && !button.disabled;
});
info("Click on the debug link and wait for the new toolbox to be ready");
info("Click on the debug button and wait for the new toolbox to be ready");
const onToolboxReady = gDevTools.once("toolbox-ready");
const debugLink = container.querySelector(".js-link-debug");
debugLink.click();
const debugButton = container.querySelector(".js-debug-button");
debugButton.click();
const serviceWorkerToolbox = await onToolboxReady;
await serviceWorkerToolbox.selectTool("jsdebugger");

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

@ -26,17 +26,22 @@ add_task(async function() {
info("Wait until the service worker appears in the application panel");
await waitUntil(() => getWorkerContainers(doc).length === 1);
info("Wait until the start link is displayed and enabled");
info("Wait until the start button is displayed and enabled");
const container = getWorkerContainers(doc)[0];
await waitUntil(() =>
container.querySelector(".js-link-start:not(.disabled-link)")
);
info("Click the link and wait for the worker to start");
const link = container.querySelector(".js-link-start");
link.click();
await waitUntil(
() => container.querySelector(".js-worker-status").textContent === "Running"
);
await waitUntil(() => {
const button = container.querySelector(".js-start-button");
return button && !button.disabled;
});
info("Click the button and wait for the worker to start");
const button = container.querySelector(".js-start-button");
button.click();
info("Wait until status 'Running' is displayed");
await waitUntil(() => {
const statusEl = container.querySelector(".js-worker-status");
return statusEl && statusEl.textContent === "Running";
});
ok(true, "Worker status is 'Running'");
await unregisterAllWorkers(target.client);
@ -59,12 +64,12 @@ add_task(async function() {
info("Wait until the service worker appears in the application panel");
await waitUntil(() => getWorkerContainers(doc).length === 1);
info("Wait until the start link is displayed");
info("Wait until the start button is displayed");
const container = getWorkerContainers(doc)[0];
await waitUntil(() => container.querySelector(".js-link-start"));
await waitUntil(() => container.querySelector(".js-start-button"));
ok(
container.querySelector(".js-link-start.disabled-link"),
"Start link is disabled"
container.querySelector(".js-start-button").disabled,
"Start button is disabled"
);
await unregisterAllWorkers(target.client);

17
dom/cache/QuotaClient.cpp поставляемый
Просмотреть файл

@ -383,14 +383,15 @@ class CacheQuotaClient final : public Client {
nsresult rv = qm->GetDirectoryForOrigin(aPersistenceType, aOrigin,
getter_AddRefs(dir));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kExternalError,
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kQuotaExternalError,
Cache_GetDirForOri);
return rv;
}
rv = dir->Append(NS_LITERAL_STRING(DOMCACHE_DIRECTORY_NAME));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kExternalError, Cache_Append);
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kQuotaExternalError,
Cache_Append);
return rv;
}
@ -406,7 +407,7 @@ class CacheQuotaClient final : public Client {
dir, &paddingSize)))) {
rv = LockedGetPaddingSizeFromDB(dir, aGroup, aOrigin, &paddingSize);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kInternalError,
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kQuotaInternalError,
Cache_GetPaddingSize);
return rv;
}
@ -418,7 +419,7 @@ class CacheQuotaClient final : public Client {
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = dir->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kExternalError,
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kQuotaExternalError,
Cache_GetDirEntries);
return rv;
}
@ -429,7 +430,7 @@ class CacheQuotaClient final : public Client {
nsAutoString leafName;
rv = file->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kExternalError,
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kQuotaExternalError,
Cache_GetLeafName);
return rv;
}
@ -437,7 +438,7 @@ class CacheQuotaClient final : public Client {
bool isDir;
rv = file->IsDirectory(&isDir);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kExternalError,
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kQuotaExternalError,
Cache_IsDirectory);
return rv;
}
@ -446,7 +447,7 @@ class CacheQuotaClient final : public Client {
if (leafName.EqualsLiteral("morgue")) {
rv = GetBodyUsage(file, aCanceled, aUsageInfo);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kExternalError,
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kQuotaExternalError,
Cache_GetBodyUsage);
return rv;
}
@ -471,7 +472,7 @@ class CacheQuotaClient final : public Client {
int64_t fileSize;
rv = file->GetFileSize(&fileSize);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kExternalError,
REPORT_TELEMETRY_ERR_IN_INIT(aInitializing, kQuotaExternalError,
Cache_GetFileSize);
return rv;
}

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

@ -15992,7 +15992,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsresult rv =
GetDirectory(aPersistenceType, aOrigin, getter_AddRefs(directory));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_GetDirectory);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_GetDirectory);
return rv;
}
@ -16007,7 +16007,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
/* aForUpgrade */ false, subdirsToProcess,
databaseFilenames, &obsoleteFilenames);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_GetDBFilenames);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_GetDBFilenames);
return rv;
}
@ -16024,7 +16024,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
// If there is an unexpected directory in the idb directory, trying to
// delete at first instead of breaking the whole initialization.
if (NS_WARN_IF(NS_FAILED(DeleteFilesNoQuota(directory, subdirName)))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_GetBaseFilename);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_GetBaseFilename);
return NS_ERROR_UNEXPECTED;
}
@ -16039,7 +16039,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
// If we somehow running into here, it probably means we are in a
// serious situation. e.g. Filesystem corruption.
// Will handle this in bug 1521541.
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_RemoveDBFiles);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_RemoveDBFiles);
return NS_ERROR_UNEXPECTED;
}
@ -16052,7 +16052,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
// delete at first instead of breaking the whole initialization.
if (NS_WARN_IF(!databaseFilenames.GetEntry(subdirNameBase)) &&
NS_WARN_IF(NS_FAILED(DeleteFilesNoQuota(directory, subdirName)))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_GetEntry);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_GetEntry);
return NS_ERROR_UNEXPECTED;
}
}
@ -16069,26 +16069,26 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsCOMPtr<nsIFile> fmDirectory;
rv = directory->Clone(getter_AddRefs(fmDirectory));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_Clone);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_Clone);
return rv;
}
rv = fmDirectory->Append(databaseFilename + filesSuffix);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_Append);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_Append);
return rv;
}
nsCOMPtr<nsIFile> databaseFile;
rv = directory->Clone(getter_AddRefs(databaseFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_Clone2);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_Clone2);
return rv;
}
rv = databaseFile->Append(databaseFilename + sqliteSuffix);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_Append2);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_Append2);
return rv;
}
@ -16096,13 +16096,13 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
if (aUsageInfo) {
rv = directory->Clone(getter_AddRefs(walFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_Clone3);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_Clone3);
return rv;
}
rv = walFile->Append(databaseFilename + walSuffix);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_Append3);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_Append3);
return rv;
}
}
@ -16111,7 +16111,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
aGroup, aOrigin,
TelemetryIdForFile(databaseFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kInternalError, IDB_InitDirectory);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, IDB_InitDirectory);
return rv;
}
@ -16119,7 +16119,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
int64_t fileSize;
rv = databaseFile->GetFileSize(&fileSize);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_GetFileSize);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_GetFileSize);
return rv;
}
@ -16133,14 +16133,14 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
aUsageInfo->AppendToDatabaseUsage(uint64_t(fileSize));
} else if (NS_WARN_IF(rv != NS_ERROR_FILE_NOT_FOUND &&
rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_GetWalFileSize);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_GetWalFileSize);
return rv;
}
uint64_t usage;
rv = FileManager::GetUsage(fmDirectory, &usage);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, IDB_GetUsage);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, IDB_GetUsage);
return rv;
}

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

@ -8545,7 +8545,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsresult rv = quotaManager->GetDirectoryForOrigin(aPersistenceType, aOrigin,
getter_AddRefs(directory));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_GetDirForOrigin);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_GetDirForOrigin);
return rv;
}
@ -8553,7 +8553,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
rv = directory->Append(NS_LITERAL_STRING(LS_DIRECTORY_NAME));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_Append);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_Append);
return rv;
}
@ -8561,7 +8561,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
bool exists;
rv = directory->Exists(&exists);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_Exists);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_Exists);
return rv;
}
@ -8571,14 +8571,14 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsString directoryPath;
rv = directory->GetPath(directoryPath);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_GetPath);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_GetPath);
return rv;
}
nsCOMPtr<nsIFile> usageFile;
rv = GetUsageFile(directoryPath, getter_AddRefs(usageFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_GetUsageFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_GetUsageFile);
return rv;
}
@ -8589,12 +8589,12 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
if (rv != NS_ERROR_FILE_NOT_FOUND &&
rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_IsDirectory);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_IsDirectory);
return rv;
}
if (NS_WARN_IF(isDirectory)) {
REPORT_TELEMETRY_INIT_ERR(kInternalError, LS_UnexpectedDir);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, LS_UnexpectedDir);
return NS_ERROR_FAILURE;
}
@ -8606,7 +8606,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsCOMPtr<nsIFile> usageJournalFile;
rv = GetUsageJournalFile(directoryPath, getter_AddRefs(usageJournalFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_GetUsageForJFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_GetUsageForJFile);
return rv;
}
@ -8614,19 +8614,19 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
if (rv != NS_ERROR_FILE_NOT_FOUND &&
rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_IsDirectory2);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_IsDirectory2);
return rv;
}
if (NS_WARN_IF(isDirectory)) {
REPORT_TELEMETRY_INIT_ERR(kInternalError, LS_UnexpectedDir2);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, LS_UnexpectedDir2);
return NS_ERROR_FAILURE;
}
if (usageFileExists) {
rv = usageFile->Remove(false);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_Remove);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_Remove);
return rv;
}
@ -8635,7 +8635,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
rv = usageJournalFile->Remove(false);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_Remove2);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_Remove2);
return rv;
}
}
@ -8643,13 +8643,13 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsCOMPtr<nsIFile> file;
rv = directory->Clone(getter_AddRefs(file));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_Clone);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_Clone);
return rv;
}
rv = file->Append(NS_LITERAL_STRING(DATA_FILE_NAME));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_Append2);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_Append2);
return rv;
}
@ -8657,12 +8657,12 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
if (rv != NS_ERROR_FILE_NOT_FOUND &&
rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_IsDirectory3);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_IsDirectory3);
return rv;
}
if (NS_WARN_IF(isDirectory)) {
REPORT_TELEMETRY_INIT_ERR(kInternalError, LS_UnexpectedDir3);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, LS_UnexpectedDir3);
return NS_ERROR_FAILURE;
}
@ -8674,25 +8674,25 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
rv = CreateStorageConnection(file, usageFile, aOrigin,
getter_AddRefs(connection), &dummy);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_CreateConnection);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_CreateConnection);
return rv;
}
rv = GetUsage(connection, /* aArchivedOriginScope */ nullptr, &usage);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_GetUsage);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_GetUsage);
return rv;
}
rv = UpdateUsageFile(usageFile, usageJournalFile, usage);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_UpdateUsageFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_UpdateUsageFile);
return rv;
}
rv = usageJournalFile->Remove(false);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_Remove3);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_Remove3);
return rv;
}
}
@ -8707,7 +8707,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
} else if (usageFileExists) {
rv = usageFile->Remove(false);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_Remove4);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_Remove4);
return rv;
}
}
@ -8718,7 +8718,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsCOMPtr<nsIDirectoryEnumerator> directoryEntries;
rv = directory->GetDirectoryEntries(getter_AddRefs(directoryEntries));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_GetDirEntries);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_GetDirEntries);
return rv;
}
@ -8734,7 +8734,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsCOMPtr<nsIFile> file;
rv = directoryEntries->GetNextFile(getter_AddRefs(file));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_GetNextFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_GetNextFile);
return rv;
}
@ -8745,7 +8745,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
nsString leafName;
rv = file->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_GetLeafName);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_GetLeafName);
return rv;
}
@ -8761,7 +8761,7 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
bool isDirectory;
rv = file->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, LS_IsDirectory4);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, LS_IsDirectory4);
return rv;
}

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

@ -3998,7 +3998,7 @@ nsresult QuotaManager::GetDirectoryMetadata2WithRestore(
rv = RestoreDirectoryMetadata2(aDirectory, aPersistent);
if (NS_WARN_IF(NS_FAILED(rv))) {
if (aTelemetry) {
REPORT_TELEMETRY_INIT_ERR(kInternalError, Rep_RestoreDirMeta);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, Rep_RestoreDirMeta);
}
return rv;
}
@ -4007,7 +4007,7 @@ nsresult QuotaManager::GetDirectoryMetadata2WithRestore(
aGroup, aOrigin);
if (NS_WARN_IF(NS_FAILED(rv))) {
if (aTelemetry) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Rep_GetDirMeta);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Rep_GetDirMeta);
}
return rv;
}
@ -4083,21 +4083,21 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType) {
nsresult rv = NS_NewLocalFile(GetStoragePath(aPersistenceType), false,
getter_AddRefs(directory));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Rep_NewLocalFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Rep_NewLocalFile);
return rv;
}
bool created;
rv = EnsureDirectory(directory, &created);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Rep_EnsureDirectory);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Rep_EnsureDirectory);
return rv;
}
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Rep_GetDirEntries);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Rep_GetDirEntries);
return rv;
}
@ -4118,7 +4118,7 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType) {
bool isDirectory;
rv = childDirectory->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Rep_IsDirectory);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Rep_IsDirectory);
RECORD_IN_NIGHTLY(statusKeeper, rv);
CONTINUE_IN_NIGHTLY_RETURN_IN_OTHERS(rv);
}
@ -4127,7 +4127,7 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType) {
nsString leafName;
rv = childDirectory->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Rep_GetLeafName);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Rep_GetLeafName);
RECORD_IN_NIGHTLY(statusKeeper, rv);
CONTINUE_IN_NIGHTLY_RETURN_IN_OTHERS(rv);
}
@ -4138,7 +4138,7 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType) {
UNKNOWN_FILE_WARNING(leafName);
REPORT_TELEMETRY_INIT_ERR(kInternalError, Rep_UnexpectedFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, Rep_UnexpectedFile);
RECORD_IN_NIGHTLY(statusKeeper, NS_ERROR_UNEXPECTED);
CONTINUE_IN_NIGHTLY_RETURN_IN_OTHERS(NS_ERROR_UNEXPECTED);
}
@ -4167,7 +4167,7 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType) {
}
}
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kInternalError, Rep_GetNextFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, Rep_GetNextFile);
RECORD_IN_NIGHTLY(statusKeeper, rv);
#ifndef NIGHTLY_BUILD
return rv;
@ -4210,7 +4210,7 @@ nsresult QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Ori_GetDirEntries);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Ori_GetDirEntries);
return rv;
}
@ -4224,7 +4224,7 @@ nsresult QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
bool isDirectory;
rv = file->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Ori_IsDirectory);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Ori_IsDirectory);
RECORD_IN_NIGHTLY(statusKeeper, rv);
CONTINUE_IN_NIGHTLY_RETURN_IN_OTHERS(rv);
}
@ -4232,7 +4232,7 @@ nsresult QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
nsString leafName;
rv = file->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Ori_GetLeafName);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Ori_GetLeafName);
RECORD_IN_NIGHTLY(statusKeeper, rv);
CONTINUE_IN_NIGHTLY_RETURN_IN_OTHERS(rv);
}
@ -4245,7 +4245,7 @@ nsresult QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
if (IsTempMetadata(leafName)) {
rv = file->Remove(/* recursive */ false);
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kExternalError, Ori_Remove);
REPORT_TELEMETRY_INIT_ERR(kQuotaExternalError, Ori_Remove);
RECORD_IN_NIGHTLY(statusKeeper, rv);
CONTINUE_IN_NIGHTLY_RETURN_IN_OTHERS(rv);
}
@ -4258,7 +4258,7 @@ nsresult QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
}
UNKNOWN_FILE_WARNING(leafName);
REPORT_TELEMETRY_INIT_ERR(kInternalError, Ori_UnexpectedFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, Ori_UnexpectedFile);
#ifdef NIGHTLY_BUILD
Telemetry::ScalarSetMaximum(
@ -4274,7 +4274,7 @@ nsresult QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
rv = Client::TypeFromText(leafName, clientType);
if (NS_FAILED(rv)) {
UNKNOWN_FILE_WARNING(leafName);
REPORT_TELEMETRY_INIT_ERR(kInternalError, Ori_UnexpectedClient);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, Ori_UnexpectedClient);
RECORD_IN_NIGHTLY(statusKeeper, NS_ERROR_UNEXPECTED);
// Our upgrade process should have attempted to delete the deprecated
@ -4310,7 +4310,7 @@ nsresult QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
}
}
if (NS_WARN_IF(NS_FAILED(rv))) {
REPORT_TELEMETRY_INIT_ERR(kInternalError, Ori_GetNextFile);
REPORT_TELEMETRY_INIT_ERR(kQuotaInternalError, Ori_GetNextFile);
RECORD_IN_NIGHTLY(statusKeeper, rv);
#ifndef NIGHTLY_BUILD
return rv;

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

@ -17,8 +17,8 @@ LazyLogModule gLogger("QuotaManager");
} // namespace
#ifdef NIGHTLY_BUILD
NS_NAMED_LITERAL_CSTRING(kInternalError, "internal");
NS_NAMED_LITERAL_CSTRING(kExternalError, "external");
NS_NAMED_LITERAL_CSTRING(kQuotaInternalError, "internal");
NS_NAMED_LITERAL_CSTRING(kQuotaExternalError, "external");
#endif
LogModule* GetQuotaManagerLogger() { return gLogger; }

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

@ -86,12 +86,12 @@ namespace quota {
// Telemetry keys to indicate types of errors.
#ifdef NIGHTLY_BUILD
extern const nsLiteralCString kInternalError;
extern const nsLiteralCString kExternalError;
extern const nsLiteralCString kQuotaInternalError;
extern const nsLiteralCString kQuotaExternalError;
#else
// No need for these when we're not collecting telemetry.
# define kInternalError
# define kExternalError
# define kQuotaInternalError
# define kQuotaExternalError
#endif
class BackgroundThreadObject {

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

@ -80,6 +80,11 @@ int32_t UlpfecReceiverImpl::AddReceivedRedPacket(
<< "Received RED packet with different SSRC than expected; dropping.";
return -1;
}
if (packet_length > IP_PACKET_SIZE) {
RTC_LOG(LS_WARNING) << "Received RED packet with length exceeds maximum IP "
"packet size; dropping.";
return -1;
}
rtc::CritScope cs(&crit_sect_);

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

@ -8,7 +8,7 @@
template = '''<!DOCTYPE html>
<html>
<head>
<!-- Generated by wpt/upgrade-insecure-requests/support/generate.py -->
<!-- Generated by wpt/upgrade-insecure-requests/support/generate.py -->%(additionalMeta)s
<title>Upgrade Insecure Requests: %(name)s.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@ -26,6 +26,12 @@ tests.forEach(test => testMap['%(name)s'](test));
</html>
'''
def getLong(file):
testsThatNeedMoreTime = [ "worker-subresource-fetch-redirect-upgrade.https.html" ]
if any(file in item for item in testsThatNeedMoreTime ):
return '\n<meta name="timeout" content="long">'
return ""
# resourceType is |ResourceType| in testharness-helper.sub.js.
for name, resourceType in [
('image', 'IMAGE'), ('iframe', 'FRAME'),
@ -40,9 +46,11 @@ for name, resourceType in [
if name == 'module-worker' or resourceType == 'WORKLET':
types.append(('-import', 'generateModuleImportTests'))
for typeName, generatorName in types:
with open('%s%s-upgrade.https.html' % (name, typeName), 'w') as html_file:
filename = '%s%s-upgrade.https.html' % (name, typeName)
with open(filename, 'w') as html_file:
html_file.write(template % {
'name': name,
'additionalMeta': getLong(filename),
'resourceType': resourceType,
'generatorName': generatorName,
'sameOriginOnly': sameOriginOnly})

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

@ -2,6 +2,7 @@
<html>
<head>
<!-- Generated by wpt/upgrade-insecure-requests/support/generate.py -->
<meta name="timeout" content="long">
<title>Upgrade Insecure Requests: worker-subresource-fetch.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>