зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to mozilla-central. a=merge
This commit is contained in:
Коммит
4b49a0dc50
|
@ -20,12 +20,12 @@ tag = "v0.4.28"
|
|||
[source."https://github.com/mozilla/mp4parse-rust"]
|
||||
git = "https://github.com/mozilla/mp4parse-rust"
|
||||
replace-with = "vendored-sources"
|
||||
rev = "1bb484e96ae724309e3346968e8ffd4c25e61616"
|
||||
rev = "5326af6b54cec885cdb9e7be282a6db6e757b964"
|
||||
|
||||
[source."https://github.com/mozilla/l10nregistry-rs"]
|
||||
git = "https://github.com/mozilla/l10nregistry-rs"
|
||||
replace-with = "vendored-sources"
|
||||
rev = "55bf7f826d773303a67d8d7fdab099a04322d4fb"
|
||||
rev = "a69df9836b1ef536727195209013b9ad6b132618"
|
||||
|
||||
[source."https://github.com/mozilla/cubeb-pulse-rs"]
|
||||
git = "https://github.com/mozilla/cubeb-pulse-rs"
|
||||
|
|
|
@ -2648,7 +2648,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "l10nregistry"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/mozilla/l10nregistry-rs?rev=55bf7f826d773303a67d8d7fdab099a04322d4fb#55bf7f826d773303a67d8d7fdab099a04322d4fb"
|
||||
source = "git+https://github.com/mozilla/l10nregistry-rs?rev=a69df9836b1ef536727195209013b9ad6b132618#a69df9836b1ef536727195209013b9ad6b132618"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"fluent-bundle",
|
||||
|
@ -3278,13 +3278,12 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "mp4parse"
|
||||
version = "0.11.5"
|
||||
source = "git+https://github.com/mozilla/mp4parse-rust?rev=1bb484e96ae724309e3346968e8ffd4c25e61616#1bb484e96ae724309e3346968e8ffd4c25e61616"
|
||||
source = "git+https://github.com/mozilla/mp4parse-rust?rev=5326af6b54cec885cdb9e7be282a6db6e757b964#5326af6b54cec885cdb9e7be282a6db6e757b964"
|
||||
dependencies = [
|
||||
"bitreader",
|
||||
"byteorder",
|
||||
"env_logger",
|
||||
"fallible_collections",
|
||||
"hashbrown",
|
||||
"log",
|
||||
"num-traits",
|
||||
"static_assertions",
|
||||
|
@ -3297,7 +3296,7 @@ version = "0.1.0"
|
|||
[[package]]
|
||||
name = "mp4parse_capi"
|
||||
version = "0.11.5"
|
||||
source = "git+https://github.com/mozilla/mp4parse-rust?rev=1bb484e96ae724309e3346968e8ffd4c25e61616#1bb484e96ae724309e3346968e8ffd4c25e61616"
|
||||
source = "git+https://github.com/mozilla/mp4parse-rust?rev=5326af6b54cec885cdb9e7be282a6db6e757b964#5326af6b54cec885cdb9e7be282a6db6e757b964"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"fallible_collections",
|
||||
|
|
|
@ -2163,7 +2163,8 @@ void LocalAccessible::BindToParent(LocalAccessible* aParent,
|
|||
mIndexInParent = aIndexInParent;
|
||||
|
||||
if (mParent->HasNameDependent() || mParent->IsXULListItem() ||
|
||||
RelationByType(RelationType::LABEL_FOR).Next()) {
|
||||
RelationByType(RelationType::LABEL_FOR).Next() ||
|
||||
nsTextEquivUtils::HasNameRule(mParent, eNameFromSubtreeRule)) {
|
||||
mContextFlags |= eHasNameDependent;
|
||||
} else {
|
||||
mContextFlags &= ~eHasNameDependent;
|
||||
|
|
|
@ -129,6 +129,11 @@
|
|||
getNode("lateLabelChild").textContent = "l2";
|
||||
await nameChanged;
|
||||
|
||||
nameChanged = PromEvents.waitForEvent(EVENT_NAME_CHANGE, "listitem");
|
||||
info("Changing text of listitem child");
|
||||
getNode("listitem").textContent = "world";
|
||||
await nameChanged;
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -161,6 +166,8 @@
|
|||
<div id="lateLabelledBy"></div>
|
||||
<div id="lateLabel"><p id="lateLabelChild">l1</p></div>
|
||||
|
||||
<ul><li id="listitem">hello</li></ul>
|
||||
|
||||
<div id="eventdump"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HandlerServiceTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/HandlerServiceTestUtils.jsm"
|
||||
);
|
||||
|
@ -277,3 +282,62 @@ add_task(async function useSystemDefaultPreferenceWorks() {
|
|||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
add_task(async function useSystemDefaultAndAskForDestinationWorks() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.download.improvements_to_download_panel", true],
|
||||
["browser.download.useDownloadDir", false],
|
||||
],
|
||||
});
|
||||
|
||||
let pdfCategory = await selectPdfCategoryItem();
|
||||
let list = pdfCategory.querySelector(".actionsMenu");
|
||||
|
||||
let useSystemDefaultItem = list.querySelector(
|
||||
`menuitem[action='${Ci.nsIHandlerInfo.useSystemDefault}']`
|
||||
);
|
||||
|
||||
// Whether there's a "use default" item depends on the OS, there might not be a system default viewer.
|
||||
if (!useSystemDefaultItem) {
|
||||
info(
|
||||
"No 'Use default' item, so no testing for setting 'use system default' preference"
|
||||
);
|
||||
gBrowser.removeCurrentTab();
|
||||
return;
|
||||
}
|
||||
|
||||
await selectItemInPopup(useSystemDefaultItem, list);
|
||||
Assert.equal(
|
||||
list.selectedItem,
|
||||
useSystemDefaultItem,
|
||||
"Should have selected 'use system default' for pdf"
|
||||
);
|
||||
|
||||
let MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
MockFilePicker.init(window);
|
||||
let filePickerShown = new Promise(resolve => {
|
||||
MockFilePicker.showCallback = function(fp) {
|
||||
ok(true, "filepicker should have been shown");
|
||||
setTimeout(resolve, 0);
|
||||
return Ci.nsIFilePicker.returnCancel;
|
||||
};
|
||||
});
|
||||
|
||||
let publicList = await Downloads.getList(Downloads.PUBLIC);
|
||||
registerCleanupFunction(async () => {
|
||||
await publicList.removeFinished();
|
||||
MockFilePicker.cleanup();
|
||||
});
|
||||
|
||||
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
TEST_PATH + "empty_pdf_file.pdf"
|
||||
);
|
||||
|
||||
await filePickerShown;
|
||||
|
||||
BrowserTestUtils.removeTab(loadingTab);
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
|
|
@ -154,19 +154,6 @@ let ShellServiceInternal = {
|
|||
throw new Error("checkBrowserUserChoiceHashes() failed");
|
||||
}
|
||||
|
||||
// We can't set the hash consistently until Win 10 1703 (build 15063).
|
||||
// This check is after the hash check so that telemetry can indicate
|
||||
// when the hash check unexpectedly succeeds on an early build.
|
||||
if (
|
||||
!(
|
||||
AppConstants.isPlatformAndVersionAtLeast("win", "10") &&
|
||||
parseInt(Services.sysinfo.getProperty("build")) >= 15063
|
||||
)
|
||||
) {
|
||||
telemetryResult = "ErrBuild";
|
||||
throw new Error("Windows build is unsupported");
|
||||
}
|
||||
|
||||
const wdba = Services.dirsvc.get("XREExeF", Ci.nsIFile);
|
||||
wdba.leafName = "default-browser-agent.exe";
|
||||
const aumi = XreDirProvider.getInstallHash();
|
||||
|
@ -184,6 +171,7 @@ let ShellServiceInternal = {
|
|||
const MOZ_E_NO_PROGID = 0xa0000001;
|
||||
const MOZ_E_HASH_CHECK = 0xa0000002;
|
||||
const MOZ_E_REJECTED = 0xa0000003;
|
||||
const MOZ_E_BUILD = 0xa0000004;
|
||||
|
||||
const exeWaitTimeoutMs = 2000; // 2 seconds
|
||||
const exeWaitPromise = exeProcess.wait();
|
||||
|
@ -199,6 +187,7 @@ let ShellServiceInternal = {
|
|||
[MOZ_E_NO_PROGID, "ErrExeProgID"],
|
||||
[MOZ_E_HASH_CHECK, "ErrExeHash"],
|
||||
[MOZ_E_REJECTED, "ErrExeRejected"],
|
||||
[MOZ_E_BUILD, "ErrBuild"],
|
||||
]).get(exitCode) ?? "ErrExeOther";
|
||||
throw new Error(
|
||||
`WDBA nonzero exit code ${exitCode}: ${telemetryResult}`
|
||||
|
|
|
@ -4,6 +4,22 @@
|
|||
|
||||
@import url("chrome://browser/skin/error-pages.css");
|
||||
|
||||
body {
|
||||
--warning-color: #ffa436;
|
||||
}
|
||||
|
||||
@media (-moz-toolbar-prefers-color-scheme: dark) {
|
||||
body {
|
||||
--warning-color: #ffbd4f;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-contrast) {
|
||||
body {
|
||||
--warning-color: var(--in-content-page-color);
|
||||
}
|
||||
}
|
||||
|
||||
body.certerror {
|
||||
width: 100%;
|
||||
justify-content: normal;
|
||||
|
@ -14,7 +30,11 @@ body.captiveportal .title {
|
|||
}
|
||||
|
||||
body.certerror .title {
|
||||
background-image: url("cert-error.svg");
|
||||
background-image: url("chrome://global/skin/icons/warning.svg");
|
||||
}
|
||||
|
||||
body.certerror .title {
|
||||
color: var(--warning-color);
|
||||
}
|
||||
|
||||
body.blocked .title {
|
||||
|
@ -240,3 +260,17 @@ body:not(.neterror) #advancedButton {
|
|||
word-wrap: anywhere;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 970px) {
|
||||
body.certerror .title {
|
||||
/* !important is necessary here until Bug 1723718 is resolved */
|
||||
background-image: url("chrome://global/skin/icons/warning.svg") !important;
|
||||
background-position: top left;
|
||||
padding-top: 60px;
|
||||
margin-top: -60px;
|
||||
}
|
||||
|
||||
body.certerror .title:dir(rtl) {
|
||||
background-position-x: right;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<!-- 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/. -->
|
||||
<svg height="96" viewBox="0 0 96 96" width="96" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<path d="m54 87h-38.718c-4.1514504-.0042773-8.00579913-2.1539983-10.19089334-5.6838598-2.1850942-3.5298615-2.39050529-7.9383886-.54310666-11.6561402l29.718-59.46c2.0323569-4.06636891 6.1880314-6.63518463 10.734-6.63518463s8.7016431 2.56881572 10.734 6.63518463l19.0437959 38.0875919c-8.4035561 1.5187368-14.7777959 8.8711807-14.7777959 17.7124081v1.0104467c-3.547421 1.6851959-6 5.3009594-6 9.4895533z" fill="#ffe900" fill-rule="nonzero"/>
|
||||
<path d="m39 27c0-3.3137085 2.6862915-6 6-6s6 2.6862915 6 6v24c0 3.3137085-2.6862915 6-6 6s-6-2.6862915-6-6zm6 49.5c-4.1421356 0-7.5-3.3578644-7.5-7.5s3.3578644-7.5 7.5-7.5 7.5 3.3578644 7.5 7.5-3.3578644 7.5-7.5 7.5z" fill="#3e2800"/>
|
||||
<path d="m89.2954301 61.9390003c.4560585 1.2683141.7045699 2.6356354.7045699 4.0609997v6h1.5c2.4620372-.0002189 4.4671728 1.9781816 4.5 4.44v15c.0160526 1.203836-.4509571 2.3639032-1.296617 3.2208385-.8456598.8569353-1.99944 1.3392685-3.203383 1.3391615h-27c-2.4852814 0-4.5-2.0147186-4.5-4.5v-15c0-2.4852814 2.0147186-4.5 4.5-4.5h1.5v-6c0-6.627417 5.372583-12 12-12 2.9975478 0 5.7383932 1.0990736 7.8415359 2.9162204l-4.2654615 4.2654616c-.998662-.7424058-2.236069-1.181682-3.5760744-1.181682-3.3137085 0-6 2.6862915-6 6v6h12v-4.7655696z" fill="#b1b1b3" fill-rule="nonzero"/>
|
||||
</g>
|
||||
</svg>
|
До Ширина: | Высота: | Размер: 1.6 KiB |
|
@ -209,7 +209,6 @@
|
|||
skin/classic/browser/update-badge.svg (../shared/update-badge.svg)
|
||||
skin/classic/browser/badge-blue.svg (../shared/badge-blue.svg)
|
||||
skin/classic/browser/profiler-popup-backdrop.png (../shared/profiler-popup-backdrop.png)
|
||||
skin/classic/browser/cert-error.svg (../shared/incontent-icons/cert-error.svg)
|
||||
skin/classic/browser/wifi.svg (../shared/incontent-icons/wifi.svg)
|
||||
skin/classic/browser/tab-crashed.svg (../shared/incontent-icons/tab-crashed.svg)
|
||||
skin/classic/browser/panic-panel/header.png (../shared/panic-panel/header.png)
|
||||
|
|
|
@ -2626,18 +2626,14 @@ void BrowsingContext::DidSet(FieldIndex<IDX_ExplicitActive>,
|
|||
});
|
||||
}
|
||||
|
||||
auto BrowsingContext::CanSet(FieldIndex<IDX_HasMainMediaController>,
|
||||
bool aNewValue, ContentParent* aSource)
|
||||
-> CanSetResult {
|
||||
if (!IsTop()) {
|
||||
return CanSetResult::Deny;
|
||||
}
|
||||
return LegacyRevertIfNotOwningOrParentProcess(aSource);
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_PageAwakeRequestCount>,
|
||||
uint32_t aNewValue, ContentParent* aSource) {
|
||||
return IsTop() && XRE_IsParentProcess() && !aSource;
|
||||
}
|
||||
|
||||
void BrowsingContext::DidSet(FieldIndex<IDX_HasMainMediaController>,
|
||||
bool aOldValue) {
|
||||
if (!IsTop() || aOldValue == GetHasMainMediaController()) {
|
||||
void BrowsingContext::DidSet(FieldIndex<IDX_PageAwakeRequestCount>,
|
||||
uint32_t aOldValue) {
|
||||
if (!IsTop() || aOldValue == GetPageAwakeRequestCount()) {
|
||||
return;
|
||||
}
|
||||
Group()->UpdateToplevelsSuspendedIfNeeded();
|
||||
|
@ -2684,11 +2680,11 @@ bool BrowsingContext::InactiveForSuspend() const {
|
|||
if (!StaticPrefs::dom_suspend_inactive_enabled()) {
|
||||
return false;
|
||||
}
|
||||
// We should suspend a page only when it's inactive and doesn't have a main
|
||||
// media controller. Having a main controller in context means it might be
|
||||
// playing media, or waiting media keys to control media (could be not playing
|
||||
// anything currently)
|
||||
return !IsActive() && !GetHasMainMediaController();
|
||||
// We should suspend a page only when it's inactive and doesn't have any awake
|
||||
// request that is used to prevent page from being suspended because web page
|
||||
// might still need to run their script. Eg. waiting for media keys to resume
|
||||
// media, playing web audio, waiting in a video call conference room.
|
||||
return !IsActive() && GetPageAwakeRequestCount() == 0;
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_TouchEventsOverrideInternal>,
|
||||
|
|
|
@ -192,8 +192,6 @@ enum class ExplicitActiveStatus : uint8_t {
|
|||
FIELD(MediumOverride, nsString) \
|
||||
FIELD(PrefersColorSchemeOverride, mozilla::dom::PrefersColorSchemeOverride) \
|
||||
FIELD(DisplayMode, mozilla::dom::DisplayMode) \
|
||||
/* True if the top level browsing context owns a main media controller */ \
|
||||
FIELD(HasMainMediaController, bool) \
|
||||
/* The number of entries added to the session history because of this \
|
||||
* browsing context. */ \
|
||||
FIELD(HistoryEntryCount, uint32_t) \
|
||||
|
@ -203,7 +201,11 @@ enum class ExplicitActiveStatus : uint8_t {
|
|||
FIELD(SessionStoreEpoch, uint32_t) \
|
||||
/* Whether we can execute scripts in this BrowsingContext. Has no effect \
|
||||
* unless scripts are also allowed in the parent WindowContext. */ \
|
||||
FIELD(AllowJavascript, bool)
|
||||
FIELD(AllowJavascript, bool) \
|
||||
/* The count of request that are used to prevent the browsing context tree \
|
||||
* from being suspended, which would ONLY be modified on the top level \
|
||||
* context in the chrome process because that's a non-atomic counter */ \
|
||||
FIELD(PageAwakeRequestCount, uint32_t)
|
||||
|
||||
// BrowsingContext, in this context, is the cross process replicated
|
||||
// environment in which information about documents is stored. In
|
||||
|
@ -861,6 +863,14 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||
|
||||
uint32_t DefaultLoadFlags() const { return GetDefaultLoadFlags(); }
|
||||
|
||||
// When request for page awake, it would increase a count that is used to
|
||||
// prevent whole browsing context tree from being suspended. The request can
|
||||
// be called multiple times. When calling the revoke, it would decrease the
|
||||
// count and once the count reaches to zero, the browsing context tree could
|
||||
// be suspended when the tree is inactive.
|
||||
void RequestForPageAwake();
|
||||
void RevokeForPageAwake();
|
||||
|
||||
protected:
|
||||
virtual ~BrowsingContext();
|
||||
BrowsingContext(WindowContext* aParentWindow, BrowsingContextGroup* aGroup,
|
||||
|
@ -1081,9 +1091,9 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||
bool CanSet(FieldIndex<IDX_PendingInitialization>, bool aNewValue,
|
||||
ContentParent* aSource);
|
||||
|
||||
CanSetResult CanSet(FieldIndex<IDX_HasMainMediaController>, bool aNewValue,
|
||||
ContentParent* aSource);
|
||||
void DidSet(FieldIndex<IDX_HasMainMediaController>, bool aOldValue);
|
||||
bool CanSet(FieldIndex<IDX_PageAwakeRequestCount>, uint32_t aNewValue,
|
||||
ContentParent* aSource);
|
||||
void DidSet(FieldIndex<IDX_PageAwakeRequestCount>, uint32_t aOldValue);
|
||||
|
||||
CanSetResult CanSet(FieldIndex<IDX_AllowJavascript>, bool aValue,
|
||||
ContentParent* aSource);
|
||||
|
|
|
@ -2513,6 +2513,20 @@ void CanonicalBrowsingContext::SetTouchEventsOverride(
|
|||
SetTouchEventsOverrideInternal(aOverride, aRv);
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::AddPageAwakeRequest() {
|
||||
MOZ_ASSERT(IsTop());
|
||||
auto count = GetPageAwakeRequestCount();
|
||||
MOZ_ASSERT(count < UINT32_MAX);
|
||||
Unused << SetPageAwakeRequestCount(++count);
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::RemovePageAwakeRequest() {
|
||||
MOZ_ASSERT(IsTop());
|
||||
auto count = GetPageAwakeRequestCount();
|
||||
MOZ_ASSERT(count > 0);
|
||||
Unused << SetPageAwakeRequestCount(--count);
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::CloneDocumentTreeInto(
|
||||
CanonicalBrowsingContext* aSource, const nsACString& aRemoteType,
|
||||
embedding::PrintData&& aPrintData) {
|
||||
|
|
|
@ -335,6 +335,14 @@ class CanonicalBrowsingContext final : public BrowsingContext {
|
|||
void ClearPermanentKey() { mPermanentKey.setNull(); }
|
||||
void MaybeSetPermanentKey(Element* aEmbedder);
|
||||
|
||||
// When request for page awake, it would increase a count that is used to
|
||||
// prevent whole browsing context tree from being suspended. The request can
|
||||
// be called multiple times. When calling the revoke, it would decrease the
|
||||
// count and once the count reaches to zero, the browsing context tree could
|
||||
// be suspended when the tree is inactive.
|
||||
void AddPageAwakeRequest();
|
||||
void RemovePageAwakeRequest();
|
||||
|
||||
void CloneDocumentTreeInto(CanonicalBrowsingContext* aSource,
|
||||
const nsACString& aRemoteType,
|
||||
embedding::PrintData&& aPrintData);
|
||||
|
|
|
@ -4851,3 +4851,15 @@ nsDOMWindowUtils::ResetMobileViewportManager() {
|
|||
// Unable to reset, so let's error out
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetSuspendedByBrowsingContextGroup(bool* aResult) {
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> inner = window->GetCurrentInnerWindow();
|
||||
NS_ENSURE_TRUE(inner, NS_ERROR_FAILURE);
|
||||
|
||||
*aResult = inner->GetWasSuspendedByGroup();
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<title>touchmove coalescing</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<title>touchmove coalescing</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
|
|
|
@ -753,7 +753,7 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
/**
|
||||
* Send a native event as if the user double tapped the touchpad with two
|
||||
* fingers.
|
||||
*
|
||||
*
|
||||
* Widget support: macOS.
|
||||
* @param aScreenX, aScreenY screen coords of the focus point of this event.
|
||||
* @param aModifierFlags is expected to contain native modifier values.
|
||||
|
@ -2228,6 +2228,9 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
// will intentionally crash any non-parent process that tries to access
|
||||
// it.
|
||||
readonly attribute AString webrtcRawDeviceId;
|
||||
|
||||
// Used for testing to check the suspend status.
|
||||
readonly attribute bool suspendedByBrowsingContextGroup;
|
||||
};
|
||||
|
||||
[scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]
|
||||
|
|
|
@ -6555,6 +6555,20 @@ mozilla::ipc::IPCResult ContentParent::RecvNotifyPositionStateChanged(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvAddOrRemovePageAwakeRequest(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext,
|
||||
const bool& aShouldAddCount) {
|
||||
if (aContext.IsNullOrDiscarded()) {
|
||||
return IPC_OK();
|
||||
}
|
||||
if (aShouldAddCount) {
|
||||
aContext.get_canonical()->AddPageAwakeRequest();
|
||||
} else {
|
||||
aContext.get_canonical()->RemovePageAwakeRequest();
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvGetModulesTrust(
|
||||
ModulePaths&& aModPaths, bool aRunAtNormalPriority,
|
||||
GetModulesTrustResolver&& aResolver) {
|
||||
|
|
|
@ -1319,6 +1319,10 @@ class ContentParent final
|
|||
const MaybeDiscarded<BrowsingContext>& aContext,
|
||||
const PositionState& aState);
|
||||
|
||||
mozilla::ipc::IPCResult RecvAddOrRemovePageAwakeRequest(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext,
|
||||
const bool& aShouldAddCount);
|
||||
|
||||
mozilla::ipc::IPCResult RecvGetModulesTrust(
|
||||
ModulePaths&& aModPaths, bool aRunAtNormalPriority,
|
||||
GetModulesTrustResolver&& aResolver);
|
||||
|
|
|
@ -1657,6 +1657,14 @@ parent:
|
|||
MaybeDiscardedBrowsingContext aContext,
|
||||
PositionState aState);
|
||||
|
||||
/**
|
||||
* This method will make canonical browsing context to update the count of
|
||||
* callers which want to keep the page from being suspended even if the page
|
||||
* is inactive.
|
||||
*/
|
||||
async AddOrRemovePageAwakeRequest(MaybeDiscardedBrowsingContext aContext,
|
||||
bool aShouldAddCount);
|
||||
|
||||
/**
|
||||
* Due to sandboxing, a child process's UntrustedModulesProcessor cannot
|
||||
* obtain enough information about a DLL file to determine its
|
||||
|
|
|
@ -253,7 +253,7 @@ static nsTArray<KeySystemConfig> GetSupportedKeySystems() {
|
|||
clearkey.mDistinctiveIdentifier = KeySystemFeatureSupport::Prohibited;
|
||||
clearkey.mSessionTypes.AppendElement(MediaKeySessionType::Temporary);
|
||||
clearkey.mEncryptionSchemes.AppendElement(u"cenc"_ns);
|
||||
// We do not have support for cbcs in clearkey yet. See bug 1516673.
|
||||
clearkey.mEncryptionSchemes.AppendElement(u"cbcs"_ns);
|
||||
if (StaticPrefs::media_clearkey_persistent_license_enabled()) {
|
||||
clearkey.mSessionTypes.AppendElement(
|
||||
MediaKeySessionType::Persistent_license);
|
||||
|
|
|
@ -233,8 +233,6 @@ static const TestFileData testFiles[] = {
|
|||
0, false, 2},
|
||||
{"test_case_1388991.mp4", true, 0, false, -1, 0, 0, 1, 30000181, false, 0,
|
||||
false, 2},
|
||||
{"test_case_1380468.mp4", false, 0, false, 0, 0, 0, 0, 0, false, 0, false,
|
||||
0},
|
||||
{"test_case_1410565.mp4", false, 0, false, 0, 0, 0, 0, 0, false, 955100,
|
||||
true, 2}, // negative 'timescale'
|
||||
{"test_case_1513651-2-sample-description-entries.mp4", true, 1, true,
|
||||
|
|
|
@ -39,7 +39,6 @@ TEST_HARNESS_FILES.gtest += [
|
|||
"test_case_1301065.mp4",
|
||||
"test_case_1329061.mov",
|
||||
"test_case_1351094.mp4",
|
||||
"test_case_1380468.mp4",
|
||||
"test_case_1388991.mp4",
|
||||
"test_case_1389299.mp4",
|
||||
"test_case_1389527.mp4",
|
||||
|
|
Двоичные данные
dom/media/gtest/mp4_demuxer/test_case_1380468.mp4
Двоичные данные
dom/media/gtest/mp4_demuxer/test_case_1380468.mp4
Двоичный файл не отображается.
|
@ -542,13 +542,13 @@ CopyableTArray<MediaControlKey> MediaController::GetSupportedMediaKeys() const {
|
|||
|
||||
void MediaController::Select() const {
|
||||
if (RefPtr<BrowsingContext> bc = BrowsingContext::Get(Id())) {
|
||||
Unused << bc->SetHasMainMediaController(true);
|
||||
bc->Canonical()->AddPageAwakeRequest();
|
||||
}
|
||||
}
|
||||
|
||||
void MediaController::Unselect() const {
|
||||
if (RefPtr<BrowsingContext> bc = BrowsingContext::Get(Id())) {
|
||||
Unused << bc->SetHasMainMediaController(false);
|
||||
bc->Canonical()->RemovePageAwakeRequest();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ add_task(async function setupTestingPref() {
|
|||
add_task(async function testInactiveTabWouldBeSuspended() {
|
||||
info(`open a tab`);
|
||||
const tab = await createTab(PAGE_NON_AUTOPLAY);
|
||||
await shouldTabStateEqualTo(tab, "running");
|
||||
await assertIfWindowGetSuspended(tab, { shouldBeSuspended: false });
|
||||
|
||||
info(`tab should be suspended when it becomes inactive`);
|
||||
setTabActive(tab, false);
|
||||
await shouldTabStateEqualTo(tab, "suspended");
|
||||
await assertIfWindowGetSuspended(tab, { shouldBeSuspended: true });
|
||||
|
||||
info(`remove tab`);
|
||||
await tab.close();
|
||||
|
@ -41,75 +41,91 @@ add_task(async function testInactiveTabWouldBeSuspended() {
|
|||
add_task(async function testInactiveTabEverStartPlayingWontBeSuspended() {
|
||||
info(`open tab1 and play media`);
|
||||
const tab1 = await createTab(PAGE_NON_AUTOPLAY, { needCheck: true });
|
||||
await shouldTabStateEqualTo(tab1, "running");
|
||||
await assertIfWindowGetSuspended(tab1, { shouldBeSuspended: false });
|
||||
await playMedia(tab1, VIDEO_ID);
|
||||
|
||||
info(`tab with playing media won't be suspended when it becomes inactive`);
|
||||
setTabActive(tab1, false);
|
||||
await shouldTabStateEqualTo(tab1, "running");
|
||||
await assertIfWindowGetSuspended(tab1, { shouldBeSuspended: false });
|
||||
|
||||
info(
|
||||
`even if media is paused, keep tab running so that it could listen to media keys to control media in the future`
|
||||
);
|
||||
await pauseMedia(tab1, VIDEO_ID);
|
||||
await shouldTabStateEqualTo(tab1, "running");
|
||||
await assertIfWindowGetSuspended(tab1, { shouldBeSuspended: false });
|
||||
|
||||
info(`open tab2 and play media`);
|
||||
const tab2 = await createTab(PAGE_NON_AUTOPLAY, { needCheck: true });
|
||||
await shouldTabStateEqualTo(tab2, "running");
|
||||
await assertIfWindowGetSuspended(tab2, { shouldBeSuspended: false });
|
||||
await playMedia(tab2, VIDEO_ID);
|
||||
|
||||
info(
|
||||
`as inactive tab1 doesn't own main controller, it should be suspended again`
|
||||
);
|
||||
await shouldTabStateEqualTo(tab1, "suspended");
|
||||
await assertIfWindowGetSuspended(tab1, { shouldBeSuspended: true });
|
||||
|
||||
info(`remove tabs`);
|
||||
await Promise.all([tab1.close(), tab2.close()]);
|
||||
});
|
||||
|
||||
add_task(
|
||||
async function testInactiveTabWithRunningAudioContextWontBeSuspended() {
|
||||
info(`open tab and start an audio context (AC)`);
|
||||
const tab = await createTab("about:blank");
|
||||
await startAudioContext(tab);
|
||||
await assertIfWindowGetSuspended(tab, { shouldBeSuspended: false });
|
||||
|
||||
info(`tab with running AC won't be suspended when it becomes inactive`);
|
||||
setTabActive(tab, false);
|
||||
await assertIfWindowGetSuspended(tab, { shouldBeSuspended: false });
|
||||
|
||||
info(`if AC has been suspended, then inactive tab should be suspended`);
|
||||
await suspendAudioContext(tab);
|
||||
await assertIfWindowGetSuspended(tab, { shouldBeSuspended: true });
|
||||
|
||||
info(`remove tab`);
|
||||
await tab.close();
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* The following are helper functions.
|
||||
*/
|
||||
async function createTab(url, needCheck = false) {
|
||||
const tab = await createLoadedTabWrapper(url, { needCheck });
|
||||
await createStateObserver(tab);
|
||||
return tab;
|
||||
}
|
||||
|
||||
function createStateObserver(tab) {
|
||||
return SpecialPowers.spawn(tab.linkedBrowser, [], _ => {
|
||||
/**
|
||||
* Currently there is no API allowing us to observe tab's suspend state
|
||||
* directly, so we use a tricky way to observe that by checking AudioContext
|
||||
* state. Because AudioContext would change its state when tab is being
|
||||
* suspended or resumed.
|
||||
*/
|
||||
class StateObserver {
|
||||
constructor() {
|
||||
this.ac = new content.AudioContext();
|
||||
}
|
||||
getState() {
|
||||
return this.ac.state;
|
||||
}
|
||||
async waitUntilStateEqualTo(expectedState) {
|
||||
while (this.ac.state != expectedState) {
|
||||
info(`wait until tab state changes to '${expectedState}'`);
|
||||
await new Promise(r => (this.ac.onstatechange = r));
|
||||
}
|
||||
}
|
||||
function assertIfWindowGetSuspended(tab, { shouldBeSuspended }) {
|
||||
return SpecialPowers.spawn(
|
||||
tab.linkedBrowser,
|
||||
[shouldBeSuspended],
|
||||
expectedSuspend => {
|
||||
const isSuspended = content.windowUtils.suspendedByBrowsingContextGroup;
|
||||
is(
|
||||
expectedSuspend,
|
||||
isSuspended,
|
||||
`window suspended state (${isSuspended}) is equal to the expected`
|
||||
);
|
||||
}
|
||||
content.obs = new StateObserver();
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
function setTabActive(tab, isActive) {
|
||||
tab.linkedBrowser.docShellIsActive = isActive;
|
||||
}
|
||||
|
||||
function shouldTabStateEqualTo(tab, state) {
|
||||
return SpecialPowers.spawn(tab.linkedBrowser, [state], async state => {
|
||||
await content.obs.waitUntilStateEqualTo(state);
|
||||
ok(content.obs.getState() == state, `correct tab state '${state}'`);
|
||||
function startAudioContext(tab) {
|
||||
return SpecialPowers.spawn(tab.linkedBrowser, [], async _ => {
|
||||
content.ac = new content.AudioContext();
|
||||
await new Promise(r => (content.ac.onstatechange = r));
|
||||
ok(content.ac.state == "running", `Audio context started running`);
|
||||
});
|
||||
}
|
||||
|
||||
function suspendAudioContext(tab) {
|
||||
return SpecialPowers.spawn(tab.linkedBrowser, [], async _ => {
|
||||
await content.ac.suspend();
|
||||
ok(content.ac.state == "suspended", `Audio context is suspended`);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,8 +21,11 @@
|
|||
#include "mozilla/dom/AudioContextBinding.h"
|
||||
#include "mozilla/dom/BaseAudioContextBinding.h"
|
||||
#include "mozilla/dom/BiquadFilterNodeBinding.h"
|
||||
#include "mozilla/dom/BrowsingContext.h"
|
||||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
||||
#include "mozilla/dom/ChannelMergerNodeBinding.h"
|
||||
#include "mozilla/dom/ChannelSplitterNodeBinding.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/ConvolverNodeBinding.h"
|
||||
#include "mozilla/dom/DelayNodeBinding.h"
|
||||
#include "mozilla/dom/DynamicsCompressorNodeBinding.h"
|
||||
|
@ -220,6 +223,7 @@ void AudioContext::StartBlockedAudioContextIfAllowed() {
|
|||
}
|
||||
|
||||
void AudioContext::DisconnectFromWindow() {
|
||||
MaybeClearPageAwakeRequest();
|
||||
nsPIDOMWindowInner* window = GetOwner();
|
||||
if (window) {
|
||||
window->RemoveAudioContext(this);
|
||||
|
@ -229,6 +233,7 @@ void AudioContext::DisconnectFromWindow() {
|
|||
AudioContext::~AudioContext() {
|
||||
DisconnectFromWindow();
|
||||
UnregisterWeakMemoryReporter(this);
|
||||
MOZ_ASSERT(!mSetPageAwakeRequest, "forgot to revoke for page awake?");
|
||||
}
|
||||
|
||||
JSObject* AudioContext::WrapObject(JSContext* aCx,
|
||||
|
@ -766,6 +771,7 @@ nsISerialEventTarget* AudioContext::GetMainThread() const {
|
|||
|
||||
void AudioContext::DisconnectFromOwner() {
|
||||
mIsDisconnecting = true;
|
||||
MaybeClearPageAwakeRequest();
|
||||
OnWindowDestroy();
|
||||
DOMEventTargetHelper::DisconnectFromOwner();
|
||||
}
|
||||
|
@ -894,6 +900,60 @@ void AudioContext::OnStateChanged(void* aPromise, AudioContextState aNewState) {
|
|||
|
||||
mAudioContextState = aNewState;
|
||||
Destination()->NotifyAudioContextStateChanged();
|
||||
MaybeUpdatePageAwakeRequest();
|
||||
}
|
||||
|
||||
BrowsingContext* AudioContext::GetTopLevelBrowsingContext() {
|
||||
nsCOMPtr<nsPIDOMWindowInner> window = GetParentObject();
|
||||
if (!window) {
|
||||
return nullptr;
|
||||
}
|
||||
BrowsingContext* bc = window->GetBrowsingContext();
|
||||
if (!bc || bc->IsDiscarded()) {
|
||||
return nullptr;
|
||||
}
|
||||
return bc->Top();
|
||||
}
|
||||
|
||||
void AudioContext::MaybeUpdatePageAwakeRequest() {
|
||||
// No need to keep page awake for offline context.
|
||||
if (IsOffline()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mIsShutDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsRunning() && !mSetPageAwakeRequest) {
|
||||
SetPageAwakeRequest(true);
|
||||
} else if (!IsRunning() && mSetPageAwakeRequest) {
|
||||
SetPageAwakeRequest(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioContext::SetPageAwakeRequest(bool aShouldSet) {
|
||||
mSetPageAwakeRequest = aShouldSet;
|
||||
BrowsingContext* bc = GetTopLevelBrowsingContext();
|
||||
if (!bc) {
|
||||
return;
|
||||
}
|
||||
if (XRE_IsContentProcess()) {
|
||||
ContentChild* contentChild = ContentChild::GetSingleton();
|
||||
Unused << contentChild->SendAddOrRemovePageAwakeRequest(bc, aShouldSet);
|
||||
return;
|
||||
}
|
||||
if (aShouldSet) {
|
||||
bc->Canonical()->AddPageAwakeRequest();
|
||||
} else {
|
||||
bc->Canonical()->RemovePageAwakeRequest();
|
||||
}
|
||||
}
|
||||
|
||||
void AudioContext::MaybeClearPageAwakeRequest() {
|
||||
if (mSetPageAwakeRequest) {
|
||||
SetPageAwakeRequest(false);
|
||||
}
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<mozilla::MediaTrack>> AudioContext::GetAllTracks() const {
|
||||
|
|
|
@ -51,6 +51,7 @@ class AudioDestinationNode;
|
|||
class AudioListener;
|
||||
class AudioNode;
|
||||
class BiquadFilterNode;
|
||||
class BrowsingContext;
|
||||
class ChannelMergerNode;
|
||||
class ChannelSplitterNode;
|
||||
class ConstantSourceNode;
|
||||
|
@ -376,6 +377,15 @@ class AudioContext final : public DOMEventTargetHelper,
|
|||
void MaybeUpdateAutoplayTelemetry();
|
||||
void MaybeUpdateAutoplayTelemetryWhenShutdown();
|
||||
|
||||
// If the pref `dom.suspend_inactive.enabled` is enabled, the dom window will
|
||||
// be suspended when the window becomes inactive. In order to keep audio
|
||||
// context running still, we will ask pages to keep awake in that situation.
|
||||
void MaybeUpdatePageAwakeRequest();
|
||||
void MaybeClearPageAwakeRequest();
|
||||
void SetPageAwakeRequest(bool aShouldSet);
|
||||
|
||||
BrowsingContext* GetTopLevelBrowsingContext();
|
||||
|
||||
private:
|
||||
// Each AudioContext has an id, that is passed down the MediaTracks that
|
||||
// back the AudioNodes, so we can easily compute the set of all the
|
||||
|
@ -434,6 +444,11 @@ class AudioContext final : public DOMEventTargetHelper,
|
|||
bool mWasEverAllowedToStart;
|
||||
bool mWasEverBlockedToStart;
|
||||
bool mWouldBeAllowedToStart;
|
||||
|
||||
// Whether we have set the page awake reqeust when non-offline audio context
|
||||
// is running. That will keep the audio context being able to continue running
|
||||
// even if the window is inactive.
|
||||
bool mSetPageAwakeRequest = false;
|
||||
};
|
||||
|
||||
static const dom::AudioContext::AudioContextId NO_AUDIO_CONTEXT = 0;
|
||||
|
|
|
@ -2808,14 +2808,8 @@ impl<'a> SceneBuilder<'a> {
|
|||
// changing because the shadow has the same raster space as the
|
||||
// primitive, and thus we know the size is already rounded.
|
||||
let mut info = pending_primitive.info.clone();
|
||||
info.rect = self.snap_rect(
|
||||
&info.rect.translate(pending_shadow.shadow.offset),
|
||||
pending_primitive.spatial_node_index,
|
||||
);
|
||||
info.clip_rect = self.snap_rect(
|
||||
&info.clip_rect.translate(pending_shadow.shadow.offset),
|
||||
pending_primitive.spatial_node_index,
|
||||
);
|
||||
info.rect = info.rect.translate(pending_shadow.shadow.offset);
|
||||
info.clip_rect = info.clip_rect.translate(pending_shadow.shadow.offset);
|
||||
|
||||
// Construct and add a primitive for the given shadow.
|
||||
let shadow_prim_instance = self.create_primitive(
|
||||
|
|
|
@ -13,6 +13,6 @@ nsstring = { path = "../../../../xpcom/rust/nsstring" }
|
|||
cstr = "0.2"
|
||||
xpcom = { path = "../../../../xpcom/rust/xpcom" }
|
||||
thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
|
||||
l10nregistry = { git = "https://github.com/mozilla/l10nregistry-rs", rev = "55bf7f826d773303a67d8d7fdab099a04322d4fb" }
|
||||
l10nregistry = { git = "https://github.com/mozilla/l10nregistry-rs", rev = "a69df9836b1ef536727195209013b9ad6b132618" }
|
||||
fluent-fallback = "0.5"
|
||||
futures = "0.3"
|
||||
|
|
|
@ -12,7 +12,7 @@ cstr = "0.2"
|
|||
log = "0.4"
|
||||
nserror = { path = "../../../../xpcom/rust/nserror" }
|
||||
nsstring = { path = "../../../../xpcom/rust/nsstring" }
|
||||
l10nregistry = { git = "https://github.com/mozilla/l10nregistry-rs", rev = "55bf7f826d773303a67d8d7fdab099a04322d4fb" }
|
||||
l10nregistry = { git = "https://github.com/mozilla/l10nregistry-rs", rev = "a69df9836b1ef536727195209013b9ad6b132618" }
|
||||
fluent = { version = "0.16", features = ["fluent-pseudo"] }
|
||||
unic-langid = "0.9"
|
||||
thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
|
||||
|
|
|
@ -9,7 +9,7 @@ futures-channel = "0.3"
|
|||
futures = "0.3"
|
||||
nserror = { path = "../../../../xpcom/rust/nserror" }
|
||||
nsstring = { path = "../../../../xpcom/rust/nsstring" }
|
||||
l10nregistry = { git = "https://github.com/mozilla/l10nregistry-rs", rev = "55bf7f826d773303a67d8d7fdab099a04322d4fb" }
|
||||
l10nregistry = { git = "https://github.com/mozilla/l10nregistry-rs", rev = "a69df9836b1ef536727195209013b9ad6b132618" }
|
||||
fluent = { version = "0.16", features = ["fluent-pseudo"] }
|
||||
unic-langid = "0.9"
|
||||
thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
|
||||
|
|
|
@ -1744,14 +1744,25 @@ bool CompilationStencil::delazifySelfHostedFunction(
|
|||
gcOutput.get().scopes.infallibleAppend(scope);
|
||||
}
|
||||
|
||||
// Phase 4, 5: Instantiate BaseScripts.
|
||||
for (size_t i = range.start; i < range.limit; i++) {
|
||||
// Phase 4: Instantiate (inner) BaseScripts.
|
||||
ScriptIndex innerStart(range.start + 1);
|
||||
for (size_t i = innerStart; i < range.limit; i++) {
|
||||
if (!JSScript::fromStencil(cx, atomCache, *this, gcOutput.get(),
|
||||
ScriptIndex(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 5: Finish top-level handling
|
||||
// NOTE: We do not have a `CompilationInput` handy here, so avoid using the
|
||||
// `InstantiateTopLevel` helper and directly create the JSScript. Our
|
||||
// caller also handles the `AllowRelazify` flag for us since self-hosted
|
||||
// delazification is a special case.
|
||||
if (!JSScript::fromStencil(cx, atomCache, *this, gcOutput.get(),
|
||||
range.start)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Phase 6: Update lazy scripts.
|
||||
// NOTE: Self-hosting is always fully parsed so there is nothing to do here.
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// |jit-test| --no-blinterp; skip-if: !('oomTest' in this)
|
||||
|
||||
// Disable the JITs to make oomTest more reliable
|
||||
|
||||
oomTest(() => Object.bind())
|
|
@ -304,6 +304,11 @@ Result<Ok, nsresult> URLPreloader::ReadCache(
|
|||
auto entry = mCachedURLs.GetOrInsertNew(key, key);
|
||||
entry->mResultCode = NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (entry->isInList()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "Entry should be new and not in any list");
|
||||
return Err(NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
pendingURLs.insertBack(entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef mp4parse_rust_mp4parse_h
|
||||
#define mp4parse_rust_mp4parse_h
|
||||
|
||||
#define MP4PARSE_UNSTABLE_API 1
|
||||
#include "mp4parse_ffi_generated.h" // prepend mozilla/media when we namespace this
|
||||
|
||||
// Add any non-generated support code here
|
||||
|
|
|
@ -298,7 +298,23 @@ extern "C" const char* __tsan_default_suppressions() {
|
|||
// Bug 1722721 - This is a false positive during SW-WR rendering.
|
||||
"race:scale_blit\n"
|
||||
|
||||
"race:mozilla::gl::MesaMemoryLeakWorkaround"
|
||||
"race:mozilla::gl::MesaMemoryLeakWorkaround\n"
|
||||
|
||||
|
||||
// Bug 1723321
|
||||
"race:mozilla::layers::AsyncPanZoomController::AsyncPanZoomController\n"
|
||||
|
||||
// Bug 1723351 and Bug 1723142
|
||||
"race:mozilla::layers::AsyncPanZoomController::ApplyAsyncTestAttributes\n"
|
||||
|
||||
// Bug 1723170
|
||||
"race:mozilla::layers::APZCTreeManager::NewAPZCInstance\n"
|
||||
|
||||
// Bug 1723176
|
||||
"race:mozilla::layers::AsyncPanZoomController::GetZoomAnimationId\n"
|
||||
|
||||
// Bug 1723730
|
||||
"race:mozilla::layers::AsyncPanZoomController::SetZoomAnimationId\n"
|
||||
|
||||
// End of suppressions.
|
||||
; // Please keep this semicolon.
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"5874fa7dbce795209a9312250fee6db8c807ddfa53df4926bebcc9b718bc2281","LICENSE-APACHE":"5db2b182453ff32ed40f7da63589c9667a3f8bd8b16b1471b152caae56f77e45","LICENSE-MIT":"49c0b000c03731d9e3970dc059ad4ca345d773681f4a612b0024435b663e0220","benches/localization.rs":"879b46b5cc6b9c8bade51796acb0de0c5dbaa197c24b644592db06f976d39208","benches/preferences.rs":"8f5242b2166896da6219be57c5cb48f5b995a884b3bafa08358ce5206b3ad098","benches/solver.rs":"dbffd67c583b76b64499b9bf5163e40b7238afafa7edee5aabb2f04e956a15a6","benches/source.rs":"5efb5e562509aeab6a643739251d2b31994e0240316ecf407ca2188f14cbcf5d","src/env.rs":"213679dd9ef5d2aa8049f0351c2caa00e8890f788ff8a237cd8fccb01d061cdb","src/errors.rs":"f025bd1674c16b85b3097bf86831f0e8a0860f00b7151293e94206e456bd6959","src/fluent.rs":"ccf3ed58e1281e28ab36e75157778452d7c5323f5b08ff48fbea7bb45b70d361","src/lib.rs":"c2bba574aa4c1258d88695f7410175ccf04c3adf1ea3fb10769a0c9f4e07b133","src/registry/asynchronous.rs":"a392c5463caf7eeb9dc27c311d08361337b14fc6b05e83fedbe5683c66967a94","src/registry/mod.rs":"8b5077b30d3a0bde13270552009eaad0aece9c447f3c5fe210b56a1aedc6cddf","src/registry/synchronous.rs":"aa359206099eca1f6dc5ef4c03bba42a849970f42b9a64ced8a5ee89d3d829ff","src/solver/README.md":"bd93b3faef6adec5e71f06a7e06ca64b32f3877b513de099638fa86acf1e2d9e","src/solver/mod.rs":"f763519feca67ce6ce42c4387482fb10313f9f33f7d0fe687e0db51ef9592a6b","src/solver/parallel.rs":"c4c4edc38d8f639b0df057c12e0f4f0e0026e3f2fb3ad9563689d2620dd99fea","src/solver/serial.rs":"dcac1128fc87295b955c11b40b7adca5106a585de9adc2e4361cc6a92c968e27","src/solver/testing/mod.rs":"9f8b3d5b3436088d410d5544d2c2e33320bb56b0d364f1862790e4ab66fb7764","src/solver/testing/scenarios.rs":"2a11b2f3a6bbfe0055ea6125cae498391e28a4811c019e2f9479f959798e5767","src/source/fetcher.rs":"6220bf5010df94eb92f1adc56f76a65b41227b59312e27963d75b16ea0ee6393","src/source/mod.rs":"3e507f5775f71abc55acdd3e9a4be34f241c4e889244caae0142e0bc2ecae109","src/testing.rs":"4408fc78efb0d3dd52d4f8cb669914ef96531fd94796a5a2f4e1f65bc54f0e5f","tests/localization.rs":"5c2f4e75f03d4e42880adde4a6902e60b0c87d14160663e495cc6ed3091b4285","tests/registry.rs":"f9da785b408f0d54b2ca8f0bd7f52e86e75e9a642fbb91f57be870160024cbb6","tests/scenarios.rs":"ffe16cb382895bdbe809f63233fc1ac9a4be9022bc7b60d2f3210b49653569e8","tests/source.rs":"c43bbcc6f2e0c34766785cd1be94a3ed34f7f6327a1693f5dce62bcae7ac1d39"},"package":null}
|
||||
{"files":{"Cargo.toml":"5874fa7dbce795209a9312250fee6db8c807ddfa53df4926bebcc9b718bc2281","LICENSE-APACHE":"5db2b182453ff32ed40f7da63589c9667a3f8bd8b16b1471b152caae56f77e45","LICENSE-MIT":"49c0b000c03731d9e3970dc059ad4ca345d773681f4a612b0024435b663e0220","benches/localization.rs":"879b46b5cc6b9c8bade51796acb0de0c5dbaa197c24b644592db06f976d39208","benches/preferences.rs":"8f5242b2166896da6219be57c5cb48f5b995a884b3bafa08358ce5206b3ad098","benches/solver.rs":"dbffd67c583b76b64499b9bf5163e40b7238afafa7edee5aabb2f04e956a15a6","benches/source.rs":"5efb5e562509aeab6a643739251d2b31994e0240316ecf407ca2188f14cbcf5d","src/env.rs":"213679dd9ef5d2aa8049f0351c2caa00e8890f788ff8a237cd8fccb01d061cdb","src/errors.rs":"f025bd1674c16b85b3097bf86831f0e8a0860f00b7151293e94206e456bd6959","src/fluent.rs":"ccf3ed58e1281e28ab36e75157778452d7c5323f5b08ff48fbea7bb45b70d361","src/lib.rs":"c2bba574aa4c1258d88695f7410175ccf04c3adf1ea3fb10769a0c9f4e07b133","src/registry/asynchronous.rs":"a392c5463caf7eeb9dc27c311d08361337b14fc6b05e83fedbe5683c66967a94","src/registry/mod.rs":"8b5077b30d3a0bde13270552009eaad0aece9c447f3c5fe210b56a1aedc6cddf","src/registry/synchronous.rs":"ca1554f88a492314be7b764b18fb39dcfcd5f47005f7364c05c1e0eb171831bf","src/solver/README.md":"bd93b3faef6adec5e71f06a7e06ca64b32f3877b513de099638fa86acf1e2d9e","src/solver/mod.rs":"f763519feca67ce6ce42c4387482fb10313f9f33f7d0fe687e0db51ef9592a6b","src/solver/parallel.rs":"c4c4edc38d8f639b0df057c12e0f4f0e0026e3f2fb3ad9563689d2620dd99fea","src/solver/serial.rs":"dcac1128fc87295b955c11b40b7adca5106a585de9adc2e4361cc6a92c968e27","src/solver/testing/mod.rs":"9f8b3d5b3436088d410d5544d2c2e33320bb56b0d364f1862790e4ab66fb7764","src/solver/testing/scenarios.rs":"2a11b2f3a6bbfe0055ea6125cae498391e28a4811c019e2f9479f959798e5767","src/source/fetcher.rs":"6220bf5010df94eb92f1adc56f76a65b41227b59312e27963d75b16ea0ee6393","src/source/mod.rs":"3e507f5775f71abc55acdd3e9a4be34f241c4e889244caae0142e0bc2ecae109","src/testing.rs":"4408fc78efb0d3dd52d4f8cb669914ef96531fd94796a5a2f4e1f65bc54f0e5f","tests/localization.rs":"5c2f4e75f03d4e42880adde4a6902e60b0c87d14160663e495cc6ed3091b4285","tests/registry.rs":"f9da785b408f0d54b2ca8f0bd7f52e86e75e9a642fbb91f57be870160024cbb6","tests/scenarios.rs":"ffe16cb382895bdbe809f63233fc1ac9a4be9022bc7b60d2f3210b49653569e8","tests/source.rs":"c43bbcc6f2e0c34766785cd1be94a3ed34f7f6327a1693f5dce62bcae7ac1d39"},"package":null}
|
|
@ -145,7 +145,7 @@ impl<P, B> SyncTester for GenerateBundlesSync<P, B> {
|
|||
self.reg
|
||||
.lock()
|
||||
.source_idx(source_idx)
|
||||
.fetch_file_sync(locale, res, false)
|
||||
.fetch_file_sync(locale, res, /* overload */ true)
|
||||
.is_some()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"21a2ada4f794296fd07b2b6f4ff781a7ac256d0d6c0b707621a4c84d142b2cf7","benches/avif_benchmark.rs":"cd99c0dde025ab40d2cd860f53dc697a1587a48c164c3e5c8adfd40add29d772","src/boxes.rs":"2bae06b89cd6f4a8bf6d58fc055b9900c9fe89697a5776c19a2e587b6b20b803","src/lib.rs":"ea3d90a541bd01cbb9f8e25599e77600f2ab011535b23334a433e5bd0d8ac7df","src/macros.rs":"76c840f9299797527fe71aa5b378ffb01312767372b45cc62deddb19775400ae","src/tests.rs":"0662320d5600a51370d3df7b8848814f4e779f10f8ad37edffe9541565dc67be","src/unstable.rs":"5a0edd7f803fdc355a46bc8142f29aca976d5bbb24cc5d94a3d7c61d0cf4634a","tests/1x1-black-alpha-50pct-premultiplied.avif":"31a8c235bf2cf601a593a7bc33f7f2779f2d5b2e0cd145897b931fce94b0c0b8","tests/amr_nb_1f.3gp":"d1423e3414ad06b69f8b58d5c916ec353ba2d0402d99dec9f1c88acc33b6a127","tests/amr_wb_1f.3gp":"be635b24097e8757b0c04d70ab28e00417ca113e86108b6c269b79b64b89bcd5","tests/bbb_sunflower_QCIF_30fps_h263_noaudio_1f.3gp":"03e5b1264d0a188d77b9e676ba3ce23a801b17aaa11c0343dfd851d6ea4e3a40","tests/clap-basic-1_3x3-to-1x1.avif":"83af9c8196fa93b2475163585a23d0eb5a8f8015d0db8da7a5d6de61adfb1876","tests/corrupt/av1C-missing-essential.avif":"a1501254c4071847b2269fe40b81409c389ff14e91cf7c0005a47e6ea97a6803","tests/corrupt/bad-ipma-flags.avif":"ecde7997b97db1910b9dcc7ca8e3c8957da0e83681ea9008c66dc9f12b78ad19","tests/corrupt/bad-ipma-version.avif":"7f9a1a0b4ebbf8d800d22eaae5ff78970cc6b811317db6c1467c6883952b7c9b","tests/corrupt/bug-1655846.avif":"e0a5a06225800fadf05f5352503a4cec11af73eef705c43b4acab5f4a99dea50","tests/corrupt/bug-1661347.avif":"31c26561e1d9eafb60f7c5968b82a0859d203d73f17f26b29276256acee12966","tests/corrupt/hdlr-not-first.avif":"2c29308af077209b9c984921b7e36f8fb7ca7cf379cf8eba4c7a91f65bc7a304","tests/corrupt/hdlr-not-pict.avif":"9fe37619606645a95725300a9e34fada9190d1e0b3919881db84353941ca9291","tests/corrupt/imir-before-clap.avif":"22d6b5dacf0ef0be59053beba7564b08037fed859ada2885e3476e0ff0d19c95","tests/corrupt/imir-missing-essential.avif":"b1226e4b1358528befbd3f1126b5caf0c5051b4354777b87e71f6001f3829f87","tests/corrupt/ipma-duplicate-item_id.avif":"ca8c5275b0b8b79c1068489a52d0a5c8f0b4453463971e72b694189f11c10745","tests/corrupt/ipma-duplicate-version-and-flags.avif":"cf8e15ec4b210235f3d68332a1adeb64e35c41b8d8e1e7586ae38b6d9cd8926c","tests/corrupt/ipma-invalid-property-index.avif":"2480e773fa716d22883032d05fd4cf2c6b00fba8796cf4ff286a5d1ba26adff6","tests/corrupt/irot-missing-essential.avif":"b7da1fc1d1b45bb1b7ca3494476e052f711d794a6d010df6870872ed8b9da10e","tests/corrupt/no-alpha-av1C.avif":"ad3d34d6331db7d9bea0c5f37efb88923520e33e08e7c636a5df435a4575eae7","tests/corrupt/no-av1C.avif":"eeb4fc50930c91465999f787c4a2a3b12de20556da0857be72da5a1a9eaa3f01","tests/corrupt/no-hdlr.avif":"91a1eb70c7b6adf2104e471d7deeeb98084a591d64ce09ba106c27edfbc3a409","tests/corrupt/no-ispe.avif":"4b6edfd8c9b40c25dc40305a6057e32b5e65f40da4a9d810c58dbff53254113f","tests/corrupt/no-mif1.avif":"1442aa6ffaeb9512724287768bfd1850d3aa29a651ef05abb33e5dec2b3ee5c2","tests/corrupt/no-pixi-for-alpha.avif":"f8adc3573c79ee25bf6d4dd2693c61661469b28f86a5c7b1d9e41b0e8d2d53bb","tests/corrupt/no-pixi.avif":"4b1776def440dc8b913c170e4479772ee6bbb299b8679f7c564704bd03c9597e","tests/multiple-extents.avif":"b5549ac68793e155a726d754e565cea0da03fa17833d3545f45c79e13f4c9360","tests/overflow.rs":"16b591d8def1a155b3b997622f6ea255536870d99c3d8f97c51755b77a50de3c","tests/public.rs":"dd2464ef83e861833f7ef9f8a1055254f1453665fd4b5ec32a2a1f6362ce535b","tests/valid-alpha.avif":"9d417a35b9b62ad3ff66ffbc55f16552aacf821a092aa5ef4adff7e746bd4c2f","tests/valid.avif":"f0b33e09bf01232e0877df325f47986c0bee7764f2a81c9c908ae109e7dc63c4"},"package":null}
|
||||
{"files":{"Cargo.toml":"c06a8bf810a588465e8d26852c29ebb1fdf7e7adc1ee3cbac8a487ae92c38000","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"86cb40854b93f988e3a63ce6fe39d2ce95367f8ca301a5ba50676ff98a0ad791","benches/avif_benchmark.rs":"cd99c0dde025ab40d2cd860f53dc697a1587a48c164c3e5c8adfd40add29d772","src/boxes.rs":"50eed905feb775a1e696a6faa33233e8f8803591bfa9c5ad15ea02cbd17732d6","src/lib.rs":"d24a97ca6dfb25d672b28ba2e9da31923136b4f1783ceca4b96c745a7bc1be51","src/macros.rs":"76c840f9299797527fe71aa5b378ffb01312767372b45cc62deddb19775400ae","src/tests.rs":"87a391c2383f601439bf1ebebb3b24d998252e2574dde75c7c578fae9bfc27bb","src/unstable.rs":"c2cef9a3b2b08a4da66fa0305fce7a117bd99c9b8d57b0a044e1d99dbda6faf5","tests/1x1-black-alpha-50pct-premultiplied.avif":"31a8c235bf2cf601a593a7bc33f7f2779f2d5b2e0cd145897b931fce94b0c0b8","tests/amr_nb_1f.3gp":"d1423e3414ad06b69f8b58d5c916ec353ba2d0402d99dec9f1c88acc33b6a127","tests/amr_wb_1f.3gp":"be635b24097e8757b0c04d70ab28e00417ca113e86108b6c269b79b64b89bcd5","tests/bbb_sunflower_QCIF_30fps_h263_noaudio_1f.3gp":"03e5b1264d0a188d77b9e676ba3ce23a801b17aaa11c0343dfd851d6ea4e3a40","tests/clap-basic-1_3x3-to-1x1.avif":"83af9c8196fa93b2475163585a23d0eb5a8f8015d0db8da7a5d6de61adfb1876","tests/clusterfuzz-testcase-minimized-mp4-6093954524250112":"af7044a470732d4e7e34ac7ab5ff038c58b66f09702cbcd774931d7766bbfd35","tests/corrupt/av1C-missing-essential.avif":"a1501254c4071847b2269fe40b81409c389ff14e91cf7c0005a47e6ea97a6803","tests/corrupt/bad-ipma-flags.avif":"ecde7997b97db1910b9dcc7ca8e3c8957da0e83681ea9008c66dc9f12b78ad19","tests/corrupt/bad-ipma-version.avif":"7f9a1a0b4ebbf8d800d22eaae5ff78970cc6b811317db6c1467c6883952b7c9b","tests/corrupt/bug-1655846.avif":"e0a5a06225800fadf05f5352503a4cec11af73eef705c43b4acab5f4a99dea50","tests/corrupt/bug-1661347.avif":"31c26561e1d9eafb60f7c5968b82a0859d203d73f17f26b29276256acee12966","tests/corrupt/hdlr-not-first.avif":"2c29308af077209b9c984921b7e36f8fb7ca7cf379cf8eba4c7a91f65bc7a304","tests/corrupt/hdlr-not-pict.avif":"9fe37619606645a95725300a9e34fada9190d1e0b3919881db84353941ca9291","tests/corrupt/imir-before-clap.avif":"22d6b5dacf0ef0be59053beba7564b08037fed859ada2885e3476e0ff0d19c95","tests/corrupt/imir-missing-essential.avif":"b1226e4b1358528befbd3f1126b5caf0c5051b4354777b87e71f6001f3829f87","tests/corrupt/ipma-duplicate-item_id.avif":"ca8c5275b0b8b79c1068489a52d0a5c8f0b4453463971e72b694189f11c10745","tests/corrupt/ipma-duplicate-version-and-flags.avif":"cf8e15ec4b210235f3d68332a1adeb64e35c41b8d8e1e7586ae38b6d9cd8926c","tests/corrupt/ipma-invalid-property-index.avif":"2480e773fa716d22883032d05fd4cf2c6b00fba8796cf4ff286a5d1ba26adff6","tests/corrupt/irot-missing-essential.avif":"b7da1fc1d1b45bb1b7ca3494476e052f711d794a6d010df6870872ed8b9da10e","tests/corrupt/no-alpha-av1C.avif":"ad3d34d6331db7d9bea0c5f37efb88923520e33e08e7c636a5df435a4575eae7","tests/corrupt/no-av1C.avif":"eeb4fc50930c91465999f787c4a2a3b12de20556da0857be72da5a1a9eaa3f01","tests/corrupt/no-hdlr.avif":"91a1eb70c7b6adf2104e471d7deeeb98084a591d64ce09ba106c27edfbc3a409","tests/corrupt/no-ispe.avif":"4b6edfd8c9b40c25dc40305a6057e32b5e65f40da4a9d810c58dbff53254113f","tests/corrupt/no-mif1.avif":"1442aa6ffaeb9512724287768bfd1850d3aa29a651ef05abb33e5dec2b3ee5c2","tests/corrupt/no-pixi-for-alpha.avif":"f8adc3573c79ee25bf6d4dd2693c61661469b28f86a5c7b1d9e41b0e8d2d53bb","tests/corrupt/no-pixi.avif":"4b1776def440dc8b913c170e4479772ee6bbb299b8679f7c564704bd03c9597e","tests/multiple-extents.avif":"b5549ac68793e155a726d754e565cea0da03fa17833d3545f45c79e13f4c9360","tests/overflow.rs":"16b591d8def1a155b3b997622f6ea255536870d99c3d8f97c51755b77a50de3c","tests/public.rs":"38f046cebbfcb7e34a816b585282887acafe68dc5143dad1841fae6328677cc3","tests/valid-alpha.avif":"9d417a35b9b62ad3ff66ffbc55f16552aacf821a092aa5ef4adff7e746bd4c2f","tests/valid.avif":"f0b33e09bf01232e0877df325f47986c0bee7764f2a81c9c908ae109e7dc63c4"},"package":null}
|
|
@ -30,7 +30,6 @@ byteorder = "1.2.1"
|
|||
bitreader = { version = "0.3.2" }
|
||||
env_logger = "0.8"
|
||||
fallible_collections = { version = "0.4", features = ["std_io"] }
|
||||
hashbrown = "0.9"
|
||||
num-traits = "0.2.14"
|
||||
log = "0.4"
|
||||
static_assertions = "1.1.0"
|
||||
|
|
|
@ -0,0 +1,373 @@
|
|||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
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/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
|
@ -0,0 +1,2 @@
|
|||
`mp4parse` is a parser for ISO base media file format (mp4) written in rust.
|
||||
See [the README in the mp4parse-rust repo](https://github.com/mozilla/mp4parse-rust/blob/master/README.md) for more details.
|
|
@ -98,7 +98,6 @@ impl PartialEq<&[u8; 4]> for FourCC {
|
|||
}
|
||||
}
|
||||
|
||||
#[deny(unreachable_patterns)]
|
||||
box_database!(
|
||||
FileTypeBox 0x6674_7970, // "ftyp"
|
||||
MediaDataBox 0x6d64_6174, // "mdat"
|
||||
|
@ -120,7 +119,7 @@ box_database!(
|
|||
ItemPropertiesBox 0x6970_7270, // "iprp"
|
||||
ItemPropertyContainerBox 0x6970_636f, // "ipco"
|
||||
ItemPropertyAssociationBox 0x6970_6d61, // "ipma"
|
||||
ColorInformationBox 0x636f_6c72, // "colr"
|
||||
ColourInformationBox 0x636f_6c72, // "colr"
|
||||
ImageSpatialExtentsProperty 0x6973_7065, // "ispe"
|
||||
PixelInformationBox 0x7069_7869, // "pixi"
|
||||
AuxiliaryTypeProperty 0x6175_7843, // "auxC"
|
||||
|
|
|
@ -44,13 +44,6 @@ mod tests;
|
|||
#[cfg(feature = "unstable-api")]
|
||||
pub mod unstable;
|
||||
|
||||
// Arbitrary buffer size limit used for raw read_bufs on a box.
|
||||
const BUF_SIZE_LIMIT: u64 = 10 * 1024 * 1024;
|
||||
|
||||
// Max table length. Calculating in worst case for one week long video, one
|
||||
// frame per table entry in 30 fps.
|
||||
const TABLE_SIZE_LIMIT: u32 = 30 * 60 * 60 * 24 * 7;
|
||||
|
||||
/// The 'mif1' brand indicates structural requirements on files
|
||||
/// See HEIF (ISO 23008-12:2017) § 10.2.1
|
||||
const MIF1_BRAND: FourCC = FourCC { value: *b"mif1" };
|
||||
|
@ -204,6 +197,12 @@ impl From<std::string::FromUtf8Error> for Error {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<std::str::Utf8Error> for Error {
|
||||
fn from(_: std::str::Utf8Error) -> Error {
|
||||
Error::InvalidData("invalid utf8")
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::num::TryFromIntError> for Error {
|
||||
fn from(_: std::num::TryFromIntError) -> Error {
|
||||
Error::Unsupported("integer conversion failed")
|
||||
|
@ -816,18 +815,18 @@ struct AvifItem {
|
|||
}
|
||||
|
||||
impl AvifItem {
|
||||
fn with_data_location(id: ItemId, extent: Extent) -> Result<Self> {
|
||||
Ok(Self {
|
||||
fn with_data_location(id: ItemId, extent: Extent) -> Self {
|
||||
Self {
|
||||
id,
|
||||
image_data: IsobmffItem::Location(extent),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn with_inline_data(id: ItemId) -> Result<Self> {
|
||||
Ok(Self {
|
||||
fn with_inline_data(id: ItemId) -> Self {
|
||||
Self {
|
||||
id,
|
||||
image_data: IsobmffItem::Data(TryVec::new()),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -859,42 +858,64 @@ impl AvifContext {
|
|||
.map(|item| self.item_as_slice(item))
|
||||
}
|
||||
|
||||
pub fn spatial_extents_ptr(&self) -> *const ImageSpatialExtentsProperty {
|
||||
pub fn spatial_extents_ptr(&self) -> Result<*const ImageSpatialExtentsProperty> {
|
||||
match self
|
||||
.item_properties
|
||||
.get(self.primary_item.id, BoxType::ImageSpatialExtentsProperty)
|
||||
.get(self.primary_item.id, BoxType::ImageSpatialExtentsProperty)?
|
||||
{
|
||||
Some(ItemProperty::ImageSpatialExtents(ispe)) => ispe,
|
||||
Some(ItemProperty::ImageSpatialExtents(ispe)) => Ok(ispe),
|
||||
Some(other_property) => panic!("property key mismatch: {:?}", other_property),
|
||||
None => {
|
||||
assert!(
|
||||
fail_if(
|
||||
self.strictness == ParseStrictness::Permissive,
|
||||
"ispe is a mandatory property",
|
||||
);
|
||||
std::ptr::null()
|
||||
)?;
|
||||
Ok(std::ptr::null())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn image_rotation(&self) -> ImageRotation {
|
||||
pub fn nclx_colour_information_ptr(&self) -> Result<*const NclxColourInformation> {
|
||||
match self
|
||||
.item_properties
|
||||
.get(self.primary_item.id, BoxType::ImageRotation)
|
||||
.get(self.primary_item.id, BoxType::ColourInformationBox)?
|
||||
{
|
||||
Some(ItemProperty::Rotation(irot)) => *irot,
|
||||
Some(ItemProperty::Colour(ColourInformation::Nclx(nclx))) => Ok(nclx),
|
||||
None | Some(ItemProperty::Colour(ColourInformation::Icc(_))) => Ok(std::ptr::null()),
|
||||
Some(other_property) => panic!("property key mismatch: {:?}", other_property),
|
||||
None => ImageRotation::D0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn image_mirror_ptr(&self) -> *const ImageMirror {
|
||||
pub fn icc_colour_information(&self) -> Result<&[u8]> {
|
||||
match self
|
||||
.item_properties
|
||||
.get(self.primary_item.id, BoxType::ImageMirror)
|
||||
.get(self.primary_item.id, BoxType::ColourInformationBox)?
|
||||
{
|
||||
Some(ItemProperty::Mirroring(imir)) => imir,
|
||||
Some(ItemProperty::Colour(ColourInformation::Icc(icc))) => Ok(icc.bytes.as_slice()),
|
||||
None | Some(ItemProperty::Colour(ColourInformation::Nclx(_))) => Ok(&[]),
|
||||
Some(other_property) => panic!("property key mismatch: {:?}", other_property),
|
||||
None => std::ptr::null(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn image_rotation(&self) -> Result<ImageRotation> {
|
||||
match self
|
||||
.item_properties
|
||||
.get(self.primary_item.id, BoxType::ImageRotation)?
|
||||
{
|
||||
Some(ItemProperty::Rotation(irot)) => Ok(*irot),
|
||||
Some(other_property) => panic!("property key mismatch: {:?}", other_property),
|
||||
None => Ok(ImageRotation::D0),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn image_mirror_ptr(&self) -> Result<*const ImageMirror> {
|
||||
match self
|
||||
.item_properties
|
||||
.get(self.primary_item.id, BoxType::ImageMirror)?
|
||||
{
|
||||
Some(ItemProperty::Mirroring(imir)) => Ok(imir),
|
||||
Some(other_property) => panic!("property key mismatch: {:?}", other_property),
|
||||
None => Ok(std::ptr::null()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1603,11 +1624,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
})
|
||||
.map(|iref| iref.from_item_id)
|
||||
// which has the alpha property
|
||||
.filter(|&item_id| {
|
||||
item_properties.get_auxc(item_id).map_or(false, |urn| {
|
||||
urn.aux_type.as_slice() == "urn:mpeg:mpegB:cicp:systems:auxiliary:alpha".as_bytes()
|
||||
})
|
||||
});
|
||||
.filter(|&item_id| item_properties.is_alpha(item_id));
|
||||
let alpha_item_id = alpha_item_ids.next();
|
||||
if alpha_item_ids.next().is_some() {
|
||||
return Err(Error::InvalidData("multiple alpha planes"));
|
||||
|
@ -1644,7 +1661,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
// into a contiguous buffer. Otherwise, we can just store the extent
|
||||
// and return a pointer into the mdat later to avoid the copy.
|
||||
if loc.extents.len() > 1 {
|
||||
*item = Some(AvifItem::with_inline_data(item_id)?)
|
||||
*item = Some(AvifItem::with_inline_data(item_id))
|
||||
}
|
||||
|
||||
for extent in loc.extents {
|
||||
|
@ -1655,7 +1672,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
match item {
|
||||
None => {
|
||||
trace!("Using IsobmffItem::Location");
|
||||
*item = Some(AvifItem::with_data_location(item_id, extent)?);
|
||||
*item = Some(AvifItem::with_data_location(item_id, extent));
|
||||
}
|
||||
Some(AvifItem {
|
||||
image_data: IsobmffItem::Data(item_data),
|
||||
|
@ -1691,7 +1708,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
let has_pixi = |item_id| {
|
||||
item_properties
|
||||
.get(item_id, BoxType::PixelInformationBox)
|
||||
.is_some()
|
||||
.map_or(false, |opt| opt.is_some())
|
||||
};
|
||||
if !has_pixi(primary_item_id) || !alpha_item_id.map_or(true, has_pixi) {
|
||||
fail_if(
|
||||
|
@ -1705,7 +1722,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
let has_av1c = |item_id| {
|
||||
item_properties
|
||||
.get(item_id, BoxType::AV1CodecConfigurationBox)
|
||||
.is_some()
|
||||
.map_or(false, |opt| opt.is_some())
|
||||
};
|
||||
if !has_av1c(primary_item_id) || !alpha_item_id.map_or(true, has_av1c) {
|
||||
fail_if(
|
||||
|
@ -1716,7 +1733,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
|
|||
)?;
|
||||
}
|
||||
|
||||
if item_properties.get_ispe(primary_item_id).is_none() {
|
||||
if item_properties.get_ispe(primary_item_id)?.is_none() {
|
||||
fail_if(
|
||||
strictness != ParseStrictness::Permissive,
|
||||
"Missing 'ispe' property for primary item, required \
|
||||
|
@ -1774,7 +1791,7 @@ fn read_avif_meta<T: Read + Offset>(
|
|||
"There shall be exactly one hdlr box per ISOBMFF (ISO 14496-12:2015) § 8.4.3.1",
|
||||
));
|
||||
}
|
||||
let HandlerBox { handler_type } = read_hdlr(&mut b)?;
|
||||
let HandlerBox { handler_type } = read_hdlr(&mut b, strictness)?;
|
||||
if handler_type != b"pict" {
|
||||
fail_if(
|
||||
strictness != ParseStrictness::Permissive,
|
||||
|
@ -1816,7 +1833,7 @@ fn read_avif_meta<T: Read + Offset>(
|
|||
}
|
||||
BoxType::ItemPropertiesBox => {
|
||||
if item_properties.is_some() {
|
||||
return Err(Error::InvalidData("There shall be zero or one iprp boxes per ISOBMFF (ISO 14496-12:2020 § 8.11.14.1"));
|
||||
return Err(Error::InvalidData("There shall be zero or one iprp boxes per ISOBMFF (ISO 14496-12:2020) § 8.11.14.1"));
|
||||
}
|
||||
item_properties = Some(read_iprp(&mut b, MIF1_BRAND, strictness)?);
|
||||
}
|
||||
|
@ -2001,7 +2018,9 @@ fn read_iprp<T: Read>(
|
|||
let mut iter = src.box_iter();
|
||||
|
||||
let properties = match iter.next_box()? {
|
||||
Some(mut b) if b.head.name == BoxType::ItemPropertyContainerBox => read_ipco(&mut b),
|
||||
Some(mut b) if b.head.name == BoxType::ItemPropertyContainerBox => {
|
||||
read_ipco(&mut b, strictness)
|
||||
}
|
||||
Some(_) => Err(Error::InvalidData("unexpected iprp child")),
|
||||
None => Err(Error::UnexpectedEOF),
|
||||
}?;
|
||||
|
@ -2141,6 +2160,7 @@ pub enum ItemProperty {
|
|||
AuxiliaryType(AuxiliaryTypeProperty),
|
||||
AV1Config(AV1ConfigBox),
|
||||
Channels(TryVec<u8>),
|
||||
Colour(ColourInformation),
|
||||
ImageSpatialExtents(ImageSpatialExtentsProperty),
|
||||
Mirroring(ImageMirror),
|
||||
Rotation(ImageRotation),
|
||||
|
@ -2153,6 +2173,7 @@ impl ItemProperty {
|
|||
match self {
|
||||
ItemProperty::AuxiliaryType(_) => BoxType::AuxiliaryTypeProperty,
|
||||
ItemProperty::AV1Config(_) => BoxType::AV1CodecConfigurationBox,
|
||||
ItemProperty::Colour(_) => BoxType::ColourInformationBox,
|
||||
ItemProperty::Mirroring(_) => BoxType::ImageMirror,
|
||||
ItemProperty::Rotation(_) => BoxType::ImageRotation,
|
||||
ItemProperty::ImageSpatialExtents(_) => BoxType::ImageSpatialExtentsProperty,
|
||||
|
@ -2196,41 +2217,69 @@ impl ItemPropertiesBox {
|
|||
/// is typically included too, so we might as well use an even power of 2.
|
||||
const MIN_PROPERTIES: usize = 4;
|
||||
|
||||
fn get_auxc(&self, item_id: ItemId) -> Option<&AuxiliaryTypeProperty> {
|
||||
if let Some(ItemProperty::AuxiliaryType(urn)) =
|
||||
self.get(item_id, BoxType::AuxiliaryTypeProperty)
|
||||
{
|
||||
Some(urn)
|
||||
} else {
|
||||
None
|
||||
fn is_alpha(&self, item_id: ItemId) -> bool {
|
||||
match self.get(item_id, BoxType::AuxiliaryTypeProperty) {
|
||||
Ok(Some(ItemProperty::AuxiliaryType(urn))) => {
|
||||
urn.aux_type.as_slice() == "urn:mpeg:mpegB:cicp:systems:auxiliary:alpha".as_bytes()
|
||||
}
|
||||
Ok(Some(other_property)) => panic!("property key mismatch: {:?}", other_property),
|
||||
Ok(None) => false,
|
||||
Err(e) => {
|
||||
error!(
|
||||
"is_alpha: Error checking AuxiliaryTypeProperty ({}), returning false",
|
||||
e
|
||||
);
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_ispe(&self, item_id: ItemId) -> Option<&ImageSpatialExtentsProperty> {
|
||||
fn get_ispe(&self, item_id: ItemId) -> Result<Option<&ImageSpatialExtentsProperty>> {
|
||||
if let Some(ItemProperty::ImageSpatialExtents(ispe)) =
|
||||
self.get(item_id, BoxType::ImageSpatialExtentsProperty)
|
||||
self.get(item_id, BoxType::ImageSpatialExtentsProperty)?
|
||||
{
|
||||
Some(ispe)
|
||||
Ok(Some(ispe))
|
||||
} else {
|
||||
None
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
fn get(&self, item_id: ItemId, property_type: BoxType) -> Option<&ItemProperty> {
|
||||
fn get(&self, item_id: ItemId, property_type: BoxType) -> Result<Option<&ItemProperty>> {
|
||||
match self.get_multiple(item_id, property_type)?.as_slice() {
|
||||
&[] => Ok(None),
|
||||
&[single_value] => Ok(Some(single_value)),
|
||||
multiple_values => {
|
||||
error!(
|
||||
"Multiple values for {:?}: {:?}",
|
||||
property_type, multiple_values
|
||||
);
|
||||
// TODO: add test
|
||||
Err(Error::InvalidData("conflicting item property values"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_multiple(
|
||||
&self,
|
||||
item_id: ItemId,
|
||||
property_type: BoxType,
|
||||
) -> Result<TryVec<&ItemProperty>> {
|
||||
let mut values = TryVec::new();
|
||||
for entry in &self.association_entries {
|
||||
for a in &entry.associations {
|
||||
if entry.item_id == item_id {
|
||||
match self.properties.get(&a.property_index) {
|
||||
Some(ItemProperty::Unsupported(_)) => {}
|
||||
Some(property) if property.box_type() == property_type => {
|
||||
return Some(property)
|
||||
values.push(property)?
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
|
||||
Ok(values)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2477,7 +2526,10 @@ fn read_ipma<T: Read>(
|
|||
/// Parse an ItemPropertyContainerBox
|
||||
///
|
||||
/// See ISOBMFF (ISO 14496-12:2020 § 8.11.14.1
|
||||
fn read_ipco<T: Read>(src: &mut BMFFBox<T>) -> Result<TryHashMap<PropertyIndex, ItemProperty>> {
|
||||
fn read_ipco<T: Read>(
|
||||
src: &mut BMFFBox<T>,
|
||||
strictness: ParseStrictness,
|
||||
) -> Result<TryHashMap<PropertyIndex, ItemProperty>> {
|
||||
let mut properties = TryHashMap::with_capacity(ItemPropertiesBox::MIN_PROPERTIES)?;
|
||||
|
||||
let mut index = PropertyIndex(1); // ipma uses 1-based indexing
|
||||
|
@ -2486,6 +2538,9 @@ fn read_ipco<T: Read>(src: &mut BMFFBox<T>) -> Result<TryHashMap<PropertyIndex,
|
|||
if let Some(property) = match b.head.name {
|
||||
BoxType::AuxiliaryTypeProperty => Some(ItemProperty::AuxiliaryType(read_auxc(&mut b)?)),
|
||||
BoxType::AV1CodecConfigurationBox => Some(ItemProperty::AV1Config(read_av1c(&mut b)?)),
|
||||
BoxType::ColourInformationBox => {
|
||||
Some(ItemProperty::Colour(read_colr(&mut b, strictness)?))
|
||||
}
|
||||
BoxType::ImageMirror => Some(ItemProperty::Mirroring(read_imir(&mut b)?)),
|
||||
BoxType::ImageRotation => Some(ItemProperty::Rotation(read_irot(&mut b)?)),
|
||||
BoxType::ImageSpatialExtentsProperty => {
|
||||
|
@ -2561,6 +2616,96 @@ fn read_pixi<T: Read>(src: &mut BMFFBox<T>) -> Result<TryVec<u8>> {
|
|||
Ok(channels)
|
||||
}
|
||||
|
||||
/// Despite [Rec. ITU-T H.273] (12/2016) defining the CICP fields as having a
|
||||
/// range of 0-255, and only a small fraction of those values being used,
|
||||
/// ISOBMFF (ISO 14496-12:2020) § 12.1.5 defines them as 16-bit values in the
|
||||
/// `colr` box. Since we have no use for the additional range, and it would
|
||||
/// complicate matters later, we fallibly convert before storing the input.
|
||||
///
|
||||
/// [Rec. ITU-T H.273]: https://www.itu.int/rec/T-REC-H.273-201612-I/en
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct NclxColourInformation {
|
||||
colour_primaries: u8,
|
||||
transfer_characteristics: u8,
|
||||
matrix_coefficients: u8,
|
||||
full_range_flag: bool,
|
||||
}
|
||||
|
||||
/// The raw bytes of the ICC profile
|
||||
#[repr(C)]
|
||||
pub struct IccColourInformation {
|
||||
bytes: TryVec<u8>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for IccColourInformation {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("IccColourInformation")
|
||||
.field("data", &format_args!("{} bytes", self.bytes.len()))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub enum ColourInformation {
|
||||
Nclx(NclxColourInformation),
|
||||
Icc(IccColourInformation),
|
||||
}
|
||||
|
||||
/// Parse colour information
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 12.1.5
|
||||
fn read_colr<T: Read>(
|
||||
src: &mut BMFFBox<T>,
|
||||
strictness: ParseStrictness,
|
||||
) -> Result<ColourInformation> {
|
||||
let colour_type = be_u32(src)?.to_be_bytes();
|
||||
|
||||
match &colour_type {
|
||||
b"nclx" => {
|
||||
const NUM_RESERVED_BITS: u8 = 7;
|
||||
let colour_primaries = be_u16(src)?.try_into()?;
|
||||
let transfer_characteristics = be_u16(src)?.try_into()?;
|
||||
let matrix_coefficients = be_u16(src)?.try_into()?;
|
||||
let bytes = src.read_into_try_vec()?;
|
||||
let mut bit_reader = BitReader::new(&bytes);
|
||||
let full_range_flag = bit_reader.read_bool()?;
|
||||
if bit_reader.remaining() != NUM_RESERVED_BITS.into() {
|
||||
error!(
|
||||
"read_colr expected {} reserved bits, found {}",
|
||||
NUM_RESERVED_BITS,
|
||||
bit_reader.remaining()
|
||||
);
|
||||
return Err(Error::InvalidData("Unexpected size for colr box"));
|
||||
}
|
||||
if bit_reader.read_u8(NUM_RESERVED_BITS)? != 0 {
|
||||
fail_if(
|
||||
strictness != ParseStrictness::Permissive,
|
||||
"The 7 reserved bits at the end of the ColourInformationBox \
|
||||
for colour_type == 'nclx' must be 0 \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 12.1.5.2",
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(ColourInformation::Nclx(NclxColourInformation {
|
||||
colour_primaries,
|
||||
transfer_characteristics,
|
||||
matrix_coefficients,
|
||||
full_range_flag,
|
||||
}))
|
||||
}
|
||||
b"rICC" | b"prof" => Ok(ColourInformation::Icc(IccColourInformation {
|
||||
bytes: src.read_into_try_vec()?,
|
||||
})),
|
||||
_ => {
|
||||
error!("read_colr colour_type: {:?}", colour_type);
|
||||
Err(Error::InvalidData(
|
||||
"Unsupported colour_type for ColourInformationBox",
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
/// Rotation in the positive (that is, anticlockwise) direction
|
||||
|
@ -2952,14 +3097,14 @@ fn read_pssh<T: Read>(src: &mut BMFFBox<T>) -> Result<ProtectionSystemSpecificHe
|
|||
|
||||
let mut kid = TryVec::<ByteData>::new();
|
||||
if version > 0 {
|
||||
let count = be_u32_with_limit(pssh)?;
|
||||
let count = be_u32(pssh)?;
|
||||
for _ in 0..count {
|
||||
let item = read_buf(pssh, 16)?;
|
||||
kid.push(item)?;
|
||||
}
|
||||
}
|
||||
|
||||
let data_size = be_u32_with_limit(pssh)?;
|
||||
let data_size = be_u32(pssh)?;
|
||||
let data = read_buf(pssh, data_size.into())?;
|
||||
|
||||
(system_id, kid, data)
|
||||
|
@ -3099,7 +3244,7 @@ fn read_mdia<T: Read>(f: &mut BMFFBox<T>, track: &mut Track) -> Result<()> {
|
|||
debug!("{:?}", mdhd);
|
||||
}
|
||||
BoxType::HandlerBox => {
|
||||
let hdlr = read_hdlr(&mut b)?;
|
||||
let hdlr = read_hdlr(&mut b, ParseStrictness::Permissive)?;
|
||||
|
||||
match hdlr.handler_type.value.as_ref() {
|
||||
b"vide" => track.track_type = TrackType::Video,
|
||||
|
@ -3290,7 +3435,7 @@ fn read_tkhd<T: Read>(src: &mut BMFFBox<T>) -> Result<TrackHeaderBox> {
|
|||
/// See ISOBMFF (ISO 14496-12:2015) § 8.6.6
|
||||
fn read_elst<T: Read>(src: &mut BMFFBox<T>) -> Result<EditListBox> {
|
||||
let (version, _) = read_fullbox_extra(src)?;
|
||||
let edit_count = be_u32_with_limit(src)?;
|
||||
let edit_count = be_u32(src)?;
|
||||
let mut edits = TryVec::with_capacity(edit_count.to_usize())?;
|
||||
for _ in 0..edit_count {
|
||||
let (segment_duration, media_time) = match version {
|
||||
|
@ -3366,7 +3511,7 @@ fn read_mdhd<T: Read>(src: &mut BMFFBox<T>) -> Result<MediaHeaderBox> {
|
|||
/// See ISOBMFF (ISO 14496-12:2015) § 8.7.5
|
||||
fn read_stco<T: Read>(src: &mut BMFFBox<T>) -> Result<ChunkOffsetBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let offset_count = be_u32_with_limit(src)?;
|
||||
let offset_count = be_u32(src)?;
|
||||
let mut offsets = TryVec::with_capacity(offset_count.to_usize())?;
|
||||
for _ in 0..offset_count {
|
||||
offsets.push(be_u32(src)?.into())?;
|
||||
|
@ -3382,7 +3527,7 @@ fn read_stco<T: Read>(src: &mut BMFFBox<T>) -> Result<ChunkOffsetBox> {
|
|||
/// See ISOBMFF (ISO 14496-12:2015) § 8.7.5
|
||||
fn read_co64<T: Read>(src: &mut BMFFBox<T>) -> Result<ChunkOffsetBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let offset_count = be_u32_with_limit(src)?;
|
||||
let offset_count = be_u32(src)?;
|
||||
let mut offsets = TryVec::with_capacity(offset_count.to_usize())?;
|
||||
for _ in 0..offset_count {
|
||||
offsets.push(be_u64(src)?)?;
|
||||
|
@ -3398,7 +3543,7 @@ fn read_co64<T: Read>(src: &mut BMFFBox<T>) -> Result<ChunkOffsetBox> {
|
|||
/// See ISOBMFF (ISO 14496-12:2015) § 8.6.2
|
||||
fn read_stss<T: Read>(src: &mut BMFFBox<T>) -> Result<SyncSampleBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let sample_count = be_u32_with_limit(src)?;
|
||||
let sample_count = be_u32(src)?;
|
||||
let mut samples = TryVec::with_capacity(sample_count.to_usize())?;
|
||||
for _ in 0..sample_count {
|
||||
samples.push(be_u32(src)?)?;
|
||||
|
@ -3414,11 +3559,11 @@ fn read_stss<T: Read>(src: &mut BMFFBox<T>) -> Result<SyncSampleBox> {
|
|||
/// See ISOBMFF (ISO 14496-12:2015) § 8.7.4
|
||||
fn read_stsc<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleToChunkBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let sample_count = be_u32_with_limit(src)?;
|
||||
let sample_count = be_u32(src)?;
|
||||
let mut samples = TryVec::with_capacity(sample_count.to_usize())?;
|
||||
for _ in 0..sample_count {
|
||||
let first_chunk = be_u32(src)?;
|
||||
let samples_per_chunk = be_u32_with_limit(src)?;
|
||||
let samples_per_chunk = be_u32(src)?;
|
||||
let sample_description_index = be_u32(src)?;
|
||||
samples.push(SampleToChunk {
|
||||
first_chunk,
|
||||
|
@ -3438,13 +3583,11 @@ fn read_stsc<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleToChunkBox> {
|
|||
fn read_ctts<T: Read>(src: &mut BMFFBox<T>) -> Result<CompositionOffsetBox> {
|
||||
let (version, _) = read_fullbox_extra(src)?;
|
||||
|
||||
let counts = be_u32_with_limit(src)?;
|
||||
let counts = be_u32(src)?;
|
||||
|
||||
if src.bytes_left()
|
||||
< counts
|
||||
.checked_mul(8)
|
||||
.expect("counts -> bytes overflow")
|
||||
.into()
|
||||
if counts
|
||||
.checked_mul(8)
|
||||
.map_or(true, |bytes| u64::from(bytes) > src.bytes_left())
|
||||
{
|
||||
return Err(Error::InvalidData("insufficient data in 'ctts' box"));
|
||||
}
|
||||
|
@ -3456,7 +3599,7 @@ fn read_ctts<T: Read>(src: &mut BMFFBox<T>) -> Result<CompositionOffsetBox> {
|
|||
// however, some buggy contents have negative value when version == 0.
|
||||
// So we always use Version1 here.
|
||||
0..=1 => {
|
||||
let count = be_u32_with_limit(src)?;
|
||||
let count = be_u32(src)?;
|
||||
let offset = TimeOffsetVersion::Version1(be_i32(src)?);
|
||||
(count, offset)
|
||||
}
|
||||
|
@ -3470,7 +3613,7 @@ fn read_ctts<T: Read>(src: &mut BMFFBox<T>) -> Result<CompositionOffsetBox> {
|
|||
})?;
|
||||
}
|
||||
|
||||
skip_box_remain(src)?;
|
||||
check_parser_state!(src.content);
|
||||
|
||||
Ok(CompositionOffsetBox { samples: offsets })
|
||||
}
|
||||
|
@ -3480,7 +3623,7 @@ fn read_ctts<T: Read>(src: &mut BMFFBox<T>) -> Result<CompositionOffsetBox> {
|
|||
fn read_stsz<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleSizeBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let sample_size = be_u32(src)?;
|
||||
let sample_count = be_u32_with_limit(src)?;
|
||||
let sample_count = be_u32(src)?;
|
||||
let mut sample_sizes = TryVec::new();
|
||||
if sample_size == 0 {
|
||||
sample_sizes.reserve(sample_count.to_usize())?;
|
||||
|
@ -3502,10 +3645,10 @@ fn read_stsz<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleSizeBox> {
|
|||
/// See ISOBMFF (ISO 14496-12:2015) § 8.6.1.2
|
||||
fn read_stts<T: Read>(src: &mut BMFFBox<T>) -> Result<TimeToSampleBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
let sample_count = be_u32_with_limit(src)?;
|
||||
let sample_count = be_u32(src)?;
|
||||
let mut samples = TryVec::with_capacity(sample_count.to_usize())?;
|
||||
for _ in 0..sample_count {
|
||||
let sample_count = be_u32_with_limit(src)?;
|
||||
let sample_count = be_u32(src)?;
|
||||
let sample_delta = be_u32(src)?;
|
||||
samples.push(Sample {
|
||||
sample_count,
|
||||
|
@ -4122,20 +4265,50 @@ fn read_alac<T: Read>(src: &mut BMFFBox<T>) -> Result<ALACSpecificBox> {
|
|||
}
|
||||
|
||||
/// Parse a Handler Reference Box.
|
||||
/// See ISOBMFF (ISO 14496-12:2015) § 8.4.3
|
||||
fn read_hdlr<T: Read>(src: &mut BMFFBox<T>) -> Result<HandlerBox> {
|
||||
let (_, _) = read_fullbox_extra(src)?;
|
||||
/// See ISOBMFF (ISO 14496-12:2020) § 8.4.3
|
||||
fn read_hdlr<T: Read>(src: &mut BMFFBox<T>, strictness: ParseStrictness) -> Result<HandlerBox> {
|
||||
if read_fullbox_version_no_flags(src)? != 0 {
|
||||
return Err(Error::Unsupported("hdlr version"));
|
||||
}
|
||||
|
||||
// Skip uninteresting fields.
|
||||
skip(src, 4)?;
|
||||
let pre_defined = be_u32(src)?;
|
||||
if pre_defined != 0 {
|
||||
fail_if(
|
||||
strictness != ParseStrictness::Permissive,
|
||||
"The HandlerBox 'pre_defined' field shall be 0 \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
)?;
|
||||
}
|
||||
|
||||
let handler_type = FourCC::from(be_u32(src)?);
|
||||
|
||||
// Skip uninteresting fields.
|
||||
skip(src, 12)?;
|
||||
for _ in 1..=3 {
|
||||
let reserved = be_u32(src)?;
|
||||
if reserved != 0 {
|
||||
fail_if(
|
||||
strictness != ParseStrictness::Permissive,
|
||||
"The HandlerBox 'reserved' fields shall be 0 \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip name.
|
||||
skip_box_remain(src)?;
|
||||
match std::str::from_utf8(src.read_into_try_vec()?.as_slice()) {
|
||||
Ok(name) => {
|
||||
if name.bytes().last() != Some(b'\0') {
|
||||
fail_if(
|
||||
strictness != ParseStrictness::Permissive,
|
||||
"The HandlerBox 'name' field shall be null-terminated \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
)?
|
||||
}
|
||||
}
|
||||
Err(_) => fail_if(
|
||||
strictness != ParseStrictness::Permissive,
|
||||
"The HandlerBox 'name' field shall be valid utf8 \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
)?,
|
||||
}
|
||||
|
||||
Ok(HandlerBox { handler_type })
|
||||
}
|
||||
|
@ -4809,10 +4982,6 @@ fn skip<T: Read>(src: &mut T, bytes: u64) -> Result<()> {
|
|||
|
||||
/// Read size bytes into a Vector or return error.
|
||||
fn read_buf<T: Read>(src: &mut T, size: u64) -> Result<TryVec<u8>> {
|
||||
if size > BUF_SIZE_LIMIT {
|
||||
return Err(Error::InvalidData("read_buf size exceeds BUF_SIZE_LIMIT"));
|
||||
}
|
||||
|
||||
let buf = src.take(size).read_into_try_vec()?;
|
||||
if buf.len().to_u64() != size {
|
||||
return Err(Error::InvalidData("failed buffer read"));
|
||||
|
@ -4845,16 +5014,6 @@ fn be_u32<T: ReadBytesExt>(src: &mut T) -> Result<u32> {
|
|||
src.read_u32::<byteorder::BigEndian>().map_err(From::from)
|
||||
}
|
||||
|
||||
/// Using in reading table size and return error if it exceeds limitation.
|
||||
fn be_u32_with_limit<T: ReadBytesExt>(src: &mut T) -> Result<u32> {
|
||||
be_u32(src).and_then(|v| {
|
||||
if v > TABLE_SIZE_LIMIT {
|
||||
return Err(Error::OutOfMemory);
|
||||
}
|
||||
Ok(v)
|
||||
})
|
||||
}
|
||||
|
||||
fn be_u64<T: ReadBytesExt>(src: &mut T) -> Result<u64> {
|
||||
src.read_u64::<byteorder::BigEndian>().map_err(From::from)
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
use super::read_mp4;
|
||||
use super::Error;
|
||||
use super::ParseStrictness;
|
||||
use fallible_collections::TryRead as _;
|
||||
|
||||
use std::convert::TryInto as _;
|
||||
|
@ -448,7 +449,7 @@ fn read_vpcc_version_1() {
|
|||
Ok(vpcc) => {
|
||||
assert_eq!(vpcc.bit_depth, 8);
|
||||
assert_eq!(vpcc.chroma_subsampling, 3);
|
||||
assert_eq!(vpcc.video_full_range_flag, false);
|
||||
assert!(!vpcc.video_full_range_flag);
|
||||
assert_eq!(vpcc.matrix_coefficients.unwrap(), 1);
|
||||
}
|
||||
_ => panic!("vpcc parsing error"),
|
||||
|
@ -470,7 +471,7 @@ fn read_hdlr() {
|
|||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
assert_eq!(stream.head.name, BoxType::HandlerBox);
|
||||
assert_eq!(stream.head.size, 45);
|
||||
let parsed = super::read_hdlr(&mut stream).unwrap();
|
||||
let parsed = super::read_hdlr(&mut stream, ParseStrictness::Normal).unwrap();
|
||||
assert_eq!(parsed.handler_type, b"vide");
|
||||
}
|
||||
|
||||
|
@ -483,10 +484,72 @@ fn read_hdlr_short_name() {
|
|||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
assert_eq!(stream.head.name, BoxType::HandlerBox);
|
||||
assert_eq!(stream.head.size, 33);
|
||||
let parsed = super::read_hdlr(&mut stream).unwrap();
|
||||
let parsed = super::read_hdlr(&mut stream, ParseStrictness::Normal).unwrap();
|
||||
assert_eq!(parsed.handler_type, b"vide");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_hdlr_unsupported_version() {
|
||||
let mut stream = make_fullbox(BoxSize::Short(32), b"hdlr", 1, |s| {
|
||||
s.B32(0).append_bytes(b"vide").B32(0).B32(0).B32(0)
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
assert_eq!(stream.head.name, BoxType::HandlerBox);
|
||||
assert_eq!(stream.head.size, 32);
|
||||
match super::read_hdlr(&mut stream, ParseStrictness::Normal) {
|
||||
Err(Error::Unsupported(msg)) => assert_eq!("hdlr version", msg),
|
||||
result => {
|
||||
eprintln!("{:?}", result);
|
||||
panic!("expected Error::Unsupported")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_hdlr_invalid_pre_defined_field() {
|
||||
let mut stream = make_fullbox(BoxSize::Short(32), b"hdlr", 0, |s| {
|
||||
s.B32(1).append_bytes(b"vide").B32(0).B32(0).B32(0)
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
assert_eq!(stream.head.name, BoxType::HandlerBox);
|
||||
assert_eq!(stream.head.size, 32);
|
||||
match super::read_hdlr(&mut stream, ParseStrictness::Normal) {
|
||||
Err(Error::InvalidData(msg)) => assert_eq!(
|
||||
"The HandlerBox 'pre_defined' field shall be 0 \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
msg
|
||||
),
|
||||
result => {
|
||||
eprintln!("{:?}", result);
|
||||
panic!("expected Error::InvalidData")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_hdlr_invalid_reserved_field() {
|
||||
let mut stream = make_fullbox(BoxSize::Short(32), b"hdlr", 0, |s| {
|
||||
s.B32(0).append_bytes(b"vide").B32(0).B32(1).B32(0)
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
assert_eq!(stream.head.name, BoxType::HandlerBox);
|
||||
assert_eq!(stream.head.size, 32);
|
||||
match super::read_hdlr(&mut stream, ParseStrictness::Normal) {
|
||||
Err(Error::InvalidData(msg)) => assert_eq!(
|
||||
"The HandlerBox 'reserved' fields shall be 0 \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
msg
|
||||
),
|
||||
result => {
|
||||
eprintln!("{:?}", result);
|
||||
panic!("expected Error::InvalidData")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_hdlr_zero_length_name() {
|
||||
let mut stream = make_fullbox(BoxSize::Short(32), b"hdlr", 0, |s| {
|
||||
|
@ -496,7 +559,29 @@ fn read_hdlr_zero_length_name() {
|
|||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
assert_eq!(stream.head.name, BoxType::HandlerBox);
|
||||
assert_eq!(stream.head.size, 32);
|
||||
let parsed = super::read_hdlr(&mut stream).unwrap();
|
||||
match super::read_hdlr(&mut stream, ParseStrictness::Normal) {
|
||||
Err(Error::InvalidData(msg)) => assert_eq!(
|
||||
"The HandlerBox 'name' field shall be null-terminated \
|
||||
per ISOBMFF (ISO 14496-12:2020) § 8.4.3.2",
|
||||
msg
|
||||
),
|
||||
result => {
|
||||
eprintln!("{:?}", result);
|
||||
panic!("expected Error::InvalidData")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_hdlr_zero_length_name_permissive() {
|
||||
let mut stream = make_fullbox(BoxSize::Short(32), b"hdlr", 0, |s| {
|
||||
s.B32(0).append_bytes(b"vide").B32(0).B32(0).B32(0)
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
assert_eq!(stream.head.name, BoxType::HandlerBox);
|
||||
assert_eq!(stream.head.size, 32);
|
||||
let parsed = super::read_hdlr(&mut stream, ParseStrictness::Permissive).unwrap();
|
||||
assert_eq!(parsed.handler_type, b"vide");
|
||||
}
|
||||
|
||||
|
@ -717,57 +802,8 @@ fn read_alac() {
|
|||
assert!(r.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn avcc_limit() {
|
||||
let mut stream = make_box(BoxSize::Auto, b"avc1", |s| {
|
||||
s.append_repeated(0, 6)
|
||||
.B16(1)
|
||||
.append_repeated(0, 16)
|
||||
.B16(320)
|
||||
.B16(240)
|
||||
.append_repeated(0, 14)
|
||||
.append_repeated(0, 32)
|
||||
.append_repeated(0, 4)
|
||||
.B32(0xffff_ffff)
|
||||
.append_bytes(b"avcC")
|
||||
.append_repeated(0, 100)
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
match super::read_video_sample_entry(&mut stream) {
|
||||
Err(Error::InvalidData(s)) => assert_eq!(s, "read_buf size exceeds BUF_SIZE_LIMIT"),
|
||||
Ok(_) => panic!("expected an error result"),
|
||||
_ => panic!("expected a different error result"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn esds_limit() {
|
||||
let mut stream = make_box(BoxSize::Auto, b"mp4a", |s| {
|
||||
s.append_repeated(0, 6)
|
||||
.B16(1)
|
||||
.B32(0)
|
||||
.B32(0)
|
||||
.B16(2)
|
||||
.B16(16)
|
||||
.B16(0)
|
||||
.B16(0)
|
||||
.B32(48000 << 16)
|
||||
.B32(0xffff_ffff)
|
||||
.append_bytes(b"esds")
|
||||
.append_repeated(0, 100)
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
match super::read_audio_sample_entry(&mut stream) {
|
||||
Err(Error::InvalidData(s)) => assert_eq!(s, "read_buf size exceeds BUF_SIZE_LIMIT"),
|
||||
Ok(_) => panic!("expected an error result"),
|
||||
_ => panic!("expected a different error result"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn esds_limit_2() {
|
||||
let mut stream = make_box(BoxSize::Auto, b"mp4a", |s| {
|
||||
s.append_repeated(0, 6)
|
||||
.B16(1)
|
||||
|
@ -1133,23 +1169,6 @@ fn read_f4v_stsd() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn max_table_limit() {
|
||||
let elst = make_fullbox(BoxSize::Auto, b"elst", 1, |s| {
|
||||
s.B32(super::TABLE_SIZE_LIMIT + 1)
|
||||
})
|
||||
.into_inner();
|
||||
let mut stream = make_box(BoxSize::Auto, b"edts", |s| s.append_bytes(elst.as_slice()));
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
let mut track = super::Track::new(0);
|
||||
match super::read_edts(&mut stream, &mut track) {
|
||||
Err(Error::OutOfMemory) => (),
|
||||
Ok(_) => panic!("expected an error result"),
|
||||
_ => panic!("expected a different error result"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_video_sample_entry() {
|
||||
let unknown_codec = make_box(BoxSize::Auto, b"yyyy", |s| s.append_repeated(0, 16)).into_inner();
|
||||
|
@ -1237,25 +1256,6 @@ fn read_esds_redundant_descriptor() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_invalid_pssh() {
|
||||
// invalid pssh header length
|
||||
let pssh = vec![
|
||||
0x00, 0x00, 0x00, 0x01, 0x70, 0x73, 0x73, 0x68, 0x01, 0x00, 0x00, 0x00, 0x10, 0x77, 0xef,
|
||||
0xec, 0xc0, 0xb2, 0x4d, 0x02, 0xac, 0xe3, 0x3c, 0x1e, 0x52, 0xe2, 0xfb, 0x4b, 0x00, 0x00,
|
||||
0x00, 0x02, 0x7e, 0x57, 0x1d, 0x01, 0x7e,
|
||||
];
|
||||
|
||||
let mut stream = make_box(BoxSize::Auto, b"moov", |s| s.append_bytes(pssh.as_slice()));
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
|
||||
match super::read_moov(&mut stream, None) {
|
||||
Err(Error::InvalidData(s)) => assert_eq!(s, "read_buf size exceeds BUF_SIZE_LIMIT"),
|
||||
_ => panic!("unexpected result with invalid descriptor"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_stsd_lpcm() {
|
||||
// Extract from sample converted by ffmpeg.
|
||||
|
|
|
@ -161,9 +161,8 @@ pub fn create_sample_table(
|
|||
// With large numbers of samples, the cost of many allocations dominates,
|
||||
// so it's worth iterating twice to allocate sample_table just once.
|
||||
let total_sample_count = sample_to_chunk_iter(&stsc.samples, &stco.offsets)
|
||||
.by_ref()
|
||||
.map(|(_, sample_counts)| sample_counts.to_usize())
|
||||
.sum();
|
||||
.try_fold(0usize, usize::checked_add)?;
|
||||
let mut sample_table = TryVec::with_capacity(total_sample_count).ok()?;
|
||||
|
||||
for i in sample_to_chunk_iter(&stsc.samples, &stco.offsets) {
|
||||
|
@ -226,7 +225,7 @@ pub fn create_sample_table(
|
|||
};
|
||||
|
||||
// sum_delta is the sum of stts_iter delta.
|
||||
// According to sepc:
|
||||
// According to spec:
|
||||
// decode time => DT(n) = DT(n-1) + STTS(n)
|
||||
// composition time => CT(n) = DT(n) + CTTS(n)
|
||||
// Note:
|
||||
|
|
Двоичные данные
third_party/rust/mp4parse/tests/clusterfuzz-testcase-minimized-mp4-6093954524250112
поставляемый
Normal file
Двоичные данные
third_party/rust/mp4parse/tests/clusterfuzz-testcase-minimized-mp4-6093954524250112
поставляемый
Normal file
Двоичный файл не отображается.
|
@ -105,7 +105,7 @@ fn public_api() {
|
|||
|
||||
// track.tkhd part
|
||||
let tkhd = track.tkhd.unwrap();
|
||||
assert_eq!(tkhd.disabled, false);
|
||||
assert!(!tkhd.disabled);
|
||||
assert_eq!(tkhd.duration, 40);
|
||||
assert_eq!(tkhd.width, 20_971_520);
|
||||
assert_eq!(tkhd.height, 15_728_640);
|
||||
|
@ -155,7 +155,7 @@ fn public_api() {
|
|||
|
||||
// track.tkhd part
|
||||
let tkhd = track.tkhd.unwrap();
|
||||
assert_eq!(tkhd.disabled, false);
|
||||
assert!(!tkhd.disabled);
|
||||
assert_eq!(tkhd.duration, 62);
|
||||
assert_eq!(tkhd.width, 0);
|
||||
assert_eq!(tkhd.height, 0);
|
||||
|
@ -242,9 +242,9 @@ fn public_metadata() {
|
|||
assert_eq!(meta.total_discs.unwrap(), 10);
|
||||
assert_eq!(meta.beats_per_minute.unwrap(), 128);
|
||||
assert_eq!(meta.composer.unwrap(), "Composer");
|
||||
assert_eq!(meta.compilation.unwrap(), true);
|
||||
assert_eq!(meta.gapless_playback.unwrap(), false);
|
||||
assert_eq!(meta.podcast.unwrap(), false);
|
||||
assert!(meta.compilation.unwrap());
|
||||
assert!(!meta.gapless_playback.unwrap());
|
||||
assert!(!meta.podcast.unwrap());
|
||||
assert_eq!(meta.advisory.unwrap(), mp4::AdvisoryRating::Clean);
|
||||
assert_eq!(meta.media_type.unwrap(), mp4::MediaType::Normal);
|
||||
assert_eq!(meta.rating.unwrap(), "50");
|
||||
|
@ -259,7 +259,7 @@ fn public_metadata() {
|
|||
assert_eq!(meta.tv_episode_number.unwrap(), 15);
|
||||
assert_eq!(meta.tv_season.unwrap(), 10);
|
||||
assert_eq!(meta.tv_show_name.unwrap(), "Show Name");
|
||||
assert_eq!(meta.hd_video.unwrap(), true);
|
||||
assert!(meta.hd_video.unwrap());
|
||||
assert_eq!(meta.owner.unwrap(), "Owner");
|
||||
assert_eq!(meta.sort_name.unwrap(), "Sort Name");
|
||||
assert_eq!(meta.sort_album.unwrap(), "Sort Album");
|
||||
|
@ -305,9 +305,9 @@ fn public_metadata_gnre() {
|
|||
assert_eq!(meta.total_discs.unwrap(), 10);
|
||||
assert_eq!(meta.beats_per_minute.unwrap(), 128);
|
||||
assert_eq!(meta.composer.unwrap(), "Composer");
|
||||
assert_eq!(meta.compilation.unwrap(), true);
|
||||
assert_eq!(meta.gapless_playback.unwrap(), false);
|
||||
assert_eq!(meta.podcast.unwrap(), false);
|
||||
assert!(meta.compilation.unwrap());
|
||||
assert!(!meta.gapless_playback.unwrap());
|
||||
assert!(!meta.podcast.unwrap());
|
||||
assert_eq!(meta.advisory.unwrap(), mp4::AdvisoryRating::Clean);
|
||||
assert_eq!(meta.media_type.unwrap(), mp4::MediaType::Normal);
|
||||
assert_eq!(meta.rating.unwrap(), "50");
|
||||
|
@ -322,7 +322,7 @@ fn public_metadata_gnre() {
|
|||
assert_eq!(meta.tv_episode_number.unwrap(), 15);
|
||||
assert_eq!(meta.tv_season.unwrap(), 10);
|
||||
assert_eq!(meta.tv_show_name.unwrap(), "Show Name");
|
||||
assert_eq!(meta.hd_video.unwrap(), true);
|
||||
assert!(meta.hd_video.unwrap());
|
||||
assert_eq!(meta.owner.unwrap(), "Owner");
|
||||
assert_eq!(meta.sort_name.unwrap(), "Sort Name");
|
||||
assert_eq!(meta.sort_album.unwrap(), "Sort Album");
|
||||
|
@ -362,7 +362,7 @@ fn public_invalid_metadata() {
|
|||
mp4::TrackType::Video => {
|
||||
// Check some of the values in the video tkhd.
|
||||
let tkhd = track.tkhd.unwrap();
|
||||
assert_eq!(tkhd.disabled, false);
|
||||
assert!(!tkhd.disabled);
|
||||
assert_eq!(tkhd.duration, 231232);
|
||||
assert_eq!(tkhd.width, 83_886_080);
|
||||
assert_eq!(tkhd.height, 47_185_920);
|
||||
|
@ -370,7 +370,7 @@ fn public_invalid_metadata() {
|
|||
mp4::TrackType::Audio => {
|
||||
// Check some of the values in the audio tkhd.
|
||||
let tkhd = track.tkhd.unwrap();
|
||||
assert_eq!(tkhd.disabled, false);
|
||||
assert!(!tkhd.disabled);
|
||||
assert_eq!(tkhd.duration, 231338);
|
||||
assert_eq!(tkhd.width, 0);
|
||||
assert_eq!(tkhd.height, 0);
|
||||
|
@ -401,7 +401,7 @@ fn public_audio_tenc() {
|
|||
};
|
||||
assert_eq!(a.codec_type, mp4::CodecType::EncryptedAudio);
|
||||
match a.protection_info.iter().find(|sinf| sinf.tenc.is_some()) {
|
||||
Some(ref p) => {
|
||||
Some(p) => {
|
||||
assert_eq!(p.original_format, b"mp4a");
|
||||
if let Some(ref schm) = p.scheme_type {
|
||||
assert_eq!(schm.scheme_type, b"cenc");
|
||||
|
@ -459,7 +459,7 @@ fn public_video_cenc() {
|
|||
};
|
||||
assert_eq!(v.codec_type, mp4::CodecType::EncryptedVideo);
|
||||
match v.protection_info.iter().find(|sinf| sinf.tenc.is_some()) {
|
||||
Some(ref p) => {
|
||||
Some(p) => {
|
||||
assert_eq!(p.original_format, b"avc1");
|
||||
if let Some(ref schm) = p.scheme_type {
|
||||
assert_eq!(schm.scheme_type, b"cenc");
|
||||
|
@ -671,7 +671,7 @@ fn public_video_av1() {
|
|||
|
||||
// track.tkhd part
|
||||
let tkhd = track.tkhd.unwrap();
|
||||
assert_eq!(tkhd.disabled, false);
|
||||
assert!(!tkhd.disabled);
|
||||
assert_eq!(tkhd.duration, 42);
|
||||
assert_eq!(tkhd.width, 4_194_304);
|
||||
assert_eq!(tkhd.height, 4_194_304);
|
||||
|
@ -693,11 +693,11 @@ fn public_video_av1() {
|
|||
assert_eq!(av1c.level, 0);
|
||||
assert_eq!(av1c.tier, 0);
|
||||
assert_eq!(av1c.bit_depth, 8);
|
||||
assert_eq!(av1c.monochrome, false);
|
||||
assert!(!av1c.monochrome);
|
||||
assert_eq!(av1c.chroma_subsampling_x, 1);
|
||||
assert_eq!(av1c.chroma_subsampling_y, 1);
|
||||
assert_eq!(av1c.chroma_sample_position, 0);
|
||||
assert_eq!(av1c.initial_presentation_delay_present, false);
|
||||
assert!(!av1c.initial_presentation_delay_present);
|
||||
assert_eq!(av1c.initial_presentation_delay_minus_one, 0);
|
||||
}
|
||||
_ => panic!("Invalid test condition"),
|
||||
|
@ -723,6 +723,13 @@ fn public_mp4_bug_1185230() {
|
|||
assert_eq!(number_audio_tracks, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn public_mp4_ctts_overflow() {
|
||||
let input = &mut File::open("tests/clusterfuzz-testcase-minimized-mp4-6093954524250112")
|
||||
.expect("Unknown file");
|
||||
assert_invalid_data(mp4::read_mp4(input), "insufficient data in 'ctts' box");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn public_avif_primary_item() {
|
||||
let input = &mut File::open(IMAGE_AVIF).expect("Unknown file");
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"b0653020f28155bfce958504c81c9fde20175e31774e5e42250dc7d3bc5b9985","cbindgen.toml":"e18e132e8c36a81af2629e7260529382486b0bb343f9aa57930348031480aecd","examples/dump.rs":"268093925d28d1636e106d93a2f2917fb1d7ddaf04ecd70880e1551fb578de1a","src/lib.rs":"0c473f2f08b0eb2455e01164c938dbca67978443c9917d48c0a0e1574510068e","tests/test_chunk_out_of_range.rs":"b5da583218d98027ed973a29c67434a91a1306f2d2fb39ec4d640d4824c308ce","tests/test_encryption.rs":"b918f0f10e7708bff5fae4becf1d09a188db25d874d0919d509b90266504eed7","tests/test_fragment.rs":"e90eb5a4418d30002655466c0c4b3125c7fd70a74b6871471eaa172f1def9db8","tests/test_rotation.rs":"fb43c2f2dfa496d151c33bdd46c0fd3252387c23cc71e2cac9ed0234de715a81","tests/test_sample_table.rs":"19b8d0b0f7ed79a857329321b49f5a7f687901cadd4cd22bc6728febd919d3ce","tests/test_workaround_stsc.rs":"7dd419f3d55b9a3a039cac57e58a9240a9c8166bcd4356c24f69f731c3ced83b"},"package":null}
|
||||
{"files":{"Cargo.toml":"b0653020f28155bfce958504c81c9fde20175e31774e5e42250dc7d3bc5b9985","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"f776ed4bbb7b58a5684402a9c5c28dfe1fa02b6b184139b2c2c49384cc1e3723","cbindgen.toml":"d3241a7ccfcc4ea53f90b1b59941b28f345e6e6e29c264726b4cf99df672b4a7","examples/dump.rs":"268093925d28d1636e106d93a2f2917fb1d7ddaf04ecd70880e1551fb578de1a","src/lib.rs":"e7629d39c39f6b390219beb5ffb8d80484e37b82350067b15ef88eb2480b3c31","tests/test_chunk_out_of_range.rs":"b5da583218d98027ed973a29c67434a91a1306f2d2fb39ec4d640d4824c308ce","tests/test_encryption.rs":"b918f0f10e7708bff5fae4becf1d09a188db25d874d0919d509b90266504eed7","tests/test_fragment.rs":"e90eb5a4418d30002655466c0c4b3125c7fd70a74b6871471eaa172f1def9db8","tests/test_rotation.rs":"fb43c2f2dfa496d151c33bdd46c0fd3252387c23cc71e2cac9ed0234de715a81","tests/test_sample_table.rs":"19b8d0b0f7ed79a857329321b49f5a7f687901cadd4cd22bc6728febd919d3ce","tests/test_workaround_stsc.rs":"7dd419f3d55b9a3a039cac57e58a9240a9c8166bcd4356c24f69f731c3ced83b"},"package":null}
|
|
@ -0,0 +1,373 @@
|
|||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
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/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
|
@ -0,0 +1,2 @@
|
|||
`mp4parse-capi` is a C API that exposes the functionality of `mp4parse`.
|
||||
See [the README in the mp4parse-rust repo](https://github.com/mozilla/mp4parse-rust/blob/master/README.md) for more details.
|
|
@ -19,6 +19,7 @@ rename_variants = "QualifiedScreamingSnakeCase"
|
|||
[defines]
|
||||
"feature = 3gpp" = "MP4PARSE_FEATURE_3GPP"
|
||||
"feature = meta-xml" = "MP4PARSE_FEATURE_META_XML"
|
||||
"feature = unstable-api" = "MP4PARSE_UNSTABLE_API"
|
||||
|
||||
[parse]
|
||||
parse_deps = true
|
||||
|
|
|
@ -101,7 +101,7 @@ impl Default for Mp4parseTrackType {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
|
||||
#[repr(C)]
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum Mp4parseCodec {
|
||||
|
@ -175,7 +175,11 @@ impl Mp4parseByteData {
|
|||
fn with_data(slice: &[u8]) -> Self {
|
||||
Self {
|
||||
length: slice.len(),
|
||||
data: slice.as_ptr(),
|
||||
data: if !slice.is_empty() {
|
||||
slice.as_ptr()
|
||||
} else {
|
||||
std::ptr::null()
|
||||
},
|
||||
indices: std::ptr::null(),
|
||||
}
|
||||
}
|
||||
|
@ -328,6 +332,8 @@ pub struct Mp4parseAvifImage {
|
|||
pub primary_item: Mp4parseByteData,
|
||||
/// The size of the image; should never be null unless using permissive parsing
|
||||
pub spatial_extents: *const mp4parse::ImageSpatialExtentsProperty,
|
||||
pub nclx_colour_information: *const mp4parse::NclxColourInformation,
|
||||
pub icc_colour_information: Mp4parseByteData,
|
||||
pub image_rotation: mp4parse::ImageRotation,
|
||||
pub image_mirror: *const mp4parse::ImageMirror,
|
||||
/// If no alpha item exists, `.length` will be 0 and `.data` will be null
|
||||
|
@ -1073,25 +1079,32 @@ pub unsafe extern "C" fn mp4parse_avif_get_image(
|
|||
return Mp4parseStatus::BadArg;
|
||||
}
|
||||
|
||||
*avif_image = mp4parse_avif_get_image_safe(&*parser);
|
||||
|
||||
Mp4parseStatus::Ok
|
||||
if let Ok(image) = mp4parse_avif_get_image_safe(&*parser) {
|
||||
*avif_image = image;
|
||||
Mp4parseStatus::Ok
|
||||
} else {
|
||||
Mp4parseStatus::Invalid
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mp4parse_avif_get_image_safe(parser: &Mp4parseAvifParser) -> Mp4parseAvifImage {
|
||||
pub fn mp4parse_avif_get_image_safe(
|
||||
parser: &Mp4parseAvifParser,
|
||||
) -> mp4parse::Result<Mp4parseAvifImage> {
|
||||
let context = parser.context();
|
||||
|
||||
Mp4parseAvifImage {
|
||||
Ok(Mp4parseAvifImage {
|
||||
primary_item: Mp4parseByteData::with_data(context.primary_item()),
|
||||
spatial_extents: context.spatial_extents_ptr(),
|
||||
image_rotation: context.image_rotation(),
|
||||
image_mirror: context.image_mirror_ptr(),
|
||||
spatial_extents: context.spatial_extents_ptr()?,
|
||||
nclx_colour_information: context.nclx_colour_information_ptr()?,
|
||||
icc_colour_information: Mp4parseByteData::with_data(context.icc_colour_information()?),
|
||||
image_rotation: context.image_rotation()?,
|
||||
image_mirror: context.image_mirror_ptr()?,
|
||||
alpha_item: context
|
||||
.alpha_item()
|
||||
.map(Mp4parseByteData::with_data)
|
||||
.unwrap_or_default(),
|
||||
premultiplied_alpha: context.premultiplied_alpha,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Fill the supplied `Mp4parseByteData` with index information from `track`.
|
||||
|
|
|
@ -1588,7 +1588,9 @@ EnvironmentCache.prototype = {
|
|||
this._currentEnvironment.settings.addonCompatibilityCheckEnabled =
|
||||
AddonManager.checkCompatibility;
|
||||
|
||||
this._updateAttribution();
|
||||
if (AppConstants.MOZ_BUILD_APP == "browser") {
|
||||
this._updateAttribution();
|
||||
}
|
||||
this._updateDefaultBrowser();
|
||||
await this._updateSearchEngine();
|
||||
this._loadAsyncUpdateSettingsFromCache();
|
||||
|
|
|
@ -9,7 +9,7 @@ description = "Shared Rust code for libxul"
|
|||
geckoservo = { path = "../../../../servo/ports/geckolib" }
|
||||
kvstore = { path = "../../../components/kvstore" }
|
||||
lmdb-rkv-sys = { version = "0.11", features = ["mdb_idl_logn_9"] }
|
||||
mp4parse_capi = { git = "https://github.com/mozilla/mp4parse-rust", rev = "1bb484e96ae724309e3346968e8ffd4c25e61616" }
|
||||
mp4parse_capi = { git = "https://github.com/mozilla/mp4parse-rust", rev = "5326af6b54cec885cdb9e7be282a6db6e757b964" }
|
||||
nserror = { path = "../../../../xpcom/rust/nserror" }
|
||||
nsstring = { path = "../../../../xpcom/rust/nsstring" }
|
||||
netwerk_helper = { path = "../../../../netwerk/base/rust-helper" }
|
||||
|
@ -65,7 +65,7 @@ rusqlite = { version = "0.24.1", features = ["modern_sqlite", "in_gecko"] }
|
|||
fluent = { version = "0.16", features = ["fluent-pseudo"] }
|
||||
fluent-ffi = { path = "../../../../intl/l10n/rust/fluent-ffi" }
|
||||
l10nregistry-ffi = { path = "../../../../intl/l10n/rust/l10nregistry-ffi" }
|
||||
l10nregistry = { git = "https://github.com/mozilla/l10nregistry-rs", rev = "55bf7f826d773303a67d8d7fdab099a04322d4fb" }
|
||||
l10nregistry = { git = "https://github.com/mozilla/l10nregistry-rs", rev = "a69df9836b1ef536727195209013b9ad6b132618" }
|
||||
fluent-fallback = "0.5"
|
||||
localization-ffi = { path = "../../../../intl/l10n/rust/localization-ffi" }
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "DefaultBrowser.h"
|
||||
#include "EventLog.h"
|
||||
#include "Registry.h"
|
||||
#include "SetDefaultBrowser.h"
|
||||
|
||||
#include "wintoastlib.h"
|
||||
|
||||
|
@ -90,6 +91,14 @@ static ULONGLONG GetFollowupNotificationRequestTime() {
|
|||
.valueOr(0);
|
||||
}
|
||||
|
||||
// Returns false if no value is set.
|
||||
static bool GetPrefSetDefaultBrowserUserChoice() {
|
||||
return RegistryGetValueBool(IsPrefixed::Prefixed,
|
||||
L"SetDefaultBrowserUserChoice")
|
||||
.unwrapOr(mozilla::Some(false))
|
||||
.valueOr(false);
|
||||
}
|
||||
|
||||
struct ToastStrings {
|
||||
mozilla::UniquePtr<wchar_t[]> text1;
|
||||
mozilla::UniquePtr<wchar_t[]> text2;
|
||||
|
@ -226,6 +235,35 @@ static bool GetStrings(Strings& strings) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the default browser.
|
||||
*
|
||||
* First check if we can directly write UserChoice, if so attempt that.
|
||||
* If we can't write UserChoice, or if the attempt fails, fall back to
|
||||
* showing the Default Apps page of Settings.
|
||||
*
|
||||
* @param aAumi The AUMI of the installation to set as default.
|
||||
*
|
||||
* @return Success (SUCCEEDED(hr)) if all associations were set with
|
||||
* UserChoice and checked successfully.
|
||||
* Other return codes indicate a failure which causes us to
|
||||
* fall back to Settings, see return codes of
|
||||
* SetDefaultBrowserUserChoice().
|
||||
*/
|
||||
static HRESULT SetDefaultBrowserFromNotification(const wchar_t* aumi) {
|
||||
// TODO maybe fall back to protocol dialog on Windows 11 (bug 1719832)?
|
||||
|
||||
HRESULT hr = E_FAIL;
|
||||
if (GetPrefSetDefaultBrowserUserChoice()) {
|
||||
hr = SetDefaultBrowserUserChoice(aumi);
|
||||
}
|
||||
|
||||
if (FAILED(hr)) {
|
||||
LaunchModernSettingsDialogDefaultApps();
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
// This encapsulates the data that needs to be protected by a mutex because it
|
||||
// will be shared by the main thread and the handler thread.
|
||||
// To ensure the data is only written once, handlerDataHasBeenSet should be
|
||||
|
@ -254,14 +292,15 @@ class ToastHandler : public WinToastLib::IWinToastHandler {
|
|||
NotificationType mWhichNotification;
|
||||
bool mIsLocalizedNotification;
|
||||
HANDLE mEvent;
|
||||
const std::wstring mAumiStr;
|
||||
|
||||
public:
|
||||
ToastHandler(NotificationType whichNotification, bool isEnglishInstall,
|
||||
HANDLE event) {
|
||||
mWhichNotification = whichNotification;
|
||||
mIsLocalizedNotification = !isEnglishInstall;
|
||||
mEvent = event;
|
||||
}
|
||||
HANDLE event, const wchar_t* aumi)
|
||||
: mWhichNotification(whichNotification),
|
||||
mIsLocalizedNotification(!isEnglishInstall),
|
||||
mEvent(event),
|
||||
mAumiStr(aumi) {}
|
||||
|
||||
void FinishHandler(NotificationActivities& returnData) const {
|
||||
SetReturnData(returnData);
|
||||
|
@ -305,6 +344,9 @@ class ToastHandler : public WinToastLib::IWinToastHandler {
|
|||
activitiesPerformed.shown = NotificationShown::Shown;
|
||||
activitiesPerformed.action = NotificationAction::ToastClicked;
|
||||
|
||||
// An activation without clicking a specific button does not clearly
|
||||
// signal that the default should be changed, so just show the settings
|
||||
// dialog instead of SetDefaultBrowserFromNotification().
|
||||
LaunchModernSettingsDialogDefaultApps();
|
||||
|
||||
FinishHandler(activitiesPerformed);
|
||||
|
@ -343,7 +385,8 @@ class ToastHandler : public WinToastLib::IWinToastHandler {
|
|||
// "Make Firefox the default" button, on both the initial and followup
|
||||
// notifications. "Yes" button on the localized notification.
|
||||
activitiesPerformed.action = NotificationAction::MakeFirefoxDefaultButton;
|
||||
LaunchModernSettingsDialogDefaultApps();
|
||||
|
||||
SetDefaultBrowserFromNotification(mAumiStr.c_str());
|
||||
}
|
||||
|
||||
FinishHandler(activitiesPerformed);
|
||||
|
@ -481,7 +524,7 @@ static NotificationActivities ShowNotification(
|
|||
toastTemplate.addAction(toastStrings->action2.get());
|
||||
toastTemplate.setImagePath(absImagePath.get());
|
||||
ToastHandler* handler =
|
||||
new ToastHandler(whichNotification, isEnglishInstall, event.get());
|
||||
new ToastHandler(whichNotification, isEnglishInstall, event.get(), aumi);
|
||||
INT64 id = WinToast::instance()->showToast(toastTemplate, handler, &error);
|
||||
if (id < 0) {
|
||||
LOG_ERROR_MESSAGE(WinToast::strerror(error).c_str());
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
#include "mozilla/WinHeaderOnlyUtils.h"
|
||||
#include "WindowsUserChoice.h"
|
||||
|
||||
|
@ -217,6 +218,11 @@ HRESULT SetDefaultBrowserUserChoice(const wchar_t* aAumi) {
|
|||
return MOZ_E_HASH_CHECK;
|
||||
}
|
||||
|
||||
if (!mozilla::IsWin10CreatorsUpdateOrLater()) {
|
||||
LOG_ERROR_MESSAGE(L"UserChoice hash matched, but Windows build is too old");
|
||||
return MOZ_E_BUILD;
|
||||
}
|
||||
|
||||
auto sid = GetCurrentUserStringSid();
|
||||
if (!sid) {
|
||||
return E_FAIL;
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
* MOZ_E_HASH_CHECK The existing UserChoice Hash could not be verified.
|
||||
* MOZ_E_REJECTED UserChoice was set, but checking the default
|
||||
* did not return our ProgID.
|
||||
* MOZ_E_BUILD The existing UserChoice Hash was verified, but
|
||||
* we're on an older, unsupported Windows build,
|
||||
* so do not attempt to update the UserChoice hash.
|
||||
* E_FAIL other failure
|
||||
*/
|
||||
HRESULT SetDefaultBrowserUserChoice(const wchar_t* aAumi);
|
||||
|
@ -33,5 +36,6 @@ HRESULT SetDefaultBrowserUserChoice(const wchar_t* aAumi);
|
|||
const HRESULT MOZ_E_NO_PROGID = 0xa0000001L;
|
||||
const HRESULT MOZ_E_HASH_CHECK = 0xa0000002L;
|
||||
const HRESULT MOZ_E_REJECTED = 0xa0000003L;
|
||||
const HRESULT MOZ_E_BUILD = 0xa0000004L;
|
||||
|
||||
#endif // DEFAULT_BROWSER_SET_DEFAULT_BROWSER_H__
|
||||
|
|
|
@ -1081,7 +1081,7 @@ nsUnknownContentTypeDialog.prototype = {
|
|||
);
|
||||
this._saveToDiskTimer.initWithCallback(this, 0, nsITimer.TYPE_ONE_SHOT);
|
||||
} else {
|
||||
this.mLauncher.launchWithApplication(this.handleInternally);
|
||||
this.mLauncher.launchWithApplication(this.handleInternally, null);
|
||||
}
|
||||
|
||||
// Update user pref for this mime type (if necessary). We do not
|
||||
|
|
|
@ -42,7 +42,7 @@ DIRS += [
|
|||
if CONFIG['MOZ_SANDBOX']:
|
||||
DIRS += ['/security/sandbox']
|
||||
|
||||
if CONFIG["MOZ_USING_WASM_SANDBOXING"]:
|
||||
if CONFIG["MOZ_USING_WASM_SANDBOXING"] and CONFIG["COMPILE_ENVIRONMENT"]:
|
||||
DIRS += ["/security/rlbox"]
|
||||
|
||||
DIRS += [
|
||||
|
|
|
@ -266,6 +266,8 @@ static const char kPrefDefaultAgentEnabled[] = "default-browser-agent.enabled";
|
|||
static const char kPrefServicesSettingsServer[] = "services.settings.server";
|
||||
static const char kPrefSecurityContentSignatureRootHash[] =
|
||||
"security.content.signature.root_hash";
|
||||
static const char kPrefSetDefaultBrowserUserChoicePref[] =
|
||||
"browser.shell.setDefaultBrowserUserChoice";
|
||||
#endif // defined(MOZ_DEFAULT_BROWSER_AGENT)
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
@ -2133,6 +2135,32 @@ static void OnDefaultAgentTelemetryPrefChanged(const char* aPref, void* aData) {
|
|||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
|
||||
static void OnSetDefaultBrowserUserChoicePrefChanged(const char* aPref,
|
||||
void* aData) {
|
||||
nsresult rv;
|
||||
if (strcmp(aPref, kPrefSetDefaultBrowserUserChoicePref) != 0) {
|
||||
return;
|
||||
}
|
||||
nsAutoString valueName;
|
||||
valueName.AssignLiteral("SetDefaultBrowserUserChoice");
|
||||
rv = PrependRegistryValueName(valueName);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
nsCOMPtr<nsIWindowsRegKey> regKey =
|
||||
do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
nsAutoString keyName;
|
||||
keyName.AppendLiteral(DEFAULT_BROWSER_AGENT_KEY_NAME);
|
||||
rv = regKey->Create(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, keyName,
|
||||
nsIWindowsRegKey::ACCESS_WRITE);
|
||||
|
||||
bool prefVal = Preferences::GetBool(aPref, true);
|
||||
|
||||
rv = regKey->WriteIntValue(valueName, prefVal);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
|
||||
static void OnDefaultAgentRemoteSettingsPrefChanged(const char* aPref,
|
||||
void* aData) {
|
||||
nsresult rv;
|
||||
|
@ -5119,6 +5147,11 @@ nsresult XREMain::XRE_mainRun() {
|
|||
Preferences::RegisterCallbackAndCall(
|
||||
&OnDefaultAgentRemoteSettingsPrefChanged,
|
||||
kPrefSecurityContentSignatureRootHash);
|
||||
|
||||
Preferences::RegisterCallbackAndCall(
|
||||
&OnSetDefaultBrowserUserChoicePrefChanged,
|
||||
kPrefSetDefaultBrowserUserChoicePref);
|
||||
|
||||
SetDefaultAgentLastRunTime();
|
||||
}
|
||||
# endif // defined(MOZ_DEFAULT_BROWSER_AGENT)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/StaticPrefs_browser.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsOSHelperAppService.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
|
@ -511,7 +512,11 @@ nsresult nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
|
|||
}
|
||||
|
||||
mimeInfoMac->SetDefaultApplication(app);
|
||||
mimeInfoMac->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
|
||||
mozilla::StaticPrefs::browser_download_improvements_to_download_panel()
|
||||
? mimeInfoMac->SetPreferredAction(nsIMIMEInfo::saveToDisk)
|
||||
: mimeInfoMac->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
|
||||
} else {
|
||||
mimeInfoMac->SetPreferredAction(nsIMIMEInfo::saveToDisk);
|
||||
}
|
||||
|
|
|
@ -1814,10 +1814,8 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
|||
|
||||
bool alwaysAsk = true;
|
||||
|
||||
// Skip showing UnknownContentType dialog, unless it is explicitly
|
||||
// set in preferences.
|
||||
// Skip showing UnknownContentType dialog by default if the pref is set.
|
||||
bool skipShowingDialog =
|
||||
Preferences::GetBool("browser.download.useDownloadDir") &&
|
||||
StaticPrefs::browser_download_improvements_to_download_panel();
|
||||
|
||||
if (skipShowingDialog) {
|
||||
|
@ -1955,10 +1953,15 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
|||
}
|
||||
|
||||
#endif
|
||||
if (action == nsIMIMEInfo::useHelperApp ||
|
||||
action == nsIMIMEInfo::useSystemDefault ||
|
||||
shouldAutomaticallyHandleInternally) {
|
||||
rv = LaunchWithApplication(shouldAutomaticallyHandleInternally);
|
||||
bool alwaysAskWhereToSave =
|
||||
!Preferences::GetBool("browser.download.useDownloadDir") &&
|
||||
StaticPrefs::browser_download_improvements_to_download_panel();
|
||||
|
||||
if ((action == nsIMIMEInfo::useHelperApp ||
|
||||
action == nsIMIMEInfo::useSystemDefault ||
|
||||
shouldAutomaticallyHandleInternally) &&
|
||||
!alwaysAskWhereToSave) {
|
||||
rv = LaunchWithApplication(shouldAutomaticallyHandleInternally, nullptr);
|
||||
} else {
|
||||
rv = PromptForSaveDestination();
|
||||
}
|
||||
|
@ -2489,7 +2492,9 @@ void nsExternalAppHandler::RequestSaveDestination(
|
|||
NS_IMETHODIMP nsExternalAppHandler::PromptForSaveDestination() {
|
||||
if (mCanceled) return NS_OK;
|
||||
|
||||
mMimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk);
|
||||
if (!StaticPrefs::browser_download_improvements_to_download_panel()) {
|
||||
mMimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk);
|
||||
}
|
||||
|
||||
if (mSuggestedFileName.IsEmpty()) {
|
||||
RequestSaveDestination(mTempLeafName, mTempFileExtension);
|
||||
|
@ -2513,14 +2518,28 @@ nsresult nsExternalAppHandler::ContinueSave(nsIFile* aNewFileLocation) {
|
|||
|
||||
MOZ_ASSERT(aNewFileLocation, "Must be called with a non-null file");
|
||||
|
||||
int32_t action = nsIMIMEInfo::saveToDisk;
|
||||
mMimeInfo->GetPreferredAction(&action);
|
||||
bool shouldAutomaticallyHandleInternally =
|
||||
action == nsIMIMEInfo::handleInternally &&
|
||||
StaticPrefs::browser_download_improvements_to_download_panel();
|
||||
|
||||
if (StaticPrefs::browser_download_improvements_to_download_panel() &&
|
||||
(action == nsIMIMEInfo::useHelperApp ||
|
||||
action == nsIMIMEInfo::useSystemDefault ||
|
||||
shouldAutomaticallyHandleInternally)) {
|
||||
return LaunchWithApplication(shouldAutomaticallyHandleInternally,
|
||||
aNewFileLocation);
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIFile> fileToUse = aNewFileLocation;
|
||||
mFinalFileDestination = fileToUse;
|
||||
|
||||
// Move what we have in the final directory, but append .part
|
||||
// to it, to indicate that it's unfinished. Do not call SetTarget on the
|
||||
// saver if we are done (Finish has been called) but OnSaverComplete has not
|
||||
// been called.
|
||||
// saver if we are done (Finish has been called) but OnSaverComplete has
|
||||
// not been called.
|
||||
if (mFinalFileDestination && mSaver && !mStopRequestIssued) {
|
||||
nsCOMPtr<nsIFile> movedFile;
|
||||
mFinalFileDestination->Clone(getter_AddRefs(movedFile));
|
||||
|
@ -2559,7 +2578,7 @@ nsresult nsExternalAppHandler::ContinueSave(nsIFile* aNewFileLocation) {
|
|||
// LaunchWithApplication should only be called by the helper app dialog which
|
||||
// allows the user to say launch with application or save to disk.
|
||||
NS_IMETHODIMP nsExternalAppHandler::LaunchWithApplication(
|
||||
bool aHandleInternally) {
|
||||
bool aHandleInternally, nsIFile* aNewFileLocation) {
|
||||
if (mCanceled) return NS_OK;
|
||||
|
||||
mHandleInternally = aHandleInternally;
|
||||
|
@ -2591,19 +2610,24 @@ NS_IMETHODIMP nsExternalAppHandler::LaunchWithApplication(
|
|||
// directory as originally downloaded so the download can be renamed in place
|
||||
// later.
|
||||
nsCOMPtr<nsIFile> fileToUse;
|
||||
(void)GetDownloadDirectory(getter_AddRefs(fileToUse));
|
||||
if (aNewFileLocation &&
|
||||
StaticPrefs::browser_download_improvements_to_download_panel()) {
|
||||
fileToUse = aNewFileLocation;
|
||||
} else {
|
||||
(void)GetDownloadDirectory(getter_AddRefs(fileToUse));
|
||||
|
||||
if (mSuggestedFileName.IsEmpty()) {
|
||||
// Keep using the leafname of the temp file, since we're just starting a
|
||||
// helper
|
||||
mSuggestedFileName = mTempLeafName;
|
||||
}
|
||||
if (mSuggestedFileName.IsEmpty()) {
|
||||
// Keep using the leafname of the temp file, since we're just starting a
|
||||
// helper
|
||||
mSuggestedFileName = mTempLeafName;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
fileToUse->Append(mSuggestedFileName + mTempFileExtension);
|
||||
fileToUse->Append(mSuggestedFileName + mTempFileExtension);
|
||||
#else
|
||||
fileToUse->Append(mSuggestedFileName);
|
||||
fileToUse->Append(mSuggestedFileName);
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult rv = fileToUse->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
|
|
@ -134,8 +134,10 @@ interface nsIHelperAppLauncher : nsICancelable
|
|||
* Tell the launcher that we will want to open the file.
|
||||
* NOTE: This will release the reference to the nsIHelperAppLauncherDialog.
|
||||
* @param aHandleInternally TRUE if we should handle opening this internally.
|
||||
* @param aNewFileLocation a preferred location choosen through the File Picker.
|
||||
* Null if going through the fast save without File Picker.
|
||||
*/
|
||||
void launchWithApplication(in boolean aHandleInternally);
|
||||
void launchWithApplication(in boolean aHandleInternally, in nsIFile aFile);
|
||||
|
||||
/**
|
||||
* Callback invoked by nsIHelperAppLauncherDialog::promptForSaveToFileAsync
|
||||
|
|
|
@ -45,6 +45,7 @@ support-files =
|
|||
skip-if = (os == 'mac') || (os == 'android')
|
||||
support-files =
|
||||
file_pdf_application_pdf.pdf
|
||||
[browser_shows_where_to_save_dialog.js]
|
||||
[browser_open_internal_choice_persistence.js]
|
||||
support-files =
|
||||
file_pdf_application_pdf.pdf
|
||||
|
|
|
@ -15,49 +15,28 @@ const TEST_PATH = getRootDirectory(gTestPath).replace(
|
|||
// is actually saved in default Downloads directory.
|
||||
add_task(async function aDownloadLaunchedWithAppIsSavedInDownloadsFolder() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.download.improvements_to_download_panel", true],
|
||||
["browser.download.useDownloadDir", false],
|
||||
],
|
||||
set: [["browser.download.improvements_to_download_panel", true]],
|
||||
});
|
||||
|
||||
let publicList = await Downloads.getList(Downloads.PUBLIC);
|
||||
registerCleanupFunction(async () => {
|
||||
await publicList.removeFinished();
|
||||
});
|
||||
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
|
||||
let downloadFinishedPromise = promiseDownloadFinished(publicList);
|
||||
let initialTabsCount = gBrowser.tabs.length;
|
||||
|
||||
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
TEST_PATH + "file_pdf_application_pdf.pdf"
|
||||
);
|
||||
|
||||
let dialogWindow = await dialogWindowPromise;
|
||||
let doc = dialogWindow.document;
|
||||
let dialog = doc.querySelector("#unknownContentType");
|
||||
let button = dialog.getButton("accept");
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() => !button.disabled,
|
||||
"Wait for Accept button to get enabled"
|
||||
let download = await downloadFinishedPromise;
|
||||
await BrowserTestUtils.waitForCondition(
|
||||
() => gBrowser.tabs.length == initialTabsCount + 2
|
||||
);
|
||||
|
||||
let downloadFinishedPromise = promiseDownloadFinished(publicList);
|
||||
let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);
|
||||
|
||||
button.disabled = false;
|
||||
dialog.acceptDialog();
|
||||
let newTab = await newTabPromise;
|
||||
|
||||
await ContentTask.spawn(newTab.linkedBrowser, null, async () => {
|
||||
await ContentTaskUtils.waitForCondition(
|
||||
() => content.document.readyState == "complete"
|
||||
);
|
||||
});
|
||||
|
||||
let download = await downloadFinishedPromise;
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
BrowserTestUtils.removeTab(loadingTab);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
|
||||
let downloadDir = await DownloadIntegration.getSystemDownloadsDirectory();
|
||||
ok(
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
"https://example.com"
|
||||
);
|
||||
|
||||
// This test ensures that a "Save as..." filepicker dialog is shown for a file
|
||||
// if useDownloadDir ("Always ask where to save files") is set to false
|
||||
add_task(async function aDownloadLaunchedWithAppPromptsForFolder() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.download.improvements_to_download_panel", true],
|
||||
["browser.download.useDownloadDir", false],
|
||||
],
|
||||
});
|
||||
|
||||
let MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
MockFilePicker.init(window);
|
||||
|
||||
let publicList = await Downloads.getList(Downloads.PUBLIC);
|
||||
registerCleanupFunction(async () => {
|
||||
await publicList.removeFinished();
|
||||
MockFilePicker.cleanup();
|
||||
});
|
||||
let filePickerShown = new Promise(resolve => {
|
||||
MockFilePicker.showCallback = function(fp) {
|
||||
ok(true, "filepicker should have been shown");
|
||||
setTimeout(resolve, 0);
|
||||
return Ci.nsIFilePicker.returnCancel;
|
||||
};
|
||||
});
|
||||
|
||||
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
TEST_PATH + "file_txt_attachment_test.txt"
|
||||
);
|
||||
|
||||
await filePickerShown;
|
||||
|
||||
BrowserTestUtils.removeTab(loadingTab);
|
||||
});
|
|
@ -34,6 +34,7 @@
|
|||
#include "ContentHandlerService.h"
|
||||
#include "prenv.h" // for PR_GetEnv()
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs_browser.h"
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -1209,7 +1210,9 @@ already_AddRefed<nsMIMEInfoBase> nsOSHelperAppService::GetFromExtension(
|
|||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mimeInfo->SetDefaultApplication(handlerFile);
|
||||
mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
mozilla::StaticPrefs::browser_download_improvements_to_download_panel()
|
||||
? mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk)
|
||||
: mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
mimeInfo->SetDefaultDescription(handler);
|
||||
}
|
||||
}
|
||||
|
@ -1325,7 +1328,9 @@ already_AddRefed<nsMIMEInfoBase> nsOSHelperAppService::GetFromType(
|
|||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mimeInfo->SetDefaultApplication(handlerFile);
|
||||
mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
StaticPrefs::browser_download_improvements_to_download_panel()
|
||||
? mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk)
|
||||
: mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
mimeInfo->SetDefaultDescription(handler);
|
||||
} else {
|
||||
mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsLocalFile.h"
|
||||
#include "nsIWindowsRegKey.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/StaticPrefs_browser.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
|
||||
|
@ -377,7 +378,9 @@ already_AddRefed<nsMIMEInfoWin> nsOSHelperAppService::GetByExtension(
|
|||
NS_ConvertUTF16toUTF8(Substring(fileExtToUse, 1));
|
||||
ToLowerCase(lowerFileExt);
|
||||
mimeInfo->AppendExtension(lowerFileExt);
|
||||
mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
mozilla::StaticPrefs::browser_download_improvements_to_download_panel()
|
||||
? mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk)
|
||||
: mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
|
||||
nsAutoString appInfo;
|
||||
bool found;
|
||||
|
|
Загрузка…
Ссылка в новой задаче