Merge mozilla-central to mozilla-inbound

--HG--
extra : rebase_source : c88bbe367754bf9270200139dbfd58d70ae1f203
This commit is contained in:
Dorel Luca 2018-09-07 19:38:58 +03:00
Родитель aaed620ced 37663bb870
Коммит 0354a42f2b
36 изменённых файлов: 713 добавлений и 565 удалений

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

@ -118,29 +118,16 @@ testing/gtest/gtest/.*
testing/talos/talos/tests/dromaeo/.*
testing/talos/talos/tests/kraken/.*
testing/talos/talos/tests/v8_7/.*
testing/web-platform/tests/resources/webidl2/.*
third_party/aom/.*
third_party/python/blessings/.*
third_party/python/configobj/.*
third_party/python/futures/.*
third_party/python/jsmin/.*
third_party/python/mock-*/.*
third_party/python/psutil/.*
third_party/python/py/.*
third_party/python/pyasn1/.*
third_party/python/pyasn1-modules/.*
third_party/python/PyECC/.*
third_party/python/pytest/.*
third_party/python/pytoml/.*
third_party/python/pyyaml/.*
third_party/python/redo/.*
third_party/python/requests/.*
third_party/python/rsa/.*
third_party/python/six/.*
third_party/python/which/.*
third_party/msgpack/.*
third_party/prio/.*
third_party/python/.*
third_party/rust/.*
toolkit/components/jsoncpp/.*
toolkit/components/protobuf/.*
toolkit/components/url-classifier/chromium/.*
toolkit/components/url-classifier/protobuf/.*
toolkit/crashreporter/google-breakpad/.*
toolkit/recordreplay/udis86/.*
tools/fuzzing/libfuzzer/.*

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

@ -109,7 +109,6 @@ support-files =
[browser_urlbarRaceWithTabs.js]
[browser_urlbarRevert.js]
[browser_urlbarSearchFunction.js]
skip-if = true # Bug 1482494
[browser_urlbarSearchSingleWordNotification.js]
[browser_urlbarSearchSuggestions.js]
support-files =

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

@ -6,8 +6,12 @@
"use strict";
add_task(async function init() {
// Run this in a new tab, to ensure all the locationchange notifications have
// fired.
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
let which = gURLBar._whichSearchSuggestionsNotification || undefined;
registerCleanupFunction(async function() {
BrowserTestUtils.removeTab(tab);
// Reset the search suggestions notification.
if (which === undefined) {
delete gURLBar._whichSearchSuggestionsNotification;

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

@ -14,8 +14,9 @@
"cxx": "cl.exe",
"ml": "ml64.exe",
"patches": [
"loosen-msvc-detection.patch",
"workaround-issue38586.patch",
"r339636.patch"
"r339636.patch",
"r341035.patch",
"loosen-msvc-detection.patch"
]
}

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

@ -0,0 +1,395 @@
Index: lld/COFF/Driver.cpp
===================================================================
--- a/lld/COFF/Driver.cpp (revision 341034)
+++ b/lld/COFF/Driver.cpp (revision 341035)
@@ -116,6 +116,19 @@
});
}
+// Symbol names are mangled by prepending "_" on x86.
+static StringRef mangle(StringRef Sym) {
+ assert(Config->Machine != IMAGE_FILE_MACHINE_UNKNOWN);
+ if (Config->Machine == I386)
+ return Saver.save("_" + Sym);
+ return Sym;
+}
+
+static bool findUnderscoreMangle(StringRef Sym) {
+ StringRef Entry = Symtab->findMangle(mangle(Sym));
+ return !Entry.empty() && !isa<Undefined>(Symtab->find(Entry));
+}
+
MemoryBufferRef LinkerDriver::takeBuffer(std::unique_ptr<MemoryBuffer> MB) {
MemoryBufferRef MBRef = *MB;
make<std::unique_ptr<MemoryBuffer>>(std::move(MB)); // take ownership
@@ -407,14 +420,6 @@
return B;
}
-// Symbol names are mangled by appending "_" prefix on x86.
-StringRef LinkerDriver::mangle(StringRef Sym) {
- assert(Config->Machine != IMAGE_FILE_MACHINE_UNKNOWN);
- if (Config->Machine == I386)
- return Saver.save("_" + Sym);
- return Sym;
-}
-
// Windows specific -- find default entry point name.
//
// There are four different entry point functions for Windows executables,
@@ -421,31 +426,23 @@
// each of which corresponds to a user-defined "main" function. This function
// infers an entry point from a user-defined "main" function.
StringRef LinkerDriver::findDefaultEntry() {
+ assert(Config->Subsystem != IMAGE_SUBSYSTEM_UNKNOWN &&
+ "must handle /subsystem before calling this");
+
// As a special case, if /nodefaultlib is given, we directly look for an
// entry point. This is because, if no default library is linked, users
// need to define an entry point instead of a "main".
- if (Config->NoDefaultLibAll) {
- for (StringRef S : {"mainCRTStartup", "wmainCRTStartup",
- "WinMainCRTStartup", "wWinMainCRTStartup"}) {
- StringRef Entry = Symtab->findMangle(S);
- if (!Entry.empty() && !isa<Undefined>(Symtab->find(Entry)))
- return mangle(S);
- }
- return "";
+ bool FindMain = !Config->NoDefaultLibAll;
+ if (Config->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
+ if (findUnderscoreMangle(FindMain ? "WinMain" : "WinMainCRTStartup"))
+ return mangle("WinMainCRTStartup");
+ if (findUnderscoreMangle(FindMain ? "wWinMain" : "wWinMainCRTStartup"))
+ return mangle("wWinMainCRTStartup");
}
-
- // User-defined main functions and their corresponding entry points.
- static const char *Entries[][2] = {
- {"main", "mainCRTStartup"},
- {"wmain", "wmainCRTStartup"},
- {"WinMain", "WinMainCRTStartup"},
- {"wWinMain", "wWinMainCRTStartup"},
- };
- for (auto E : Entries) {
- StringRef Entry = Symtab->findMangle(mangle(E[0]));
- if (!Entry.empty() && !isa<Undefined>(Symtab->find(Entry)))
- return mangle(E[1]);
- }
+ if (findUnderscoreMangle(FindMain ? "main" : "mainCRTStartup"))
+ return mangle("mainCRTStartup");
+ if (findUnderscoreMangle(FindMain ? "wmain" : "wmainCRTStartup"))
+ return mangle("wmainCRTStartup");
return "";
}
@@ -452,9 +449,9 @@
WindowsSubsystem LinkerDriver::inferSubsystem() {
if (Config->DLL)
return IMAGE_SUBSYSTEM_WINDOWS_GUI;
- if (Symtab->findUnderscore("main") || Symtab->findUnderscore("wmain"))
+ if (findUnderscoreMangle("main") || findUnderscoreMangle("wmain"))
return IMAGE_SUBSYSTEM_WINDOWS_CUI;
- if (Symtab->findUnderscore("WinMain") || Symtab->findUnderscore("wWinMain"))
+ if (findUnderscoreMangle("WinMain") || findUnderscoreMangle("wWinMain"))
return IMAGE_SUBSYSTEM_WINDOWS_GUI;
return IMAGE_SUBSYSTEM_UNKNOWN;
}
@@ -1335,25 +1332,6 @@
error("/dynamicbase:no is not compatible with " +
machineToStr(Config->Machine));
- // Handle /entry and /dll
- if (auto *Arg = Args.getLastArg(OPT_entry)) {
- Config->Entry = addUndefined(mangle(Arg->getValue()));
- } else if (!Config->Entry && !Config->NoEntry) {
- if (Args.hasArg(OPT_dll)) {
- StringRef S = (Config->Machine == I386) ? "__DllMainCRTStartup@12"
- : "_DllMainCRTStartup";
- Config->Entry = addUndefined(S);
- } else {
- // Windows specific -- If entry point name is not given, we need to
- // infer that from user-defined entry name.
- StringRef S = findDefaultEntry();
- if (S.empty())
- fatal("entry point must be defined");
- Config->Entry = addUndefined(S);
- log("Entry name inferred: " + S);
- }
- }
-
// Handle /export
for (auto *Arg : Args.filtered(OPT_export)) {
Export E = parseExport(Arg->getValue());
@@ -1379,6 +1357,34 @@
return;
}
+ // Windows specific -- if no /subsystem is given, we need to infer
+ // that from entry point name. Must happen before /entry handling,
+ // and after the early return when just writing an import library.
+ if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) {
+ Config->Subsystem = inferSubsystem();
+ if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
+ fatal("subsystem must be defined");
+ }
+
+ // Handle /entry and /dll
+ if (auto *Arg = Args.getLastArg(OPT_entry)) {
+ Config->Entry = addUndefined(mangle(Arg->getValue()));
+ } else if (!Config->Entry && !Config->NoEntry) {
+ if (Args.hasArg(OPT_dll)) {
+ StringRef S = (Config->Machine == I386) ? "__DllMainCRTStartup@12"
+ : "_DllMainCRTStartup";
+ Config->Entry = addUndefined(S);
+ } else {
+ // Windows specific -- If entry point name is not given, we need to
+ // infer that from user-defined entry name.
+ StringRef S = findDefaultEntry();
+ if (S.empty())
+ fatal("entry point must be defined");
+ Config->Entry = addUndefined(S);
+ log("Entry name inferred: " + S);
+ }
+ }
+
// Handle /delayload
for (auto *Arg : Args.filtered(OPT_delayload)) {
Config->DelayLoads.insert(StringRef(Arg->getValue()).lower());
@@ -1491,14 +1497,6 @@
if (errorCount())
return;
- // Windows specific -- if no /subsystem is given, we need to infer
- // that from entry point name.
- if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) {
- Config->Subsystem = inferSubsystem();
- if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
- fatal("subsystem must be defined");
- }
-
// Handle /safeseh.
if (Args.hasFlag(OPT_safeseh, OPT_safeseh_no, false)) {
for (ObjFile *File : ObjFile::Instances)
Index: lld/COFF/Driver.h
===================================================================
--- a/lld/COFF/Driver.h (revision 341034)
+++ b/lld/COFF/Driver.h (revision 341035)
@@ -103,7 +103,6 @@
std::set<std::string> VisitedLibs;
Symbol *addUndefined(StringRef Sym);
- StringRef mangle(StringRef Sym);
// Windows specific -- "main" is not the only main function in Windows.
// You can choose one from these four -- {w,}{WinMain,main}.
Index: lld/test/COFF/entry-inference332.test
===================================================================
--- a/lld/test/COFF/entry-inference332.test (nonexistent)
+++ b/lld/test/COFF/entry-inference332.test (revision 341035)
@@ -0,0 +1,39 @@
+# RUN: sed -e s/ENTRYNAME/_mainCRTStartup/ %s | yaml2obj > %t.obj
+# RUN: lld-link /subsystem:console /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1
+# RUN: FileCheck %s < %t.log
+
+# RUN: sed -e s/ENTRYNAME/?mainCRTStartup@@YAHXZ/ %s | yaml2obj > %t.obj
+# RUN: lld-link /subsystem:console /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1
+# RUN: FileCheck %s < %t.log
+
+# CHECK: Entry name inferred: _mainCRTStartup
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: []
+sections:
+ - Name: .text
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: B82A000000C3
+symbols:
+ - Name: .text
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 6
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: "ENTRYNAME"
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
Index: lld/test/COFF/entry-inference3.test
===================================================================
--- a/lld/test/COFF/entry-inference3.test (revision 341034)
+++ b/lld/test/COFF/entry-inference3.test (revision 341035)
@@ -1,7 +1,11 @@
-# RUN: yaml2obj < %s > %t.obj
-# RUN: not lld-link /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1
+# RUN: sed -e s/ENTRYNAME/mainCRTStartup/ %s | yaml2obj > %t.obj
+# RUN: lld-link /subsystem:console /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1
# RUN: FileCheck %s < %t.log
+# RUN: sed -e s/ENTRYNAME/?mainCRTStartup@@YAHXZ/ %s | yaml2obj > %t.obj
+# RUN: lld-link /subsystem:console /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1
+# RUN: FileCheck %s < %t.log
+
# CHECK: Entry name inferred: mainCRTStartup
--- !COFF
@@ -26,7 +30,7 @@
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
- - Name: mainCRTStartup
+ - Name: "ENTRYNAME"
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Index: lld/test/COFF/subsystem-inference32.test
===================================================================
--- a/lld/test/COFF/subsystem-inference32.test (nonexistent)
+++ b/lld/test/COFF/subsystem-inference32.test (revision 341035)
@@ -0,0 +1,74 @@
+# RUN: sed -e s/ENTRYNAME/_main/ %s | yaml2obj > %t.obj
+# RUN: lld-link /out:%t.exe %t.obj
+# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=MAIN %s
+
+# RUN: sed s/ENTRYNAME/_wmain/ %s | yaml2obj > %t.obj
+# RUN: lld-link /out:%t.exe %t.obj
+# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WMAIN %s
+
+# RUN: sed s/ENTRYNAME/_WinMain@16/ %s | yaml2obj > %t.obj
+# RUN: lld-link /out:%t.exe %t.obj
+# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WINMAIN %s
+
+# RUN: sed s/ENTRYNAME/_wWinMain@16/ %s | yaml2obj > %t.obj
+# RUN: lld-link /out:%t.exe %t.obj
+# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WWINMAIN %s
+
+# MAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
+# WMAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
+# WINMAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI
+# WWINMAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: []
+sections:
+ - Name: .text
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: B82A000000C3
+symbols:
+ - Name: .text
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 6
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: ENTRYNAME
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: _mainCRTStartup
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: _wmainCRTStartup
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: _WinMainCRTStartup
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: _wWinMainCRTStartup
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
Index: lld/test/COFF/entry-inference4.test
===================================================================
--- a/lld/test/COFF/entry-inference4.test (nonexistent)
+++ b/lld/test/COFF/entry-inference4.test (revision 341035)
@@ -0,0 +1,56 @@
+# RUN: sed 's/ENTRY1/WinMain/;s/ENTRY2/main/' %s | yaml2obj > %t.obj
+# RUN: not lld-link /subsystem:windows /out:%t.exe %t.obj > %t.log 2>&1
+# RUN: FileCheck -check-prefix=WINMAIN %s < %t.log
+
+# RUN: sed 's/ENTRY1/wWinMain/;s/ENTRY2/main/' %s | yaml2obj > %t.obj
+# RUN: not lld-link /subsystem:windows /out:%t.exe %t.obj > %t.log 2>&1
+# RUN: FileCheck -check-prefix=WWINMAIN %s < %t.log
+
+# RUN: sed 's/ENTRY1/WinMain/;s/ENTRY2/main/' %s | yaml2obj > %t.obj
+# RUN: not lld-link /subsystem:console /out:%t.exe %t.obj > %t.log 2>&1
+# RUN: FileCheck -check-prefix=MAIN %s < %t.log
+
+# RUN: sed 's/ENTRY1/WinMain/;s/ENTRY2/wmain/' %s | yaml2obj > %t.obj
+# RUN: not lld-link /subsystem:console /out:%t.exe %t.obj > %t.log 2>&1
+# RUN: FileCheck -check-prefix=WMAIN %s < %t.log
+
+# MAIN: error: <root>: undefined symbol: mainCRTStartup
+# WMAIN: error: <root>: undefined symbol: wmainCRTStartup
+# WINMAIN: error: <root>: undefined symbol: WinMainCRTStartup
+# WWINMAIN: error: <root>: undefined symbol: wWinMainCRTStartup
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: []
+sections:
+ - Name: .text
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: B82A000000C3
+symbols:
+ - Name: .text
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 6
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: ENTRY1
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: ENTRY2
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...

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

@ -162,9 +162,12 @@ class FontPropertyValue extends PureComponent {
* Change event.
*/
onChange(e) {
// Regular expresion to check for positive floating point or integer numbers.
// Regular expresion to check for floating point or integer numbers. Accept negative
// numbers only if the min value is negative. Otherwise, expect positive numbers.
// Whitespace and non-digit characters are invalid (aside from a single dot).
const regex = /^[0-9]+(.[0-9]+)?$/;
const regex = (this.props.min && this.props.min < 0)
? /^-?[0-9]+(.[0-9]+)?$/
: /^[0-9]+(.[0-9]+)?$/;
let string = e.target.value.trim();
if (e.target.validity.badInput) {
@ -190,7 +193,6 @@ class FontPropertyValue extends PureComponent {
return;
}
// Catch any negative or irrational numbers.
if (!regex.test(string)) {
return;
}

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

@ -55,7 +55,7 @@ class RequestListColumnDomain extends Component {
onMouseDown: onSecurityIconMouseDown,
title: iconTitle,
}),
item.isTrackingResource && div({
item.isThirdPartyTrackingResource && div({
className: "tracking-resource",
title: L10N.getStr("netmonitor.trackingResource.tooltip"),
}),

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

@ -71,7 +71,7 @@ class FirefoxDataProvider {
startedDateTime,
fromCache,
fromServiceWorker,
isTrackingResource,
isThirdPartyTrackingResource,
} = data;
if (this.actionsEnabled && this.actions.addRequest) {
@ -90,7 +90,7 @@ class FirefoxDataProvider {
fromCache,
fromServiceWorker,
isTrackingResource,
isThirdPartyTrackingResource,
}, true);
}
@ -325,7 +325,7 @@ class FirefoxDataProvider {
url,
},
startedDateTime,
isTrackingResource,
isThirdPartyTrackingResource,
} = networkInfo;
await this.addRequest(actor, {
@ -336,7 +336,7 @@ class FirefoxDataProvider {
method,
startedDateTime,
url,
isTrackingResource,
isThirdPartyTrackingResource,
});
this.emit(EVENTS.NETWORK_EVENT, actor);

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

@ -146,7 +146,7 @@ const UPDATE_PROPS = [
"responseCacheAvailable",
"formDataSections",
"stacktrace",
"isTrackingResource",
"isThirdPartyTrackingResource",
];
const PANELS = {

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

@ -6,7 +6,7 @@
const { UrlClassifierTestUtils } =
ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
const TEST_URI = "http://tracking.example.org/browser/devtools/client/" +
const TEST_URI = "http://example.com/browser/devtools/client/" +
"netmonitor/test/html_tracking-protection.html";
registerCleanupFunction(function() {
@ -19,7 +19,7 @@ registerCleanupFunction(function() {
add_task(async function() {
await UrlClassifierTestUtils.addTestTrackers();
const { tab, monitor } = await initNetMonitor(TEST_URI);
const { monitor, tab } = await initNetMonitor(TEST_URI);
info("Starting test...");
const { document, store, windowRequire } = monitor.panelWin;
@ -27,10 +27,8 @@ add_task(async function() {
store.dispatch(Actions.batchEnable(false));
// Reload the page
const wait = waitForAllRequestsFinished(monitor);
tab.linkedBrowser.reload();
await wait;
// Execute request with third party tracking protection flag.
await performRequests(monitor, tab, 1);
const requests = document.querySelectorAll(".request-list-item .tracking-resource");
is(requests.length, 1, "There should be one tracking request");

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

@ -7,6 +7,15 @@
<meta charset="utf8">
</head>
<body>
<iframe src="http://tracking.example.com/"></iframe>
<script type="text/javascript">
/* exported performRequests */
"use strict";
function performRequests() {
const xhr = new XMLHttpRequest();
xhr.open("GET", "http://tracking.example.org/", true);
xhr.send(null);
}
</script>
</body>
</html>

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

@ -41,6 +41,7 @@ tags = usercontextid
[browser_storage_cookies_domain_port.js]
[browser_storage_cookies_edit.js]
[browser_storage_cookies_edit_keyboard.js]
[browser_storage_cookies_hostOnly.js]
[browser_storage_cookies_samesite.js]
skip-if = true # Bug 1448484 - sameSite1 is "Unset" - Got undefined, expected Unset
[browser_storage_cookies_tab_navigation.js]

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

@ -0,0 +1,26 @@
/* 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/. */
"use strict";
// Test that the HostOnly values displayed in the table are correct.
add_task(async function() {
await openTabAndSetupStorage(MAIN_DOMAIN + "storage-complex-values.html");
gUI.tree.expandAll();
showColumn("hostOnly", true);
const c1id = getCookieId("c1", "test1.example.org", "/browser");
await selectTableItem(c1id);
checkCell(c1id, "hostOnly", "true");
const c2id = getCookieId("cs2", ".example.org", "/");
await selectTableItem(c2id);
checkCell(c2id, "hostOnly", "false");
await finishTests();
});

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

@ -51,9 +51,9 @@ const COOKIE_KEY_MAP = {
path: "Path",
host: "Domain",
expires: "Expires",
hostOnly: "HostOnly",
isSecure: "Secure",
isHttpOnly: "HttpOnly",
isDomain: "HostOnly",
creationTime: "CreationTime",
lastAccessed: "LastAccessed"
};
@ -755,8 +755,7 @@ class StorageUI {
}
const cookieProp = COOKIE_KEY_MAP[prop] || prop;
// The pseduo property of HostOnly refers to converse of isDomain property
rawObject[cookieProp] = (prop === "isDomain") ? !item[prop] : item[prop];
rawObject[cookieProp] = item[prop];
}
itemVar.populate(rawObject, {sorted: true});
itemVar.twisty = true;

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

@ -266,7 +266,7 @@ stubPackets.set(`GET request`, {
"timings": {},
"updates": [],
"private": false,
"isTrackingResource": false,
"isThirdPartyTrackingResource": false,
"from": "server1.conn0.child1/consoleActor2"
});
@ -318,7 +318,7 @@ stubPackets.set(`XHR GET request`, {
"timings": {},
"updates": [],
"private": false,
"isTrackingResource": false,
"isThirdPartyTrackingResource": false,
"from": "server1.conn1.child1/consoleActor2"
});
@ -370,7 +370,7 @@ stubPackets.set(`XHR POST request`, {
"timings": {},
"updates": [],
"private": false,
"isTrackingResource": false,
"isThirdPartyTrackingResource": false,
"from": "server1.conn2.child1/consoleActor2"
});

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

@ -65,7 +65,7 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
fromCache: this._fromCache,
fromServiceWorker: this._fromServiceWorker,
private: this._private,
isTrackingResource: this._isTrackingResource,
isThirdPartyTrackingResource: this._isThirdPartyTrackingResource,
};
},
@ -104,7 +104,7 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
this._cause = networkEvent.cause;
this._fromCache = networkEvent.fromCache;
this._fromServiceWorker = networkEvent.fromServiceWorker;
this._isTrackingResource = networkEvent.isTrackingResource;
this._isThirdPartyTrackingResource = networkEvent.isThirdPartyTrackingResource;
this._channelId = networkEvent.channelId;
// Stack trace info isn't sent automatically. The client

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

@ -494,7 +494,7 @@ NetworkObserver.prototype = {
.toISOString();
event.fromCache = fromCache;
event.fromServiceWorker = fromServiceWorker;
event.isTrackingResource = channel.isTrackingResource;
event.isThirdPartyTrackingResource = channel.isThirdPartyTrackingResource;
httpActivity.fromServiceWorker = fromServiceWorker;
if (extraStringData) {

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

@ -561,7 +561,7 @@ StorageActors.createActor({
// - do -
lastAccessed: cookie.lastAccessed / 1000,
value: new LongStringActor(this.conn, cookie.value || ""),
isDomain: cookie.isDomain,
hostOnly: !cookie.isDomain,
isSecure: cookie.isSecure,
isHttpOnly: cookie.isHttpOnly,
sameSite: this.getSameSiteStringFromCookie(cookie)
@ -686,7 +686,7 @@ StorageActors.createActor({
{ name: "lastAccessed", editable: false, hidden: false },
{ name: "creationTime", editable: false, hidden: true },
{ name: "value", editable: true, hidden: false },
{ name: "isDomain", editable: false, hidden: true },
{ name: "hostOnly", editable: false, hidden: true },
{ name: "isSecure", editable: true, hidden: true },
{ name: "isHttpOnly", editable: true, hidden: false },
{ name: "sameSite", editable: false, hidden: false }

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

@ -19,7 +19,7 @@ const TESTDATA = {
expires: 0,
path: "/",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: false,
},
{
@ -28,7 +28,7 @@ const TESTDATA = {
expires: 0,
path: "/path2/",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: false,
},
{
@ -37,7 +37,7 @@ const TESTDATA = {
expires: 0,
path: "/path3/",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: false,
}
]
@ -89,7 +89,7 @@ var testCookiesObjects = async function(index, hosts, cookiesActor) {
is(item.path, toMatch.path, "The path matches.");
is(item.host, toMatch.host, "The host matches.");
is(item.isSecure, toMatch.isSecure, "The isSecure value matches.");
is(item.isDomain, toMatch.isDomain, "The isDomain value matches.");
is(item.hostOnly, toMatch.hostOnly, "The hostOnly value matches.");
break;
}
}

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

@ -17,7 +17,7 @@ const storeMap = {
expires: 2000000000000,
path: "/browser",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: false,
},
{
@ -26,7 +26,7 @@ const storeMap = {
path: "/",
host: ".example.org",
expires: 0,
isDomain: true,
hostOnly: false,
isSecure: false,
},
{
@ -35,7 +35,7 @@ const storeMap = {
expires: 2000000001000,
path: "/",
host: "test1.example.org",
isDomain: false,
hostOnly: true,
isSecure: true,
}
],
@ -47,7 +47,7 @@ const storeMap = {
path: "/",
host: ".example.org",
expires: 0,
isDomain: true,
hostOnly: false,
isSecure: false,
},
{
@ -56,7 +56,7 @@ const storeMap = {
path: "/browser/devtools/server/tests/browser/",
host: "sectest1.example.org",
expires: 0,
isDomain: false,
hostOnly: true,
isSecure: false,
}
],
@ -68,7 +68,7 @@ const storeMap = {
host: ".example.org",
path: "/",
expires: 0,
isDomain: true,
hostOnly: false,
isSecure: true,
},
{
@ -77,7 +77,7 @@ const storeMap = {
path: "/",
host: ".example.org",
expires: 0,
isDomain: true,
hostOnly: false,
isSecure: false,
},
{
@ -86,7 +86,7 @@ const storeMap = {
path: "/browser/devtools/server/tests/browser/",
host: "sectest1.example.org",
expires: 0,
isDomain: false,
hostOnly: true,
isSecure: false,
}
]
@ -372,7 +372,7 @@ var testCookiesObjects = async function(index, hosts, cookiesActor) {
is(item.path, toMatch.path, "The path matches.");
is(item.host, toMatch.host, "The host matches.");
is(item.isSecure, toMatch.isSecure, "The isSecure value matches.");
is(item.isDomain, toMatch.isDomain, "The isDomain value matches.");
is(item.hostOnly, toMatch.hostOnly, "The hostOnly value matches.");
break;
}
}

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

@ -45,7 +45,7 @@ types.addDictType("cookieobject", {
value: "longstring",
path: "nullable:string",
host: "string",
isDomain: "boolean",
hostOnly: "boolean",
isSecure: "boolean",
isHttpOnly: "boolean",
creationTime: "number",

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

@ -111,7 +111,7 @@ WebConsoleClient.prototype = {
private: actor.private,
fromCache: actor.fromCache,
fromServiceWorker: actor.fromServiceWorker,
isTrackingResource: actor.isTrackingResource,
isThirdPartyTrackingResource: actor.isThirdPartyTrackingResource,
};
this._networkRequests.set(actor.actor, networkInfo);

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

@ -2,26 +2,29 @@
#include "nsUnicharUtils.h"
namespace {
static inline bool IsHTTPTokenPoint(const char16_t c) {
template<typename char_type>
static inline bool IsHTTPTokenPoint(const char_type c) {
return c == '!' || c == '#' || c == '$' || c == '%' || c == '&' ||
c == '\'' || c == '*' || c == '+' || c == '-' || c == '.' ||
c == '^' || c == '_' || c == '`' || c == '|' || c == '~' ||
mozilla::IsAsciiAlphanumeric(c);
}
static inline bool IsHTTPQuotedStringTokenPoint(const char16_t c) {
return c == 0x9 || (c >= ' ' && c <= '~') || (c >= 0x80 && c <= 0xFF);
template<typename char_type>
static inline bool IsHTTPQuotedStringTokenPoint(const char_type c) {
return c == 0x9 || (c >= ' ' && c <= '~') || mozilla::IsNonAsciiLatin1(c);
}
}
/* static */ mozilla::UniquePtr<MimeType>
MimeType::Parse(const nsAString& aMimeType)
template<typename char_type>
/* static */ mozilla::UniquePtr<TMimeType<char_type>>
TMimeType<char_type>::Parse(const nsTSubstring<char_type>& aMimeType)
{
// See https://mimesniff.spec.whatwg.org/#parsing-a-mime-type
// Steps 1-2
const char16_t* pos = aMimeType.BeginReading();
const char16_t* end = aMimeType.EndReading();
const char_type* pos = aMimeType.BeginReading();
const char_type* end = aMimeType.EndReading();
while (pos < end && mozilla::IsAsciiWhitespace(*pos)) {
++pos;
}
@ -33,14 +36,14 @@ MimeType::Parse(const nsAString& aMimeType)
}
// Steps 3-4
const char16_t* typeStart = pos;
const char_type* typeStart = pos;
while (pos < end && *pos != '/') {
if (!IsHTTPTokenPoint(*pos)) {
return nullptr;
}
++pos;
}
const char16_t* typeEnd = pos;
const char_type* typeEnd = pos;
if (typeStart == typeEnd) {
return nullptr;
}
@ -54,8 +57,8 @@ MimeType::Parse(const nsAString& aMimeType)
++pos;
// Step 7-9
const char16_t* subtypeStart = pos;
const char16_t* subtypeEnd = nullptr;
const char_type* subtypeStart = pos;
const char_type* subtypeEnd = nullptr;
while (pos < end && *pos != ';') {
if (!IsHTTPTokenPoint(*pos)) {
// If we hit a whitespace, check that the rest of
@ -84,15 +87,15 @@ MimeType::Parse(const nsAString& aMimeType)
}
// Step 10
nsString type;
nsString subtype;
for (const char16_t* c = typeStart; c < typeEnd; ++c) {
nsTString<char_type> type;
nsTString<char_type> subtype;
for (const char_type* c = typeStart; c < typeEnd; ++c) {
type.Append(ToLowerCaseASCII(*c));
}
for (const char16_t* c = subtypeStart; c < subtypeEnd; ++c) {
for (const char_type* c = subtypeStart; c < subtypeEnd; ++c) {
subtype.Append(ToLowerCaseASCII(*c));
}
mozilla::UniquePtr<MimeType> mimeType(mozilla::MakeUnique<MimeType>(type, subtype));
mozilla::UniquePtr<TMimeType<char_type>> mimeType(mozilla::MakeUnique<TMimeType<char_type>>(type, subtype));
// Step 11
while (pos < end) {
@ -105,7 +108,7 @@ MimeType::Parse(const nsAString& aMimeType)
}
// Steps 11.3 and 11.4
nsString paramName;
nsTString<char_type> paramName;
bool paramNameHadInvalidChars = false;
while (pos < end && *pos != ';' && *pos != '=') {
if (!IsHTTPTokenPoint(*pos)) {
@ -186,7 +189,7 @@ MimeType::Parse(const nsAString& aMimeType)
} else {
const char16_t* paramValueStart = pos;
const char_type* paramValueStart = pos;
// Step 11.7.2.1
while (pos < end && *pos != ';') {
@ -200,13 +203,13 @@ MimeType::Parse(const nsAString& aMimeType)
}
// Step 11.7.2.2
const char16_t* paramValueEnd = pos - 1;
const char_type* paramValueEnd = pos - 1;
while (paramValueEnd >= paramValueStart &&
mozilla::IsAsciiWhitespace(*paramValueEnd)) {
--paramValueEnd;
}
for (const char16_t* c = paramValueStart; c <= paramValueEnd; ++c) {
for (const char_type* c = paramValueStart; c <= paramValueEnd; ++c) {
paramValue.Append(*c);
}
}
@ -224,33 +227,74 @@ MimeType::Parse(const nsAString& aMimeType)
return mimeType;
}
template<typename char_type>
void
MimeType::Serialize(nsAString& aOutput) const
TMimeType<char_type>::Serialize(nsTSubstring<char_type>& aOutput) const
{
aOutput.Assign(mType);
aOutput.AppendLiteral("/");
aOutput.Append(mSubtype);
for (uint32_t i = 0; i < mParameterNames.Length(); i++) {
auto name = mParameterNames[i];
ParameterValue value;
mParameters.Get(name, &value);
aOutput.AppendLiteral(";");
aOutput.Append(name);
aOutput.AppendLiteral("=");
if (value.mRequiresQuoting) {
aOutput.AppendLiteral("\"");
const char16_t* vcur = value.BeginReading();
const char16_t* vend = value.EndReading();
while (vcur < vend) {
if (*vcur == '"' || *vcur == '\\') {
aOutput.AppendLiteral("\\");
}
aOutput.Append(*vcur);
vcur++;
}
aOutput.AppendLiteral("\"");
} else {
aOutput.Append(value);
}
GetParameterValue(name, aOutput, true);
}
}
template<typename char_type>
void
TMimeType<char_type>::GetFullType(nsTSubstring<char_type>& aOutput) const
{
aOutput.Assign(mType);
aOutput.AppendLiteral("/");
aOutput.Append(mSubtype);
}
template<typename char_type>
bool
TMimeType<char_type>::GetParameterValue(const nsTSubstring<char_type>& aName,
nsTSubstring<char_type>& aOutput,
bool aAppend) const
{
if (!aAppend) {
aOutput.Truncate();
}
ParameterValue value;
if (!mParameters.Get(aName, &value)) {
return false;
}
if (value.mRequiresQuoting) {
aOutput.AppendLiteral("\"");
const char_type* vcur = value.BeginReading();
const char_type* vend = value.EndReading();
while (vcur < vend) {
if (*vcur == '"' || *vcur == '\\') {
aOutput.AppendLiteral("\\");
}
aOutput.Append(*vcur);
vcur++;
}
aOutput.AppendLiteral("\"");
} else {
aOutput.Append(value);
}
return true;
}
template mozilla::UniquePtr<TMimeType<char16_t>> TMimeType<char16_t>::Parse(const nsTSubstring<char16_t>& aMimeType);
template mozilla::UniquePtr<TMimeType<char>> TMimeType<char>::Parse(const nsTSubstring<char>& aMimeType);
template void TMimeType<char16_t>::Serialize(nsTSubstring<char16_t>& aOutput) const;
template void TMimeType<char>::Serialize(nsTSubstring<char>& aOutput) const;
template void TMimeType<char16_t>::GetFullType(nsTSubstring<char16_t>& aOutput) const;
template void TMimeType<char>::GetFullType(nsTSubstring<char>& aOutput) const;
template bool TMimeType<char16_t>::GetParameterValue(const nsTSubstring<char16_t>& aName,
nsTSubstring<char16_t>& aOutput,
bool aAppend) const;
template bool TMimeType<char>::GetParameterValue(const nsTSubstring<char>& aName,
nsTSubstring<char>& aOutput,
bool aAppend) const;

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

@ -12,10 +12,15 @@
#include "nsDataHashtable.h"
#include "nsTArray.h"
class MimeType final
template<typename char_type> struct HashKeyType;
template<> struct HashKeyType<char16_t> { typedef nsStringHashKey HashType; };
template<> struct HashKeyType<char> { typedef nsCStringHashKey HashType; };
template <typename char_type>
class TMimeType final
{
private:
class ParameterValue : public nsString
class ParameterValue : public nsTString<char_type>
{
public:
bool mRequiresQuoting;
@ -25,18 +30,34 @@ private:
{}
};
nsString mType;
nsString mSubtype;
nsDataHashtable<nsStringHashKey, ParameterValue> mParameters;
nsTArray<nsString> mParameterNames;
nsTString<char_type> mType;
nsTString<char_type> mSubtype;
nsDataHashtable<typename HashKeyType<char_type>::HashType, ParameterValue> mParameters;
nsTArray<nsTString<char_type>> mParameterNames;
public:
MimeType(const nsAString& aType, const nsAString& aSubtype)
TMimeType(const nsTSubstring<char_type>& aType, const nsTSubstring<char_type>& aSubtype)
: mType(aType), mSubtype(aSubtype)
{}
static mozilla::UniquePtr<MimeType> Parse(const nsAString& aStr);
void Serialize(nsAString& aStr) const;
static mozilla::UniquePtr<TMimeType<char_type>> Parse(const nsTSubstring<char_type>& aStr);
void Serialize(nsTSubstring<char_type>& aStr) const;
// Returns the `<mType>/<mSubtype>`
void GetFullType(nsTSubstring<char_type>& aStr) const;
// @param aName - the name of the parameter
// @param aOutput - will hold the value of the parameter (quoted if necessary)
// @param aAppend - if true, the method will append to the string;
// otherwise the string is truncated before appending.
// @return true if the parameter name is found, false otherwise.
bool GetParameterValue(const nsTSubstring<char_type>& aName,
nsTSubstring<char_type>& aOutput,
bool aAppend = false) const;
};
using MimeType = TMimeType<char16_t>;
using CMimeType = TMimeType<char>;
#endif // mozilla_dom_MimeType_h

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

@ -212,6 +212,17 @@ TEST(MimeType, DuplicateParameter2)
"Duplicate parameter #2";
}
TEST(MimeType, CString)
{
const auto in = NS_LITERAL_CSTRING("text/html;charset=();charset=GBK");
UniquePtr<CMimeType> parsed = CMimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
nsCString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(NS_LITERAL_CSTRING("text/html;charset=\"()\""))) <<
"Duplicate parameter #2";
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4819)

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

@ -22,7 +22,7 @@ onmessage = function(e) {
var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
ifr.src = "data:html,<script>location=URL.createObjectURL(new%20Blob(['<script>parent.postMessage(location.pathname,\"*\");location.pathname=\"foo\";parent.postMessage(location.pathname,\"*\");<\/s' +'cript>'], {type:\"text/html\"}));<\/script>";
ifr.src = "data:text/html,<script>location=URL.createObjectURL(new%20Blob(['<script>parent.postMessage(location.pathname,\"*\");location.pathname=\"foo\";parent.postMessage(location.pathname,\"*\");<\/s' +'cript>'], {type:\"text/html\"}));<\/script>";
SimpleTest.waitForExplicitFinish();

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

@ -47,6 +47,15 @@ IsAscii(Char aChar)
return uc < 0x80;
}
template<typename Char>
constexpr bool
IsNonAsciiLatin1(Char aChar)
{
using UnsignedChar = typename detail::MakeUnsignedChar<Char>::Type;
auto uc = static_cast<UnsignedChar>(aChar);
return uc >= 0x80 && uc <= 0xFF;
}
/**
* Returns true iff |aChar| matches Ascii Whitespace.
*

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

@ -11,6 +11,7 @@
#include "DataChannelChild.h"
#include "plstr.h"
#include "nsSimpleURI.h"
#include "mozilla/dom/MimeType.h"
////////////////////////////////////////////////////////////////////////////////
@ -143,13 +144,13 @@ nsDataHandler::AllowPort(int32_t port, const char *scheme, bool *_retval) {
return NS_OK;
}
#define BASE64_EXTENSION ";base64"
/**
* Helper that performs a case insensitive match to find the offset of a given
* pattern in a nsACString.
* The search is performed starting from the end of the string; if the string
* contains more than one match, the rightmost (last) match will be returned.
*/
bool
static bool
FindOffsetOf(const nsACString& aPattern, const nsACString& aSrc,
nsACString::size_type& aOffset)
{
@ -158,7 +159,7 @@ FindOffsetOf(const nsACString& aPattern, const nsACString& aSrc,
nsACString::const_iterator begin, end;
aSrc.BeginReading(begin);
aSrc.EndReading(end);
if (!FindInReadable(aPattern, begin, end, kComparator)) {
if (!RFindInReadable(aPattern, begin, end, kComparator)) {
return false;
}
@ -175,8 +176,8 @@ nsDataHandler::ParsePathWithoutRef(
bool& aIsBase64,
nsDependentCSubstring* aDataBuffer)
{
static NS_NAMED_LITERAL_CSTRING(kBase64Ext, BASE64_EXTENSION);
static NS_NAMED_LITERAL_CSTRING(kCharset, "charset=");
static NS_NAMED_LITERAL_CSTRING(kBase64, "base64");
static NS_NAMED_LITERAL_CSTRING(kCharset, "charset");
aIsBase64 = false;
@ -197,8 +198,8 @@ nsDataHandler::ParsePathWithoutRef(
// Determine if the data is base64 encoded.
nsACString::size_type base64;
if (FindOffsetOf(kBase64Ext, mediaType, base64)) {
nsACString::size_type offset = base64 + kBase64Ext.Length();
if (FindOffsetOf(kBase64, mediaType, base64) && base64 > 0) {
nsACString::size_type offset = base64 + kBase64.Length();
// Per the RFC 2397 grammar, "base64" MUST be at the end of the
// non-data part.
//
@ -207,37 +208,51 @@ nsDataHandler::ParsePathWithoutRef(
// 781693 for an example). Anything after "base64" in the non-data
// part will be discarded in this case, however.
if (offset == mediaType.Length() || mediaType[offset] == ';') {
aIsBase64 = true;
// Trim the base64 part off.
mediaType.Rebind(aPath, 0, base64);
}
}
// Everything else is content type.
int32_t semiColon = mediaType.FindChar(';');
if (semiColon == 0 || mediaType.IsEmpty()) {
// There is no content type, but there are other parameters.
aContentType.AssignLiteral("text/plain");
} else {
aContentType = Substring(mediaType, 0, semiColon);
ToLowerCase(aContentType);
if (!aContentType.StripWhitespace(mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
if (semiColon != kNotFound && aContentCharset) {
auto afterSemi = Substring(mediaType, semiColon + 1);
nsACString::size_type charset;
if (FindOffsetOf(kCharset, afterSemi, charset)) {
*aContentCharset =
Substring(afterSemi, charset + kCharset.Length());
if (!aContentCharset->StripWhitespace(mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
MOZ_DIAGNOSTIC_ASSERT(base64 > 0, "Did someone remove the check?");
// Index is on the first character of matched "base64" so we
// move to the preceding character
base64--;
// Skip any preceding spaces, searching for a semicolon
while (base64 > 0 && mediaType[base64] == ' ') {
base64--;
}
if (mediaType[base64] == ';') {
aIsBase64 = true;
// Trim the base64 part off.
mediaType.Rebind(aPath, 0, base64);
}
}
}
// Skip any leading spaces
nsACString::size_type startIndex = 0;
while (startIndex < mediaType.Length() && mediaType[startIndex] == ' ') {
startIndex++;
}
nsAutoCString mediaTypeBuf;
// If the mimetype starts with ';' we assume text/plain
if (startIndex < mediaType.Length() && mediaType[startIndex] == ';') {
mediaTypeBuf.AssignLiteral("text/plain");
mediaTypeBuf.Append(mediaType);
mediaType.Rebind(mediaTypeBuf, 0, mediaTypeBuf.Length());
}
// Everything else is content type.
UniquePtr<CMimeType> parsed = CMimeType::Parse(mediaType);
if (parsed) {
parsed->GetFullType(aContentType);
if (aContentCharset) {
parsed->GetParameterValue(kCharset, *aContentCharset);
}
} else {
// Mime Type parsing failed
aContentType.AssignLiteral("text/plain");
if (aContentCharset) {
aContentCharset->AssignLiteral("US-ASCII");
}
}
}
if (aDataBuffer) {

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

@ -24,7 +24,9 @@ var urls = [
// Bug 781693
["data:text/plain;base64;x=y,dGVzdA==", "text/plain", "test"],
["data:text/plain;x=y;base64,dGVzdA==", "text/plain", "test"],
["data:text/plain;x=y;base64,", "text/plain", ""]
["data:text/plain;x=y;base64,", "text/plain", ""],
["data: ;charset=x ; base64,WA", "text/plain", "X", "x"],
["data:base64,WA", "text/plain", "WA", "US-ASCII"],
];
function run_test() {
@ -36,6 +38,10 @@ function run_test() {
if (request.nsIChannel.contentType != urls[idx][1])
do_throw("Type mismatch! Is <" + chan.contentType + ">, should be <" + urls[idx][1] + ">");
if (urls[idx][3] && request.nsIChannel.contentCharset !== urls[idx][3]) {
do_throw(`Charset mismatch! Test <${urls[idx][0]}> - Is <${request.nsIChannel.contentCharset}>, should be <${urls[idx][3]}>`);
}
/* read completed successfully. now compare the data. */
if (data != urls[idx][2])
do_throw("Stream contents do not match with direct read! Is <" + data + ">, should be <" + urls[idx][2] + ">");

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

@ -1,198 +0,0 @@
# coding=utf8
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE, TERM_REFERENCE, VARIABLE_REFERENCE, transforms_from
from fluent.migrate import REPLACE
def migrate(ctx):
"""Bug 1457021 - Migrate the JS of Preferences subdialogs to Fluent, part {index}."""
ctx.add_transforms(
'browser/browser/preferences/permissions.ftl',
'browser/browser/preferences/permissions.ftl',
transforms_from(
"""
permissions-capabilities-allow =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "can") }
permissions-capabilities-block =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "cannot") }
permissions-capabilities-prompt =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "prompt") }
""")
)
ctx.add_transforms(
'browser/browser/preferences/blocklists.ftl',
'browser/browser/preferences/blocklists.ftl',
transforms_from(
"""
blocklist-item-moz-std-name = { COPY("browser/chrome/browser/preferences/preferences.properties", "mozstdName") }
blocklist-item-moz-std-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "mozstdDesc") }
blocklist-item-moz-full-name = { COPY("browser/chrome/browser/preferences/preferences.properties", "mozfullName") }
blocklist-item-moz-full-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "mozfullDesc2") }
""") + [
FTL.Message(
id=FTL.Identifier('blocklist-item-list-template'),
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'mozNameTemplate',
{
'%1$S': VARIABLE_REFERENCE(
'listName'
),
'%2$S': VARIABLE_REFERENCE(
'description'
)
}
)
)
]
)
ctx.add_transforms(
'browser/browser/preferences/fonts.ftl',
'browser/browser/preferences/fonts.ftl',
transforms_from(
"""
fonts-very-large-warning-title = { COPY("browser/chrome/browser/preferences/preferences.properties", "veryLargeMinimumFontTitle") }
fonts-very-large-warning-message = { COPY("browser/chrome/browser/preferences/preferences.properties", "veryLargeMinimumFontWarning") }
fonts-very-large-warning-accept = { COPY("browser/chrome/browser/preferences/preferences.properties", "acceptVeryLargeMinimumFont") }
fonts-label-default-unnamed =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "labelDefaultFontUnnamed") }
""") + [
FTL.Message(
id=FTL.Identifier('fonts-label-default'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'labelDefaultFont',
{
'%S': VARIABLE_REFERENCE(
'name'
)
}
)
),
]
)
]
)
ctx.add_transforms(
'browser/browser/preferences/preferences.ftl',
'browser/browser/preferences/preferences.ftl',
transforms_from(
"""
sitedata-total-size-calculating = { COPY("browser/chrome/browser/preferences/preferences.properties", "loadingSiteDataSize1") }
""") + [
FTL.Message(
id=FTL.Identifier('sitedata-total-size'),
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'totalSiteDataSize2',
{
'%1$S': VARIABLE_REFERENCE(
'value'
),
'%2$S': VARIABLE_REFERENCE(
'unit'
)
}
)
)
]
)
ctx.add_transforms(
'browser/browser/preferences/siteDataSettings.ftl',
'browser/browser/preferences/siteDataSettings.ftl',
transforms_from(
"""
site-data-remove-all =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "removeAllSiteData.label") }
.accesskey = { COPY("browser/chrome/browser/preferences/preferences.properties", "removeAllSiteData.accesskey") }
site-data-remove-shown =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "removeAllSiteDataShown.label") }
.accesskey = { COPY("browser/chrome/browser/preferences/preferences.properties", "removeAllSiteDataShown.accesskey") }
site-data-removing-dialog =
.title = { site-data-removing-header }
.buttonlabelaccept = { COPY("browser/chrome/browser/preferences/preferences.properties", "acceptRemove") }
""") + [
# This replacement might not always work, since locales can either
# remove the space, or use a non-breaking space for "%1$S %2$S"
FTL.Message(
id=FTL.Identifier('site-usage-persistent'),
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'siteUsagePersistent',
{
'%1$S %2$S': MESSAGE_REFERENCE(
'site-usage-pattern'
)
}
)
),
FTL.Message(
id=FTL.Identifier('site-data-settings-description'),
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'siteDataSettings3.description',
{
'%S': TERM_REFERENCE(
'-brand-short-name'
)
}
)
),
FTL.Message(
id=FTL.Identifier('site-usage-pattern'),
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'siteUsage',
{
'%1$S': VARIABLE_REFERENCE(
'value'
),
'%2$S': VARIABLE_REFERENCE(
'unit'
)
}
)
)
]
)
ctx.add_transforms(
'browser/browser/preferences/languages.ftl',
'browser/browser/preferences/languages.ftl',
[
FTL.Message(
id=FTL.Identifier('languages-code-format'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'languageCodeFormat',
{
'%1$S': VARIABLE_REFERENCE(
'locale'
),
'%2$S': VARIABLE_REFERENCE(
'code'
)
}
)
)
]
)
]
)

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

@ -1,70 +0,0 @@
# coding=utf8
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import transforms_from
def migrate(ctx):
"""Bug 1457948 - Migrate in-content/privacy.js to Fluent, part {index}."""
ctx.add_transforms(
'browser/browser/preferences/permissions.ftl',
'browser/browser/preferences/permissions.ftl',
transforms_from(
"""
permissions-invalid-uri-title = { COPY("browser/chrome/browser/preferences/preferences.properties", "invalidURITitle") }
permissions-invalid-uri-label = { COPY("browser/chrome/browser/preferences/preferences.properties", "invalidURI") }
permissions-exceptions-tracking-protection-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "trackingprotectionpermissionstitle") }
.style = { permissions-window.style }
permissions-exceptions-tracking-protection-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "trackingprotectionpermissionstext2") }
permissions-exceptions-cookie-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "cookiepermissionstitle1") }
.style = { permissions-window.style }
permissions-exceptions-cookie-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "cookiepermissionstext1") }
permissions-exceptions-popup-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "popuppermissionstitle2") }
.style = { permissions-window.style }
permissions-exceptions-popup-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "popuppermissionstext") }
permissions-exceptions-saved-logins-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "savedLoginsExceptions_title") }
.style = { permissions-window.style }
permissions-exceptions-saved-logins-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "savedLoginsExceptions_desc3") }
permissions-exceptions-addons-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "addons_permissions_title2") }
.style = { permissions-window.style }
permissions-exceptions-addons-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "addonspermissionstext") }
permissions-site-notification-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "notificationspermissionstitle2") }
.style = { permissions-window.style }
permissions-site-notification-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "notificationspermissionstext6") }
permissions-site-notification-disable-label =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "notificationspermissionsdisablelabel") }
permissions-site-notification-disable-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "notificationspermissionsdisabledescription") }
permissions-site-location-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "locationpermissionstitle") }
.style = { permissions-window.style }
permissions-site-location-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "locationpermissionstext2") }
permissions-site-location-disable-label =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "locationpermissionsdisablelabel") }
permissions-site-location-disable-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "locationpermissionsdisabledescription") }
permissions-site-camera-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "camerapermissionstitle") }
.style = { permissions-window.style }
permissions-site-camera-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "camerapermissionstext2") }
permissions-site-camera-disable-label =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "camerapermissionsdisablelabel") }
permissions-site-camera-disable-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "camerapermissionsdisabledescription") }
permissions-site-microphone-window =
.title = { COPY("browser/chrome/browser/preferences/preferences.properties", "microphonepermissionstitle") }
.style = { permissions-window.style }
permissions-site-microphone-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "microphonepermissionstext2") }
permissions-site-microphone-disable-label =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "microphonepermissionsdisablelabel") }
permissions-site-microphone-disable-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "microphonepermissionsdisabledescription") }
""")
)

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

@ -334,8 +334,8 @@ def generate_partials_upstream_artifacts(job, artifacts, platform, locale=None):
upstream_artifacts = [{
'taskId': {'task-reference': '<partials-signing>'},
'taskType': 'signing',
'paths': ["{}/{}".format(artifact_prefix, p)
for p in artifacts],
'paths': ["{}/{}".format(artifact_prefix, path)
for path, _ in artifacts],
'locale': locale or 'en-US',
}]

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

@ -33,11 +33,32 @@ def generate_upstream_artifacts(job, release_history, platform, locale=None):
upstream_artifacts = [{
"taskId": {"task-reference": '<partials>'},
"taskType": 'partials',
"paths": ["{}/{}".format(artifact_prefix, p)
for p in artifacts],
"paths": [
"{}/{}".format(artifact_prefix, path)
for path, version in artifacts
# TODO Use mozilla-version to avoid comparing strings. Otherwise Firefox 100 will be
# considered smaller than Firefox 56
if version is None or version >= '56'
],
"formats": ["mar_sha384"],
}]
old_mar_upstream_artifacts = {
"taskId": {"task-reference": '<partials>'},
"taskType": 'partials',
"paths": [
"{}/{}".format(artifact_prefix, path)
for path, version in artifacts
# TODO Use mozilla-version to avoid comparing strings. Otherwise Firefox 100 will be
# considered smaller than Firefox 56
if version is not None and version < '56'
],
"formats": ["mar"],
}
if old_mar_upstream_artifacts["paths"]:
upstream_artifacts.append(old_mar_upstream_artifacts)
return upstream_artifacts
@ -81,7 +102,11 @@ def make_task_description(config, jobs):
signing_cert_scope = get_signing_cert_scope_per_platform(
build_platform, is_nightly, config
)
scopes = [signing_cert_scope, 'project:releng:signing:format:mar_sha384']
if any("mar" in upstream_details["formats"] for upstream_details in upstream_artifacts):
scopes.append('project:releng:signing:format:mar')
task = {
'label': label,
'description': "{} Partials".format(

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

@ -91,7 +91,10 @@ def get_builds(release_history, platform, locale):
def get_partials_artifacts(release_history, platform, locale):
platform = _sanitize_platform(platform)
return release_history.get(platform, {}).get(locale, {}).keys()
return [
(artifact, details.get('previousVersion', None))
for artifact, details in release_history.get(platform, {}).get(locale, {}).items()
]
def get_partials_artifact_map(release_history, platform, locale):

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

@ -1,7 +1,4 @@
[processing.any.html]
["data://test/,X"]
expected: FAIL
["data://test:test/,X"]
expected: FAIL
@ -14,27 +11,6 @@
["data:IMAGE/gif;hi=x,%C2%B1"]
expected: FAIL
["data:%20,%FF"]
expected: FAIL
["data:%1F,%FF"]
expected: FAIL
["data:\\0,%FF"]
expected: FAIL
["data:%00,%FF"]
expected: FAIL
["data:text / html,X"]
expected: FAIL
["data:†,X"]
expected: FAIL
["data:X,X"]
expected: FAIL
["data:image/png,X X"]
expected: FAIL
@ -47,33 +23,9 @@
["data:x/x;base64;charset=x,WA"]
expected: FAIL
["data:x/x;base64;charset=x;base64,WA"]
expected: FAIL
["data:x/x;base64;base64x,WA"]
expected: FAIL
["data:;base64,W%20A"]
expected: FAIL
["data:;base64,W%0CA"]
expected: FAIL
["data:x;base64x,WA"]
expected: FAIL
["data:x;base64;x,WA"]
expected: FAIL
["data:x;base64=x,WA"]
expected: FAIL
["data:; base64,WA"]
expected: FAIL
["data:; base64,WA"]
expected: FAIL
["data:;base64;,WA"]
expected: FAIL
@ -83,29 +35,11 @@
["data:;base64 ,WA"]
expected: FAIL
["data:;BASe64,WA"]
expected: FAIL
["data:%3Bbase64,WA"]
expected: FAIL
["data:;charset= x,X"]
expected: FAIL
["data:;charset=\\"x\\",X"]
expected: FAIL
["data:;CHARSET=\\"X\\",X"]
expected: FAIL
["data:application/javascript,X X"]
expected: FAIL
[processing.any.worker.html]
["data://test/,X"]
expected: FAIL
["data://test:test/,X"]
expected: FAIL
@ -118,27 +52,6 @@
["data:IMAGE/gif;hi=x,%C2%B1"]
expected: FAIL
["data:%20,%FF"]
expected: FAIL
["data:%1F,%FF"]
expected: FAIL
["data:\\0,%FF"]
expected: FAIL
["data:%00,%FF"]
expected: FAIL
["data:text / html,X"]
expected: FAIL
["data:†,X"]
expected: FAIL
["data:X,X"]
expected: FAIL
["data:image/png,X X"]
expected: FAIL
@ -151,33 +64,9 @@
["data:x/x;base64;charset=x,WA"]
expected: FAIL
["data:x/x;base64;charset=x;base64,WA"]
expected: FAIL
["data:x/x;base64;base64x,WA"]
expected: FAIL
["data:;base64,W%20A"]
expected: FAIL
["data:;base64,W%0CA"]
expected: FAIL
["data:x;base64x,WA"]
expected: FAIL
["data:x;base64;x,WA"]
expected: FAIL
["data:x;base64=x,WA"]
expected: FAIL
["data:; base64,WA"]
expected: FAIL
["data:; base64,WA"]
expected: FAIL
["data:;base64;,WA"]
expected: FAIL
@ -187,21 +76,6 @@
["data:;base64 ,WA"]
expected: FAIL
["data:;BASe64,WA"]
expected: FAIL
["data:%3Bbase64,WA"]
expected: FAIL
["data:;charset= x,X"]
expected: FAIL
["data:;charset=\\"x\\",X"]
expected: FAIL
["data:;CHARSET=\\"X\\",X"]
expected: FAIL
["data:application/javascript,X X"]
expected: FAIL

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

@ -86,29 +86,16 @@ testing/gtest/gtest/
testing/talos/talos/tests/dromaeo/
testing/talos/talos/tests/kraken/
testing/talos/talos/tests/v8_7/
testing/web-platform/tests/resources/webidl2/
third_party/aom/
third_party/python/blessings/
third_party/python/configobj/
third_party/python/futures/
third_party/python/jsmin/
third_party/python/mock-*/
third_party/python/psutil/
third_party/python/py/
third_party/python/pyasn1/
third_party/python/pyasn1-modules/
third_party/python/PyECC/
third_party/python/pytest/
third_party/python/pytoml/
third_party/python/pyyaml/
third_party/python/redo/
third_party/python/requests/
third_party/python/rsa/
third_party/python/six/
third_party/python/which/
third_party/msgpack/
third_party/prio/
third_party/python/
third_party/rust/
toolkit/components/jsoncpp/
toolkit/components/protobuf/
toolkit/components/url-classifier/chromium/
toolkit/components/url-classifier/protobuf/
toolkit/crashreporter/google-breakpad/
toolkit/recordreplay/udis86/
tools/fuzzing/libfuzzer/