Skip to content

Commit

Permalink
Merge pull request #1213 from Floorp-Projects/upstream-esr115-2024061…
Browse files Browse the repository at this point in the history
…1022104

Pull upstream
  • Loading branch information
surapunoyousei authored Jun 11, 2024
2 parents d95aecb + c644b90 commit e80e1c4
Show file tree
Hide file tree
Showing 67 changed files with 5,459 additions and 3,209 deletions.
1 change: 1 addition & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -4406,3 +4406,4 @@ f65068dc82bf6051f520551ba5497a5985877d47 FIREFOX_115_9_1esr_RELEASE
64fc0d6e7ff6b1d626e40d45c492fa210591a1c0 FIREFOX_115_10_0esr_RELEASE
36d2dde067333d0c181cb8e21b12b73c307575db FIREFOX_115_11_0esr_BUILD1
36d2dde067333d0c181cb8e21b12b73c307575db FIREFOX_115_11_0esr_RELEASE
6b05ad1f5f2dbb0d47ac169115e250ff3776289c FIREFOX_115_12_0esr_BUILD1
2 changes: 1 addition & 1 deletion CLOBBER
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.

Merge day clobber 2024-05-13
Merge day clobber 2024-06-10
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const BLOCKED_PAGE =
"http://example.org:8000/browser/browser/base/content/test/about/csp_iframe.sjs";

add_task(async function test_csp() {
await SpecialPowers.pushPrefEnv({
set: [["security.xfocsp.hideOpenInNewWindow", false]],
});

let { iframePageTab, blockedPageTab } = await setupPage(
"iframe_page_csp.html",
BLOCKED_PAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const BLOCKED_PAGE =
"http://example.org:8000/browser/browser/base/content/test/about/xfo_iframe.sjs";

add_task(async function test_xfo_iframe() {
await SpecialPowers.pushPrefEnv({
set: [["security.xfocsp.hideOpenInNewWindow", false]],
});

let { iframePageTab, blockedPageTab } = await setupPage(
"iframe_page_xfo.html",
BLOCKED_PAGE
Expand Down
2 changes: 1 addition & 1 deletion browser/config/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
115.12.0
115.13.0
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Section "MaintenanceService"
; These keys are used to bypass the installation dir is a valid installation
; check from the service so that tests can be run.
; WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation"
; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA"
; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1"
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastused
Expand Down
8 changes: 8 additions & 0 deletions browser/installer/windows/nsis/shared.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@
${EndIf}
${EndIf}

ClearErrors
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
${If} ${Errors}
StrCpy $TmpVal "HKCU"
${Else}
StrCpy $TmpVal "HKLM"
${EndIf}

!ifdef MOZ_MAINTENANCE_SERVICE
Call IsUserAdmin
Pop $R0
Expand Down
2 changes: 1 addition & 1 deletion config/milestone.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------

115.12.0
115.13.0
38 changes: 15 additions & 23 deletions devtools/shared/DevToolsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,7 @@ function mainThreadFetch(
* @param {Object} options - The options object passed to @method fetch.
* @return {nsIChannel} - The newly created channel. Throws on failure.
*/
function newChannelForURL(
url,
{ policy, window, principal },
recursing = false
) {
function newChannelForURL(url, { policy, window, principal }) {
const securityFlags =
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL;

Expand All @@ -735,6 +731,19 @@ function newChannelForURL(
// scheme to see if it helps.
uri = Services.io.newURI("file://" + url);
}

// In xpcshell tests on Windows, opening the channel
// can throw NS_ERROR_UNKNOWN_PROTOCOL if the external protocol isn't
// supported by Windows, so we also need to handle that case here if
// parsing the URL above doesn't throw.
const handler = Services.io.getProtocolHandler(uri.scheme);
if (
handler instanceof Ci.nsIExternalProtocolHandler &&
!handler.externalAppExistsForScheme(uri.scheme)
) {
uri = Services.io.newURI("file://" + url);
}

const channelOptions = {
contentPolicyType: policy,
securityFlags,
Expand Down Expand Up @@ -766,24 +775,7 @@ function newChannelForURL(
channelOptions.loadingPrincipal = prin;
}

try {
return NetUtil.newChannel(channelOptions);
} catch (e) {
// Don't infinitely recurse if newChannel keeps throwing.
if (recursing) {
throw e;
}

// In xpcshell tests on Windows, nsExternalProtocolHandler::NewChannel()
// can throw NS_ERROR_UNKNOWN_PROTOCOL if the external protocol isn't
// supported by Windows, so we also need to handle the exception here if
// parsing the URL above doesn't throw.
return newChannelForURL(
"file://" + url,
{ policy, window, principal },
/* recursing */ true
);
}
return NetUtil.newChannel(channelOptions);
}

// Fetch is defined differently depending on whether we are on the main thread
Expand Down
3 changes: 3 additions & 0 deletions devtools/startup/tests/browser/browser_command_line_urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ add_task(async function openingWithDevToolsButUnknownSource() {
);

await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
// View source may not have updated the selection just yet
ContentTaskUtils.waitForCondition(() => !!content.getSelection());

const selection = content.getSelection();
Assert.equal(
selection.toString(),
Expand Down
40 changes: 21 additions & 19 deletions dom/base/nsTextFragment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,23 +198,22 @@ bool nsTextFragment::SetTo(const char16_t* aBuffer, uint32_t aLength,
}

if (aForce2b && mState.mIs2b && !m2b->IsReadonly()) {
// Try to re-use our existing StringBuffer.
uint32_t storageSize = m2b->StorageSize();
uint32_t neededSize = aLength * sizeof(char16_t);
if (!neededSize) {
if (storageSize < AutoStringDefaultStorageSize) {
// If we're storing small enough nsStringBuffer, let's preserve it.

static_cast<char16_t*>(m2b->Data())[0] = char16_t(0);
mState.mLength = 0;
mState.mIsBidi = false;
return true;
}
} else if ((neededSize < storageSize) &&
((storageSize / 2) <
(neededSize + AutoStringDefaultStorageSize))) {
// Don't try to reuse the existing nsStringBuffer, if it would have
// lots of unused space.

} else if (neededSize < storageSize &&
(storageSize / 2) <
(neededSize + AutoStringDefaultStorageSize)) {
// Don't try to reuse the existing nsStringBuffer, if it would have lots
// of unused space.
memcpy(m2b->Data(), aBuffer, neededSize);
static_cast<char16_t*>(m2b->Data())[aLength] = char16_t(0);
mState.mLength = aLength;
Expand All @@ -226,19 +225,18 @@ bool nsTextFragment::SetTo(const char16_t* aBuffer, uint32_t aLength,
}
}

ReleaseText();

if (aLength == 0) {
ReleaseText();
return true;
}

char16_t firstChar = *aBuffer;
if (!aForce2b && aLength == 1 && firstChar < 256) {
ReleaseText();
m1b = sSingleCharSharedString + firstChar;
mState.mInHeap = false;
mState.mIs2b = false;
mState.mLength = 1;

return true;
}

Expand Down Expand Up @@ -266,6 +264,7 @@ bool nsTextFragment::SetTo(const char16_t* aBuffer, uint32_t aLength,

if (ucp == uend && endNewLine - start <= TEXTFRAG_MAX_NEWLINES &&
ucp - endNewLine <= TEXTFRAG_WHITE_AFTER_NEWLINE) {
ReleaseText();
char** strings = space == ' ' ? sSpaceSharedString : sTabSharedString;
m1b = strings[endNewLine - start];

Expand All @@ -287,34 +286,37 @@ bool nsTextFragment::SetTo(const char16_t* aBuffer, uint32_t aLength,

if (first16bit != -1) { // aBuffer contains no non-8bit character
// Use ucs2 storage because we have to
CheckedUint32 m2bSize = CheckedUint32(aLength) + 1;
if (!m2bSize.isValid()) {
CheckedUint32 size = CheckedUint32(aLength) + 1;
if (!size.isValid()) {
return false;
}
m2bSize *= sizeof(char16_t);
if (!m2bSize.isValid()) {
size *= sizeof(char16_t);
if (!size.isValid()) {
return false;
}

m2b = nsStringBuffer::Alloc(m2bSize.value()).take();
if (!m2b) {
RefPtr<nsStringBuffer> newBuffer = nsStringBuffer::Alloc(size.value());
if (!newBuffer) {
return false;
}
memcpy(m2b->Data(), aBuffer, aLength * sizeof(char16_t));
static_cast<char16_t*>(m2b->Data())[aLength] = char16_t(0);

ReleaseText();
memcpy(newBuffer->Data(), aBuffer, aLength * sizeof(char16_t));
static_cast<char16_t*>(newBuffer->Data())[aLength] = char16_t(0);

m2b = newBuffer.forget().take();
mState.mIs2b = true;
if (aUpdateBidi) {
UpdateBidiFlag(aBuffer + first16bit, aLength - first16bit);
}

} else {
// Use 1 byte storage because we can
char* buff = static_cast<char*>(malloc(aLength));
if (!buff) {
return false;
}

ReleaseText();
// Copy data
LossyConvertUtf16toLatin1(Span(aBuffer, aLength), Span(buff, aLength));
m1b = buff;
Expand Down
Loading

0 comments on commit e80e1c4

Please sign in to comment.