merge mozilla-inbound to mozilla-central. r=merge a=merge

MozReview-Commit-ID: 1yS8D5e0Ejz
This commit is contained in:
Sebastian Hengst 2017-08-20 23:24:15 +02:00
commit 54d8b1efae
18 changed files with 163 additions and 37 deletions

View File

@ -101,6 +101,9 @@ function* testSelect(view, swatch, inspector, testActor) {
let color = swatch.style.backgroundColor;
is(color, EXPECTED_COLOR, "swatch changed colors");
ok(!swatch.eyedropperOpen, "swatch eye dropper is closed");
ok(!swatch.activeSwatch, "no active swatch");
is((yield getComputedStyleProperty("div", null, "background-color")),
EXPECTED_COLOR,
"div's color set to body color after dropper");

View File

@ -97,15 +97,21 @@ body,
flex-wrap: wrap;
}
.learn-more-link {
color: var(--theme-highlight-blue);
cursor: pointer;
margin: 0 5px;
white-space: nowrap;
/* Learn more links */
.learn-more-link::before {
background-image: url(chrome://devtools/skin/images/help.svg);
}
.learn-more-link:hover {
text-decoration: underline;
.tree-container .treeTable tr .learn-more-link {
position: absolute;
top: 0;
left: 0;
padding: 0;
}
.tree-container .treeTable tr:not(:hover) .learn-more-link {
opacity: 0.1;
}
/* Status bar */
@ -856,6 +862,7 @@ body,
.tree-container .treeTable tr {
display: block;
position: relative;
}
/* Make right td fill available horizontal space */
@ -985,10 +992,6 @@ body,
width: auto!important;
}
.headers-summary .learn-more-link {
flex-grow: 1;
}
/* Response tabpanel */
.response-error-header {

View File

@ -19,10 +19,10 @@ const LEARN_MORE = L10N.getStr("netmonitor.headers.learnMore");
function MDNLink({ url }) {
return (
a({
className: "learn-more-link",
title: url,
className: "devtools-button learn-more-link",
title: LEARN_MORE,
onClick: (e) => onLearnMoreClick(e, url),
}, `[${LEARN_MORE}]`)
})
);
}

View File

@ -32,7 +32,7 @@ add_task(function* () {
wait = waitForDOM(document, ".raw-headers-container textarea", 2);
EventUtils.sendMouseEvent({ type: "click" },
document.querySelectorAll(".headers-summary .devtools-button")[1]);
document.querySelectorAll(".headers-summary .devtools-button")[2]);
yield wait;
testShowRawHeaders(getSortedRequests(store.getState()).get(0));

View File

@ -176,6 +176,7 @@ SwatchColorPickerTooltip.prototype = Heritage.extend(SwatchBasedEditorTooltip.pr
inspector.once("color-picked", color => {
toolbox.win.focus();
this._selectColor(color);
this._onEyeDropperDone();
});
inspector.once("color-pick-canceled", () => {

View File

@ -1,4 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="11" stroke-width="2" stroke="currentColor" fill="none"/>
<path d="M12.2,4.9c-1.6,0-2.9,0.4-3.8,0.8L9.2,8c0.6-0.4,1.5-0.6,2.2-0.6c1.1,0,1.6,0.5,1.6,1.2 c0,0.7-0.6,1.3-1.3,2.1c-1,1.1-1.4,2.1-1.3,3.2l0,0.5h3V14c0-0.9,0.3-1.7,1.2-2.5c0.9-0.9,1.9-1.9,1.9-3.4 C16.6,6.4,15.2,4.9,12.2,4.9z M12,16.1c-1.1,0-1.9,0.8-1.9,1.9c0,1.1,0.8,1.9,1.9,1.9c1.2,0,1.9-0.8,1.9-1.9 C13.9,16.9,13.1,16.1,12,16.1z"/>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="context-fill" d="M8 1a7 7 0 1 0 7 7 7.008 7.008 0 0 0-7-7zm0 13a6 6 0 1 1 6-6 6.007 6.007 0 0 1-6 6zM8 3.125A2.7 2.7 0 0 0 5.125 6a.875.875 0 0 0 1.75 0c0-1 .6-1.125 1.125-1.125a1.105 1.105 0 0 1 1.13.744.894.894 0 0 1-.53 1.016A2.738 2.738 0 0 0 7.125 9v.337a.875.875 0 0 0 1.75 0v-.37a1.041 1.041 0 0 1 .609-.824A2.637 2.637 0 0 0 10.82 5.16 2.838 2.838 0 0 0 8 3.125zm0 7.625A1.25 1.25 0 1 0 9.25 12 1.25 1.25 0 0 0 8 10.75z"></path>
</svg>

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 754 B

View File

@ -89,6 +89,7 @@ SERVO_ARC_TYPE(StyleContext, ServoStyleContext)
#undef SERVO_ARC_TYPE
static Mutex* sServoFontMetricsLock = nullptr;
static Mutex* sServoWidgetLock = nullptr;
static RWLock* sServoLangFontPrefsLock = nullptr;
static
@ -862,12 +863,14 @@ Gecko_GetBody(RawGeckoPresContextBorrowed aPresContext)
return aPresContext->Document()->GetBodyElement();
}
nscolor Gecko_GetLookAndFeelSystemColor(int32_t aId,
RawGeckoPresContextBorrowed aPresContext)
nscolor
Gecko_GetLookAndFeelSystemColor(int32_t aId,
RawGeckoPresContextBorrowed aPresContext)
{
bool useStandinsForNativeColors = aPresContext && !aPresContext->IsChrome();
nscolor result;
LookAndFeel::ColorID colorId = static_cast<LookAndFeel::ColorID>(aId);
MutexAutoLock guard(*sServoWidgetLock);
LookAndFeel::GetColor(colorId, useStandinsForNativeColors, &result);
return result;
}
@ -2458,13 +2461,19 @@ InitializeServo()
Servo_Initialize(URLExtraData::Dummy());
sServoFontMetricsLock = new Mutex("Gecko_GetFontMetrics");
sServoWidgetLock = new Mutex("Servo::WidgetLock");
sServoLangFontPrefsLock = new RWLock("nsPresContext::GetDefaultFont");
}
void
ShutdownServo()
{
MOZ_ASSERT(sServoFontMetricsLock);
MOZ_ASSERT(sServoWidgetLock);
MOZ_ASSERT(sServoLangFontPrefsLock);
delete sServoFontMetricsLock;
delete sServoWidgetLock;
delete sServoLangFontPrefsLock;
Servo_Shutdown();
}

View File

@ -19,10 +19,20 @@ namespace net {
* layer do.
**/
#define TFO_NOT_TRIED 0
#define TFO_TRIED 1
#define TFO_DATA_SENT 2
#define TFO_FAILED 3
typedef enum {
TFO_NOT_TRIED,
TFO_TRIED,
TFO_DATA_SENT,
TFO_FAILED_CONNECTION_REFUSED,
TFO_FAILED_NET_TIMEOUT,
TFO_FAILED_UNKNOW_ERROR,
TFO_FAILED_BACKUP_CONNECTION,
TFO_FAILED_CONNECTION_REFUSED_NO_TFO_FAILED_TOO,
TFO_FAILED_NET_TIMEOUT__NO_TFO_FAILED_TOO,
TFO_FAILED_UNKNOW_ERROR_NO_TFO_FAILED_TOO,
TFO_FAILED_BACKUP_CONNECTION_NO_TFO_FAILED_TOO,
TFO_FAILED
} TFOResult;
nsresult AttachTCPFastOpenIOLayer(PRFileDesc *fd);

View File

@ -271,4 +271,6 @@ interface nsISocketTransport : nsITransport
in long keepaliveRetryInterval);
[noscript] void setFastOpenCallback(in TCPFastOpenPtr aFastOpen);
readonly attribute nsresult firstRetryError;
};

View File

@ -800,6 +800,8 @@ nsSocketTransport::nsSocketTransport()
, mKeepaliveProbeCount(-1)
, mFastOpenCallback(nullptr)
, mFastOpenLayerHasBufferedData(false)
, mFastOpenStatus(TFO_NOT_TRIED)
, mFirstRetryError(NS_OK)
, mDoNotRetryToConnect(false)
{
SOCKET_LOG(("creating nsSocketTransport @%p\n", this));
@ -1570,11 +1572,10 @@ nsSocketTransport::InitiateSocket()
status = PR_FAILURE;
connectCalled = false;
bool fastOpenNotSupported = false;
uint8_t tfoStatus = TFO_NOT_TRIED;
TCPFastOpenFinish(fd, code, fastOpenNotSupported, tfoStatus);
TCPFastOpenFinish(fd, code, fastOpenNotSupported, mFastOpenStatus);
// If we have sent data, trigger a socket status event.
if (tfoStatus == TFO_DATA_SENT) {
if (mFastOpenStatus == TFO_DATA_SENT) {
SendStatus(NS_NET_STATUS_SENDING_TO);
}
@ -1584,11 +1585,11 @@ nsSocketTransport::InitiateSocket()
// event in order.
mFastOpenLayerHasBufferedData = TCPFastOpenGetCurrentBufferSize(fd);
mFastOpenCallback->SetFastOpenStatus(tfoStatus);
mFastOpenCallback->SetFastOpenStatus(mFastOpenStatus);
SOCKET_LOG(("called StartFastOpen - code=%d; fastOpen is %s "
"supported.\n", code,
fastOpenNotSupported ? "not" : ""));
SOCKET_LOG(("TFO status %d\n", tfoStatus));
SOCKET_LOG(("TFO status %d\n", mFastOpenStatus));
if (fastOpenNotSupported) {
// When TCP_FastOpen is turned off on the local host
@ -1776,8 +1777,13 @@ nsSocketTransport::RecoverFromError()
mFastOpenCallback->SetFastOpenConnected(mCondition, true);
}
mFastOpenCallback = nullptr;
} else {
// This is only needed for telemetry.
if (NS_SUCCEEDED(mFirstRetryError)) {
mFirstRetryError = mCondition;
}
if ((mState == STATE_CONNECTING) && mDNSRecord &&
mSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
if (mNetAddr.raw.family == AF_INET) {
@ -2217,6 +2223,24 @@ nsSocketTransport::OnSocketReady(PRFileDesc *fd, int16_t outFlags)
PRStatus status = PR_ConnectContinue(fd, outFlags);
#if defined(_WIN64) && defined(WIN95)
#ifndef TCP_FASTOPEN
#define TCP_FASTOPEN 15
#endif
if (mFDFastOpenInProgress && mFastOpenCallback &&
(mFastOpenStatus == TFO_DATA_SENT)) {
PROsfd osfd = PR_FileDesc2NativeHandle(fd);
BOOL option = 0;
int len = sizeof(option);
PRInt32 rv = getsockopt((SOCKET)osfd, IPPROTO_TCP, TCP_FASTOPEN, (char*)&option, &len);
if ((rv != 0) && !option) {
// On error, I will let the normal necko paths pickup the error.
mFastOpenCallback->SetFastOpenStatus(TFO_NOT_TRIED);
}
}
#endif
if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase() &&
connectStarted) {
SendPRBlockingTelemetry(connectStarted,
@ -3584,5 +3608,12 @@ nsSocketTransport::SetFastOpenCallback(TCPFastOpen *aFastOpen)
return NS_OK;
}
NS_IMETHODIMP
nsSocketTransport::GetFirstRetryError(nsresult *aFirstRetryError)
{
*aFirstRetryError = mFirstRetryError;
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -478,6 +478,8 @@ private:
// A Fast Open callback.
TCPFastOpen *mFastOpenCallback;
bool mFastOpenLayerHasBufferedData;
uint8_t mFastOpenStatus;
nsresult mFirstRetryError;
bool mDoNotRetryToConnect;
};

View File

@ -1525,6 +1525,12 @@ SocketTransportShim::Bind(NetAddr *aLocalAddr)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
SocketTransportShim::GetFirstRetryError(nsresult *aFirstRetryError)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#define FWD_TS_PTR(fx, ts) NS_IMETHODIMP \
SocketTransportShim::fx(ts *arg) { return mWrapped->fx(arg); }

View File

@ -125,7 +125,20 @@ nsHttpConnection::~nsHttpConnection()
mForceSendTimer = nullptr;
}
Telemetry::Accumulate(Telemetry::TCP_FAST_OPEN, mFastOpenStatus);
if ((mFastOpenStatus != TFO_FAILED) &&
((mFastOpenStatus != TFO_NOT_TRIED) ||
#if defined(_WIN64) && defined(WIN95)
(gHttpHandler->UseFastOpen() &&
gSocketTransportService &&
gSocketTransportService->HasFileDesc2PlatformOverlappedIOHandleFunc()))) {
#else
gHttpHandler->UseFastOpen())) {
#endif
// TFO_FAILED will be reported in the replacement connection with more
// details.
// Otherwise report only if TFO is enabled and supported.
Telemetry::Accumulate(Telemetry::TCP_FAST_OPEN_2, mFastOpenStatus);
}
}
nsresult
@ -2393,6 +2406,19 @@ nsHttpConnection::SetFastOpen(bool aFastOpen)
}
}
void
nsHttpConnection::SetFastOpenStatus(uint8_t tfoStatus) {
mFastOpenStatus = tfoStatus;
if ((mFastOpenStatus >= TFO_FAILED_CONNECTION_REFUSED) &&
mSocketTransport) {
nsresult firstRetryError;
if (NS_SUCCEEDED(mSocketTransport->GetFirstRetryError(&firstRetryError)) &&
(NS_FAILED(firstRetryError))) {
mFastOpenStatus = tfoStatus + 4;
}
}
}
void
nsHttpConnection::BootstrapTimings(TimingStruct times)
{

View File

@ -233,9 +233,7 @@ public:
bool TestJoinConnection(const nsACString &hostname, int32_t port);
bool JoinConnection(const nsACString &hostname, int32_t port);
void SetFastOpenStatus(uint8_t tfoStatus) {
mFastOpenStatus = tfoStatus;
}
void SetFastOpenStatus(uint8_t tfoStatus);
private:
// Value (set in mTCPKeepaliveConfig) indicates which set of prefs to use.

View File

@ -3726,6 +3726,7 @@ nsHalfOpenSocket::nsHalfOpenSocket(nsConnectionEntry *ent,
, mFreeToUse(true)
, mPrimaryStreamStatus(NS_OK)
, mFastOpenInProgress(false)
, mFastOpenStatus(TFO_NOT_TRIED)
, mEnt(ent)
{
MOZ_ASSERT(ent && trans, "constructor with null arguments");
@ -4176,6 +4177,7 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
mFastOpenInProgress = false;
mConnectionNegotiatingFastOpen = nullptr;
mFastOpenStatus = TFO_FAILED_BACKUP_CONNECTION;
}
nsresult rv = SetupConn(out, false);
@ -4358,6 +4360,7 @@ nsHalfOpenSocket::SetFastOpenConnected(nsresult aError, bool aWillRetry)
// work around.
(aError == NS_ERROR_FAILURE) ||
#endif
(aError == NS_ERROR_PROXY_CONNECTION_REFUSED) ||
(aError == NS_ERROR_NET_TIMEOUT))) {
if (mEnt->mUseFastOpen) {
gHttpHandler->IncrementFastOpenConsecutiveFailureCounter();
@ -4397,6 +4400,14 @@ nsHalfOpenSocket::SetFastOpenConnected(nsresult aError, bool aWillRetry)
mSocketTransport->SetSecurityCallbacks(this);
mStreamIn->AsyncWait(nullptr, 0, 0, nullptr);
if (aError == NS_ERROR_CONNECTION_REFUSED) {
mFastOpenStatus = TFO_FAILED_CONNECTION_REFUSED;
} else if (aError == NS_ERROR_NET_TIMEOUT) {
mFastOpenStatus = TFO_FAILED_NET_TIMEOUT;
} else {
mFastOpenStatus = TFO_FAILED_UNKNOW_ERROR;
}
} else {
// On success or other error we proceed with connection, we just need
// to close backup timer and halfOpenSock.
@ -4658,6 +4669,8 @@ nsHalfOpenSocket::SetupConn(nsIAsyncOutputStream *out,
} else {
conn->SetFastOpen(false);
}
} else {
conn->SetFastOpenStatus(mFastOpenStatus);
}
// If this halfOpenConn was speculative, but at the ende the conn got a

View File

@ -473,6 +473,7 @@ private:
bool mFastOpenInProgress;
RefPtr<nsHttpConnection> mConnectionNegotiatingFastOpen;
uint8_t mFastOpenStatus;
RefPtr<nsConnectionEntry> mEnt;
nsCOMPtr<nsITimer> mSynTimer;

View File

@ -2299,6 +2299,16 @@ nsHttpHandler::Observe(nsISupports *subject,
} else {
Telemetry::Accumulate(Telemetry::DNT_USAGE, 1);
}
if (UseFastOpen()) {
Telemetry::Accumulate(Telemetry::TCP_FAST_OPEN_STATUS, 0);
} else if (!mFastOpenSupported) {
Telemetry::Accumulate(Telemetry::TCP_FAST_OPEN_STATUS, 1);
} else if (!mUseFastOpen) {
Telemetry::Accumulate(Telemetry::TCP_FAST_OPEN_STATUS, 2);
} else {
Telemetry::Accumulate(Telemetry::TCP_FAST_OPEN_STATUS, 3);
}
} else if (!strcmp(topic, "profile-change-net-restore")) {
// initialize connection manager
rv = InitConnectionMgr();

View File

@ -2545,14 +2545,23 @@
"description": "Stats about success rate of HTTP OMT request in content process, keyed by content policy.",
"labels": ["success", "successMainThread", "failListener", "failListenerChain", "notRequested"]
},
"TCP_FAST_OPEN": {
"TCP_FAST_OPEN_2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "61",
"kind": "enumerated",
"n_values": 16,
"description": "When a http connection is closed, track whether or not TCP Fast Open was used: 0=TFO_NOT_TRIED(There was no http connection and it was not TLS), 1=TFO_TRIED_NEGOTIATING, 2=TFO_DATA_SENT, 3=TFO_FAILED_CONNECTION_REFUSED, 4=TFO_FAILED_NET_TIMEOUT, 5=TFO_FAILED_UNKNOW_ERROR, 6=TFO_FAILED_BACKUP_CONNECTION, 7=TFO_FAILED_CONNECTION_REFUSED_NO_TFO_FAILED_TOO, 8=TFO_FAILED_NET_TIMEOUT__NO_TFO_FAILED_TOO, 9=TFO_FAILED_UNKNOW_ERROR_NO_TFO_FAILED_TOO, 10=TFO_FAILED_BACKUP_CONNECTION_NO_TFO_FAILED_TOO.",
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"bug_numbers": [1390881]
},
"TCP_FAST_OPEN_STATUS": {
"record_in_processes": ["main", "content"],
"expires_in_version": "61",
"kind": "enumerated",
"n_values": 8,
"description": "When a http connection is closed, track whether or not TCP Fast Open was used: 0=TFO_NOT_TRIED, 1=TFO_TRIED_NEGOTIATING, 2=TFO_DATA_SENT, 3=TFO_FAILED.",
"alert_emails": ["necko@mozilla.com"],
"bug_numbers": [1352271]
"description": "TCP Fast Open was: 0=enabled during the session, 1=not available or disabled in the os, 2=disabled by the pref, 3=disabled based on the too many connection failures.",
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"bug_numbers": [1390881]
},
"TLS_EARLY_DATA_NEGOTIATED": {
"record_in_processes": ["main", "content"],