Skip to content

Commit

Permalink
Merge mozilla-central to autoland a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoroiu committed Apr 13, 2019
2 parents d8d0bca + 8442bbf commit d4f3370
Show file tree
Hide file tree
Showing 35 changed files with 59 additions and 144 deletions.
8 changes: 3 additions & 5 deletions dom/html/nsHTMLDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ void nsHTMLDocument::TryFallback(int32_t& aCharsetSource,
aEncoding = FallbackEncoding::FromLocale();
}

// Using a prototype document is currently only allowed with browser.xhtml.
// Using a prototype document is only allowed with chrome privilege.
bool ShouldUsePrototypeDocument(nsIChannel* aChannel, nsIDocShell* aDocShell) {
if (!aChannel || !aDocShell ||
!StaticPrefs::dom_prototype_document_cache_enabled()) {
Expand All @@ -455,9 +455,7 @@ bool ShouldUsePrototypeDocument(nsIChannel* aChannel, nsIDocShell* aDocShell) {
}
nsCOMPtr<nsIURI> originalURI;
aChannel->GetOriginalURI(getter_AddRefs(originalURI));
return IsChromeURI(originalURI) &&
originalURI->GetSpecOrDefault().EqualsLiteral(
BROWSER_CHROME_URL_QUOTED);
return IsChromeURI(originalURI);
}

nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand,
Expand Down Expand Up @@ -561,7 +559,7 @@ nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand,
} else {
mParser->MarkAsNotScriptCreated(aCommand);
}
} else if (ShouldUsePrototypeDocument(aChannel, docShell)) {
} else if (xhtml && ShouldUsePrototypeDocument(aChannel, docShell)) {
loadWithPrototype = true;
nsCOMPtr<nsIURI> originalURI;
aChannel->GetOriginalURI(getter_AddRefs(originalURI));
Expand Down
9 changes: 9 additions & 0 deletions dom/prototype/PrototypeDocumentContentSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,15 @@ nsresult PrototypeDocumentContentSink::CreateElementFromPrototype(

rv = AddAttributes(aPrototype, result);
if (NS_FAILED(rv)) return rv;

if (xtfNi->Equals(nsGkAtoms::script, kNameSpaceID_XHTML) ||
xtfNi->Equals(nsGkAtoms::script, kNameSpaceID_SVG)) {
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(result);
MOZ_ASSERT(sele, "Node didn't QI to script.");
// Script loading is handled by the this content sink, so prevent the
// script from loading when it is bound to the document.
sele->PreventExecution();
}
}

result.forget(aResult);
Expand Down
4 changes: 2 additions & 2 deletions dom/svg/SVGComponentTransferFunctionElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace mozilla {

class DOMSVGAnimatedNumberList;

namespace dom {

class DOMSVGAnimatedNumberList;

typedef SVGFEUnstyledElement SVGComponentTransferFunctionElementBase;

class SVGComponentTransferFunctionElement
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ already_AddRefed<gfx::Path> SVGContentUtils::GetPath(
SVGPathData pathData;
SVGPathDataParser parser(aPathString, &pathData);
if (!parser.Parse()) {
return NULL;
return nullptr;
}

RefPtr<DrawTarget> drawTarget =
Expand Down
5 changes: 2 additions & 3 deletions gfx/wr/webrender/src/texture_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
use util;

//TODO: gather real-world statistics on the bin usage in order to assist the decision
// on where to place the size thresholds.
Expand Down Expand Up @@ -167,10 +166,10 @@ impl ArrayAllocationTracker {
}

// Add the guillotined rects back to the free list.
if !util::rect_is_empty(&new_free_rect_to_right) {
if !new_free_rect_to_right.is_empty() {
self.push(chosen.slice, new_free_rect_to_right);
}
if !util::rect_is_empty(&new_free_rect_to_bottom) {
if !new_free_rect_to_bottom.is_empty() {
self.push(chosen.slice, new_free_rect_to_bottom);
}
}
Expand Down
15 changes: 1 addition & 14 deletions gfx/wr/webrender/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

use api::BorderRadius;
use api::units::*;
use euclid::{Point2D, Rect, Size2D, TypedPoint2D, TypedRect, TypedSize2D, Vector2D};
use euclid::{TypedPoint2D, TypedRect, TypedSize2D, Vector2D};
use euclid::{TypedTransform2D, TypedTransform3D, TypedVector2D, TypedScale};
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
use num_traits::Zero;
use plane_split::{Clipper, Polygon};
use std::{i32, f32, fmt, ptr};
use std::borrow::Cow;
Expand Down Expand Up @@ -416,18 +415,6 @@ impl<U> RectHelpers<U> for TypedRect<f32, U> {
}
}

// Don't use `euclid`'s `is_empty` because that has effectively has an "and" in the conditional
// below instead of an "or".
pub fn rect_is_empty<N: PartialEq + Zero, U>(rect: &TypedRect<N, U>) -> bool {
rect.size.width == Zero::zero() || rect.size.height == Zero::zero()
}

#[allow(dead_code)]
#[inline]
pub fn rect_from_points_f(x0: f32, y0: f32, x1: f32, y1: f32) -> Rect<f32> {
Rect::new(Point2D::new(x0, y0), Size2D::new(x1 - x0, y1 - y0))
}

pub fn lerp(a: f32, b: f32, t: f32) -> f32 {
(b - a) * t + a
}
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/SVGTextFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3677,7 +3677,7 @@ uint32_t SVGTextFrame::GetNumberOfChars(nsIContent* aContent) {
float SVGTextFrame::GetComputedTextLength(nsIContent* aContent) {
UpdateGlyphPositioning();

float cssPxPerDevPx = PresContext()->AppUnitsToFloatCSSPixels(
float cssPxPerDevPx = nsPresContext::AppUnitsToFloatCSSPixels(
PresContext()->AppUnitsPerDevPixel());

nscoord length = 0;
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/nsCSSClipPathInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class nsCSSClipPathInstance {

private:
explicit nsCSSClipPathInstance(nsIFrame* aFrame,
const StyleShapeSource aClipPathStyle)
const StyleShapeSource& aClipPathStyle)
: mTargetFrame(aFrame), mClipPathStyle(aClipPathStyle) {}

already_AddRefed<Path> CreateClipPath(DrawTarget* aDrawTarget);
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/nsSVGForeignObjectFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
// SVG paints in CSS px, but normally frames paint in dev pixels. Here we
// multiply a CSS-px-to-dev-pixel factor onto aTransform so our children
// paint correctly.
float cssPxPerDevPx = PresContext()->AppUnitsToFloatCSSPixels(
float cssPxPerDevPx = nsPresContext::AppUnitsToFloatCSSPixels(
PresContext()->AppUnitsPerDevPixel());
gfxMatrix canvasTMForChildren = aTransform;
canvasTMForChildren.PreScale(cssPxPerDevPx, cssPxPerDevPx);
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/nsSVGIntegrationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class PreEffectsVisualOverflowCollector : public nsLayoutUtils::BoxCallback {
if (nsSVGIntegrationUtils::UsingOverflowAffectingEffects(aFrame) &&
!aInReflow) {
nsOverflowAreas* preTransformOverflows =
aFrame->GetProperty(aFrame->PreTransformOverflowAreasProperty());
aFrame->GetProperty(nsIFrame::PreTransformOverflowAreasProperty());

MOZ_ASSERT(!preTransformOverflows,
"GetVisualOverflowRect() won't return the pre-effects rect!");
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/nsSVGOuterSVGFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ gfxMatrix nsSVGOuterSVGFrame::GetCanvasTM() {
if (!mCanvasTM) {
SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());

float devPxPerCSSPx = 1.0f / PresContext()->AppUnitsToFloatCSSPixels(
float devPxPerCSSPx = 1.0f / nsPresContext::AppUnitsToFloatCSSPixels(
PresContext()->AppUnitsPerDevPixel());

gfxMatrix tm = content->PrependLocalTransformsTo(
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/nsSVGPatternFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ gfxMatrix nsSVGPatternFrame::ConstructCTM(const SVGAnimatedViewBox &aViewBox,
if (!aViewBox.IsExplicitlySet()) {
return gfxMatrix(scaleX, 0.0, 0.0, scaleY, 0.0, 0.0);
}
const SVGViewBox viewBox = aViewBox.GetAnimValue();
const SVGViewBox& viewBox = aViewBox.GetAnimValue();

if (viewBox.height <= 0.0f || viewBox.width <= 0.0f) {
return gfxMatrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular
Expand Down
4 changes: 0 additions & 4 deletions media/mtransport/test/webrtcproxychannel_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ class FakeSocketTransportProvider : public nsISocketTransport {
MOZ_ASSERT(false);
return NS_OK;
}
NS_IMETHOD ResolvedByTRR(bool *aResolvedByTRR) override {
MOZ_ASSERT(false);
return NS_OK;
}

// nsITransport
NS_IMETHOD OpenInputStream(uint32_t aFlags, uint32_t aSegmentSize,
Expand Down
5 changes: 0 additions & 5 deletions netwerk/base/nsISocketTransport.idl
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,4 @@ interface nsISocketTransport : nsITransport
* The value is set after PR_Connect is called.
*/
readonly attribute boolean esniUsed;

/**
* IP address resolved using TRR.
*/
bool resolvedByTRR();
};
9 changes: 0 additions & 9 deletions netwerk/base/nsSocketTransport2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,6 @@ nsSocketTransport::nsSocketTransport()
mInputClosed(true),
mOutputClosed(true),
mResolving(false),
mResolvedByTRR(false),
mDNSLookupStatus(NS_OK),
mDNSARequestFinished(0),
mEsniQueried(false),
Expand Down Expand Up @@ -1804,7 +1803,6 @@ bool nsSocketTransport::RecoverFromError() {
// try next ip address only if past the resolver stage...
if (mState == STATE_CONNECTING && mDNSRecord) {
nsresult rv = mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
mDNSRecord->IsTRR(&mResolvedByTRR);
if (NS_SUCCEEDED(rv)) {
SOCKET_LOG((" trying again with next ip address\n"));
tryAgain = true;
Expand Down Expand Up @@ -2098,7 +2096,6 @@ void nsSocketTransport::OnSocketEvent(uint32_t type, nsresult status,
mDNSTxtRequest = nullptr;
if (mDNSRecord) {
mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
mDNSRecord->IsTRR(&mResolvedByTRR);
}
// status contains DNS lookup status
if (NS_FAILED(status)) {
Expand Down Expand Up @@ -3526,11 +3523,5 @@ nsSocketTransport::GetEsniUsed(bool *aEsniUsed) {
return NS_OK;
}

NS_IMETHODIMP
nsSocketTransport::ResolvedByTRR(bool *aResolvedByTRR) {
*aResolvedByTRR = mResolvedByTRR;
return NS_OK;
}

} // namespace net
} // namespace mozilla
1 change: 0 additions & 1 deletion netwerk/base/nsSocketTransport2.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ class nsSocketTransport final : public nsASocketHandler,

nsCOMPtr<nsICancelable> mDNSRequest;
nsCOMPtr<nsIDNSRecord> mDNSRecord;
bool mResolvedByTRR;

nsresult mDNSLookupStatus;
PRIntervalTime mDNSARequestFinished;
Expand Down
2 changes: 1 addition & 1 deletion netwerk/dns/TRR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ nsresult TRR::SendHTTPRequest() {
// update with each HEADERS or reply to a DATA with a WINDOW UPDATE
rv = internalChannel->SetInitialRwin(127 * 1024);
NS_ENSURE_SUCCESS(rv, rv);
rv = internalChannel->SetIsTRRServiceChannel(true);
rv = internalChannel->SetTrr(true);
NS_ENSURE_SUCCESS(rv, rv);

mAllowRFC1918 = gTRRService->AllowRFC1918();
Expand Down
1 change: 0 additions & 1 deletion netwerk/dns/nsDNSService2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ nsDNSRecord::IsTRR(bool *retval) {
}
return NS_OK;
}

NS_IMETHODIMP
nsDNSRecord::GetNextAddr(uint16_t port, NetAddr *addr) {
if (mDone) {
Expand Down
13 changes: 2 additions & 11 deletions netwerk/protocol/http/ClassifierDummyChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,19 +476,10 @@ ClassifierDummyChannel::SetBeConservative(bool aBeConservative) {
}

NS_IMETHODIMP
ClassifierDummyChannel::GetIsTRRServiceChannel(bool* aTrr) {
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
ClassifierDummyChannel::SetIsTRRServiceChannel(bool aTrr) {
return NS_ERROR_NOT_IMPLEMENTED;
}
ClassifierDummyChannel::GetTrr(bool* aTrr) { return NS_ERROR_NOT_IMPLEMENTED; }

NS_IMETHODIMP
ClassifierDummyChannel::GetIsResolvedByTRR(bool* aResolvedByTRR) {
return NS_ERROR_NOT_IMPLEMENTED;
}
ClassifierDummyChannel::SetTrr(bool aTrr) { return NS_ERROR_NOT_IMPLEMENTED; }

NS_IMETHODIMP
ClassifierDummyChannel::GetTlsFlags(uint32_t* aTlsFlags) {
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/Http2Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ uint32_t Http2Session::RegisterStreamID(Http2Stream *stream, uint32_t aNewID) {
// don't count push streams here
MOZ_ASSERT(stream->Transaction(), "no transation for the stream!");
RefPtr<nsHttpConnectionInfo> ci(stream->Transaction()->ConnectionInfo());
if (ci && ci->GetIsTrrServiceChannel()) {
if (ci && ci->GetTrrUsed()) {
IncrementTrrCounter();
}
}
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/Http2Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ nsresult Http2Stream::ParseHttpRequestHeaders(const char *buf, uint32_t avail,

// if the "mother stream" had TRR, this one is a TRR stream too!
RefPtr<nsHttpConnectionInfo> ci(Transaction()->ConnectionInfo());
if (ci && ci->GetIsTrrServiceChannel()) {
if (ci && ci->GetTrrUsed()) {
mSession->IncrementTrrCounter();
}

Expand Down
22 changes: 7 additions & 15 deletions netwerk/protocol/http/HttpBaseChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ HttpBaseChannel::HttpBaseChannel()
mAllowSpdy(true),
mAllowAltSvc(true),
mBeConservative(false),
mIsTRRServiceChannel(false),
mResolvedByTRR(false),
mTRR(false),
mResponseTimeoutEnabled(true),
mAllRedirectsSameOrigin(true),
mAllRedirectsPassTimingAllowCheck(true),
Expand Down Expand Up @@ -2702,23 +2701,16 @@ HttpBaseChannel::SetBeConservative(bool aBeConservative) {
}

NS_IMETHODIMP
HttpBaseChannel::GetIsTRRServiceChannel(bool* aIsTRRServiceChannel) {
NS_ENSURE_ARG_POINTER(aIsTRRServiceChannel);
HttpBaseChannel::GetTrr(bool* aTRR) {
NS_ENSURE_ARG_POINTER(aTRR);

*aIsTRRServiceChannel = mIsTRRServiceChannel;
*aTRR = mTRR;
return NS_OK;
}

NS_IMETHODIMP
HttpBaseChannel::SetIsTRRServiceChannel(bool aIsTRRServiceChannel) {
mIsTRRServiceChannel = aIsTRRServiceChannel;
return NS_OK;
}

NS_IMETHODIMP
HttpBaseChannel::GetIsResolvedByTRR(bool* aResolvedByTRR) {
NS_ENSURE_ARG_POINTER(aResolvedByTRR);
*aResolvedByTRR = mResolvedByTRR;
HttpBaseChannel::SetTrr(bool aTRR) {
mTRR = aTRR;
return NS_OK;
}

Expand Down Expand Up @@ -3585,7 +3577,7 @@ nsresult HttpBaseChannel::SetupReplacementChannel(nsIURI* newURI,
MOZ_ASSERT(NS_SUCCEEDED(rv));
rv = httpInternal->SetBeConservative(mBeConservative);
MOZ_ASSERT(NS_SUCCEEDED(rv));
rv = httpInternal->SetIsTRRServiceChannel(mIsTRRServiceChannel);
rv = httpInternal->SetTrr(mTRR);
MOZ_ASSERT(NS_SUCCEEDED(rv));
rv = httpInternal->SetTlsFlags(mTlsFlags);
MOZ_ASSERT(NS_SUCCEEDED(rv));
Expand Down
12 changes: 3 additions & 9 deletions netwerk/protocol/http/HttpBaseChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ class HttpBaseChannel : public nsHashPropertyBag,
NS_IMETHOD SetAllowAltSvc(bool aAllowAltSvc) override;
NS_IMETHOD GetBeConservative(bool *aBeConservative) override;
NS_IMETHOD SetBeConservative(bool aBeConservative) override;
NS_IMETHOD GetIsTRRServiceChannel(bool *aTRR) override;
NS_IMETHOD SetIsTRRServiceChannel(bool aTRR) override;
NS_IMETHOD GetIsResolvedByTRR(bool *aResolvedByTRR) override;
NS_IMETHOD GetTrr(bool *aTRR) override;
NS_IMETHOD SetTrr(bool aTRR) override;
NS_IMETHOD GetTlsFlags(uint32_t *aTlsFlags) override;
NS_IMETHOD SetTlsFlags(uint32_t aTlsFlags) override;
NS_IMETHOD GetApiRedirectToURI(nsIURI **aApiRedirectToURI) override;
Expand Down Expand Up @@ -702,12 +701,7 @@ class HttpBaseChannel : public nsHashPropertyBag,
// classification. If this is changed or removed, make sure we also update
// NS_ShouldClassifyChannel accordingly !!!
uint32_t mBeConservative : 1;
// If the current channel is used to as a TRR connection.
uint32_t mIsTRRServiceChannel : 1;
// If the request was performed to a TRR resolved IP address.
// Will be false if loading the resource does not create a connection
// (for example when it's loaded from the cache).
uint32_t mResolvedByTRR : 1;
uint32_t mTRR : 1;
uint32_t mResponseTimeoutEnabled : 1;
// A flag that should be false only if a cross-domain redirect occurred
uint32_t mAllRedirectsSameOrigin : 1;
Expand Down
Loading

0 comments on commit d4f3370

Please sign in to comment.