Skip to content

Commit

Permalink
Merge mozilla-central to mozilla-autoland. r=merge a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nerli1 committed Dec 5, 2017
2 parents bc29ed2 + 2e08acd commit 449829e
Show file tree
Hide file tree
Showing 25 changed files with 203 additions and 139 deletions.
29 changes: 21 additions & 8 deletions accessible/windows/msaa/LazyInstantiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ static const wchar_t* gBlockedInprocDlls[] = {
L"dtvhooks64.dll" // RealPlayer, bug 1418535
};

/**
* This is the blocklist for known "bad" remote clients that instantiate a11y.
*/
static const char* gBlockedRemoteClients[] = {
"tbnnotifier.exe" // Ask.com Toolbar, bug 1421018
};

/**
* Check for the presence of any known "bad" injected DLLs that may be trying
* to instantiate a11y.
Expand Down Expand Up @@ -292,17 +299,24 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
return true;
}

// Blocklist checks for external clients should go here.
// return false if we should not instantiate.
/*
if (ClientShouldBeBlocked(clientExe)) {
return false;
nsresult rv;
if (!PR_GetEnv("MOZ_DISABLE_ACCESSIBLE_BLOCKLIST")) {
// Debugging option is not present, so check blocklist.
nsAutoString leafName;
rv = clientExe->GetLeafName(leafName);
if (NS_SUCCEEDED(rv)) {
for (size_t i = 0, len = ArrayLength(gBlockedRemoteClients); i < len; ++i) {
if (leafName.EqualsIgnoreCase(gBlockedRemoteClients[i])) {
// If client exe is in our blocklist, do not instantiate.
return false;
}
}
}
}
*/

// Store full path to executable for support purposes.
nsAutoString filePath;
nsresult rv = clientExe->GetPath(filePath);
rv = clientExe->GetPath(filePath);
if (NS_SUCCEEDED(rv)) {
a11y::SetInstantiator(filePath);
}
Expand Down Expand Up @@ -909,4 +923,3 @@ LazyInstantiator::QueryService(REFGUID aServiceId, REFIID aServiceIid,

} // namespace a11y
} // namespace mozilla

10 changes: 10 additions & 0 deletions docshell/base/nsDefaultURIFixup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI,
uriString.ReplaceLiteral(0, 3, "http");
scheme.AssignLiteral("http");
info->mFixupChangedProtocol = true;
} else if (scheme.LowerCaseEqualsLiteral("htp")) {
// htp -> http.
uriString.ReplaceLiteral(0, 3, "http");
scheme.AssignLiteral("http");
info->mFixupChangedProtocol = true;
} else if (scheme.LowerCaseEqualsLiteral("ttps")) {
// ttps -> https.
uriString.ReplaceLiteral(0, 4, "https");
Expand All @@ -276,6 +281,11 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI,
uriString.ReplaceLiteral(0, 2, "https");
scheme.AssignLiteral("https");
info->mFixupChangedProtocol = true;
} else if (scheme.LowerCaseEqualsLiteral("htps")) {
// htps -> https.
uriString.ReplaceLiteral(0, 4, "https");
scheme.AssignLiteral("https");
info->mFixupChangedProtocol = true;
} else if (scheme.LowerCaseEqualsLiteral("ile")) {
// ile -> file.
uriString.ReplaceLiteral(0, 3, "file");
Expand Down
5 changes: 3 additions & 2 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,8 @@ nsDocShell::DestroyChildren()
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsDocShell,
nsDocLoader,
mSessionStorageManager,
mScriptGlobal)
mScriptGlobal,
mInitialClientSource)

NS_IMPL_ADDREF_INHERITED(nsDocShell, nsDocLoader)
NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
Expand Down Expand Up @@ -7053,7 +7054,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
* LoadURI(...) will cancel all refresh timers... This causes the
* Timer and its refreshData instance to be released...
*/
LoadURI(aURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, true);
LoadURI(aURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL, true);

return NS_OK;
}
Expand Down
10 changes: 10 additions & 0 deletions docshell/test/unit/test_nsDefaultURIFixup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ var data = [
wrong: 'ttp://www.example.com/',
fixed: 'http://www.example.com/',
},
{
// htp -> http.
wrong: 'htp://www.example.com/',
fixed: 'http://www.example.com/',
},
{
// ttps -> https.
wrong: 'ttps://www.example.com/',
Expand All @@ -26,6 +31,11 @@ var data = [
wrong: 'ps://www.example.com/',
fixed: 'https://www.example.com/',
},
{
// htps -> https.
wrong: 'htps://www.example.com/',
fixed: 'https://www.example.com/',
},
{
// ile -> file.
wrong: 'ile:///this/is/a/test.html',
Expand Down
4 changes: 3 additions & 1 deletion dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIdleObservers)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mClientSource)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepads)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCacheStorage)
Expand Down Expand Up @@ -1595,7 +1597,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
// that IdleRequest objects have been traced and will remove
// themselves while unlinking.

tmp->mClientSource.reset();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mClientSource)

if (tmp->IsChromeWindow()) {
if (tmp->mChromeFields.mMessageManager) {
Expand Down
16 changes: 16 additions & 0 deletions dom/clients/manager/ClientSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,21 @@ ClientSource::EventTarget() const
return mEventTarget;
}

void
ClientSource::Traverse(nsCycleCollectionTraversalCallback& aCallback,
const char* aName,
uint32_t aFlags)
{
if (mOwner.is<RefPtr<nsPIDOMWindowInner>>()) {
ImplCycleCollectionTraverse(aCallback,
mOwner.as<RefPtr<nsPIDOMWindowInner>>(),
aName, aFlags);
} else if (mOwner.is<nsCOMPtr<nsIDocShell>>()) {
ImplCycleCollectionTraverse(aCallback,
mOwner.as<nsCOMPtr<nsIDocShell>>(),
aName, aFlags);
}
}

} // namespace dom
} // namespace mozilla
22 changes: 22 additions & 0 deletions dom/clients/manager/ClientSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,30 @@ class ClientSource final : public ClientThing<ClientSourceChild>

nsISerialEventTarget*
EventTarget() const;

void
Traverse(nsCycleCollectionTraversalCallback& aCallback,
const char* aName,
uint32_t aFlags);
};

inline void
ImplCycleCollectionUnlink(UniquePtr<ClientSource>& aField)
{
aField.reset();
}

inline void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
UniquePtr<ClientSource>& aField,
const char* aName,
uint32_t aFlags)
{
if (aField) {
aField->Traverse(aCallback, aName, aFlags);
}
}

} // namespace dom
} // namespace mozilla

Expand Down
5 changes: 2 additions & 3 deletions gfx/layers/wr/WebRenderBridgeChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,12 @@ WriteFontDescriptor(const uint8_t* aData, uint32_t aLength, uint32_t aIndex,
}

void
WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray<wr::GlyphInstance>& aGlyphs,
WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, Range<const wr::GlyphInstance> aGlyphs,
gfx::ScaledFont* aFont, const wr::ColorF& aColor, const StackingContextHelper& aSc,
const wr::LayerRect& aBounds, const wr::LayerRect& aClip, bool aBackfaceVisible,
const wr::GlyphOptions* aGlyphOptions)
{
MOZ_ASSERT(aFont);
MOZ_ASSERT(!aGlyphs.IsEmpty());

wr::WrFontInstanceKey key = GetFontKeyForScaledFont(aFont);
MOZ_ASSERT(key.mNamespace.mHandle && key.mHandle);
Expand All @@ -304,7 +303,7 @@ WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArra
aBackfaceVisible,
aColor,
key,
Range<const wr::GlyphInstance>(aGlyphs.Elements(), aGlyphs.Length()),
aGlyphs,
aGlyphOptions);
}

Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/wr/WebRenderBridgeChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild
return wr::WrImageKey{ GetNamespace(), GetNextResourceId() };
}

void PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray<wr::GlyphInstance>& aGlyphs,
void PushGlyphs(wr::DisplayListBuilder& aBuilder, Range<const wr::GlyphInstance> aGlyphs,
gfx::ScaledFont* aFont, const wr::ColorF& aColor,
const StackingContextHelper& aSc,
const wr::LayerRect& aBounds, const wr::LayerRect& aClip,
Expand Down
2 changes: 1 addition & 1 deletion js/src/jsgc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6953,7 +6953,7 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea
AutoGCRooter::traceAllWrappers(target, &marker);

/* If we needed delayed marking for gray roots, then collect until done. */
if (!hasBufferedGrayRoots()) {
if (isIncremental && !hasBufferedGrayRoots()) {
budget.makeUnlimited();
isIncremental = false;
stats().nonincremental(AbortReason::GrayRootBufferingFailed);
Expand Down
34 changes: 21 additions & 13 deletions layout/generic/TextDrawTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ class TextDrawTarget : public DrawTarget
MOZ_RELEASE_ASSERT(aOptions.mCompositionOp == CompositionOp::OP_OVER);
MOZ_RELEASE_ASSERT(aOptions.mAlpha == 1.0f);
MOZ_RELEASE_ASSERT(aPattern.GetType() == PatternType::COLOR);
auto* colorPat = static_cast<const ColorPattern*>(&aPattern);
auto color = wr::ToColorF(colorPat->mColor);

// Make sure the font exists, and can be serialized
MOZ_RELEASE_ASSERT(aFont);
Expand All @@ -115,17 +113,27 @@ class TextDrawTarget : public DrawTarget
return;
}

// 170 is the maximum size gfxFont is expected to hand us
AutoTArray<wr::GlyphInstance, 170> glyphs;
glyphs.SetLength(aBuffer.mNumGlyphs);

for (size_t i = 0; i < aBuffer.mNumGlyphs; i++) {
wr::GlyphInstance& targetGlyph = glyphs[i];
const gfx::Glyph& sourceGlyph = aBuffer.mGlyphs[i];
targetGlyph.index = sourceGlyph.mIndex;
targetGlyph.point = mSc.ToRelativeLayoutPoint(
LayoutDevicePoint::FromUnknownPoint(sourceGlyph.mPosition));
}
auto* colorPat = static_cast<const ColorPattern*>(&aPattern);
auto color = wr::ToColorF(colorPat->mColor);
MOZ_ASSERT(aBuffer.mNumGlyphs);
auto glyphs = Range<const wr::GlyphInstance>(reinterpret_cast<const wr::GlyphInstance*>(aBuffer.mGlyphs), aBuffer.mNumGlyphs);
// MSVC won't let us use offsetof on the following directly so we give it a
// name with typedef
typedef std::remove_reference<decltype(aBuffer.mGlyphs[0])>::type GlyphType;
// Compare gfx::Glyph and wr::GlyphInstance to make sure that they are
// structurally equivalent to ensure that our cast above was ok
static_assert(std::is_same<decltype(aBuffer.mGlyphs[0].mIndex), decltype(glyphs[0].index)>()
&& std::is_same<decltype(aBuffer.mGlyphs[0].mPosition.x), decltype(glyphs[0].point.x)>()
&& std::is_same<decltype(aBuffer.mGlyphs[0].mPosition.y), decltype(glyphs[0].point.y)>()
&& offsetof(GlyphType, mIndex) == offsetof(wr::GlyphInstance, index)
&& offsetof(GlyphType, mPosition) == offsetof(wr::GlyphInstance, point)
&& offsetof(decltype(aBuffer.mGlyphs[0].mPosition), x) == offsetof(decltype(glyphs[0].point), x)
&& offsetof(decltype(aBuffer.mGlyphs[0].mPosition), y) == offsetof(decltype(glyphs[0].point), y)
&& std::is_standard_layout<std::remove_reference<decltype(aBuffer.mGlyphs[0])>>::value
&& std::is_standard_layout<std::remove_reference<decltype(glyphs[0])>>::value
&& sizeof(aBuffer.mGlyphs[0]) == sizeof(glyphs[0])
&& sizeof(aBuffer.mGlyphs[0].mPosition) == sizeof(glyphs[0].point)
, "glyph buf types don't match");

wr::GlyphOptions glyphOptions;
glyphOptions.render_mode = wr::ToFontRenderMode(aOptions.mAntialiasMode, GetPermitSubpixelAA());
Expand Down
2 changes: 2 additions & 0 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -1584,9 +1584,11 @@ pref("network.protocol-handler.external.moz-icon", false);

// Don't allow external protocol handlers for common typos
pref("network.protocol-handler.external.ttp", false); // http
pref("network.protocol-handler.external.htp", false); // http
pref("network.protocol-handler.external.ttps", false); // https
pref("network.protocol-handler.external.tps", false); // https
pref("network.protocol-handler.external.ps", false); // https
pref("network.protocol-handler.external.htps", false); // https
pref("network.protocol-handler.external.ile", false); // file
pref("network.protocol-handler.external.le", false); // file

Expand Down
5 changes: 0 additions & 5 deletions mozglue/build/WindowsDllBlocklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,6 @@ static const DllBlockInfo sWindowsDllBlocklist[] = {
// Avecto Privilege Guard causes crashes, bug 1385542
{ "pghook.dll", ALL_VERSIONS },

// Microsoft UI automation causing performance problems on 57+, bug 1420276
#if defined(MOZ_DEV_EDITION) || defined(RELEASE_OR_BETA)
{ "uiautomationcore.dll", ALL_VERSIONS },
#endif // defined(MOZ_DEV_EDITION) || defined(RELEASE_OR_BETA)

{ nullptr, 0 }
};

Expand Down
2 changes: 1 addition & 1 deletion security/manager/ssl/StaticHPKPins.h
Original file line number Diff line number Diff line change
Expand Up @@ -1159,4 +1159,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {

static const int32_t kUnknownId = -1;

static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1520881940301000);
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1520898145766000);
Loading

0 comments on commit 449829e

Please sign in to comment.