Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2022-12-30 09:29:56 +08:00
commit 120ac6d556
25 changed files with 193 additions and 112 deletions

View file

@ -187,16 +187,7 @@ tup:
@$(TUP) $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),,--verbose) @$(TUP) $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),,--verbose)
$(call BUILDSTATUS,TIER_FINISH tup) $(call BUILDSTATUS,TIER_FINISH tup)
# process_install_manifest needs to be invoked with --no-remove when building .PHONY: $(addprefix install-,$(install_manifests))
# js as standalone because automated builds are building nspr separately and
# that would remove the resulting files.
# Eventually, a standalone js build would just be able to build nspr itself,
# removing the need for the former.
ifdef JS_STANDALONE
NO_REMOVE=1
endif
.PHONY: $(addprefix install-,$(subst /,_,$(install_manifests)))
$(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends) $(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS))) ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
@# If we're using the hybrid FasterMake/RecursiveMake backend, we want @# If we're using the hybrid FasterMake/RecursiveMake backend, we want
@ -204,7 +195,7 @@ ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
@# same directory, because that would blow up @# same directory, because that would blow up
$(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*))) $(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
endif endif
$(addprefix $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$*) ,$(wildcard _build_manifests/install/$(subst /,_,$*))) $(addprefix $(call py_action,process_install_manifest,--track install_$(subst /,_,$*).track $*) ,$(wildcard _build_manifests/install/$(subst /,_,$*)))
# Dummy wrapper rule to allow the faster backend to piggy back # Dummy wrapper rule to allow the faster backend to piggy back
$(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ; $(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ;
@ -217,10 +208,9 @@ install-tests: install-test-files
.PHONY: run-tests-deps .PHONY: run-tests-deps
run-tests-deps: $(install_manifest_depends) run-tests-deps: $(install_manifest_depends)
# Force --no-remove, because $objdir/_tests is handled by multiple manifests.
.PHONY: install-test-files .PHONY: install-test-files
install-test-files: install-test-files:
$(call py_action,process_install_manifest,--no-remove _tests _build_manifests/install/_test_files) $(call py_action,process_install_manifest,--track install__test_files.track _tests _build_manifests/install/_test_files)
include $(topsrcdir)/build/moz-automation.mk include $(topsrcdir)/build/moz-automation.mk
@ -240,13 +230,13 @@ ifndef NO_PROFILE_GUIDED_OPTIMIZE
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_) ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
recurse_pre-export:: install-manifests recurse_pre-export:: install-manifests
binaries:: binaries::
@$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include @$(MAKE) install-manifests install_manifests=dist/include
endif endif
endif endif
else # !MOZ_PROFILE_USE (normal build) else # !MOZ_PROFILE_USE (normal build)
recurse_pre-export:: install-manifests recurse_pre-export:: install-manifests
binaries:: binaries::
@$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include @$(MAKE) install-manifests install_manifests=dist/include
endif endif
# For historical reasons that are unknown, $(DIST)/sdk is always blown away # For historical reasons that are unknown, $(DIST)/sdk is always blown away

View file

@ -10,13 +10,12 @@
# things happening at each step required other things happening in previous # things happening at each step required other things happening in previous
# steps without any documentation of those dependencies. # steps without any documentation of those dependencies.
# #
# This new build system tries to start afresh by establishing what files or # This build system establishes what files or operations are needed for the
# operations are needed for the build, and applying the necessary rules to # build, and applying the necessary rules to have those in place, relying on
# have those in place, relying on make dependencies to get them going. # make dependencies to get them going.
# #
# As of writing, only building non-compiled parts of Firefox is supported # Only non-compiled parts of the application and platform are built and
# here (a few other things are also left out). This is a starting point, with # supported here (a few other things are also left out).
# the intent to grow this build system to make it more complete.
# #
# This file contains rules and dependencies to get things working. The intent # This file contains rules and dependencies to get things working. The intent
# is for a Makefile to define some dependencies and variables, and include # is for a Makefile to define some dependencies and variables, and include
@ -42,19 +41,11 @@ ifndef NO_XPIDL
default: $(TOPOBJDIR)/config/makefiles/xpidl/xpidl default: $(TOPOBJDIR)/config/makefiles/xpidl/xpidl
endif endif
# Mac builds require to copy things in dist/bin/*.app # Mac builds require copying files in dist/bin/*.app
# TODO: remove the MOZ_WIDGET_TOOLKIT and MOZ_BUILD_APP variables from
# faster/Makefile and python/mozbuild/mozbuild/test/backend/test_build.py
# when this is not required anymore.
# We however don't need to do this when using the hybrid
# FasterMake/RecursiveMake backend (FASTER_RECURSIVE_MAKE is set when
# recursing from the RecursiveMake backend)
ifndef FASTER_RECURSIVE_MAKE
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
default: default:
$(MAKE) -C $(TOPOBJDIR)/$(MOZ_BUILD_APP)/app repackage $(MAKE) -C $(TOPOBJDIR)/$(MOZ_BUILD_APP)/app repackage
endif endif
endif
.PHONY: FORCE .PHONY: FORCE
@ -99,12 +90,9 @@ $(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(addprefix $(TOPOBJDIR)/
# that are not supported by data in moz.build. # that are not supported by data in moz.build.
# The xpidl target in config/makefiles/xpidl requires the install manifest for # The xpidl target in config/makefiles/xpidl requires the install manifest for
# dist/idl to have been processed. When using the hybrid # dist/idl to have been processed.
# FasterMake/RecursiveMake backend, this dependency is handled in the top-level
# Makefile.
ifndef FASTER_RECURSIVE_MAKE
$(TOPOBJDIR)/config/makefiles/xpidl/xpidl: $(TOPOBJDIR)/install-dist_idl $(TOPOBJDIR)/config/makefiles/xpidl/xpidl: $(TOPOBJDIR)/install-dist_idl
endif
# It also requires all the install manifests for dist/bin to have been processed # It also requires all the install manifests for dist/bin to have been processed
# because it adds interfaces.manifest references with buildlist.py. # because it adds interfaces.manifest references with buildlist.py.
$(TOPOBJDIR)/config/makefiles/xpidl/xpidl: $(addprefix install-,$(filter dist/bin%,$(INSTALL_MANIFESTS))) $(TOPOBJDIR)/config/makefiles/xpidl/xpidl: $(addprefix install-,$(filter dist/bin%,$(INSTALL_MANIFESTS)))

View file

@ -15,6 +15,7 @@
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsHTMLTags.h" #include "nsHTMLTags.h"
#include "jsapi.h" #include "jsapi.h"
#include "ShadowRoot.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {

View file

@ -185,7 +185,7 @@ install:: js-config.h
# #
install:: install::
$(call py_action,process_install_manifest,--no-remove --no-symlinks $(DESTDIR)$(includedir) $(DEPTH)/_build_manifests/install/dist_include) $(call py_action,process_install_manifest,--track install_dist_include.track --no-symlinks $(DESTDIR)$(includedir) $(DEPTH)/_build_manifests/install/dist_include)
# #
# END SpiderMonkey header installation # END SpiderMonkey header installation

View file

@ -30,6 +30,9 @@
#ifndef V8_INFALLIBLEVECTOR_H_ #ifndef V8_INFALLIBLEVECTOR_H_
#define V8_INFALLIBLEVECTOR_H_ #define V8_INFALLIBLEVECTOR_H_
#include "ds/LifoAlloc.h"
#include "mozilla/Vector.h"
namespace js { namespace js {
namespace irregexp { namespace irregexp {
@ -39,7 +42,7 @@ namespace irregexp {
template<typename T, size_t N> template<typename T, size_t N>
class InfallibleVector class InfallibleVector
{ {
Vector<T, N, LifoAllocPolicy<Infallible>> vector_; mozilla::Vector<T, N, LifoAllocPolicy<Infallible>> vector_;
InfallibleVector(const InfallibleVector&) = delete; InfallibleVector(const InfallibleVector&) = delete;
void operator=(const InfallibleVector&) = delete; void operator=(const InfallibleVector&) = delete;

View file

@ -29,7 +29,10 @@
#include "irregexp/RegExpCharRanges.h" #include "irregexp/RegExpCharRanges.h"
#include "ds/LifoAlloc.h"
#include "mozilla/Unused.h"
#include "unicode/uniset.h" #include "unicode/uniset.h"
#include "vm/Unicode.h"
// Generated table // Generated table
#include "irregexp/RegExpCharacters-inl.h" #include "irregexp/RegExpCharacters-inl.h"
@ -447,7 +450,7 @@ bool IsExactPropertyValueAlias(const std::string& property_value_name, UProperty
return false; return false;
} }
bool LookupPropertyValueName(LifoAlloc* alloc, bool LookupPropertyValueName(js::LifoAlloc* alloc,
UProperty property, UProperty property,
const std::string& property_value_name, bool negate, const std::string& property_value_name, bool negate,
CharacterRangeVector* ranges, CharacterRangeVector* ranges,
@ -485,7 +488,7 @@ bool LookupPropertyValueName(LifoAlloc* alloc,
return success; return success;
} }
bool LookupSpecialPropertyValueName(LifoAlloc* alloc, bool LookupSpecialPropertyValueName(js::LifoAlloc* alloc,
const std::string& name, bool negate, const std::string& name, bool negate,
CharacterRangeVector* ranges, CharacterRangeVector* ranges,
CharacterRangeVector* lead_ranges, CharacterRangeVector* lead_ranges,
@ -497,14 +500,14 @@ bool LookupSpecialPropertyValueName(LifoAlloc* alloc,
// is the empty set. // is the empty set.
} else { } else {
CharacterRange::AddUnicodeRange(alloc, ranges, lead_ranges, trail_ranges, wide_ranges, CharacterRange::AddUnicodeRange(alloc, ranges, lead_ranges, trail_ranges, wide_ranges,
0, unicode::NonBMPMax); 0, js::unicode::NonBMPMax);
} }
} else } else
if (name == "ASCII") { if (name == "ASCII") {
if (negate) { if (negate) {
// negative ASCII contains all planes // negative ASCII contains all planes
CharacterRange::AddUnicodeRange(alloc, ranges, lead_ranges, trail_ranges, wide_ranges, CharacterRange::AddUnicodeRange(alloc, ranges, lead_ranges, trail_ranges, wide_ranges,
0x80, unicode::NonBMPMax); 0x80, js::unicode::NonBMPMax);
} else { } else {
// positve ASCII is just low codepoints // positve ASCII is just low codepoints
ranges->append(CharacterRange::Range(0x00, 0x7F)); ranges->append(CharacterRange::Range(0x00, 0x7F));
@ -748,7 +751,7 @@ CharacterRange::InsertRangeInCanonicalList(CharacterRangeVector& list,
} }
int int
irregexp::GetCaseIndependentLetters(char16_t character, js::irregexp::GetCaseIndependentLetters(char16_t character,
bool ascii_subject, bool ascii_subject,
bool unicode, bool unicode,
const char16_t* choices, const char16_t* choices,
@ -781,7 +784,7 @@ irregexp::GetCaseIndependentLetters(char16_t character,
} }
int int
irregexp::GetCaseIndependentLetters(char16_t character, js::irregexp::GetCaseIndependentLetters(char16_t character,
bool ascii_subject, bool ascii_subject,
bool unicode, bool unicode,
char16_t* letters) char16_t* letters)

View file

@ -32,8 +32,10 @@
#include <string> #include <string>
#include "ds/LifoAlloc.h"
#include "irregexp/RegExpCharacters.h" #include "irregexp/RegExpCharacters.h"
#include "irregexp/InfallibleVector.h" #include "irregexp/InfallibleVector.h"
#include "vm/Unicode.h"
namespace js { namespace js {

View file

@ -987,7 +987,7 @@ RegExpParser<CharT>::ParseClassEscape(char16_t* char_class, widechar *value,
} }
return true; return true;
} }
MOZ_FALLTHROUGH MOZ_FALLTHROUGH;
default: default:
if (!ParseClassCharacterEscape(value)) if (!ParseClassCharacterEscape(value))
return false; return false;
@ -2069,8 +2069,8 @@ RegExpParser<CharT>::ParseDisjunction()
// an identity escape for non-Unicode patterns without named // an identity escape for non-Unicode patterns without named
// capture groups, and as the beginning of a named back-reference // capture groups, and as the beginning of a named back-reference
// in all other cases. // in all other cases.
if (unicode_ || HasNamedCaptures()) {
Advance(2); Advance(2);
if (unicode_ || HasNamedCaptures()) {
if (!ParseNamedBackReference(builder, state)) { if (!ParseNamedBackReference(builder, state)) {
return ReportError(JSMSG_INVALID_IDENTITY_ESCAPE); return ReportError(JSMSG_INVALID_IDENTITY_ESCAPE);
} }

View file

@ -1558,7 +1558,7 @@ ParseRegExpFlags(const CharT* chars, size_t length, RegExpFlag* flagsOut, char16
return false; return false;
break; break;
} }
MOZ_FALLTHROUGH MOZ_FALLTHROUGH;
default: default:
return false; return false;
} }

View file

@ -9034,6 +9034,13 @@ nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent,
} }
} }
// Ensure ::first-letter inherits from ::first-line even when floated, see
// Issue #2063 / Mozilla bug 13610.
if (parent->GetType() == nsGkAtoms::lineFrame &&
parent == parent->FirstInFlow()) {
return parent;
}
nsIAtom* parentPseudo = parent->StyleContext()->GetPseudo(); nsIAtom* parentPseudo = parent->StyleContext()->GetPseudo();
if (!parentPseudo || if (!parentPseudo ||
(!nsCSSAnonBoxes::IsAnonBox(parentPseudo) && (!nsCSSAnonBoxes::IsAnonBox(parentPseudo) &&

View file

@ -580,9 +580,10 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
nscoord availableISize = aReflowInput.AvailableISize(); nscoord availableISize = aReflowInput.AvailableISize();
NS_ASSERTION(availableISize != NS_UNCONSTRAINEDSIZE, NS_ASSERTION(availableISize != NS_UNCONSTRAINEDSIZE,
"should no longer use available widths"); "should no longer use available widths");
// Subtract off inline axis border+padding from availableISize // Subtract off inline axis border+padding from availableISize;
// we don't subtract the end border+padding as we don't yet know whether
// the end of the element will occur on the same line.
availableISize -= startEdge; availableISize -= startEdge;
availableISize -= framePadding.IEnd(frameWM);
lineLayout->BeginSpan(this, &aReflowInput, startEdge, lineLayout->BeginSpan(this, &aReflowInput, startEdge,
startEdge + availableISize, &mBaseline); startEdge + availableISize, &mBaseline);

View file

@ -1101,7 +1101,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
"The frame ctor should've dealt with this."); "The frame ctor should've dealt with this.");
if (CanPlaceFrame(pfd, notSafeToBreak, continuingTextRun, if (CanPlaceFrame(pfd, notSafeToBreak, continuingTextRun,
savedOptionalBreakFrame != nullptr, reflowOutput, savedOptionalBreakFrame != nullptr, reflowOutput,
aReflowStatus, &optionalBreakAfterFits)) { aReflowStatus, &optionalBreakAfterFits,
isText && availableSpaceOnLine < 0)) {
if (!isEmpty) { if (!isEmpty) {
psd->mHasNonemptyContent = true; psd->mHasNonemptyContent = true;
mLineIsEmpty = false; mLineIsEmpty = false;
@ -1259,6 +1260,10 @@ nsLineLayout::SyncAnnotationBounds(PerFrameData* aRubyFrame)
* ReflowFrame above would have returned false, preventing this method * ReflowFrame above would have returned false, preventing this method
* from being called. The logic in this method assumes that. * from being called. The logic in this method assumes that.
* *
* We can always place an empty frame *unless* aAlreadyOverflowed is true,
* in which case the line has already overflowed and we'd rather back up
* to an earlier break (if available).
*
* Note that there is no check against the Y coordinate because we * Note that there is no check against the Y coordinate because we
* assume that the caller will take care of that. * assume that the caller will take care of that.
*/ */
@ -1269,7 +1274,8 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
bool aCanRollBackBeforeFrame, bool aCanRollBackBeforeFrame,
ReflowOutput& aMetrics, ReflowOutput& aMetrics,
nsReflowStatus& aStatus, nsReflowStatus& aStatus,
bool* aOptionalBreakAfterFits) bool* aOptionalBreakAfterFits,
bool aAlreadyOverflowed)
{ {
NS_PRECONDITION(pfd && pfd->mFrame, "bad args, null pointers for frame data"); NS_PRECONDITION(pfd && pfd->mFrame, "bad args, null pointers for frame data");
@ -1340,8 +1346,11 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
// When it doesn't fit, check for a few special conditions where we // When it doesn't fit, check for a few special conditions where we
// allow it to fit anyway. // allow it to fit anyway.
if (0 == startMargin + pfd->mBounds.ISize(lineWM) + endMargin) { if (0 == startMargin + pfd->mBounds.ISize(lineWM) + endMargin &&
// Empty frames always fit right where they are !aAlreadyOverflowed) {
// Empty frames always fit right where they are, unless we have text that
// has already overflowed the line width, in which case we should try to
// back up to an earlier break.
#ifdef NOISY_CAN_PLACE_FRAME #ifdef NOISY_CAN_PLACE_FRAME
printf(" ==> empty frame fits\n"); printf(" ==> empty frame fits\n");
#endif #endif

View file

@ -677,7 +677,8 @@ protected:
bool aCanRollBackBeforeFrame, bool aCanRollBackBeforeFrame,
ReflowOutput& aMetrics, ReflowOutput& aMetrics,
nsReflowStatus& aStatus, nsReflowStatus& aStatus,
bool* aOptionalBreakAfterFits); bool* aOptionalBreakAfterFits,
bool aAlreadyOverflowed);
void PlaceFrame(PerFrameData* pfd, void PlaceFrame(PerFrameData* pfd,
ReflowOutput& aMetrics); ReflowOutput& aMetrics);

View file

@ -187,7 +187,7 @@ pref("dom.enable_resource_timing", true);
pref("dom.enable_user_timing", true); pref("dom.enable_user_timing", true);
// Whether performance.GetEntries* will contain an entry for the active document // Whether performance.GetEntries* will contain an entry for the active document
pref("dom.enable_performance_navigation_timing", true); pref("dom.enable_performance_navigation_timing", false);
// Enable printing performance marks/measures to log // Enable printing performance marks/measures to log
pref("dom.performance.enable_user_timing_logging", false); pref("dom.performance.enable_user_timing_logging", false);

View file

@ -79,6 +79,7 @@ HTTP_ATOM(Service_Worker_Allowed, "Service-Worker-Allowed")
HTTP_ATOM(Set_Cookie, "Set-Cookie") HTTP_ATOM(Set_Cookie, "Set-Cookie")
HTTP_ATOM(Set_Cookie2, "Set-Cookie2") HTTP_ATOM(Set_Cookie2, "Set-Cookie2")
HTTP_ATOM(Status_URI, "Status-URI") HTTP_ATOM(Status_URI, "Status-URI")
HTTP_ATOM(Strict_Transport_Security, "Strict-Transport-Security")
HTTP_ATOM(TE, "TE") HTTP_ATOM(TE, "TE")
HTTP_ATOM(Title, "Title") HTTP_ATOM(Title, "Title")
HTTP_ATOM(Timeout, "Timeout") HTTP_ATOM(Timeout, "Timeout")

View file

@ -79,7 +79,7 @@ nsHttpHeaderArray::SetHeader(nsHttpAtom header,
return SetHeader_internal(header, headerName, value, variety); return SetHeader_internal(header, headerName, value, variety);
} else if (merge && !IsSingletonHeader(header)) { } else if (merge && !IsSingletonHeader(header)) {
return MergeHeader(header, entry, value, variety); return MergeHeader(header, entry, value, variety);
} else { } else if (!IsIgnoreMultipleHeader(header)) {
// Replace the existing string with the new value // Replace the existing string with the new value
if (entry->variety == eVarietyResponseNetOriginalAndResponse) { if (entry->variety == eVarietyResponseNetOriginalAndResponse) {
MOZ_ASSERT(variety == eVarietyResponse); MOZ_ASSERT(variety == eVarietyResponse);
@ -190,7 +190,7 @@ nsHttpHeaderArray::SetHeaderFromNet(nsHttpAtom header,
eVarietyResponseNetOriginal); eVarietyResponseNetOriginal);
} }
return rv; return rv;
} else { } else if (!IsIgnoreMultipleHeader(header)) {
// Multiple instances of non-mergeable header received from network // Multiple instances of non-mergeable header received from network
// - ignore if same value // - ignore if same value
if (!entry->value.Equals(value)) { if (!entry->value.Equals(value)) {

View file

@ -160,6 +160,8 @@ private:
// Header cannot be merged: only one value possible // Header cannot be merged: only one value possible
bool IsSingletonHeader(nsHttpAtom header); bool IsSingletonHeader(nsHttpAtom header);
// Header cannot be merged, and subsequent values should be ignored
bool IsIgnoreMultipleHeader(nsHttpAtom header);
// For some headers we want to track empty values to prevent them being // For some headers we want to track empty values to prevent them being
// combined with non-empty ones as a CRLF attack vector // combined with non-empty ones as a CRLF attack vector
bool TrackEmptyHeader(nsHttpAtom header); bool TrackEmptyHeader(nsHttpAtom header);
@ -231,7 +233,22 @@ nsHttpHeaderArray::IsSingletonHeader(nsHttpAtom header)
header == nsHttp::If_Unmodified_Since || header == nsHttp::If_Unmodified_Since ||
header == nsHttp::From || header == nsHttp::From ||
header == nsHttp::Location || header == nsHttp::Location ||
header == nsHttp::Max_Forwards; header == nsHttp::Max_Forwards ||
// Ignore-multiple-headers are singletons in the sense that they
// shouldn't be merged.
IsIgnoreMultipleHeader(header);
}
// These are headers for which, in the presence of multiple values, we only
// consider the first.
inline bool nsHttpHeaderArray::IsIgnoreMultipleHeader(nsHttpAtom header)
{
// https://tools.ietf.org/html/rfc6797#section-8:
//
// If a UA receives more than one STS header field in an HTTP
// response message over secure transport, then the UA MUST process
// only the first such header field.
return header == nsHttp::Strict_Transport_Security;
} }
inline bool inline bool

View file

@ -0,0 +1,29 @@
#include "gtest/gtest.h"
#include "nsHttpHeaderArray.h"
TEST(TestHeaders, DuplicateHSTS) {
// When the Strict-Transport-Security header is sent multiple times, its
// effective value is the value of the first item. It is not coalesced like
// other headers are.
mozilla::net::nsHttpHeaderArray headers;
nsresult rv = headers.SetHeaderFromNet(
mozilla::net::nsHttp::Strict_Transport_Security, NS_LITERAL_CSTRING("max-age=360"), true
);
ASSERT_EQ(rv, NS_OK);
nsAutoCString h;
rv = headers.GetHeader(mozilla::net::nsHttp::Strict_Transport_Security, h);
ASSERT_EQ(rv, NS_OK);
ASSERT_EQ(h.get(), "max-age=360");
rv = headers.SetHeaderFromNet(
mozilla::net::nsHttp::Strict_Transport_Security, NS_LITERAL_CSTRING("max-age=720"), true
);
ASSERT_EQ(rv, NS_OK);
rv = headers.GetHeader(mozilla::net::nsHttp::Strict_Transport_Security, h);
ASSERT_EQ(rv, NS_OK);
ASSERT_EQ(h.get(), "max-age=360");
}

View file

@ -5,6 +5,7 @@
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'TestBase64Stream.cpp', 'TestBase64Stream.cpp',
'TestHeaders.cpp',
'TestProtocolProxyService.cpp', 'TestProtocolProxyService.cpp',
'TestStandardURL.cpp', 'TestStandardURL.cpp',
] ]

View file

@ -29,14 +29,10 @@ COMPLETE = 'Elapsed: {elapsed:.2f}s; From {dest}: Kept {existing} existing; ' \
'Removed {rm_files} files and {rm_dirs} directories.' 'Removed {rm_files} files and {rm_dirs} directories.'
def process_manifest(destdir, paths, track=None, def process_manifest(destdir, paths, track,
remove_unaccounted=True,
remove_all_directory_symlinks=True,
remove_empty_directories=True,
no_symlinks=False, no_symlinks=False,
defines={}): defines={}):
if track:
if os.path.exists(track): if os.path.exists(track):
# We use the same format as install manifests for the tracking # We use the same format as install manifests for the tracking
# data. # data.
@ -50,6 +46,8 @@ def process_manifest(destdir, paths, track=None,
for p, f in finder.find(dest): for p, f in finder.find(dest):
remove_unaccounted.add(p, dummy_file) remove_unaccounted.add(p, dummy_file)
remove_empty_directories=True
remove_all_directory_symlinks=True
else: else:
# If tracking is enabled and there is no file, we don't want to # If tracking is enabled and there is no file, we don't want to
# be removing anything. # be removing anything.
@ -70,7 +68,9 @@ def process_manifest(destdir, paths, track=None,
remove_empty_directories=remove_empty_directories) remove_empty_directories=remove_empty_directories)
if track: if track:
manifest.write(path=track) # We should record files that we actually copied.
# It is too late to expand wildcards when the track file is read.
manifest.write(path=track, expand_pattern=True)
return result return result
@ -81,15 +81,9 @@ def main(argv):
parser.add_argument('destdir', help='Destination directory.') parser.add_argument('destdir', help='Destination directory.')
parser.add_argument('manifests', nargs='+', help='Path to manifest file(s).') parser.add_argument('manifests', nargs='+', help='Path to manifest file(s).')
parser.add_argument('--no-remove', action='store_true',
help='Do not remove unaccounted files from destination.')
parser.add_argument('--no-remove-all-directory-symlinks', action='store_true',
help='Do not remove all directory symlinks from destination.')
parser.add_argument('--no-remove-empty-directories', action='store_true',
help='Do not remove empty directories from destination.')
parser.add_argument('--no-symlinks', action='store_true', parser.add_argument('--no-symlinks', action='store_true',
help='Do not install symbolic links. Always copy files') help='Do not install symbolic links. Always copy files')
parser.add_argument('--track', metavar="PATH", parser.add_argument('--track', metavar="PATH", required=True,
help='Use installed files tracking information from the given path.') help='Use installed files tracking information from the given path.')
parser.add_argument('-D', action=DefinesAction, parser.add_argument('-D', action=DefinesAction,
dest='defines', metavar="VAR[=VAL]", dest='defines', metavar="VAR[=VAL]",
@ -99,11 +93,11 @@ def main(argv):
start = time.time() start = time.time()
result = process_manifest(args.destdir, args.manifests, result = process_manifest(
track=args.track, remove_unaccounted=not args.no_remove, args.destdir,
remove_all_directory_symlinks=not args.no_remove_all_directory_symlinks, args.manifests,
remove_empty_directories=not args.no_remove_empty_directories,
no_symlinks=args.no_symlinks, no_symlinks=args.no_symlinks,
track=args.track,
defines=args.defines) defines=args.defines)
elapsed = time.time() - start elapsed = time.time() - start

View file

@ -79,7 +79,7 @@ class FasterMakeBackend(CommonBackend, PartialBackend):
.add_pattern_symlink( .add_pattern_symlink(
prefix, prefix,
f.full_path[len(prefix):], f.full_path[len(prefix):],
mozpath.join(path, f.target_basename)) path)
else: else:
self._install_manifests[obj.install_target].add_symlink( self._install_manifests[obj.install_target].add_symlink(
f.full_path, f.full_path,

View file

@ -228,7 +228,7 @@ class InstallManifest(object):
""" """
return json.loads(data) return json.loads(data)
def write(self, path=None, fileobj=None): def write(self, path=None, fileobj=None, expand_pattern=False):
"""Serialize this manifest to a file or file object. """Serialize this manifest to a file or file object.
If path is specified, that file will be written to. If fileobj is specified, If path is specified, that file will be written to. If fileobj is specified,
@ -242,6 +242,17 @@ class InstallManifest(object):
for dest in sorted(self._dests): for dest in sorted(self._dests):
entry = self._dests[dest] entry = self._dests[dest]
if expand_pattern and entry[0] in (self.PATTERN_SYMLINK, self.PATTERN_COPY):
type, base, pattern, dest = entry
type = self.SYMLINK if type == self.PATTERN_SYMLINK else self.COPY
finder = FileFinder(base)
paths = [f[0] for f in finder.find(pattern)]
for path in paths:
source = mozpath.join(base, path)
parts = ['%d' % type, mozpath.join(dest, path), source]
fh.write('%s\n' % self.FIELD_SEPARATOR.join(
p.encode('utf-8') for p in parts))
else:
parts = ['%d' % entry[0], dest] parts = ['%d' % entry[0], dest]
parts.extend(entry[1:]) parts.extend(entry[1:])
fh.write('%s\n' % self.FIELD_SEPARATOR.join( fh.write('%s\n' % self.FIELD_SEPARATOR.join(
@ -289,7 +300,7 @@ class InstallManifest(object):
<base>/foo/bar.h -> <dest>/foo/bar.h <base>/foo/bar.h -> <dest>/foo/bar.h
""" """
self._add_entry(mozpath.join(base, pattern, dest), self._add_entry(mozpath.join(dest, pattern),
(self.PATTERN_SYMLINK, base, pattern, dest)) (self.PATTERN_SYMLINK, base, pattern, dest))
def add_pattern_copy(self, base, pattern, dest): def add_pattern_copy(self, base, pattern, dest):
@ -297,7 +308,7 @@ class InstallManifest(object):
See ``add_pattern_symlink()`` for usage. See ``add_pattern_symlink()`` for usage.
""" """
self._add_entry(mozpath.join(base, pattern, dest), self._add_entry(mozpath.join(dest, pattern),
(self.PATTERN_COPY, base, pattern, dest)) (self.PATTERN_COPY, base, pattern, dest))
def add_preprocess(self, source, dest, deps, marker='#', defines={}, def add_preprocess(self, source, dest, deps, marker='#', defines={},

View file

@ -156,6 +156,29 @@ class TestInstallManifest(TestWithTmpDir):
self.assertIn('s_dest2', m1) self.assertIn('s_dest2', m1)
self.assertIn('c_dest2', m1) self.assertIn('c_dest2', m1)
def test_write_expand_pattern(self):
source = self.tmppath('source')
os.mkdir(source)
os.mkdir('%s/base' % source)
os.mkdir('%s/base/foo' % source)
with open('%s/base/foo/file1' % source, 'a'):
pass
with open('%s/base/foo/file2' % source, 'a'):
pass
m = InstallManifest()
m.add_pattern_link('%s/base' % source, '**', 'dest')
track = self.tmppath('track')
m.write(path=track, expand_pattern=True)
m = InstallManifest(path=track)
self.assertEqual([dest for dest in m._dests],
['dest/foo/file1', 'dest/foo/file2'])
def test_copier_application(self): def test_copier_application(self):
dest = self.tmppath('dest') dest = self.tmppath('dest')
os.mkdir(dest) os.mkdir(dest)

View file

@ -35,7 +35,7 @@ using namespace mozilla;
static bool static bool
ShouldHandleKeyEvent(nsIDOMEvent* aEvent) { ShouldHandleKeyEvent(nsIDOMEvent* aEvent) {
bool handled, trusted = false; bool handled, trusted = false;
aEvent->GetPreventDefault(&handled); aEvent->GetDefaultPrevented(&handled);
aEvent->GetIsTrusted(&trusted); aEvent->GetIsTrusted(&trusted);
if (handled || !trusted) { if (handled || !trusted) {

View file

@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
export:: export::
$(call py_action,process_install_manifest,$(DIST)/idl $(DEPTH)/_build_manifests/install/dist_idl) $(call py_action,process_install_manifest,--track install-xpidl.track $(DIST)/idl $(DEPTH)/_build_manifests/install/dist_idl)
$(call SUBMAKE,xpidl,$(DEPTH)/config/makefiles/xpidl) $(call SUBMAKE,xpidl,$(DEPTH)/config/makefiles/xpidl)
clean clobber realclean clobber_all distclean:: clean clobber realclean clobber_all distclean::