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

This commit is contained in:
roytam1 2021-07-15 09:47:07 +08:00
commit c0cea40182
31 changed files with 314 additions and 108 deletions

View file

@ -123,6 +123,13 @@ toolbar:-moz-lwtheme {
border-top: none; border-top: none;
} }
@media (-moz-os-version: windows-win10) and (-moz-windows-theme: aero) {
#navigator-toolbox {
/* Override the global style for Windows 10 that adds a bottom border */
border-bottom: none;
};
}
#navigator-toolbox::after { #navigator-toolbox::after {
content: ""; content: "";
display: -moz-box; display: -moz-box;

View file

@ -193,6 +193,13 @@
} }
} }
@media (-moz-os-version: windows-win10) and (-moz-windows-theme: aero) {
#placesToolbox {
/* Override the global style for Windows 10 that adds a bottom border */
border-bottom: none;
}
}
@media (-moz-windows-default-theme) and (-moz-os-version: windows-vista), @media (-moz-windows-default-theme) and (-moz-os-version: windows-vista),
(-moz-windows-default-theme) and (-moz-os-version: windows-win7) { (-moz-windows-default-theme) and (-moz-os-version: windows-win7) {
#placesView, #placesView,

View file

@ -91,6 +91,13 @@
border-top: none; border-top: none;
} }
@media (-moz-os-version: windows-win10) and (-moz-windows-theme: aero) {
#navigator-toolbox {
/* Override the global style for Windows 10 that adds a bottom border */
border-bottom: none;
};
}
#navigator-toolbox::after { #navigator-toolbox::after {
content: ""; content: "";
display: -moz-box; display: -moz-box;

View file

@ -214,6 +214,13 @@
} }
} }
@media (-moz-os-version: windows-win10) and (-moz-windows-theme: aero) {
#placesToolbox {
/* Override the global style for Windows 10 that adds a bottom border */
border-bottom: none;
}
}
@media (-moz-windows-default-theme) and (-moz-os-version: windows-vista), @media (-moz-windows-default-theme) and (-moz-os-version: windows-vista),
(-moz-windows-default-theme) and (-moz-os-version: windows-win7) { (-moz-windows-default-theme) and (-moz-os-version: windows-win7) {
#placesView, #placesView,

View file

@ -298,7 +298,6 @@ DOMInterfaces = {
# We can also get rid of the UnwrapArg bits in # We can also get rid of the UnwrapArg bits in
# the dom QueryInterface (in BindingUtils.cpp) at that point. # the dom QueryInterface (in BindingUtils.cpp) at that point.
'hasXPConnectImpls': True, 'hasXPConnectImpls': True,
'concrete': False,
'jsImplParent': 'mozilla::DOMEventTargetHelper', 'jsImplParent': 'mozilla::DOMEventTargetHelper',
'implicitJSContext': [ 'dispatchEvent' ] 'implicitJSContext': [ 'dispatchEvent' ]
}, },

View file

@ -2321,22 +2321,11 @@ class MethodDefiner(PropertyDefiner):
if len(signatures) > 1 or len(signatures[0][1]) > 1 or not argTypeIsIID(signatures[0][1][0]): if len(signatures) > 1 or len(signatures[0][1]) > 1 or not argTypeIsIID(signatures[0][1][0]):
raise TypeError("There should be only one queryInterface method with 1 argument of type IID") raise TypeError("There should be only one queryInterface method with 1 argument of type IID")
# Make sure to not stick QueryInterface on abstract interfaces that # Make sure to not stick QueryInterface on abstract interfaces.
# have hasXPConnectImpls (like EventTarget). So only put it on
# interfaces that are concrete and all of whose ancestors are abstract.
def allAncestorsAbstract(iface):
if not iface.parent:
return True
desc = self.descriptor.getDescriptor(iface.parent.identifier.name)
if desc.concrete:
return False
return allAncestorsAbstract(iface.parent)
if (not self.descriptor.interface.hasInterfacePrototypeObject() or if (not self.descriptor.interface.hasInterfacePrototypeObject() or
not self.descriptor.concrete or not self.descriptor.concrete):
not allAncestorsAbstract(self.descriptor.interface)):
raise TypeError("QueryInterface is only supported on " raise TypeError("QueryInterface is only supported on "
"interfaces that are concrete and all " "interfaces that are concrete: " +
"of whose ancestors are abstract: " +
self.descriptor.name) self.descriptor.name)
condition = "WantsQueryInterface<%s>::Enabled" % descriptor.nativeType condition = "WantsQueryInterface<%s>::Enabled" % descriptor.nativeType
self.regular.append({ self.regular.append({

View file

@ -0,0 +1,20 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#include "mozilla/dom/ConstructibleEventTarget.h"
#include "mozilla/dom/EventTargetBinding.h"
namespace mozilla {
namespace dom {
JSObject*
ConstructibleEventTarget::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
{
return EventTargetBinding::Wrap(cx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla

View file

@ -0,0 +1,34 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_ConstructibleEventTarget_h_
#define mozilla_dom_ConstructibleEventTarget_h_
#include "mozilla/DOMEventTargetHelper.h"
#include "js/RootingAPI.h"
namespace mozilla {
namespace dom {
class ConstructibleEventTarget : public DOMEventTargetHelper
{
public:
// We're not worrying about ISupports and Cycle Collection here just for a wrapper function.
// This does mean that ConstructibleEventTarget will show up in CC and refcount logs as a
// DOMEventTargetHelper, but that's OK.
explicit ConstructibleEventTarget(nsIGlobalObject* aGlobalObject)
: DOMEventTargetHelper(aGlobalObject)
{
}
virtual JSObject* WrapObject(JSContext* cx,
JS::Handle<JSObject*> aGivenProto) override;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ConstructibleEventTarget_h_

View file

@ -146,10 +146,7 @@ public:
void BindToOwner(nsPIDOMWindowInner* aOwner); void BindToOwner(nsPIDOMWindowInner* aOwner);
void BindToOwner(DOMEventTargetHelper* aOther); void BindToOwner(DOMEventTargetHelper* aOther);
virtual void DisconnectFromOwner(); virtual void DisconnectFromOwner();
nsIGlobalObject* GetParentObject() const using EventTarget::GetParentObject;
{
return GetOwnerGlobal();
}
virtual nsIGlobalObject* GetOwnerGlobal() const override virtual nsIGlobalObject* GetOwnerGlobal() const override
{ {
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject); nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject);

View file

@ -7,11 +7,26 @@
#include "mozilla/dom/Event.h" #include "mozilla/dom/Event.h"
#include "mozilla/dom/EventTarget.h" #include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/EventTargetBinding.h" #include "mozilla/dom/EventTargetBinding.h"
#include "mozilla/dom/ConstructibleEventTarget.h"
#include "nsIGlobalObject.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
/* static */
already_AddRefed<EventTarget>
EventTarget::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
if (!global) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
RefPtr<EventTarget> target = new ConstructibleEventTarget(global);
return target.forget();
}
void void
EventTarget::RemoveEventListener(const nsAString& aType, EventTarget::RemoveEventListener(const nsAString& aType,
EventListener* aListener, EventListener* aListener,

View file

@ -26,6 +26,7 @@ class Event;
class EventListener; class EventListener;
class EventListenerOptionsOrBoolean; class EventListenerOptionsOrBoolean;
class EventHandlerNonNull; class EventHandlerNonNull;
class GlobalObject;
template <class T> struct Nullable; template <class T> struct Nullable;
@ -41,6 +42,8 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_EVENTTARGET_IID) NS_DECLARE_STATIC_IID_ACCESSOR(NS_EVENTTARGET_IID)
// WebIDL API // WebIDL API
static already_AddRefed<EventTarget> Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv);
using nsIDOMEventTarget::AddEventListener; using nsIDOMEventTarget::AddEventListener;
using nsIDOMEventTarget::RemoveEventListener; using nsIDOMEventTarget::RemoveEventListener;
using nsIDOMEventTarget::DispatchEvent; using nsIDOMEventTarget::DispatchEvent;
@ -55,6 +58,11 @@ public:
ErrorResult& aRv); ErrorResult& aRv);
bool DispatchEvent(JSContext* aCx, Event& aEvent, ErrorResult& aRv); bool DispatchEvent(JSContext* aCx, Event& aEvent, ErrorResult& aRv);
nsIGlobalObject* GetParentObject() const
{
return GetOwnerGlobal();
}
// Note, this takes the type in onfoo form! // Note, this takes the type in onfoo form!
EventHandlerNonNull* GetEventHandler(const nsAString& aType) EventHandlerNonNull* GetEventHandler(const nsAString& aType)
{ {

View file

@ -40,6 +40,7 @@ EXPORTS.mozilla.dom += [
'ClipboardEvent.h', 'ClipboardEvent.h',
'CommandEvent.h', 'CommandEvent.h',
'CompositionEvent.h', 'CompositionEvent.h',
'ConstructibleEventTarget.h',
'CustomEvent.h', 'CustomEvent.h',
'DataContainerEvent.h', 'DataContainerEvent.h',
'DataTransfer.h', 'DataTransfer.h',
@ -80,6 +81,7 @@ SOURCES += [
'ClipboardEvent.cpp', 'ClipboardEvent.cpp',
'CommandEvent.cpp', 'CommandEvent.cpp',
'CompositionEvent.cpp', 'CompositionEvent.cpp',
'ConstructibleEventTarget.cpp',
'ContentEventHandler.cpp', 'ContentEventHandler.cpp',
'CustomEvent.cpp', 'CustomEvent.cpp',
'DataContainerEvent.cpp', 'DataContainerEvent.cpp',

View file

@ -23,7 +23,8 @@ dictionary AddEventListenerOptions : EventListenerOptions {
boolean once = false; boolean once = false;
}; };
[Exposed=(Window,Worker,WorkerDebugger,System)] [Constructor,
Exposed=(Window,Worker,WorkerDebugger,System)]
interface EventTarget { interface EventTarget {
/* Passing null for wantsUntrusted means "default behavior", which /* Passing null for wantsUntrusted means "default behavior", which
differs in content and chrome. In content that default boolean differs in content and chrome. In content that default boolean

View file

@ -205,6 +205,7 @@ bool Image11::redefine(GLenum target, GLenum internalformat, const gl::Extents &
{ {
if (mWidth != size.width || if (mWidth != size.width ||
mHeight != size.height || mHeight != size.height ||
mDepth != size.depth ||
mInternalFormat != internalformat || mInternalFormat != internalformat ||
forceRelease) forceRelease)
{ {

View file

@ -1463,9 +1463,7 @@ pref("network.http.redirection-limit", 20);
// Enable http compression: comment this out in case of problems with 1.1 // Enable http compression: comment this out in case of problems with 1.1
// NOTE: support for "compress" has been disabled per bug 196406. // NOTE: support for "compress" has been disabled per bug 196406.
// NOTE: separate values with comma+space (", "): see bug 576033 // NOTE: separate values with comma+space (", "): see bug 576033
// NOTE: there is currently no reason except evangelism for https to not use brotli for http
pref("network.http.accept-encoding", "gzip, deflate, br"); pref("network.http.accept-encoding", "gzip, deflate, br");
pref("network.http.accept-encoding.secure", "gzip, deflate, br");
pref("network.http.pipelining" , true); pref("network.http.pipelining" , true);
pref("network.http.pipelining.ssl" , false); // disable pipelining over SSL pref("network.http.pipelining.ssl" , false); // disable pipelining over SSL

View file

@ -165,7 +165,7 @@ int16_t gBadPortList[] = {
6667, // Standard IRC [Apple addition] 6667, // Standard IRC [Apple addition]
6668, // Alternate IRC [Apple addition] 6668, // Alternate IRC [Apple addition]
6669, // Alternate IRC [Apple addition] 6669, // Alternate IRC [Apple addition]
10080,// Amanda // 10080,// (Amanda) too many collisions with other services, disabled for now.
0, // Sentinel value: This MUST be zero 0, // Sentinel value: This MUST be zero
}; };

View file

@ -315,6 +315,46 @@ DumpLeakedURLs::~DumpLeakedURLs()
} }
#endif #endif
bool nsStandardURL::IsValid() {
auto checkSegment = [&](const nsStandardURL::URLSegment& aSeg) {
// Bad value
if (NS_WARN_IF(aSeg.mLen < -1)) {
return false;
}
if (aSeg.mLen == -1) {
return true;
}
// Position outside of string
if (NS_WARN_IF(aSeg.mPos + aSeg.mLen > mSpec.Length())) {
return false;
}
// Overflow
if (NS_WARN_IF(aSeg.mPos + aSeg.mLen < aSeg.mPos)) {
return false;
}
return true;
};
bool allSegmentsValid = checkSegment(mScheme) && checkSegment(mAuthority) &&
checkSegment(mUsername) && checkSegment(mPassword) &&
checkSegment(mHost) && checkSegment(mPath) &&
checkSegment(mFilepath) && checkSegment(mDirectory) &&
checkSegment(mBasename) && checkSegment(mExtension) &&
checkSegment(mQuery) && checkSegment(mRef);
if (!allSegmentsValid) {
return false;
}
if (mScheme.mPos != 0) {
return false;
}
return true;
}
void void
nsStandardURL::InitGlobalObjects() nsStandardURL::InitGlobalObjects()
{ {
@ -3518,6 +3558,10 @@ nsStandardURL::Deserialize(const URIParams& aParams)
return false; return false;
} }
// If we exit early, make sure to clear the URL so we don't fail the sanity
// check in the destructor
auto clearOnExit = MakeScopeExit([&] { Clear(); });
const StandardURLParams& params = aParams.get_StandardURLParams(); const StandardURLParams& params = aParams.get_StandardURLParams();
mURLType = params.urlType(); mURLType = params.urlType();
@ -3565,7 +3609,7 @@ nsStandardURL::Deserialize(const URIParams& aParams)
mSupportsFileURL = params.supportsFileURL(); mSupportsFileURL = params.supportsFileURL();
mHostEncoding = params.hostEncoding(); mHostEncoding = params.hostEncoding();
// Some sanity checks // Some segment sanity checks
NS_ENSURE_TRUE(mScheme.mPos == 0, false); NS_ENSURE_TRUE(mScheme.mPos == 0, false);
NS_ENSURE_TRUE(mScheme.mLen > 0, false); NS_ENSURE_TRUE(mScheme.mLen > 0, false);
// Make sure scheme is followed by :// (3 characters) // Make sure scheme is followed by :// (3 characters)
@ -3577,6 +3621,13 @@ nsStandardURL::Deserialize(const URIParams& aParams)
NS_ENSURE_TRUE(mQuery.mLen == -1 || mSpec.CharAt(mQuery.mPos - 1) == '?', false); NS_ENSURE_TRUE(mQuery.mLen == -1 || mSpec.CharAt(mQuery.mPos - 1) == '?', false);
NS_ENSURE_TRUE(mRef.mLen == -1 || mSpec.CharAt(mRef.mPos - 1) == '#', false); NS_ENSURE_TRUE(mRef.mLen == -1 || mSpec.CharAt(mRef.mPos - 1) == '#', false);
// Sanity-check the result
if (!IsValid()) {
return false;
}
clearOnExit.release();
// mSpecEncoding and mHostA are just caches that can be recovered as needed. // mSpecEncoding and mHostA are just caches that can be recovered as needed.
return true; return true;
} }

View file

@ -253,6 +253,9 @@ private:
void FindHostLimit(nsACString::const_iterator& aStart, void FindHostLimit(nsACString::const_iterator& aStart,
nsACString::const_iterator& aEnd); nsACString::const_iterator& aEnd);
// Checks if the URL has a valid representation.
bool IsValid();
// mSpec contains the normalized version of the URL spec (UTF-8 encoded). // mSpec contains the normalized version of the URL spec (UTF-8 encoded).
nsCString mSpec; nsCString mSpec;
int32_t mDefaultPort; int32_t mDefaultPort;

View file

@ -215,6 +215,11 @@ nsresult CacheIOThread::Init()
mBlockingIOWatcher = MakeUnique<detail::BlockingIOWatcher>(); mBlockingIOWatcher = MakeUnique<detail::BlockingIOWatcher>();
} }
// Increase the reference count while spawning a new thread.
// If PR_CreateThread succeeds, we will forget this reference and the thread
// will be responsible to release it when it completes.
RefPtr<CacheIOThread> self = this;
mThread = PR_CreateThread(PR_USER_THREAD, ThreadFunc, this, mThread = PR_CreateThread(PR_USER_THREAD, ThreadFunc, this,
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
PR_JOINABLE_THREAD, 128 * 1024); PR_JOINABLE_THREAD, 128 * 1024);
@ -222,6 +227,11 @@ nsresult CacheIOThread::Init()
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
// IMPORTANT: The thread now owns this reference, so it's important that we
// leak it here, otherwise we'll end up with a bad refcount.
// See the dont_AddRef in ThreadFunc().
Unused << self.forget().take();
return NS_OK; return NS_OK;
} }
@ -382,7 +392,9 @@ void CacheIOThread::ThreadFunc(void* aClosure)
{ {
PR_SetCurrentThreadName("Cache2 I/O"); PR_SetCurrentThreadName("Cache2 I/O");
mozilla::IOInterposer::RegisterCurrentThread(); mozilla::IOInterposer::RegisterCurrentThread();
CacheIOThread* thread = static_cast<CacheIOThread*>(aClosure); // We hold on to this reference for the duration of the thread.
RefPtr<CacheIOThread> thread =
dont_AddRef(static_cast<CacheIOThread*>(aClosure));
thread->ThreadFunc(); thread->ThreadFunc();
mozilla::IOInterposer::UnregisterCurrentThread(); mozilla::IOInterposer::UnregisterCurrentThread();
} }

View file

@ -171,10 +171,7 @@ HttpBaseChannel::Init(nsIURI *aURI,
int32_t port = -1; int32_t port = -1;
bool isHTTPS = false; bool isHTTPS = false;
nsresult rv = mURI->SchemeIs("https", &isHTTPS); nsresult rv = mURI->GetAsciiHost(host);
if (NS_FAILED(rv)) return rv;
rv = mURI->GetAsciiHost(host);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// Reject the URL if it doesn't specify a host // Reject the URL if it doesn't specify a host
@ -201,7 +198,7 @@ HttpBaseChannel::Init(nsIURI *aURI,
rv = mRequestHead.SetHeader(nsHttp::Host, hostLine); rv = mRequestHead.SetHeader(nsHttp::Host, hostLine);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = gHttpHandler->AddStandardRequestHeaders(&mRequestHead, isHTTPS, aContentPolicyType); rv = gHttpHandler->AddStandardRequestHeaders(&mRequestHead, aContentPolicyType);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsAutoCString type; nsAutoCString type;
@ -975,9 +972,7 @@ HttpBaseChannel::DoApplyContentConversions(nsIStreamListener* aNextListener,
break; break;
} }
bool isHTTPS = false; if (gHttpHandler->IsAcceptableEncoding(val)) {
mURI->SchemeIs("https", &isHTTPS);
if (gHttpHandler->IsAcceptableEncoding(val, isHTTPS)) {
nsCOMPtr<nsIStreamConverterService> serv; nsCOMPtr<nsIStreamConverterService> serv;
rv = gHttpHandler->GetStreamConverterService(getter_AddRefs(serv)); rv = gHttpHandler->GetStreamConverterService(getter_AddRefs(serv));

View file

@ -446,7 +446,6 @@ nsHttpHandler::InitConnectionMgr()
nsresult nsresult
nsHttpHandler::AddStandardRequestHeaders(nsHttpRequestHead *request, nsHttpHandler::AddStandardRequestHeaders(nsHttpRequestHead *request,
bool isSecure,
nsContentPolicyType aContentPolicyType) nsContentPolicyType aContentPolicyType)
{ {
nsresult rv; nsresult rv;
@ -493,15 +492,9 @@ nsHttpHandler::AddStandardRequestHeaders(nsHttpRequestHead *request,
} }
// Add the "Accept-Encoding" header // Add the "Accept-Encoding" header
if (isSecure) { rv = request->SetHeader(nsHttp::Accept_Encoding, mAcceptEncodings,
rv = request->SetHeader(nsHttp::Accept_Encoding, mHttpsAcceptEncodings, false,
false, nsHttpHeaderArray::eVarietyRequestDefault);
nsHttpHeaderArray::eVarietyRequestDefault);
} else {
rv = request->SetHeader(nsHttp::Accept_Encoding, mHttpAcceptEncodings,
false,
nsHttpHeaderArray::eVarietyRequestDefault);
}
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// add the "Send Hint" header // add the "Send Hint" header
@ -535,19 +528,15 @@ nsHttpHandler::AddConnectionHeader(nsHttpRequestHead *request,
} }
bool bool
nsHttpHandler::IsAcceptableEncoding(const char *enc, bool isSecure) nsHttpHandler::IsAcceptableEncoding(const char *enc)
{ {
if (!enc) if (!enc)
return false; return false;
// we used to accept x-foo anytime foo was acceptable, but that's just // we used to accept x-foo anytime foo was acceptable, but that's just
// continuing bad behavior.. so limit it to known x-* patterns // continuing bad behavior.. so limit it to known x-* patterns
bool rv; bool rv = nsHttp::FindToken(mAcceptEncodings.get(), enc, HTTP_LWS ",") != nullptr;
if (isSecure) {
rv = nsHttp::FindToken(mHttpsAcceptEncodings.get(), enc, HTTP_LWS ",") != nullptr;
} else {
rv = nsHttp::FindToken(mHttpAcceptEncodings.get(), enc, HTTP_LWS ",") != nullptr;
}
// gzip and deflate are inherently acceptable in modern HTTP - always // gzip and deflate are inherently acceptable in modern HTTP - always
// process them if a stream converter can also be found. // process them if a stream converter can also be found.
if (!rv && if (!rv &&
@ -555,8 +544,8 @@ nsHttpHandler::IsAcceptableEncoding(const char *enc, bool isSecure)
!PL_strcasecmp(enc, "x-gzip") || !PL_strcasecmp(enc, "x-deflate"))) { !PL_strcasecmp(enc, "x-gzip") || !PL_strcasecmp(enc, "x-deflate"))) {
rv = true; rv = true;
} }
LOG(("nsHttpHandler::IsAceptableEncoding %s https=%d %d\n", LOG(("nsHttpHandler::IsAceptableEncoding %s %d\n",
enc, isSecure, rv)); enc, rv));
return rv; return rv;
} }
@ -1275,16 +1264,7 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
rv = prefs->GetCharPref(HTTP_PREF("accept-encoding"), rv = prefs->GetCharPref(HTTP_PREF("accept-encoding"),
getter_Copies(acceptEncodings)); getter_Copies(acceptEncodings));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
SetAcceptEncodings(acceptEncodings, false); SetAcceptEncodings(acceptEncodings);
}
}
if (PREF_CHANGED(HTTP_PREF("accept-encoding.secure"))) {
nsXPIDLCString acceptEncodings;
rv = prefs->GetCharPref(HTTP_PREF("accept-encoding.secure"),
getter_Copies(acceptEncodings));
if (NS_SUCCEEDED(rv)) {
SetAcceptEncodings(acceptEncodings, true);
} }
} }
@ -1910,18 +1890,9 @@ nsHttpHandler::SetAccept(const char *aAccept, AcceptType aType)
} }
nsresult nsresult
nsHttpHandler::SetAcceptEncodings(const char *aAcceptEncodings, bool isSecure) nsHttpHandler::SetAcceptEncodings(const char *aAcceptEncodings)
{ {
if (isSecure) { mAcceptEncodings = aAcceptEncodings;
mHttpsAcceptEncodings = aAcceptEncodings;
} else {
// use legacy list if a secure override is not specified
mHttpAcceptEncodings = aAcceptEncodings;
if (mHttpsAcceptEncodings.IsEmpty()) {
mHttpsAcceptEncodings = aAcceptEncodings;
}
}
return NS_OK; return NS_OK;
} }

View file

@ -79,10 +79,10 @@ public:
nsHttpHandler(); nsHttpHandler();
nsresult Init(); nsresult Init();
nsresult AddStandardRequestHeaders(nsHttpRequestHead *, bool isSecure, nsContentPolicyType aContentPolicyType); nsresult AddStandardRequestHeaders(nsHttpRequestHead *, nsContentPolicyType aContentPolicyType);
nsresult AddConnectionHeader(nsHttpRequestHead *, nsresult AddConnectionHeader(nsHttpRequestHead *,
uint32_t capabilities); uint32_t capabilities);
bool IsAcceptableEncoding(const char *encoding, bool isSecure); bool IsAcceptableEncoding(const char *encoding);
const nsAFlatCString &UserAgent(); const nsAFlatCString &UserAgent();
@ -398,7 +398,7 @@ private:
nsresult SetAccept(const char *, AcceptType aType); nsresult SetAccept(const char *, AcceptType aType);
nsresult SetAcceptLanguages(); nsresult SetAcceptLanguages();
nsresult SetAcceptEncodings(const char *, bool mIsSecure); nsresult SetAcceptEncodings(const char *);
nsresult InitConnectionMgr(); nsresult InitConnectionMgr();
@ -476,8 +476,7 @@ private:
nsCString mAcceptStyle; nsCString mAcceptStyle;
nsCString mAcceptDefault; nsCString mAcceptDefault;
nsCString mAcceptLanguages; nsCString mAcceptLanguages;
nsCString mHttpAcceptEncodings; nsCString mAcceptEncodings;
nsCString mHttpsAcceptEncodings;
nsXPIDLCString mDefaultSocketType; nsXPIDLCString mDefaultSocketType;

View file

@ -9,6 +9,10 @@
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsIIPCSerializableURI.h" #include "nsIIPCSerializableURI.h"
#include "mozilla/ipc/URIUtils.h" #include "mozilla/ipc/URIUtils.h"
#include "mozilla/Unused.h"
#include "nsSerializationHelper.h"
#include "mozilla/Base64.h"
#include "nsEscape.h"
TEST(TestStandardURL, Simple) { TEST(TestStandardURL, Simple) {
nsCOMPtr<nsIURL> url( do_CreateInstance(NS_STANDARDURL_CONTRACTID) ); nsCOMPtr<nsIURL> url( do_CreateInstance(NS_STANDARDURL_CONTRACTID) );
@ -83,3 +87,50 @@ TEST(TestStandardURL, Deserialize_Bug1392739)
nsCOMPtr<nsIIPCSerializableURI> url = do_CreateInstance(NS_STANDARDURL_CID); nsCOMPtr<nsIIPCSerializableURI> url = do_CreateInstance(NS_STANDARDURL_CID);
ASSERT_EQ(url->Deserialize(params), false); ASSERT_EQ(url->Deserialize(params), false);
} }
TEST(TestStandardURL, CorruptSerialization)
{
auto spec = "http://user:pass@example.com/path/to/file.ext?query#hash"_ns;
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
.SetSpec(spec)
.Finalize(uri);
ASSERT_EQ(rv, NS_OK);
nsAutoCString serialization;
nsCOMPtr<nsISerializable> serializable = do_QueryInterface(uri);
ASSERT_TRUE(serializable);
// Check that the URL is normally serializable.
ASSERT_EQ(NS_OK, NS_SerializeToString(serializable, serialization));
nsCOMPtr<nsISupports> deserializedObject;
ASSERT_EQ(NS_OK, NS_DeserializeObject(serialization,
getter_AddRefs(deserializedObject)));
nsAutoCString canonicalBin;
Unused << Base64Decode(serialization, canonicalBin);
// The spec serialization begins at byte 49
// If the implementation of nsStandardURL::Write changes, this test will need
// to be adjusted.
#define SPEC_OFFSET 49
ASSERT_EQ(Substring(canonicalBin, SPEC_OFFSET, 7), "http://"_ns);
nsAutoCString corruptedBin = canonicalBin;
// change mScheme.mPos
corruptedBin.BeginWriting()[SPEC_OFFSET + spec.Length()] = 1;
Unused << Base64Encode(corruptedBin, serialization);
ASSERT_EQ(
NS_ERROR_MALFORMED_URI,
NS_DeserializeObject(serialization, getter_AddRefs(deserializedObject)));
corruptedBin = canonicalBin;
// change mScheme.mLen
corruptedBin.BeginWriting()[SPEC_OFFSET + spec.Length() + 4] = 127;
Unused << Base64Encode(corruptedBin, serialization);
ASSERT_EQ(
NS_ERROR_MALFORMED_URI,
NS_DeserializeObject(serialization, getter_AddRefs(deserializedObject)));
}

View file

@ -771,10 +771,15 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce(
_PR_ImplicitInitialization(); _PR_ImplicitInitialization();
} }
if (!once->initialized) { PR_Lock(mod_init.ml);
PRIntn initialized = once->initialized;
PRStatus status = once->status;
PR_Unlock(mod_init.ml);
if (!initialized) {
if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) {
once->status = (*func)(); status = (*func)();
PR_Lock(mod_init.ml); PR_Lock(mod_init.ml);
once->status = status;
once->initialized = 1; once->initialized = 1;
PR_NotifyAllCondVar(mod_init.cv); PR_NotifyAllCondVar(mod_init.cv);
PR_Unlock(mod_init.ml); PR_Unlock(mod_init.ml);
@ -783,14 +788,18 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce(
while (!once->initialized) { while (!once->initialized) {
PR_WaitCondVar(mod_init.cv, PR_INTERVAL_NO_TIMEOUT); PR_WaitCondVar(mod_init.cv, PR_INTERVAL_NO_TIMEOUT);
} }
status = once->status;
PR_Unlock(mod_init.ml); PR_Unlock(mod_init.ml);
if (PR_SUCCESS != status) {
PR_SetError(PR_CALL_ONCE_ERROR, 0);
}
} }
} else { return status;
if (PR_SUCCESS != once->status) {
PR_SetError(PR_CALL_ONCE_ERROR, 0);
}
} }
return once->status; if (PR_SUCCESS != status) {
PR_SetError(PR_CALL_ONCE_ERROR, 0);
}
return status;
} }
PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg( PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg(
@ -802,10 +811,15 @@ PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg(
_PR_ImplicitInitialization(); _PR_ImplicitInitialization();
} }
if (!once->initialized) { PR_Lock(mod_init.ml);
PRIntn initialized = once->initialized;
PRStatus status = once->status;
PR_Unlock(mod_init.ml);
if (!initialized) {
if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) {
once->status = (*func)(arg); status = (*func)(arg);
PR_Lock(mod_init.ml); PR_Lock(mod_init.ml);
once->status = status;
once->initialized = 1; once->initialized = 1;
PR_NotifyAllCondVar(mod_init.cv); PR_NotifyAllCondVar(mod_init.cv);
PR_Unlock(mod_init.ml); PR_Unlock(mod_init.ml);
@ -814,14 +828,18 @@ PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg(
while (!once->initialized) { while (!once->initialized) {
PR_WaitCondVar(mod_init.cv, PR_INTERVAL_NO_TIMEOUT); PR_WaitCondVar(mod_init.cv, PR_INTERVAL_NO_TIMEOUT);
} }
status = once->status;
PR_Unlock(mod_init.ml); PR_Unlock(mod_init.ml);
if (PR_SUCCESS != status) {
PR_SetError(PR_CALL_ONCE_ERROR, 0);
}
} }
} else { return status;
if (PR_SUCCESS != once->status) {
PR_SetError(PR_CALL_ONCE_ERROR, 0);
}
} }
return once->status; if (PR_SUCCESS != status) {
PR_SetError(PR_CALL_ONCE_ERROR, 0);
}
return status;
} }
PRBool _PR_Obsolete(const char *obsolete, const char *preferred) PRBool _PR_Obsolete(const char *obsolete, const char *preferred)

View file

@ -1,3 +0,0 @@
[details.html]
type: testharness
prefs: [dom.details_element.enabled:true]

View file

@ -1,3 +0,0 @@
[toggleEvent.html]
type: testharness
prefs: [dom.details_element.enabled:true]

View file

@ -208,11 +208,13 @@ toolbar#ToolbarMode .toolbarbutton-text {
} }
%ifdef XP_WIN %ifdef XP_WIN
#ToolbarMode { @media not (-moz-os-version: windows-win10) {
-moz-appearance: -moz-win-browsertabbar-toolbox; #ToolbarMode {
} -moz-appearance: -moz-win-browsertabbar-toolbox;
}
#ToolbarEval { #ToolbarEval {
-moz-appearance: toolbox; -moz-appearance: toolbox;
}
} }
%endif %endif

View file

@ -23,6 +23,12 @@ toolbox {
so don't use the widget toolbox styling and fallback to -moz-Dialog's so don't use the widget toolbox styling and fallback to -moz-Dialog's
color which by default should be a non-blinding rgb(240, 240, 240) */ color which by default should be a non-blinding rgb(240, 240, 240) */
-moz-appearance: none; -moz-appearance: none;
/* Since we are overriding the style we want to provide the bottom border
that is normally drawn by look&feel.
However, local application styling may also provide it on adjacent
widgets as a border-top. Those will need to omit it on Windows 10. */
border-bottom: 1px solid ThreeDShadow;
} }
} }

View file

@ -198,6 +198,14 @@ treechildren::-moz-tree-cell-text(progressmeter) {
/* ::::: tree columns ::::: */ /* ::::: tree columns ::::: */
@media (-moz-os-version: windows-win10) and (-moz-windows-theme: aero) {
treecols {
/* Windows 10's "aero" msstyle does not provide a complete style for
the treecols header so we need to provide a bottom border */
border-bottom: 1px solid ThreeDLightShadow;
}
}
treecol, treecol,
treecolpicker { treecolpicker {
-moz-appearance: treeheadercell; -moz-appearance: treeheadercell;

View file

@ -111,7 +111,7 @@ richlistitem[type="download"] .dateTime {
margin-top: 3px; margin-top: 3px;
} }
@media (-moz-windows-compositor) { @media (-moz-windows-compositor) and (-moz-os-version: windows-win7) {
#downloadManager { #downloadManager {
-moz-appearance: -moz-win-glass; -moz-appearance: -moz-win-glass;
background: transparent; background: transparent;

View file

@ -359,7 +359,11 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
aSuggestedDriverVersion.AssignLiteral("Mesa 8.1"); aSuggestedDriverVersion.AssignLiteral("Mesa 8.1");
} }
} }
else if (mIsNouveau && version(mMajorVersion, mMinorVersion) < version(11,0)) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aFailureId = "FEATURE_FAILURE_OLD_NOUVEAU";
aSuggestedDriverVersion.AssignLiteral("Mesa 11.0");
}
} else if (mIsNVIDIA) { } else if (mIsNVIDIA) {
if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(257,21)) { if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(257,21)) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;