From a5cee657d8db41c7b237cce1724b3f57da90cbdc Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Tue, 21 Aug 2018 17:54:20 -0500 Subject: [PATCH 01/67] Bug 1414389 - Remove use of RwAssert in CaptureCommandList. r=lsalzman --HG-- extra : rebase_source : a657f30cd10bed422883c554f799ea4fc884f508 --- gfx/2d/CaptureCommandList.h | 10 ---- gfx/2d/RwAssert.h | 98 ------------------------------------- 2 files changed, 108 deletions(-) delete mode 100644 gfx/2d/RwAssert.h diff --git a/gfx/2d/CaptureCommandList.h b/gfx/2d/CaptureCommandList.h index 602a374645ae..f40ba4065388 100644 --- a/gfx/2d/CaptureCommandList.h +++ b/gfx/2d/CaptureCommandList.h @@ -13,7 +13,6 @@ #include "DrawCommand.h" #include "Logging.h" -#include "RwAssert.h" namespace mozilla { namespace gfx { @@ -33,7 +32,6 @@ public: ~CaptureCommandList(); CaptureCommandList& operator=(CaptureCommandList&& aOther) { - RwAssert::Writer lock(mAssert); mStorage = std::move(aOther.mStorage); mLastCommand = aOther.mLastCommand; aOther.mLastCommand = nullptr; @@ -42,7 +40,6 @@ public: template T* Append() { - RwAssert::Writer lock(mAssert); size_t oldSize = mStorage.size(); mStorage.resize(mStorage.size() + sizeof(T) + sizeof(uint32_t)); uint8_t* nextDrawLocation = &mStorage.front() + oldSize; @@ -55,7 +52,6 @@ public: template T* ReuseOrAppend() { { // Scope lock - RwAssert::Writer lock(mAssert); if (mLastCommand != nullptr && mLastCommand->GetType() == T::Type) { return reinterpret_cast(mLastCommand); @@ -87,16 +83,11 @@ public: mCurrent(nullptr), mEnd(nullptr) { - mParent.mAssert.BeginReading(); if (!mParent.mStorage.empty()) { mCurrent = &mParent.mStorage.front(); mEnd = mCurrent + mParent.mStorage.size(); } } - ~iterator() - { - mParent.mAssert.EndReading(); - } bool Done() const { return mCurrent >= mEnd; @@ -132,7 +123,6 @@ private: private: std::vector mStorage; DrawingCommand* mLastCommand; - RwAssert mAssert; }; } // namespace gfx diff --git a/gfx/2d/RwAssert.h b/gfx/2d/RwAssert.h deleted file mode 100644 index 4fc52a27f2b6..000000000000 --- a/gfx/2d/RwAssert.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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_gfx_2d_RwAssert_h -#define mozilla_gfx_2d_RwAssert_h - -#include "mozilla/Attributes.h" -#include "mozilla/Mutex.h" - -namespace mozilla { -namespace gfx { - -class RwAssert { -public: - RwAssert() - : mLock("RwAssert::mLock") - , mReaders(0) - , mWriting(false) - { } - - ~RwAssert() - { - MOZ_RELEASE_ASSERT(!mReaders && !mWriting); - } - - class MOZ_RAII Writer { - public: - MOZ_IMPLICIT Writer(RwAssert& aAssert) - : mAssert(aAssert) - { - mAssert.BeginWriting(); - } - ~Writer() - { - mAssert.EndWriting(); - } - - private: - RwAssert& mAssert; - }; - - class MOZ_RAII Reader { - public: - MOZ_IMPLICIT Reader(RwAssert& aAssert) - : mAssert(aAssert) - { - mAssert.BeginReading(); - } - ~Reader() - { - mAssert.EndReading(); - } - - private: - RwAssert& mAssert; - }; - - void BeginWriting() - { - MutexAutoLock lock(mLock); - MOZ_RELEASE_ASSERT(!mReaders && !mWriting); - mWriting = true; - } - - void EndWriting() - { - MutexAutoLock lock(mLock); - MOZ_ASSERT(mWriting); - mWriting = false; - } - - void BeginReading() - { - MutexAutoLock lock(mLock); - MOZ_RELEASE_ASSERT(!mWriting); - mReaders += 1; - } - - void EndReading() - { - MutexAutoLock lock(mLock); - MOZ_ASSERT(mReaders > 0); - mReaders -= 1; - } - -private: - Mutex mLock; - uint32_t mReaders; - bool mWriting; -}; - -} // namespace gfx -} // namespace mozilla - -#endif // mozilla_gfx_2d_RwAssert_h From 5285c599ca4292649cf2ff0f12fa4982842012a6 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Thu, 23 Aug 2018 14:58:21 -0400 Subject: [PATCH 02/67] Bug 1485712 - set SkTypeface atomically in ScaledFonts. r=rhunt --- gfx/2d/ScaledFontBase.cpp | 24 +++++++++++++++----- gfx/2d/ScaledFontBase.h | 5 +++-- gfx/2d/ScaledFontDWrite.cpp | 39 +++++++++++++++------------------ gfx/2d/ScaledFontDWrite.h | 2 +- gfx/2d/ScaledFontFontconfig.cpp | 8 ++----- gfx/2d/ScaledFontFontconfig.h | 2 +- gfx/2d/ScaledFontFreeType.cpp | 8 ++----- gfx/2d/ScaledFontFreeType.h | 2 +- gfx/2d/ScaledFontMac.cpp | 24 ++++++++++---------- gfx/2d/ScaledFontMac.h | 2 +- gfx/2d/ScaledFontWin.cpp | 7 ++---- gfx/2d/ScaledFontWin.h | 2 +- 12 files changed, 62 insertions(+), 63 deletions(-) diff --git a/gfx/2d/ScaledFontBase.cpp b/gfx/2d/ScaledFontBase.cpp index d36a2130b475..1a93208230cd 100644 --- a/gfx/2d/ScaledFontBase.cpp +++ b/gfx/2d/ScaledFontBase.cpp @@ -54,7 +54,7 @@ ScaledFont::GetDefaultAAMode() ScaledFontBase::~ScaledFontBase() { #ifdef USE_SKIA - SkSafeUnref(mTypeface); + SkSafeUnref(mTypeface); #endif #ifdef USE_CAIRO_SCALED_FONT cairo_scaled_font_destroy(mScaledFont); @@ -64,16 +64,30 @@ ScaledFontBase::~ScaledFontBase() ScaledFontBase::ScaledFontBase(const RefPtr& aUnscaledFont, Float aSize) : ScaledFont(aUnscaledFont) - , mSize(aSize) -{ #ifdef USE_SKIA - mTypeface = nullptr; + , mTypeface(nullptr) #endif #ifdef USE_CAIRO_SCALED_FONT - mScaledFont = nullptr; + , mScaledFont(nullptr) #endif + , mSize(aSize) +{ } +#ifdef USE_SKIA +SkTypeface* +ScaledFontBase::GetSkTypeface() +{ + if (!mTypeface) { + SkTypeface* typeface = CreateSkTypeface(); + if (!mTypeface.compareExchange(nullptr, typeface)) { + SkSafeUnref(typeface); + } + } + return mTypeface; +} +#endif + #ifdef USE_CAIRO_SCALED_FONT bool ScaledFontBase::PopulateCairoScaledFont() diff --git a/gfx/2d/ScaledFontBase.h b/gfx/2d/ScaledFontBase.h index b442342187ef..d0adcde7751f 100644 --- a/gfx/2d/ScaledFontBase.h +++ b/gfx/2d/ScaledFontBase.h @@ -42,7 +42,7 @@ public: virtual Float GetSize() const override { return mSize; } #ifdef USE_SKIA - virtual SkTypeface* GetSkTypeface() { return mTypeface; } + SkTypeface* GetSkTypeface(); #endif #ifdef USE_CAIRO_SCALED_FONT @@ -54,7 +54,8 @@ public: protected: friend class DrawTargetSkia; #ifdef USE_SKIA - SkTypeface* mTypeface; + Atomic mTypeface; + virtual SkTypeface* CreateSkTypeface() { return nullptr; } SkPath GetSkiaPathForGlyphs(const GlyphBuffer &aBuffer); #endif #ifdef USE_CAIRO_SCALED_FONT diff --git a/gfx/2d/ScaledFontDWrite.cpp b/gfx/2d/ScaledFontDWrite.cpp index 335045b1e437..dac5ef60ce0f 100644 --- a/gfx/2d/ScaledFontDWrite.cpp +++ b/gfx/2d/ScaledFontDWrite.cpp @@ -172,29 +172,26 @@ ScaledFontDWrite::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget #ifdef USE_SKIA SkTypeface* -ScaledFontDWrite::GetSkTypeface() +ScaledFontDWrite::CreateSkTypeface() { - if (!mTypeface) { - RefPtr factory = Factory::GetDWriteFactory(); - if (!factory) { - return nullptr; - } - - Float gamma = mGamma; - // Skia doesn't support a gamma value outside of 0-4, so default to 2.2 - if (gamma < 0.0f || gamma > 4.0f) { - gamma = 2.2f; - } - - Float contrast = mContrast; - // Skia doesn't support a contrast value outside of 0-1, so default to 1.0 - if (contrast < 0.0f || contrast > 1.0f) { - contrast = 1.0f; - } - - mTypeface = SkCreateTypefaceFromDWriteFont(factory, mFontFace, mStyle, mForceGDIMode, gamma, contrast); + RefPtr factory = Factory::GetDWriteFactory(); + if (!factory) { + return nullptr; } - return mTypeface; + + Float gamma = mGamma; + // Skia doesn't support a gamma value outside of 0-4, so default to 2.2 + if (gamma < 0.0f || gamma > 4.0f) { + gamma = 2.2f; + } + + Float contrast = mContrast; + // Skia doesn't support a contrast value outside of 0-1, so default to 1.0 + if (contrast < 0.0f || contrast > 1.0f) { + contrast = 1.0f; + } + + return SkCreateTypefaceFromDWriteFont(factory, mFontFace, mStyle, mForceGDIMode, gamma, contrast); } #endif diff --git a/gfx/2d/ScaledFontDWrite.h b/gfx/2d/ScaledFontDWrite.h index 47e2f38fc83b..ead945cda5c1 100644 --- a/gfx/2d/ScaledFontDWrite.h +++ b/gfx/2d/ScaledFontDWrite.h @@ -67,7 +67,7 @@ public: bool ForceGDIMode() { return mForceGDIMode; } #ifdef USE_SKIA - SkTypeface* GetSkTypeface() override; + SkTypeface* CreateSkTypeface() override; SkFontStyle mStyle; #endif diff --git a/gfx/2d/ScaledFontFontconfig.cpp b/gfx/2d/ScaledFontFontconfig.cpp index 612a4dd68604..2046971c003c 100644 --- a/gfx/2d/ScaledFontFontconfig.cpp +++ b/gfx/2d/ScaledFontFontconfig.cpp @@ -43,13 +43,9 @@ ScaledFontFontconfig::~ScaledFontFontconfig() } #ifdef USE_SKIA -SkTypeface* ScaledFontFontconfig::GetSkTypeface() +SkTypeface* ScaledFontFontconfig::CreateSkTypeface() { - if (!mTypeface) { - mTypeface = SkCreateTypefaceFromCairoFTFontWithFontconfig(mScaledFont, mPattern); - } - - return mTypeface; + return SkCreateTypefaceFromCairoFTFontWithFontconfig(mScaledFont, mPattern); } #endif diff --git a/gfx/2d/ScaledFontFontconfig.h b/gfx/2d/ScaledFontFontconfig.h index 23b720cf991c..9e78fe1ac9e5 100644 --- a/gfx/2d/ScaledFontFontconfig.h +++ b/gfx/2d/ScaledFontFontconfig.h @@ -28,7 +28,7 @@ public: FontType GetType() const override { return FontType::FONTCONFIG; } #ifdef USE_SKIA - SkTypeface* GetSkTypeface() override; + SkTypeface* CreateSkTypeface() override; #endif bool CanSerialize() override { return true; } diff --git a/gfx/2d/ScaledFontFreeType.cpp b/gfx/2d/ScaledFontFreeType.cpp index 82e15541b4e5..4aca29c2c94b 100644 --- a/gfx/2d/ScaledFontFreeType.cpp +++ b/gfx/2d/ScaledFontFreeType.cpp @@ -35,13 +35,9 @@ ScaledFontFreeType::ScaledFontFreeType(cairo_scaled_font_t* aScaledFont, } #ifdef USE_SKIA -SkTypeface* ScaledFontFreeType::GetSkTypeface() +SkTypeface* ScaledFontFreeType::CreateSkTypeface() { - if (!mTypeface) { - mTypeface = SkCreateTypefaceFromCairoFTFont(mScaledFont); - } - - return mTypeface; + return SkCreateTypefaceFromCairoFTFont(mScaledFont); } #endif diff --git a/gfx/2d/ScaledFontFreeType.h b/gfx/2d/ScaledFontFreeType.h index 26c2cc552f37..5ab161733fcf 100644 --- a/gfx/2d/ScaledFontFreeType.h +++ b/gfx/2d/ScaledFontFreeType.h @@ -27,7 +27,7 @@ public: FontType GetType() const override { return FontType::FREETYPE; } #ifdef USE_SKIA - virtual SkTypeface* GetSkTypeface() override; + virtual SkTypeface* CreateSkTypeface() override; #endif bool CanSerialize() override { return true; } diff --git a/gfx/2d/ScaledFontMac.cpp b/gfx/2d/ScaledFontMac.cpp index 435759d45948..e97faa7b5e2e 100644 --- a/gfx/2d/ScaledFontMac.cpp +++ b/gfx/2d/ScaledFontMac.cpp @@ -177,21 +177,19 @@ ScaledFontMac::~ScaledFontMac() } #ifdef USE_SKIA -SkTypeface* ScaledFontMac::GetSkTypeface() +SkTypeface* ScaledFontMac::CreateSkTypeface() { - if (!mTypeface) { - if (mCTFont) { - mTypeface = SkCreateTypefaceFromCTFont(mCTFont); - } else { - auto unscaledMac = static_cast(GetUnscaledFont().get()); - bool dataFont = unscaledMac->IsDataFont(); - CTFontRef fontFace = - CreateCTFontFromCGFontWithVariations(mFont, mSize, !dataFont); - mTypeface = SkCreateTypefaceFromCTFont(fontFace); - CFRelease(fontFace); - } + if (mCTFont) { + return SkCreateTypefaceFromCTFont(mCTFont); + } else { + auto unscaledMac = static_cast(GetUnscaledFont().get()); + bool dataFont = unscaledMac->IsDataFont(); + CTFontRef fontFace = + CreateCTFontFromCGFontWithVariations(mFont, mSize, !dataFont); + SkTypeface* typeface = SkCreateTypefaceFromCTFont(fontFace); + CFRelease(fontFace); + return typeface; } - return mTypeface; } #endif diff --git a/gfx/2d/ScaledFontMac.h b/gfx/2d/ScaledFontMac.h index 0e3d2cadd1d9..a68a747cb243 100644 --- a/gfx/2d/ScaledFontMac.h +++ b/gfx/2d/ScaledFontMac.h @@ -34,7 +34,7 @@ public: FontType GetType() const override { return FontType::MAC; } #ifdef USE_SKIA - SkTypeface* GetSkTypeface() override; + SkTypeface* CreateSkTypeface() override; #endif already_AddRefed GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget) override; diff --git a/gfx/2d/ScaledFontWin.cpp b/gfx/2d/ScaledFontWin.cpp index b5c3b2b31b06..f776ed3a1b42 100644 --- a/gfx/2d/ScaledFontWin.cpp +++ b/gfx/2d/ScaledFontWin.cpp @@ -122,12 +122,9 @@ ScaledFontWin::GetDefaultAAMode() } #ifdef USE_SKIA -SkTypeface* ScaledFontWin::GetSkTypeface() +SkTypeface* ScaledFontWin::CreateSkTypeface() { - if (!mTypeface) { - mTypeface = SkCreateTypefaceFromLOGFONT(mLogFont); - } - return mTypeface; + return SkCreateTypefaceFromLOGFONT(mLogFont); } #endif diff --git a/gfx/2d/ScaledFontWin.h b/gfx/2d/ScaledFontWin.h index 581f3ffcbebd..79fb8d6b1bc7 100644 --- a/gfx/2d/ScaledFontWin.h +++ b/gfx/2d/ScaledFontWin.h @@ -28,7 +28,7 @@ public: AntialiasMode GetDefaultAAMode() override; #ifdef USE_SKIA - SkTypeface* GetSkTypeface() override; + SkTypeface* CreateSkTypeface() override; #endif protected: From 2c96a060efe3200ae142d931aeda875f31dcd292 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Thu, 23 Aug 2018 21:04:35 +0200 Subject: [PATCH 03/67] Bug 1279185 - Make sure we clip all of the fieldset border behind the legend, also when the legend is smaller than the border. r=dholbert --- layout/forms/nsFieldSetFrame.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index e501fa4a001c..f5f5716afb69 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -273,6 +273,13 @@ nsFieldSetFrame::PaintBorder( // border looks. nsRect legendRect = legend->GetNormalRect() + aPt; + // Make sure we clip all of the border in case the legend is smaller. + nscoord borderTopWidth = GetUsedBorder().top; + if (legendRect.height < borderTopWidth) { + legendRect.height = borderTopWidth; + legendRect.y = aPt.y; + } + DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); // We set up a clip path which has our rect clockwise and the legend rect // counterclockwise, with FILL_WINDING as the fill rule. That will allow us From dfbde0f9cb8f8bfb2145d69cf70b77468022f7c4 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 23 Aug 2018 15:07:19 -0400 Subject: [PATCH 04/67] Bug 1485751 - add aarch64 windows support to protobuf; r=Mossop Otherwise the giant chain of ifdefs that we're modifying won't be able to figure out what platform we're on, and we'll get a compilation error. --- toolkit/components/protobuf/m-c-changes.patch | 22 +++++++++++++++++++ .../google/protobuf/stubs/platform_macros.h | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/toolkit/components/protobuf/m-c-changes.patch b/toolkit/components/protobuf/m-c-changes.patch index 5b28653c635a..ed7c64cb14f2 100644 --- a/toolkit/components/protobuf/m-c-changes.patch +++ b/toolkit/components/protobuf/m-c-changes.patch @@ -43,3 +43,25 @@ diff --git a/toolkit/components/protobuf/src/google/protobuf/stubs/atomicops.h b // return result; // // I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value". +diff --git a/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h b/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h +--- a/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h ++++ b/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h +@@ -45,17 +45,17 @@ + #define GOOGLE_PROTOBUF_ARCH_IA32 1 + #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 + #elif defined(__QNX__) + #define GOOGLE_PROTOBUF_ARCH_ARM_QNX 1 + #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 + #elif defined(_M_ARM) || defined(__ARMEL__) + #define GOOGLE_PROTOBUF_ARCH_ARM 1 + #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 +-#elif defined(__aarch64__) ++#elif defined(__aarch64__) || defined(_M_ARM64) + #define GOOGLE_PROTOBUF_ARCH_AARCH64 1 + #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 + #elif defined(__MIPSEL__) + #if defined(__LP64__) + #define GOOGLE_PROTOBUF_ARCH_MIPS64 1 + #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 + #else + #define GOOGLE_PROTOBUF_ARCH_MIPS 1 diff --git a/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h b/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h index 7a54060dfa31..3ab43a42ef06 100644 --- a/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h +++ b/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h @@ -50,7 +50,7 @@ #elif defined(_M_ARM) || defined(__ARMEL__) #define GOOGLE_PROTOBUF_ARCH_ARM 1 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 -#elif defined(__aarch64__) +#elif defined(__aarch64__) || defined(_M_ARM64) #define GOOGLE_PROTOBUF_ARCH_AARCH64 1 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 #elif defined(__MIPSEL__) From 2475f58106229717a2666a13c574bf6d84bc0148 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 23 Aug 2018 15:47:39 -0400 Subject: [PATCH 05/67] Bug 1485691. Update webrender to commit 93997662842b6d8bafbdb3dde79009c930db66ca --- gfx/webrender/src/clip.rs | 36 +-- gfx/webrender/src/clip_scroll_tree.rs | 284 ++++++++++++++++++++-- gfx/webrender/src/glyph_rasterizer/mod.rs | 81 +++--- gfx/webrender/src/prim_store.rs | 6 +- gfx/webrender_bindings/revision.txt | 2 +- 5 files changed, 328 insertions(+), 81 deletions(-) diff --git a/gfx/webrender/src/clip.rs b/gfx/webrender/src/clip.rs index 933d95588e52..e4584abad823 100644 --- a/gfx/webrender/src/clip.rs +++ b/gfx/webrender/src/clip.rs @@ -7,14 +7,13 @@ use api::{ImageRendering, LayoutRect, LayoutSize, LayoutPoint, LayoutVector2D, L use api::{BoxShadowClipMode, LayoutToWorldScale, LineOrientation, LineStyle, LayoutTransform}; use border::{ensure_no_corner_overlap}; use box_shadow::{BLUR_SAMPLE_SCALE, BoxShadowClipSource, BoxShadowCacheKey}; -use clip_scroll_tree::{CoordinateSystemId, SpatialNodeIndex}; +use clip_scroll_tree::{ClipScrollTree, CoordinateSystemId, SpatialNodeIndex}; use ellipse::Ellipse; use gpu_cache::{GpuCache, GpuCacheHandle, ToGpuBlocks}; use gpu_types::BoxShadowStretchMode; use prim_store::{BrushClipMaskKind, ClipData, ImageMaskData}; use render_task::to_cache_size; use resource_cache::{ImageRequest, ResourceCache}; -use spatial_node::SpatialNode; use std::u32; use util::{extract_inner_rect_safe, pack_as_float, recycle_vec, MatrixHelpers}; @@ -449,7 +448,7 @@ impl ClipStore { local_prim_rect: LayoutRect, local_prim_clip_rect: LayoutRect, spatial_node_index: SpatialNodeIndex, - spatial_nodes: &[SpatialNode], + clip_scroll_tree: &ClipScrollTree, gpu_cache: &mut GpuCache, resource_cache: &mut ResourceCache, device_pixel_scale: DevicePixelScale, @@ -461,6 +460,7 @@ impl ClipStore { None => return None, }; let mut current_local_clip_rect = local_prim_clip_rect; + let spatial_nodes = &clip_scroll_tree.spatial_nodes; // Walk the clip chain to build local rects, and collect the // smallest possible local clip area. @@ -489,26 +489,16 @@ impl ClipStore { ref_spatial_node.coordinate_system_relative_offset; Some(ClipSpaceConversion::Offset(offset)) } else { - // TODO(gw): We still have issues with clip nodes and primitives where - // there is a perspective transform. We intend to fix these - // cases as a follow up. - let relative_transform = ref_spatial_node - .world_content_transform - .to_transform() - .inverse() - .map(|inv| { - inv.pre_mul(&clip_spatial_node.world_content_transform.to_transform()) - }); - let inv_relative_transform = relative_transform - .and_then(|rt| rt.inverse()); - match (relative_transform, inv_relative_transform) { - (Some(relative_transform), Some(inv_relative_transform)) => { - Some(ClipSpaceConversion::Transform(relative_transform, inv_relative_transform)) - } - _ => { - None - } - } + let xf = clip_scroll_tree.get_relative_transform( + clip_node.spatial_node_index, + spatial_node_index, + ); + + xf.and_then(|xf| { + xf.inverse().map(|inv| { + ClipSpaceConversion::Transform(xf, inv) + }) + }) }; // If we can convert spaces, try to reduce the size of the region diff --git a/gfx/webrender/src/clip_scroll_tree.rs b/gfx/webrender/src/clip_scroll_tree.rs index 2063d0ff5b8d..2aa22290911d 100644 --- a/gfx/webrender/src/clip_scroll_tree.rs +++ b/gfx/webrender/src/clip_scroll_tree.rs @@ -10,6 +10,7 @@ use gpu_types::TransformPalette; use internal_types::{FastHashMap, FastHashSet}; use print_tree::{PrintTree, PrintTreePrinter}; use scene::SceneProperties; +use smallvec::SmallVec; use spatial_node::{ScrollFrameInfo, SpatialNode, SpatialNodeType, StickyFrameInfo}; use util::LayoutToWorldFastTransform; @@ -112,35 +113,54 @@ impl ClipScrollTree { /// panic if that invariant isn't true! pub fn get_relative_transform( &self, - ref_node_index: SpatialNodeIndex, - target_node_index: SpatialNodeIndex, - ) -> LayoutTransform { - let ref_node = &self.spatial_nodes[ref_node_index.0]; - let target_node = &self.spatial_nodes[target_node_index.0]; + from_node_index: SpatialNodeIndex, + to_node_index: SpatialNodeIndex, + ) -> Option { + let from_node = &self.spatial_nodes[from_node_index.0]; + let to_node = &self.spatial_nodes[to_node_index.0]; - let mut offset = LayoutVector3D::new( - target_node.coordinate_system_relative_offset.x, - target_node.coordinate_system_relative_offset.y, - 0.0, - ); - let mut transform = LayoutTransform::identity(); + let (child, parent, inverse) = if from_node_index.0 > to_node_index.0 { + (from_node, to_node, false) + } else { + (to_node, from_node, true) + }; - // Walk up the tree of coordinate systems, accumulating each - // relative transform. - let mut current_coordinate_system_id = target_node.coordinate_system_id; - while current_coordinate_system_id != ref_node.coordinate_system_id { - let coord_system = &self.coord_systems[current_coordinate_system_id.0 as usize]; + let mut coordinate_system_id = child.coordinate_system_id; + let mut nodes: SmallVec<[_; 16]> = SmallVec::new(); - let relative_transform = coord_system - .transform - .post_translate(offset); - transform = transform.pre_mul(&relative_transform); - - offset = coord_system.offset; - current_coordinate_system_id = coord_system.parent.expect("invalid parent!"); + while coordinate_system_id != parent.coordinate_system_id { + nodes.push(coordinate_system_id); + let coord_system = &self.coord_systems[coordinate_system_id.0 as usize]; + coordinate_system_id = coord_system.parent.expect("invalid parent!"); } - transform + nodes.reverse(); + + let mut transform = LayoutTransform::create_translation( + -parent.coordinate_system_relative_offset.x, + -parent.coordinate_system_relative_offset.y, + 0.0, + ); + + for node in nodes { + let coord_system = &self.coord_systems[node.0 as usize]; + transform = transform.pre_translate(coord_system.offset) + .pre_mul(&coord_system.transform); + } + + let transform = transform.post_translate( + LayoutVector3D::new( + child.coordinate_system_relative_offset.x, + child.coordinate_system_relative_offset.y, + 0.0, + ) + ); + + if inverse { + transform.inverse() + } else { + Some(transform) + } } /// The root reference frame, which is the true root of the ClipScrollTree. Initially @@ -442,3 +462,219 @@ impl ClipScrollTree { } } } + +#[cfg(test)] +fn add_reference_frame( + cst: &mut ClipScrollTree, + parent: Option, + transform: LayoutTransform, + origin_in_parent_reference_frame: LayoutVector2D, +) -> SpatialNodeIndex { + cst.add_reference_frame( + parent, + Some(PropertyBinding::Value(transform)), + None, + origin_in_parent_reference_frame, + PipelineId::dummy(), + ) +} + +#[cfg(test)] +fn test_pt( + px: f32, + py: f32, + cst: &ClipScrollTree, + from: SpatialNodeIndex, + to: SpatialNodeIndex, + expected_x: f32, + expected_y: f32, +) { + use euclid::approxeq::ApproxEq; + const EPSILON: f32 = 0.0001; + + let p = LayoutPoint::new(px, py); + let m = cst.get_relative_transform(from, to).unwrap(); + let pt = m.transform_point2d(&p).unwrap(); + assert!(pt.x.approx_eq_eps(&expected_x, &EPSILON) && + pt.y.approx_eq_eps(&expected_y, &EPSILON), + "p: {:?} -> {:?}\nm={:?}", + p, pt, m, + ); +} + +#[test] +fn test_cst_simple_translation() { + // Basic translations only + + let mut cst = ClipScrollTree::new(); + + let root = add_reference_frame( + &mut cst, + None, + LayoutTransform::identity(), + LayoutVector2D::zero(), + ); + + let child1 = add_reference_frame( + &mut cst, + Some(root), + LayoutTransform::create_translation(100.0, 0.0, 0.0), + LayoutVector2D::zero(), + ); + + let child2 = add_reference_frame( + &mut cst, + Some(child1), + LayoutTransform::create_translation(0.0, 50.0, 0.0), + LayoutVector2D::zero(), + ); + + let child3 = add_reference_frame( + &mut cst, + Some(child2), + LayoutTransform::create_translation(200.0, 200.0, 0.0), + LayoutVector2D::zero(), + ); + + cst.update_tree(WorldPoint::zero(), &SceneProperties::new()); + + test_pt(100.0, 100.0, &cst, child1, root, 200.0, 100.0); + test_pt(100.0, 100.0, &cst, root, child1, 0.0, 100.0); + test_pt(100.0, 100.0, &cst, child2, root, 200.0, 150.0); + test_pt(100.0, 100.0, &cst, root, child2, 0.0, 50.0); + test_pt(100.0, 100.0, &cst, child2, child1, 100.0, 150.0); + test_pt(100.0, 100.0, &cst, child1, child2, 100.0, 50.0); + test_pt(100.0, 100.0, &cst, child3, root, 400.0, 350.0); +} + +#[test] +fn test_cst_simple_scale() { + // Basic scale only + + let mut cst = ClipScrollTree::new(); + + let root = add_reference_frame( + &mut cst, + None, + LayoutTransform::identity(), + LayoutVector2D::zero(), + ); + + let child1 = add_reference_frame( + &mut cst, + Some(root), + LayoutTransform::create_scale(4.0, 1.0, 1.0), + LayoutVector2D::zero(), + ); + + let child2 = add_reference_frame( + &mut cst, + Some(child1), + LayoutTransform::create_scale(1.0, 2.0, 1.0), + LayoutVector2D::zero(), + ); + + let child3 = add_reference_frame( + &mut cst, + Some(child2), + LayoutTransform::create_scale(2.0, 2.0, 1.0), + LayoutVector2D::zero(), + ); + + cst.update_tree(WorldPoint::zero(), &SceneProperties::new()); + + test_pt(100.0, 100.0, &cst, child1, root, 400.0, 100.0); + test_pt(100.0, 100.0, &cst, root, child1, 25.0, 100.0); + test_pt(100.0, 100.0, &cst, child2, root, 400.0, 200.0); + test_pt(100.0, 100.0, &cst, root, child2, 25.0, 50.0); + test_pt(100.0, 100.0, &cst, child3, root, 800.0, 400.0); + test_pt(100.0, 100.0, &cst, child2, child1, 100.0, 200.0); + test_pt(100.0, 100.0, &cst, child1, child2, 100.0, 50.0); + test_pt(100.0, 100.0, &cst, child3, child1, 200.0, 400.0); + test_pt(100.0, 100.0, &cst, child1, child3, 50.0, 25.0); +} + +#[test] +fn test_cst_scale_translation() { + // Scale + translation + + let mut cst = ClipScrollTree::new(); + + let root = add_reference_frame( + &mut cst, + None, + LayoutTransform::identity(), + LayoutVector2D::zero(), + ); + + let child1 = add_reference_frame( + &mut cst, + Some(root), + LayoutTransform::create_translation(100.0, 50.0, 0.0), + LayoutVector2D::zero(), + ); + + let child2 = add_reference_frame( + &mut cst, + Some(child1), + LayoutTransform::create_scale(2.0, 4.0, 1.0), + LayoutVector2D::zero(), + ); + + let child3 = add_reference_frame( + &mut cst, + Some(child2), + LayoutTransform::create_translation(200.0, -100.0, 0.0), + LayoutVector2D::zero(), + ); + + let child4 = add_reference_frame( + &mut cst, + Some(child3), + LayoutTransform::create_scale(3.0, 2.0, 1.0), + LayoutVector2D::zero(), + ); + + cst.update_tree(WorldPoint::zero(), &SceneProperties::new()); + + test_pt(100.0, 100.0, &cst, child1, root, 200.0, 150.0); + test_pt(100.0, 100.0, &cst, child2, root, 300.0, 450.0); + test_pt(100.0, 100.0, &cst, root, child1, 0.0, 50.0); + test_pt(100.0, 100.0, &cst, root, child2, 0.0, 12.5); + test_pt(100.0, 100.0, &cst, child4, root, 1100.0, 450.0); + test_pt(1100.0, 450.0, &cst, root, child4, 100.0, 100.0); + + test_pt(0.0, 0.0, &cst, child4, child1, 400.0, -400.0); + test_pt(100.0, 100.0, &cst, child4, child1, 1000.0, 400.0); + test_pt(100.0, 100.0, &cst, child2, child1, 200.0, 400.0); + test_pt(200.0, 400.0, &cst, child1, child2, 100.0, 100.0); + + test_pt(100.0, 100.0, &cst, child3, child1, 400.0, 300.0); + test_pt(400.0, 300.0, &cst, child1, child3, 100.0, 100.0); +} + +#[test] +fn test_cst_translation_rotate() { + // Rotation + translation + use euclid::Angle; + + let mut cst = ClipScrollTree::new(); + + let root = add_reference_frame( + &mut cst, + None, + LayoutTransform::identity(), + LayoutVector2D::zero(), + ); + + let child1 = add_reference_frame( + &mut cst, + Some(root), + LayoutTransform::create_rotation(0.0, 0.0, 1.0, Angle::degrees(90.0)), + LayoutVector2D::zero(), + ); + + cst.update_tree(WorldPoint::zero(), &SceneProperties::new()); + + test_pt(100.0, 0.0, &cst, child1, root, 0.0, -100.0); +} diff --git a/gfx/webrender/src/glyph_rasterizer/mod.rs b/gfx/webrender/src/glyph_rasterizer/mod.rs index 03301abfdff9..d8cefe6498a4 100644 --- a/gfx/webrender/src/glyph_rasterizer/mod.rs +++ b/gfx/webrender/src/glyph_rasterizer/mod.rs @@ -15,7 +15,7 @@ use rayon::ThreadPool; use std::cmp; use std::hash::{Hash, Hasher}; use std::mem; -use std::sync::{Arc, Mutex, MutexGuard}; +use std::sync::{Arc, Condvar, Mutex, MutexGuard}; use std::sync::mpsc::{channel, Receiver, Sender}; #[cfg(feature = "pathfinder")] @@ -451,6 +451,8 @@ pub struct FontContexts { // Stored here as a convenience to get the current thread index. #[allow(dead_code)] workers: Arc, + locked_mutex: Mutex, + locked_cond: Condvar, } impl FontContexts { @@ -478,6 +480,46 @@ impl FontContexts { } } +pub trait ForEach { + fn for_each) + Send + 'static>(&self, f: F); +} + +impl ForEach for Arc { + fn for_each) + Send + 'static>(&self, f: F) { + // Reset the locked condition. + let mut locked = self.locked_mutex.lock().unwrap(); + *locked = false; + + // Arc that can be safely moved into a spawn closure. + let font_contexts = self.clone(); + // Spawn a new thread on which to run the for-each off the main thread. + self.workers.spawn(move || { + // Lock the shared and worker contexts up front. + let mut locks = Vec::with_capacity(font_contexts.num_worker_contexts() + 1); + locks.push(font_contexts.lock_shared_context()); + for i in 0 .. font_contexts.num_worker_contexts() { + locks.push(font_contexts.lock_context(Some(i))); + } + + // Signal the locked condition now that all contexts are locked. + *font_contexts.locked_mutex.lock().unwrap() = true; + font_contexts.locked_cond.notify_all(); + + // Now that everything is locked, proceed to processing each locked context. + for context in locks { + f(context); + } + }); + + // Wait for locked condition before resuming. Safe to proceed thereafter + // since any other thread that needs to use a FontContext will try to lock + // it first. + while !*locked { + locked = self.locked_cond.wait(locked).unwrap(); + } + } +} + pub struct GlyphRasterizer { #[allow(dead_code)] workers: Arc, @@ -527,6 +569,8 @@ impl GlyphRasterizer { #[cfg(feature = "pathfinder")] pathfinder_context: create_pathfinder_font_context()?, workers: Arc::clone(&workers), + locked_mutex: Mutex::new(false), + locked_cond: Condvar::new(), }; Ok(GlyphRasterizer { @@ -541,27 +585,12 @@ impl GlyphRasterizer { } pub fn add_font(&mut self, font_key: FontKey, template: FontTemplate) { - let font_contexts = Arc::clone(&self.font_contexts); - // It's important to synchronously add the font for the shared context because - // we use it to check that fonts have been properly added when requesting glyphs. - font_contexts - .lock_shared_context() - .add_font(&font_key, &template); - - // TODO: this locks each font context while adding the font data, probably not a big deal, - // but if there is contention on this lock we could easily have a queue of per-context - // operations to add and delete fonts, and have these queues lazily processed by each worker - // before rendering a glyph. - // We can also move this into a worker to free up some cycles in the calling (render backend) - // thread. - for i in 0 .. font_contexts.num_worker_contexts() { - font_contexts - .lock_context(Some(i)) - .add_font(&font_key, &template); - } - #[cfg(feature = "pathfinder")] self.add_font_to_pathfinder(&font_key, &template); + + self.font_contexts.for_each(move |mut context| { + context.add_font(&font_key, &template); + }); } pub fn delete_font(&mut self, font_key: FontKey) { @@ -599,18 +628,10 @@ impl GlyphRasterizer { return } - let font_contexts = Arc::clone(&self.font_contexts); let fonts_to_remove = mem::replace(&mut self.fonts_to_remove, Vec::new()); - - self.workers.spawn(move || { + self.font_contexts.for_each(move |mut context| { for font_key in &fonts_to_remove { - font_contexts.lock_shared_context().delete_font(font_key); - } - for i in 0 .. font_contexts.num_worker_contexts() { - let mut context = font_contexts.lock_context(Some(i)); - for font_key in &fonts_to_remove { - context.delete_font(font_key); - } + context.delete_font(font_key); } }); } diff --git a/gfx/webrender/src/prim_store.rs b/gfx/webrender/src/prim_store.rs index f0021b2be124..c5826e081e89 100644 --- a/gfx/webrender/src/prim_store.rs +++ b/gfx/webrender/src/prim_store.rs @@ -162,9 +162,9 @@ impl LocalRectBuilder { CoordinateSpaceMapping::Offset(offset) } else { let transform = clip_scroll_tree.get_relative_transform( - self.ref_spatial_node_index, target_node_index, - ); + self.ref_spatial_node_index, + ).expect("bug: should have already been culled"); CoordinateSpaceMapping::Transform(transform) }; } @@ -1620,7 +1620,7 @@ impl PrimitiveStore { local_rect, prim.metadata.local_clip_rect, prim_context.spatial_node_index, - &frame_context.clip_scroll_tree.spatial_nodes, + &frame_context.clip_scroll_tree, frame_state.gpu_cache, frame_state.resource_cache, frame_context.device_pixel_scale, diff --git a/gfx/webrender_bindings/revision.txt b/gfx/webrender_bindings/revision.txt index bea06dc48312..13626b8c2628 100644 --- a/gfx/webrender_bindings/revision.txt +++ b/gfx/webrender_bindings/revision.txt @@ -1 +1 @@ -e70bae07664def86aefd11c86dac818ab7ea64ea +93997662842b6d8bafbdb3dde79009c930db66ca From c12ebf5cd696ddebb147fa914183636a0643c20a Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 23 Aug 2018 15:48:02 -0400 Subject: [PATCH 06/67] Bug 1485691. Remark 1081185-1.html as failing. This reverts 63ad91cbc63a which was from the last webrender update. If we could fail before it's ok to fail now. --- layout/reftests/bugs/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 2647d7664c9b..654943608530 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1866,7 +1866,7 @@ test-pref(dom.webcomponents.shadowdom.enabled,true) == 1066554-1.html 1066554-1- == 1069716-1.html 1069716-1-ref.html == 1078262-1.html about:blank test-pref(layout.testing.overlay-scrollbars.always-visible,false) == 1081072-1.html 1081072-1-ref.html -== 1081185-1.html 1081185-1-ref.html +fails-if(webrender) == 1081185-1.html 1081185-1-ref.html == 1097437-1.html 1097437-1-ref.html == 1103258-1.html 1103258-1-ref.html # assertion crash test with layers culling test == 1105137-1.html 1105137-1-ref.html From e7aec45f125e81c3be836b23ed381f0e855adb95 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 23 Aug 2018 15:48:07 -0400 Subject: [PATCH 07/67] Bug 1485691. Re-generate FFI header --- .../webrender_ffi_generated.h | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/gfx/webrender_bindings/webrender_ffi_generated.h b/gfx/webrender_bindings/webrender_ffi_generated.h index 0c2def61b539..db42b13aab92 100644 --- a/gfx/webrender_bindings/webrender_ffi_generated.h +++ b/gfx/webrender_bindings/webrender_ffi_generated.h @@ -2,7 +2,7 @@ * 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/. */ -/* Generated with cbindgen:0.6.0 */ +/* Generated with cbindgen:0.6.2 */ /* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen. * To generate this file: @@ -240,9 +240,9 @@ struct Tiles; // A Transaction is a group of commands to apply atomically to a document. // // This mechanism ensures that: -// - no other message can be interleaved between two commands that need to be applied together. -// - no redundant work is performed if two commands in the same transaction cause the scene or -// the frame to be rebuilt. +// - no other message can be interleaved between two commands that need to be applied together. +// - no redundant work is performed if two commands in the same transaction cause the scene or +// the frame to be rebuilt. struct Transaction; // The default unit. @@ -715,8 +715,7 @@ union GlyphRasterSpace { float _0; bool operator==(const Local_Body& aOther) const { - return tag == aOther.tag && - _0 == aOther._0; + return _0 == aOther._0; } }; @@ -745,6 +744,16 @@ union GlyphRasterSpace { bool IsScreen() const { return tag == Tag::Screen; } + + bool operator==(const GlyphRasterSpace& aOther) const { + if (tag != aOther.tag) { + return false; + } + switch (tag) { + case Tag::Local: return local == aOther.local; + default: return true; + } + } }; struct FontInstanceKey { @@ -972,13 +981,6 @@ struct WrOpacityProperty { extern "C" { -/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen. - * To generate this file: - * 1. Get the latest cbindgen using `cargo install --force cbindgen` - * a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release - * 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h` - */ - extern void AddFontData(WrFontKey aKey, const uint8_t *aData, uintptr_t aSize, @@ -1296,7 +1298,7 @@ void wr_dp_push_image(WrState *aState, ImageRendering aImageRendering, WrImageKey aKey, bool aPremultipliedAlpha, - ColorF color) + ColorF aColor) WR_FUNC; WR_INLINE @@ -1763,10 +1765,3 @@ WR_FUNC; } // namespace wr } // namespace mozilla - -/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen. - * To generate this file: - * 1. Get the latest cbindgen using `cargo install --force cbindgen` - * a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release - * 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h` - */ From 6900fb42ab9f29ddf4c37c14293977738f80e3b3 Mon Sep 17 00:00:00 2001 From: Diego Pino Garcia Date: Thu, 23 Aug 2018 09:00:00 -0400 Subject: [PATCH 08/67] Bug 1481199 - Drop the obsolete dataType parameter for nsIBrowserSearchService.addEngine. r=mkaply --- browser/base/content/browser-pageActions.js | 2 +- .../content/test/about/browser_aboutHome_search_POST.js | 2 +- browser/base/content/test/about/head.js | 2 +- .../content/test/general/browser_keywordSearch_postData.js | 2 +- .../browser_ext_webNavigation_urlbar_transitions.js | 2 +- browser/components/search/test/browser_426329.js | 2 +- browser/components/search/test/browser_483086.js | 4 ++-- browser/components/search/test/browser_addEngine.js | 2 +- browser/components/search/test/browser_contextmenu.js | 2 +- browser/components/search/test/browser_healthreport.js | 2 +- .../search/test/browser_hiddenOneOffs_cleanup.js | 2 +- browser/components/search/test/head.js | 2 +- browser/modules/test/browser/browser_ContentSearch.js | 2 +- .../test/browser/browser_UsageTelemetry_searchbar.js | 6 +++--- .../modules/test/browser/browser_UsageTelemetry_urlbar.js | 2 +- mobile/android/chrome/content/browser.js | 2 +- netwerk/base/nsIBrowserSearchService.idl | 7 ++----- .../places/tests/unifiedcomplete/head_autocomplete.js | 2 +- .../components/processsingleton/MainProcessSingleton.js | 2 +- toolkit/components/search/nsSearchService.js | 4 ++-- toolkit/components/search/tests/xpcshell/head_search.js | 3 +-- .../search/tests/xpcshell/test_addEngineWithExtensionID.js | 2 +- .../search/tests/xpcshell/test_addEngine_callback.js | 6 +++--- .../components/search/tests/xpcshell/test_multipleIcons.js | 2 +- .../components/search/tests/xpcshell/test_notifications.js | 2 +- .../telemetry/tests/unit/test_TelemetryEnvironment.js | 2 +- 26 files changed, 33 insertions(+), 37 deletions(-) diff --git a/browser/base/content/browser-pageActions.js b/browser/base/content/browser-pageActions.js index 2166637027b8..373903db6e4e 100644 --- a/browser/base/content/browser-pageActions.js +++ b/browser/base/content/browser-pageActions.js @@ -1166,7 +1166,7 @@ BrowserPageActions.addSearchEngine = { }, _installEngine(uri, image) { - Services.search.addEngine(uri, null, image, false, { + Services.search.addEngine(uri, image, false, { onSuccess: engine => { showBrowserPageActionFeedback(this.action); }, diff --git a/browser/base/content/test/about/browser_aboutHome_search_POST.js b/browser/base/content/test/about/browser_aboutHome_search_POST.js index 7acc733f6385..a8e99ade4a18 100644 --- a/browser/base/content/test/about/browser_aboutHome_search_POST.js +++ b/browser/base/content/test/about/browser_aboutHome_search_POST.js @@ -54,7 +54,7 @@ add_task(async function() { }; Services.obs.addObserver(searchObserver, "browser-search-engine-modified"); Services.search.addEngine("http://test:80/browser/browser/base/content/test/about/POSTSearchEngine.xml", - null, null, false); + null, false); }); }); }); diff --git a/browser/base/content/test/about/head.js b/browser/base/content/test/about/head.js index ca3fdf5ff500..f79a4d356a00 100644 --- a/browser/base/content/test/about/head.js +++ b/browser/base/content/test/about/head.js @@ -167,7 +167,7 @@ function promiseNewEngine(basename) { info("Waiting for engine to be added: " + basename); return new Promise((resolve, reject) => { let url = getRootDirectory(gTestPath) + basename; - Services.search.addEngine(url, null, "", false, { + Services.search.addEngine(url, "", false, { onSuccess(engine) { info("Search engine added: " + basename); registerCleanupFunction(() => { diff --git a/browser/base/content/test/general/browser_keywordSearch_postData.js b/browser/base/content/test/general/browser_keywordSearch_postData.js index 79e5bae4a6c2..0a467c10fd20 100644 --- a/browser/base/content/test/general/browser_keywordSearch_postData.js +++ b/browser/base/content/test/general/browser_keywordSearch_postData.js @@ -50,7 +50,7 @@ function test() { }); Services.search.addEngine("http://test:80/browser/browser/base/content/test/general/POSTSearchEngine.xml", - null, null, false); + null, false); } var gCurrTest; diff --git a/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js b/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js index 2df39f0a2639..b92820dfea67 100644 --- a/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js +++ b/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js @@ -42,7 +42,7 @@ function addSearchEngine(basename) { return new Promise((resolve, reject) => { info("Waiting for engine to be added: " + basename); let url = getRootDirectory(gTestPath) + basename; - Services.search.addEngine(url, null, "", false, { + Services.search.addEngine(url, "", false, { onSuccess: (engine) => { info(`Search engine added: ${basename}`); registerCleanupFunction(() => Services.search.removeEngine(engine)); diff --git a/browser/components/search/test/browser_426329.js b/browser/components/search/test/browser_426329.js index d87a4cb56269..e257f8992ff0 100644 --- a/browser/components/search/test/browser_426329.js +++ b/browser/components/search/test/browser_426329.js @@ -83,7 +83,7 @@ function promiseSetEngine() { Services.obs.addObserver(observer, "browser-search-engine-modified"); ss.addEngine("http://mochi.test:8888/browser/browser/components/search/test/426329.xml", - null, "data:image/x-icon,%00", false); + "data:image/x-icon,%00", false); }); } diff --git a/browser/components/search/test/browser_483086.js b/browser/components/search/test/browser_483086.js index a606c8879aa6..af6fdcb66c91 100644 --- a/browser/components/search/test/browser_483086.js +++ b/browser/components/search/test/browser_483086.js @@ -24,7 +24,7 @@ function test() { Services.obs.addObserver(observer, "browser-search-engine-modified"); gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/483086-1.xml", - null, "data:image/x-icon;%00", false); + "data:image/x-icon;%00", false); } function test2() { @@ -45,5 +45,5 @@ function test2() { Services.obs.addObserver(observer, "browser-search-engine-modified"); gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/483086-2.xml", - null, "data:image/x-icon;%00", false); + "data:image/x-icon;%00", false); } diff --git a/browser/components/search/test/browser_addEngine.js b/browser/components/search/test/browser_addEngine.js index e72e4c9110fa..cf683afb8c79 100644 --- a/browser/components/search/test/browser_addEngine.js +++ b/browser/components/search/test/browser_addEngine.js @@ -50,7 +50,7 @@ var gTests = [ Services.obs.addObserver(observer, "browser-search-engine-modified"); gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.xml", - null, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC", + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC", false); }, added(engine) { diff --git a/browser/components/search/test/browser_contextmenu.js b/browser/components/search/test/browser_contextmenu.js index 7f385501339d..845043ef817e 100644 --- a/browser/components/search/test/browser_contextmenu.js +++ b/browser/components/search/test/browser_contextmenu.js @@ -49,7 +49,7 @@ add_task(async function() { Services.obs.addObserver(observer, "browser-search-engine-modified"); ss.addEngine("resource://search-plugins/testEngine_mozsearch.xml", - null, "data:image/x-icon,%00", false); + "data:image/x-icon,%00", false); }); contextMenu = document.getElementById("contentAreaContextMenu"); diff --git a/browser/components/search/test/browser_healthreport.js b/browser/components/search/test/browser_healthreport.js index a1b514754e23..daea794f32f6 100644 --- a/browser/components/search/test/browser_healthreport.js +++ b/browser/components/search/test/browser_healthreport.js @@ -78,7 +78,7 @@ function test() { Services.obs.addObserver(observer, "browser-search-engine-modified"); gCUITestUtils.addSearchBar().then(function() { Services.search.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.xml", - null, "data:image/x-icon,%00", false); + "data:image/x-icon,%00", false); }); } diff --git a/browser/components/search/test/browser_hiddenOneOffs_cleanup.js b/browser/components/search/test/browser_hiddenOneOffs_cleanup.js index d1e9907a01a1..aba2a46951e9 100644 --- a/browser/components/search/test/browser_hiddenOneOffs_cleanup.js +++ b/browser/components/search/test/browser_hiddenOneOffs_cleanup.js @@ -9,7 +9,7 @@ function promiseNewEngine(basename) { Services.search.init({ onInitComplete() { let url = getRootDirectory(gTestPath) + basename; - Services.search.addEngine(url, null, "", false, { + Services.search.addEngine(url, "", false, { onSuccess(engine) { info("Search engine added: " + basename); resolve(engine); diff --git a/browser/components/search/test/head.js b/browser/components/search/test/head.js index 1613336f9823..61663bb23a30 100644 --- a/browser/components/search/test/head.js +++ b/browser/components/search/test/head.js @@ -61,7 +61,7 @@ function promiseNewEngine(basename, options = {}) { onInitComplete() { let url = getRootDirectory(options.testPath || gTestPath) + basename; let current = Services.search.currentEngine; - Services.search.addEngine(url, null, options.iconURL || "", false, { + Services.search.addEngine(url, options.iconURL || "", false, { onSuccess(engine) { info("Search engine added: " + basename); if (setAsCurrent) { diff --git a/browser/modules/test/browser/browser_ContentSearch.js b/browser/modules/test/browser/browser_ContentSearch.js index 575f609adc49..501db3a44a46 100644 --- a/browser/modules/test/browser/browser_ContentSearch.js +++ b/browser/modules/test/browser/browser_ContentSearch.js @@ -335,7 +335,7 @@ function waitForNewEngine(basename, numImages) { // Wait for addEngine(). let addDeferred = PromiseUtils.defer(); let url = getRootDirectory(gTestPath) + basename; - Services.search.addEngine(url, null, "", false, { + Services.search.addEngine(url, "", false, { onSuccess(engine) { info("Search engine added: " + basename); addDeferred.resolve(engine); diff --git a/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js b/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js index 6440881de906..3b62ce0dd9e8 100644 --- a/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js +++ b/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js @@ -186,7 +186,7 @@ add_task(async function test_oneOff_enterSelection() { // for this test. const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml"; let suggestionEngine = await new Promise((resolve, reject) => { - Services.search.addEngine(url, null, "", false, { + Services.search.addEngine(url, "", false, { onSuccess(engine) { resolve(engine); }, onError() { reject(); } }); @@ -254,7 +254,7 @@ add_task(async function test_suggestion_click() { // for this test. const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml"; let suggestionEngine = await new Promise((resolve, reject) => { - Services.search.addEngine(url, null, "", false, { + Services.search.addEngine(url, "", false, { onSuccess(engine) { resolve(engine); }, onError() { reject(); } }); @@ -311,7 +311,7 @@ add_task(async function test_suggestion_enterSelection() { // for this test. const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml"; let suggestionEngine = await new Promise((resolve, reject) => { - Services.search.addEngine(url, null, "", false, { + Services.search.addEngine(url, "", false, { onSuccess(engine) { resolve(engine); }, onError() { reject(); } }); diff --git a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js index 2c0250fc3cc1..b4cc17ca73e1 100644 --- a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js +++ b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js @@ -82,7 +82,7 @@ function clickURLBarSuggestion(entryName, button = 1) { async function withNewSearchEngine(taskFn) { const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml"; let suggestionEngine = await new Promise((resolve, reject) => { - Services.search.addEngine(url, null, "", false, { + Services.search.addEngine(url, "", false, { onSuccess(engine) { resolve(engine); }, onError() { reject(); } }); diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 5ad5d9838d05..76bfd0e6256b 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -5990,7 +5990,7 @@ var SearchEngines = { }, addOpenSearchEngine: function addOpenSearchEngine(engine) { - Services.search.addEngine(engine.url, Ci.nsISearchEngine.DATA_XML, engine.iconURL, false, { + Services.search.addEngine(engine.url, engine.iconURL, false, { onSuccess: function() { // Display a toast confirming addition of new search engine. Snackbars.show(Strings.browser.formatStringFromName("alertSearchEngineAddedToast", [engine.title], 1), Snackbars.LENGTH_LONG); diff --git a/netwerk/base/nsIBrowserSearchService.idl b/netwerk/base/nsIBrowserSearchService.idl index 8bc9bebb6395..58761689a439 100644 --- a/netwerk/base/nsIBrowserSearchService.idl +++ b/netwerk/base/nsIBrowserSearchService.idl @@ -295,9 +295,6 @@ interface nsIBrowserSearchService : nsISupports * @param engineURL * The URL to the search engine's description file. * - * @param dataType - * Obsolete, the value is ignored. - * * @param iconURL * A URL string to an icon file to be used as the search engine's * icon. This value may be overridden by an icon specified in the @@ -320,8 +317,8 @@ interface nsIBrowserSearchService : nsISupports * @throws NS_ERROR_FAILURE if the description file cannot be successfully * loaded. */ - void addEngine(in AString engineURL, in long dataType, in AString iconURL, - in boolean confirm, [optional] in nsISearchInstallCallback callback, + void addEngine(in AString engineURL, in AString iconURL, in boolean confirm, + [optional] in nsISearchInstallCallback callback, [optional] in AString extensionID); /** diff --git a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js index ee17fd58e4d5..f7c9b6c204d9 100644 --- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js +++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js @@ -462,7 +462,7 @@ function addTestEngine(basename, httpServer = undefined) { }, "browser-search-engine-modified"); info("Adding engine from URL: " + dataUrl + basename); - Services.search.addEngine(dataUrl + basename, null, null, false); + Services.search.addEngine(dataUrl + basename, null, false); }); } diff --git a/toolkit/components/processsingleton/MainProcessSingleton.js b/toolkit/components/processsingleton/MainProcessSingleton.js index dc71dc4ff12c..61dbd0895b7e 100644 --- a/toolkit/components/processsingleton/MainProcessSingleton.js +++ b/toolkit/components/processsingleton/MainProcessSingleton.js @@ -53,7 +53,7 @@ MainProcessSingleton.prototype = { if (status != Cr.NS_OK) return; - Services.search.addEngine(engineURL.spec, null, iconURL ? iconURL.spec : null, true); + Services.search.addEngine(engineURL.spec, iconURL ? iconURL.spec : null, true); }); }, diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index 9d008ded66d1..bd4676274a15 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -3850,8 +3850,8 @@ SearchService.prototype = { } }, - addEngine: function SRCH_SVC_addEngine(aEngineURL, aDataType, aIconURL, - aConfirm, aCallback, aExtensionID) { + addEngine: function SRCH_SVC_addEngine(aEngineURL, aIconURL, aConfirm, + aCallback, aExtensionID) { LOG("addEngine: Adding \"" + aEngineURL + "\"."); this._ensureInitialized(); try { diff --git a/toolkit/components/search/tests/xpcshell/head_search.js b/toolkit/components/search/tests/xpcshell/head_search.js index b9f73eec5786..c7c93281cae7 100644 --- a/toolkit/components/search/tests/xpcshell/head_search.js +++ b/toolkit/components/search/tests/xpcshell/head_search.js @@ -415,8 +415,7 @@ var addTestEngines = async function(aItems) { }, "browser-search-engine-modified"); if (item.xmlFileName) { - Services.search.addEngine(gDataUrl + item.xmlFileName, - null, null, false); + Services.search.addEngine(gDataUrl + item.xmlFileName, null, false); } else { Services.search.addEngineWithDetails(item.name, ...item.details); } diff --git a/toolkit/components/search/tests/xpcshell/test_addEngineWithExtensionID.js b/toolkit/components/search/tests/xpcshell/test_addEngineWithExtensionID.js index 015ac2bfaf8d..4019666e9b44 100644 --- a/toolkit/components/search/tests/xpcshell/test_addEngineWithExtensionID.js +++ b/toolkit/components/search/tests/xpcshell/test_addEngineWithExtensionID.js @@ -40,7 +40,7 @@ add_test(function test_addEngineWithExtensionID() { } }; Services.search.addEngine(gDataUrl + "engine.xml", null, - null, false, searchCallback, kExtensionID2); + false, searchCallback, kExtensionID2); }); function run_test() { diff --git a/toolkit/components/search/tests/xpcshell/test_addEngine_callback.js b/toolkit/components/search/tests/xpcshell/test_addEngine_callback.js index 256e949516a7..d15986147f8f 100644 --- a/toolkit/components/search/tests/xpcshell/test_addEngine_callback.js +++ b/toolkit/components/search/tests/xpcshell/test_addEngine_callback.js @@ -50,7 +50,7 @@ add_test(function simple_callback_test() { } }; Services.search.addEngine(gDataUrl + "engine.xml", null, - null, false, searchCallback); + false, searchCallback); }); // Test of the search callback on duplicate engine failures @@ -67,7 +67,7 @@ add_test(function duplicate_failure_test() { }; // Re-add the same engine added in the previous test Services.search.addEngine(gDataUrl + "engine.xml", null, - null, false, searchCallback); + false, searchCallback); }); // Test of the search callback on failure to load the engine failures @@ -84,7 +84,7 @@ add_test(function load_failure_test() { }; // Try adding an engine that doesn't exist Services.search.addEngine("http://invalid/data/engine.xml", null, - null, false, searchCallback); + false, searchCallback); }); function run_test() { diff --git a/toolkit/components/search/tests/xpcshell/test_multipleIcons.js b/toolkit/components/search/tests/xpcshell/test_multipleIcons.js index 04ae7af02254..1190c035f639 100644 --- a/toolkit/components/search/tests/xpcshell/test_multipleIcons.js +++ b/toolkit/components/search/tests/xpcshell/test_multipleIcons.js @@ -48,7 +48,7 @@ add_task(async function test_multipleIcons() { add_task(async function test_icon_not_in_file() { let engineUrl = gDataUrl + "engine-fr.xml"; let engine = await new Promise((resolve, reject) => { - Services.search.addEngine(engineUrl, null, "data:image/x-icon;base64,ico16", + Services.search.addEngine(engineUrl, "data:image/x-icon;base64,ico16", false, {onSuccess: resolve, onError: reject}); }); diff --git a/toolkit/components/search/tests/xpcshell/test_notifications.js b/toolkit/components/search/tests/xpcshell/test_notifications.js index 3ae78a27b2a7..1b325d0edacc 100644 --- a/toolkit/components/search/tests/xpcshell/test_notifications.js +++ b/toolkit/components/search/tests/xpcshell/test_notifications.js @@ -66,5 +66,5 @@ function run_test() { Services.obs.addObserver(search_observer, "browser-search-engine-modified"); - Services.search.addEngine(gDataUrl + "engine.xml", null, null, false); + Services.search.addEngine(gDataUrl + "engine.xml", null, false); } diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js index 340bfd851be7..f70e551be3e8 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js @@ -1610,7 +1610,7 @@ add_task(async function test_defaultSearchEngine() { } }, "browser-search-engine-modified"); Services.search.addEngine("file://" + do_get_cwd().path + "/engine.xml", - null, null, false); + null, false); }); Services.search.defaultEngine = engine; await promise; From b8b76ab4fe5c71c44b16ca3d3cad54e521143f9c Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 10 Aug 2018 20:17:01 -0700 Subject: [PATCH 09/67] Bug 1485538 - Expose WebRender's "show overdraw" debug mode behind a pref. r=jrmuizel --- gfx/thebes/gfxPlatform.cpp | 1 + modules/libpref/init/all.js | 1 + 2 files changed, 2 insertions(+) diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index d07640006be1..bf62658f7186 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -602,6 +602,7 @@ WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) GFX_WEBRENDER_DEBUG(".echo-driver-messages", 1 << 8) GFX_WEBRENDER_DEBUG(".new-frame-indicator", 1 << 9) GFX_WEBRENDER_DEBUG(".new-scene-indicator", 1 << 10) + GFX_WEBRENDER_DEBUG(".show-overdraw", 1 << 11) #undef GFX_WEBRENDER_DEBUG gfx::gfxVars::SetWebRenderDebugFlags(flags); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 7c68fdd48d77..cb3154df3749 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -924,6 +924,7 @@ pref("gfx.webrender.debug.compact-profiler", false); pref("gfx.webrender.debug.echo-driver-messages", false); pref("gfx.webrender.debug.new-frame-indicator", false); pref("gfx.webrender.debug.new-scene-indicator", false); +pref("gfx.webrender.debug.show-overdraw", false); pref("gfx.webrender.dl.dump-parent", false); pref("gfx.webrender.dl.dump-content", false); From 4cba5259d509f7a47dc4ca37a95424678c5a0dd2 Mon Sep 17 00:00:00 2001 From: Eitan Isaacson Date: Tue, 21 Aug 2018 10:24:00 -0400 Subject: [PATCH 10/67] Bug 1484778 - Null-check scroll frame in DispatchScrollingEvent. r=surkov --- accessible/generic/DocAccessible.cpp | 3 +++ accessible/tests/crashtests/1484778.html | 26 +++++++++++++++++++++ accessible/tests/crashtests/crashtests.list | 1 + 3 files changed, 30 insertions(+) create mode 100644 accessible/tests/crashtests/1484778.html diff --git a/accessible/generic/DocAccessible.cpp b/accessible/generic/DocAccessible.cpp index 20fa9e042768..2b1cee4029bb 100644 --- a/accessible/generic/DocAccessible.cpp +++ b/accessible/generic/DocAccessible.cpp @@ -2448,6 +2448,9 @@ void DocAccessible::DispatchScrollingEvent(uint32_t aEventType) { nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollable(); + if (!sf) { + return; + } int32_t appUnitsPerDevPixel = mPresShell->GetPresContext()->AppUnitsPerDevPixel(); LayoutDevicePoint scrollPoint = LayoutDevicePoint::FromAppUnits( diff --git a/accessible/tests/crashtests/1484778.html b/accessible/tests/crashtests/1484778.html new file mode 100644 index 000000000000..9d3fc33f5985 --- /dev/null +++ b/accessible/tests/crashtests/1484778.html @@ -0,0 +1,26 @@ + + + + diff --git a/accessible/tests/crashtests/crashtests.list b/accessible/tests/crashtests/crashtests.list index f28c3273622e..2210d0945603 100644 --- a/accessible/tests/crashtests/crashtests.list +++ b/accessible/tests/crashtests/crashtests.list @@ -6,6 +6,7 @@ load 893515.html load 1072792.xhtml load 1380199.html load 1402999.html +load 1484778.html # last_test_to_unload_testsuite.xul MUST be the last test in the list because it # is responsible for shutting down accessibility service affecting later tests. From 00d1d6455e953382e25313c58410dc79bdca962f Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Thu, 23 Aug 2018 22:17:01 +0200 Subject: [PATCH 11/67] Bug 1279185 (Follow-up) - Mark the WPT test legend-position-relative.html as expected PASS. r=me --- .../the-fieldset-element-0/legend-position-relative.html.ini | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 testing/web-platform/meta/html/rendering/non-replaced-elements/the-fieldset-element-0/legend-position-relative.html.ini diff --git a/testing/web-platform/meta/html/rendering/non-replaced-elements/the-fieldset-element-0/legend-position-relative.html.ini b/testing/web-platform/meta/html/rendering/non-replaced-elements/the-fieldset-element-0/legend-position-relative.html.ini deleted file mode 100644 index f1efd104b956..000000000000 --- a/testing/web-platform/meta/html/rendering/non-replaced-elements/the-fieldset-element-0/legend-position-relative.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[legend-position-relative.html] - expected: FAIL From a86d94efc7225d16760c3007e830e00ee63397cc Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Thu, 23 Aug 2018 12:59:00 +0300 Subject: [PATCH 12/67] Bug 1485752 - Update Debugger Frontend v86. r=dwalsh --- .../debugger/new/src/actions/expressions.js | 10 ++++++++-- .../client/debugger/new/src/reducers/pause.js | 18 +++++++++++++----- .../browser_dbg-preview-source-maps.js | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/devtools/client/debugger/new/src/actions/expressions.js b/devtools/client/debugger/new/src/actions/expressions.js index 2ccb0317ee39..52ca43c3648f 100644 --- a/devtools/client/debugger/new/src/actions/expressions.js +++ b/devtools/client/debugger/new/src/actions/expressions.js @@ -217,9 +217,15 @@ function getMappedExpression(expression) { sourceMaps }) { const mappings = (0, _selectors.getSelectedScopeMappings)(getState()); - const bindings = (0, _selectors.getSelectedFrameBindings)(getState()); + const bindings = (0, _selectors.getSelectedFrameBindings)(getState()); // We bail early if we do not need to map the expression. This is important + // because mapping an expression can be slow if the parser worker is + // busy doing other work. + // + // 1. there are no mappings - we do not need to map original expressions + // 2. does not contain `await` - we do not need to map top level awaits + // 3. does not contain `=` - we do not need to map assignments - if (!mappings && !bindings && !expression.includes("await")) { + if (!mappings && !expression.match(/(await|=)/)) { return expression; } diff --git a/devtools/client/debugger/new/src/reducers/pause.js b/devtools/client/debugger/new/src/reducers/pause.js index 47d7dffe7f03..516529751cf7 100644 --- a/devtools/client/debugger/new/src/reducers/pause.js +++ b/devtools/client/debugger/new/src/reducers/pause.js @@ -410,12 +410,20 @@ function getFrameScope(state, sourceId, frameId) { } function getSelectedScope(state) { - const sourceRecord = (0, _sources.getSelectedSource)(state); + const source = (0, _sources.getSelectedSource)(state); const frameId = getSelectedFrameId(state); - const { - scope - } = getFrameScope(state, sourceRecord && sourceRecord.id, frameId) || {}; - return scope || null; + + if (!source) { + return null; + } + + const frameScope = getFrameScope(state, source.id, frameId); + + if (!frameScope) { + return null; + } + + return frameScope.scope || null; } function getSelectedScopeMappings(state) { diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-preview-source-maps.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-preview-source-maps.js index b6b37c1331fc..277ac7757802 100644 --- a/devtools/client/debugger/new/test/mochitest/browser_dbg-preview-source-maps.js +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-preview-source-maps.js @@ -49,7 +49,7 @@ add_task(async function() { info(`Test previewing in the original location`); await assertPreviews(dbg, [ - { line: 2, column: 10, result: 4, expression: "x;" } + { line: 2, column: 10, result: 4, expression: "x" } ]); info(`Test previewing in the generated location`); From 988c6ea8707e74691d0b12290d5e9711e48659ab Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 22 Aug 2018 00:22:01 -0400 Subject: [PATCH 13/67] Bug 1485493 - Remove the XPCOM registration for the geolocation service; r=nika --- dom/ipc/ContentChild.cpp | 9 +++++---- layout/build/nsLayoutModule.cpp | 8 -------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 511ebf884c21..ea3998f9f22f 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -90,6 +90,7 @@ #include "nsISimpleEnumerator.h" #include "nsIStringBundle.h" #include "nsIWorkerDebuggerManager.h" +#include "nsGeolocation.h" #if !defined(XP_WIN) #include "mozilla/Omnijar.h" @@ -2626,8 +2627,8 @@ ContentChild::RecvUpdateSharedData(const FileDescriptor& aMapFile, mozilla::ipc::IPCResult ContentChild::RecvGeolocationUpdate(nsIDOMGeoPosition* aPosition) { - nsCOMPtr gs = - do_GetService("@mozilla.org/geolocation/service;1"); + RefPtr gs = + nsGeolocationService::GetGeolocationService(); if (!gs) { return IPC_OK(); } @@ -2638,8 +2639,8 @@ ContentChild::RecvGeolocationUpdate(nsIDOMGeoPosition* aPosition) mozilla::ipc::IPCResult ContentChild::RecvGeolocationError(const uint16_t& errorCode) { - nsCOMPtr gs = - do_GetService("@mozilla.org/geolocation/service;1"); + RefPtr gs = + nsGeolocationService::GetGeolocationService(); if (!gs) { return IPC_OK(); } diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index f84d45bf8e62..a8ec89d1b65d 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -429,17 +429,12 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Geolocation, Geolocation::NonWindowSingleton) -#define NS_GEOLOCATION_SERVICE_CID \ - { 0x404d02a, 0x1CA, 0xAAAB, { 0x47, 0x62, 0x94, 0x4b, 0x1b, 0xf2, 0xf7, 0xb5 } } - #define NS_AUDIOCHANNEL_SERVICE_CID \ { 0xf712e983, 0x048a, 0x443f, { 0x88, 0x02, 0xfc, 0xc3, 0xd9, 0x27, 0xce, 0xac }} #define NS_WEBSOCKETEVENT_SERVICE_CID \ { 0x31689828, 0xda66, 0x49a6, { 0x87, 0x0c, 0xdf, 0x62, 0xb8, 0x3f, 0xe7, 0x89 }} -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsGeolocationService, nsGeolocationService::GetGeolocationService) - NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(AudioChannelService, AudioChannelService::GetOrCreate) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WebSocketEventService, WebSocketEventService::GetOrCreate) @@ -552,7 +547,6 @@ NS_DEFINE_NAMED_CID(NS_EDITORCONTROLLER_CID); NS_DEFINE_NAMED_CID(NS_EDITINGCONTROLLER_CID); NS_DEFINE_NAMED_CID(NS_EDITORCOMMANDTABLE_CID); NS_DEFINE_NAMED_CID(NS_EDITINGCOMMANDTABLE_CID); -NS_DEFINE_NAMED_CID(NS_GEOLOCATION_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID); NS_DEFINE_NAMED_CID(NS_AUDIOCHANNEL_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_WEBSOCKETEVENT_SERVICE_CID); @@ -790,7 +784,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { { &kNS_EDITINGCONTROLLER_CID, false, nullptr, nsEditingControllerConstructor }, { &kNS_EDITORCOMMANDTABLE_CID, false, nullptr, nsEditorCommandTableConstructor }, { &kNS_EDITINGCOMMANDTABLE_CID, false, nullptr, nsEditingCommandTableConstructor }, - { &kNS_GEOLOCATION_SERVICE_CID, false, nullptr, nsGeolocationServiceConstructor }, { &kNS_GEOLOCATION_CID, false, nullptr, GeolocationConstructor }, { &kNS_AUDIOCHANNEL_SERVICE_CID, false, nullptr, AudioChannelServiceConstructor }, { &kNS_WEBSOCKETEVENT_SERVICE_CID, false, nullptr, WebSocketEventServiceConstructor }, @@ -891,7 +884,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { "@mozilla.org/editor/htmleditor;1", &kNS_HTMLEDITOR_CID }, { "@mozilla.org/editor/editorcontroller;1", &kNS_EDITORCONTROLLER_CID }, { "@mozilla.org/editor/editingcontroller;1", &kNS_EDITINGCONTROLLER_CID }, - { "@mozilla.org/geolocation/service;1", &kNS_GEOLOCATION_SERVICE_CID }, { "@mozilla.org/geolocation;1", &kNS_GEOLOCATION_CID }, { "@mozilla.org/audiochannel/service;1", &kNS_AUDIOCHANNEL_SERVICE_CID }, { "@mozilla.org/websocketevent/service;1", &kNS_WEBSOCKETEVENT_SERVICE_CID }, From 8e7a61886ba586eacda5b2fbecdf6e9953b99948 Mon Sep 17 00:00:00 2001 From: Dorel Luca Date: Thu, 23 Aug 2018 23:45:02 +0300 Subject: [PATCH 14/67] Backed out changeset d47a2f5db828 (bug 1481199) browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js. CLOSED TREE --- browser/base/content/browser-pageActions.js | 2 +- .../content/test/about/browser_aboutHome_search_POST.js | 2 +- browser/base/content/test/about/head.js | 2 +- .../content/test/general/browser_keywordSearch_postData.js | 2 +- .../browser_ext_webNavigation_urlbar_transitions.js | 2 +- browser/components/search/test/browser_426329.js | 2 +- browser/components/search/test/browser_483086.js | 4 ++-- browser/components/search/test/browser_addEngine.js | 2 +- browser/components/search/test/browser_contextmenu.js | 2 +- browser/components/search/test/browser_healthreport.js | 2 +- .../search/test/browser_hiddenOneOffs_cleanup.js | 2 +- browser/components/search/test/head.js | 2 +- browser/modules/test/browser/browser_ContentSearch.js | 2 +- .../test/browser/browser_UsageTelemetry_searchbar.js | 6 +++--- .../modules/test/browser/browser_UsageTelemetry_urlbar.js | 2 +- mobile/android/chrome/content/browser.js | 2 +- netwerk/base/nsIBrowserSearchService.idl | 7 +++++-- .../places/tests/unifiedcomplete/head_autocomplete.js | 2 +- .../components/processsingleton/MainProcessSingleton.js | 2 +- toolkit/components/search/nsSearchService.js | 4 ++-- toolkit/components/search/tests/xpcshell/head_search.js | 3 ++- .../search/tests/xpcshell/test_addEngineWithExtensionID.js | 2 +- .../search/tests/xpcshell/test_addEngine_callback.js | 6 +++--- .../components/search/tests/xpcshell/test_multipleIcons.js | 2 +- .../components/search/tests/xpcshell/test_notifications.js | 2 +- .../telemetry/tests/unit/test_TelemetryEnvironment.js | 2 +- 26 files changed, 37 insertions(+), 33 deletions(-) diff --git a/browser/base/content/browser-pageActions.js b/browser/base/content/browser-pageActions.js index 373903db6e4e..2166637027b8 100644 --- a/browser/base/content/browser-pageActions.js +++ b/browser/base/content/browser-pageActions.js @@ -1166,7 +1166,7 @@ BrowserPageActions.addSearchEngine = { }, _installEngine(uri, image) { - Services.search.addEngine(uri, image, false, { + Services.search.addEngine(uri, null, image, false, { onSuccess: engine => { showBrowserPageActionFeedback(this.action); }, diff --git a/browser/base/content/test/about/browser_aboutHome_search_POST.js b/browser/base/content/test/about/browser_aboutHome_search_POST.js index a8e99ade4a18..7acc733f6385 100644 --- a/browser/base/content/test/about/browser_aboutHome_search_POST.js +++ b/browser/base/content/test/about/browser_aboutHome_search_POST.js @@ -54,7 +54,7 @@ add_task(async function() { }; Services.obs.addObserver(searchObserver, "browser-search-engine-modified"); Services.search.addEngine("http://test:80/browser/browser/base/content/test/about/POSTSearchEngine.xml", - null, false); + null, null, false); }); }); }); diff --git a/browser/base/content/test/about/head.js b/browser/base/content/test/about/head.js index f79a4d356a00..ca3fdf5ff500 100644 --- a/browser/base/content/test/about/head.js +++ b/browser/base/content/test/about/head.js @@ -167,7 +167,7 @@ function promiseNewEngine(basename) { info("Waiting for engine to be added: " + basename); return new Promise((resolve, reject) => { let url = getRootDirectory(gTestPath) + basename; - Services.search.addEngine(url, "", false, { + Services.search.addEngine(url, null, "", false, { onSuccess(engine) { info("Search engine added: " + basename); registerCleanupFunction(() => { diff --git a/browser/base/content/test/general/browser_keywordSearch_postData.js b/browser/base/content/test/general/browser_keywordSearch_postData.js index 0a467c10fd20..79e5bae4a6c2 100644 --- a/browser/base/content/test/general/browser_keywordSearch_postData.js +++ b/browser/base/content/test/general/browser_keywordSearch_postData.js @@ -50,7 +50,7 @@ function test() { }); Services.search.addEngine("http://test:80/browser/browser/base/content/test/general/POSTSearchEngine.xml", - null, false); + null, null, false); } var gCurrTest; diff --git a/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js b/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js index b92820dfea67..2df39f0a2639 100644 --- a/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js +++ b/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js @@ -42,7 +42,7 @@ function addSearchEngine(basename) { return new Promise((resolve, reject) => { info("Waiting for engine to be added: " + basename); let url = getRootDirectory(gTestPath) + basename; - Services.search.addEngine(url, "", false, { + Services.search.addEngine(url, null, "", false, { onSuccess: (engine) => { info(`Search engine added: ${basename}`); registerCleanupFunction(() => Services.search.removeEngine(engine)); diff --git a/browser/components/search/test/browser_426329.js b/browser/components/search/test/browser_426329.js index e257f8992ff0..d87a4cb56269 100644 --- a/browser/components/search/test/browser_426329.js +++ b/browser/components/search/test/browser_426329.js @@ -83,7 +83,7 @@ function promiseSetEngine() { Services.obs.addObserver(observer, "browser-search-engine-modified"); ss.addEngine("http://mochi.test:8888/browser/browser/components/search/test/426329.xml", - "data:image/x-icon,%00", false); + null, "data:image/x-icon,%00", false); }); } diff --git a/browser/components/search/test/browser_483086.js b/browser/components/search/test/browser_483086.js index af6fdcb66c91..a606c8879aa6 100644 --- a/browser/components/search/test/browser_483086.js +++ b/browser/components/search/test/browser_483086.js @@ -24,7 +24,7 @@ function test() { Services.obs.addObserver(observer, "browser-search-engine-modified"); gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/483086-1.xml", - "data:image/x-icon;%00", false); + null, "data:image/x-icon;%00", false); } function test2() { @@ -45,5 +45,5 @@ function test2() { Services.obs.addObserver(observer, "browser-search-engine-modified"); gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/483086-2.xml", - "data:image/x-icon;%00", false); + null, "data:image/x-icon;%00", false); } diff --git a/browser/components/search/test/browser_addEngine.js b/browser/components/search/test/browser_addEngine.js index cf683afb8c79..e72e4c9110fa 100644 --- a/browser/components/search/test/browser_addEngine.js +++ b/browser/components/search/test/browser_addEngine.js @@ -50,7 +50,7 @@ var gTests = [ Services.obs.addObserver(observer, "browser-search-engine-modified"); gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.xml", - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC", + null, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC", false); }, added(engine) { diff --git a/browser/components/search/test/browser_contextmenu.js b/browser/components/search/test/browser_contextmenu.js index 845043ef817e..7f385501339d 100644 --- a/browser/components/search/test/browser_contextmenu.js +++ b/browser/components/search/test/browser_contextmenu.js @@ -49,7 +49,7 @@ add_task(async function() { Services.obs.addObserver(observer, "browser-search-engine-modified"); ss.addEngine("resource://search-plugins/testEngine_mozsearch.xml", - "data:image/x-icon,%00", false); + null, "data:image/x-icon,%00", false); }); contextMenu = document.getElementById("contentAreaContextMenu"); diff --git a/browser/components/search/test/browser_healthreport.js b/browser/components/search/test/browser_healthreport.js index daea794f32f6..a1b514754e23 100644 --- a/browser/components/search/test/browser_healthreport.js +++ b/browser/components/search/test/browser_healthreport.js @@ -78,7 +78,7 @@ function test() { Services.obs.addObserver(observer, "browser-search-engine-modified"); gCUITestUtils.addSearchBar().then(function() { Services.search.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.xml", - "data:image/x-icon,%00", false); + null, "data:image/x-icon,%00", false); }); } diff --git a/browser/components/search/test/browser_hiddenOneOffs_cleanup.js b/browser/components/search/test/browser_hiddenOneOffs_cleanup.js index aba2a46951e9..d1e9907a01a1 100644 --- a/browser/components/search/test/browser_hiddenOneOffs_cleanup.js +++ b/browser/components/search/test/browser_hiddenOneOffs_cleanup.js @@ -9,7 +9,7 @@ function promiseNewEngine(basename) { Services.search.init({ onInitComplete() { let url = getRootDirectory(gTestPath) + basename; - Services.search.addEngine(url, "", false, { + Services.search.addEngine(url, null, "", false, { onSuccess(engine) { info("Search engine added: " + basename); resolve(engine); diff --git a/browser/components/search/test/head.js b/browser/components/search/test/head.js index 61663bb23a30..1613336f9823 100644 --- a/browser/components/search/test/head.js +++ b/browser/components/search/test/head.js @@ -61,7 +61,7 @@ function promiseNewEngine(basename, options = {}) { onInitComplete() { let url = getRootDirectory(options.testPath || gTestPath) + basename; let current = Services.search.currentEngine; - Services.search.addEngine(url, options.iconURL || "", false, { + Services.search.addEngine(url, null, options.iconURL || "", false, { onSuccess(engine) { info("Search engine added: " + basename); if (setAsCurrent) { diff --git a/browser/modules/test/browser/browser_ContentSearch.js b/browser/modules/test/browser/browser_ContentSearch.js index 501db3a44a46..575f609adc49 100644 --- a/browser/modules/test/browser/browser_ContentSearch.js +++ b/browser/modules/test/browser/browser_ContentSearch.js @@ -335,7 +335,7 @@ function waitForNewEngine(basename, numImages) { // Wait for addEngine(). let addDeferred = PromiseUtils.defer(); let url = getRootDirectory(gTestPath) + basename; - Services.search.addEngine(url, "", false, { + Services.search.addEngine(url, null, "", false, { onSuccess(engine) { info("Search engine added: " + basename); addDeferred.resolve(engine); diff --git a/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js b/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js index 3b62ce0dd9e8..6440881de906 100644 --- a/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js +++ b/browser/modules/test/browser/browser_UsageTelemetry_searchbar.js @@ -186,7 +186,7 @@ add_task(async function test_oneOff_enterSelection() { // for this test. const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml"; let suggestionEngine = await new Promise((resolve, reject) => { - Services.search.addEngine(url, "", false, { + Services.search.addEngine(url, null, "", false, { onSuccess(engine) { resolve(engine); }, onError() { reject(); } }); @@ -254,7 +254,7 @@ add_task(async function test_suggestion_click() { // for this test. const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml"; let suggestionEngine = await new Promise((resolve, reject) => { - Services.search.addEngine(url, "", false, { + Services.search.addEngine(url, null, "", false, { onSuccess(engine) { resolve(engine); }, onError() { reject(); } }); @@ -311,7 +311,7 @@ add_task(async function test_suggestion_enterSelection() { // for this test. const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml"; let suggestionEngine = await new Promise((resolve, reject) => { - Services.search.addEngine(url, "", false, { + Services.search.addEngine(url, null, "", false, { onSuccess(engine) { resolve(engine); }, onError() { reject(); } }); diff --git a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js index b4cc17ca73e1..2c0250fc3cc1 100644 --- a/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js +++ b/browser/modules/test/browser/browser_UsageTelemetry_urlbar.js @@ -82,7 +82,7 @@ function clickURLBarSuggestion(entryName, button = 1) { async function withNewSearchEngine(taskFn) { const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml"; let suggestionEngine = await new Promise((resolve, reject) => { - Services.search.addEngine(url, "", false, { + Services.search.addEngine(url, null, "", false, { onSuccess(engine) { resolve(engine); }, onError() { reject(); } }); diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 76bfd0e6256b..5ad5d9838d05 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -5990,7 +5990,7 @@ var SearchEngines = { }, addOpenSearchEngine: function addOpenSearchEngine(engine) { - Services.search.addEngine(engine.url, engine.iconURL, false, { + Services.search.addEngine(engine.url, Ci.nsISearchEngine.DATA_XML, engine.iconURL, false, { onSuccess: function() { // Display a toast confirming addition of new search engine. Snackbars.show(Strings.browser.formatStringFromName("alertSearchEngineAddedToast", [engine.title], 1), Snackbars.LENGTH_LONG); diff --git a/netwerk/base/nsIBrowserSearchService.idl b/netwerk/base/nsIBrowserSearchService.idl index 58761689a439..8bc9bebb6395 100644 --- a/netwerk/base/nsIBrowserSearchService.idl +++ b/netwerk/base/nsIBrowserSearchService.idl @@ -295,6 +295,9 @@ interface nsIBrowserSearchService : nsISupports * @param engineURL * The URL to the search engine's description file. * + * @param dataType + * Obsolete, the value is ignored. + * * @param iconURL * A URL string to an icon file to be used as the search engine's * icon. This value may be overridden by an icon specified in the @@ -317,8 +320,8 @@ interface nsIBrowserSearchService : nsISupports * @throws NS_ERROR_FAILURE if the description file cannot be successfully * loaded. */ - void addEngine(in AString engineURL, in AString iconURL, in boolean confirm, - [optional] in nsISearchInstallCallback callback, + void addEngine(in AString engineURL, in long dataType, in AString iconURL, + in boolean confirm, [optional] in nsISearchInstallCallback callback, [optional] in AString extensionID); /** diff --git a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js index f7c9b6c204d9..ee17fd58e4d5 100644 --- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js +++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js @@ -462,7 +462,7 @@ function addTestEngine(basename, httpServer = undefined) { }, "browser-search-engine-modified"); info("Adding engine from URL: " + dataUrl + basename); - Services.search.addEngine(dataUrl + basename, null, false); + Services.search.addEngine(dataUrl + basename, null, null, false); }); } diff --git a/toolkit/components/processsingleton/MainProcessSingleton.js b/toolkit/components/processsingleton/MainProcessSingleton.js index 61dbd0895b7e..dc71dc4ff12c 100644 --- a/toolkit/components/processsingleton/MainProcessSingleton.js +++ b/toolkit/components/processsingleton/MainProcessSingleton.js @@ -53,7 +53,7 @@ MainProcessSingleton.prototype = { if (status != Cr.NS_OK) return; - Services.search.addEngine(engineURL.spec, iconURL ? iconURL.spec : null, true); + Services.search.addEngine(engineURL.spec, null, iconURL ? iconURL.spec : null, true); }); }, diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index bd4676274a15..9d008ded66d1 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -3850,8 +3850,8 @@ SearchService.prototype = { } }, - addEngine: function SRCH_SVC_addEngine(aEngineURL, aIconURL, aConfirm, - aCallback, aExtensionID) { + addEngine: function SRCH_SVC_addEngine(aEngineURL, aDataType, aIconURL, + aConfirm, aCallback, aExtensionID) { LOG("addEngine: Adding \"" + aEngineURL + "\"."); this._ensureInitialized(); try { diff --git a/toolkit/components/search/tests/xpcshell/head_search.js b/toolkit/components/search/tests/xpcshell/head_search.js index c7c93281cae7..b9f73eec5786 100644 --- a/toolkit/components/search/tests/xpcshell/head_search.js +++ b/toolkit/components/search/tests/xpcshell/head_search.js @@ -415,7 +415,8 @@ var addTestEngines = async function(aItems) { }, "browser-search-engine-modified"); if (item.xmlFileName) { - Services.search.addEngine(gDataUrl + item.xmlFileName, null, false); + Services.search.addEngine(gDataUrl + item.xmlFileName, + null, null, false); } else { Services.search.addEngineWithDetails(item.name, ...item.details); } diff --git a/toolkit/components/search/tests/xpcshell/test_addEngineWithExtensionID.js b/toolkit/components/search/tests/xpcshell/test_addEngineWithExtensionID.js index 4019666e9b44..015ac2bfaf8d 100644 --- a/toolkit/components/search/tests/xpcshell/test_addEngineWithExtensionID.js +++ b/toolkit/components/search/tests/xpcshell/test_addEngineWithExtensionID.js @@ -40,7 +40,7 @@ add_test(function test_addEngineWithExtensionID() { } }; Services.search.addEngine(gDataUrl + "engine.xml", null, - false, searchCallback, kExtensionID2); + null, false, searchCallback, kExtensionID2); }); function run_test() { diff --git a/toolkit/components/search/tests/xpcshell/test_addEngine_callback.js b/toolkit/components/search/tests/xpcshell/test_addEngine_callback.js index d15986147f8f..256e949516a7 100644 --- a/toolkit/components/search/tests/xpcshell/test_addEngine_callback.js +++ b/toolkit/components/search/tests/xpcshell/test_addEngine_callback.js @@ -50,7 +50,7 @@ add_test(function simple_callback_test() { } }; Services.search.addEngine(gDataUrl + "engine.xml", null, - false, searchCallback); + null, false, searchCallback); }); // Test of the search callback on duplicate engine failures @@ -67,7 +67,7 @@ add_test(function duplicate_failure_test() { }; // Re-add the same engine added in the previous test Services.search.addEngine(gDataUrl + "engine.xml", null, - false, searchCallback); + null, false, searchCallback); }); // Test of the search callback on failure to load the engine failures @@ -84,7 +84,7 @@ add_test(function load_failure_test() { }; // Try adding an engine that doesn't exist Services.search.addEngine("http://invalid/data/engine.xml", null, - false, searchCallback); + null, false, searchCallback); }); function run_test() { diff --git a/toolkit/components/search/tests/xpcshell/test_multipleIcons.js b/toolkit/components/search/tests/xpcshell/test_multipleIcons.js index 1190c035f639..04ae7af02254 100644 --- a/toolkit/components/search/tests/xpcshell/test_multipleIcons.js +++ b/toolkit/components/search/tests/xpcshell/test_multipleIcons.js @@ -48,7 +48,7 @@ add_task(async function test_multipleIcons() { add_task(async function test_icon_not_in_file() { let engineUrl = gDataUrl + "engine-fr.xml"; let engine = await new Promise((resolve, reject) => { - Services.search.addEngine(engineUrl, "data:image/x-icon;base64,ico16", + Services.search.addEngine(engineUrl, null, "data:image/x-icon;base64,ico16", false, {onSuccess: resolve, onError: reject}); }); diff --git a/toolkit/components/search/tests/xpcshell/test_notifications.js b/toolkit/components/search/tests/xpcshell/test_notifications.js index 1b325d0edacc..3ae78a27b2a7 100644 --- a/toolkit/components/search/tests/xpcshell/test_notifications.js +++ b/toolkit/components/search/tests/xpcshell/test_notifications.js @@ -66,5 +66,5 @@ function run_test() { Services.obs.addObserver(search_observer, "browser-search-engine-modified"); - Services.search.addEngine(gDataUrl + "engine.xml", null, false); + Services.search.addEngine(gDataUrl + "engine.xml", null, null, false); } diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js index f70e551be3e8..340bfd851be7 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js @@ -1610,7 +1610,7 @@ add_task(async function test_defaultSearchEngine() { } }, "browser-search-engine-modified"); Services.search.addEngine("file://" + do_get_cwd().path + "/engine.xml", - null, false); + null, null, false); }); Services.search.defaultEngine = engine; await promise; From c1c5987ee2a699d2810fae9c852a256b5af89304 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 23 Aug 2018 16:48:53 -0400 Subject: [PATCH 15/67] Bug 1485716 - part 1 - always use frame pointers on aarch64 windows; r=dmajor This support is not necessary, but the ABI conventions page (https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions) encourages people to use frame pointers for fast stack walking, and using frame pointers means we're compatible with ETW, which is a Good Thing. --- build/autoconf/frameptr.m4 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build/autoconf/frameptr.m4 b/build/autoconf/frameptr.m4 index e7e50330eea5..4efe32c3be18 100644 --- a/build/autoconf/frameptr.m4 +++ b/build/autoconf/frameptr.m4 @@ -30,13 +30,15 @@ AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [ fi # If we are debugging, profiling, using sanitizers, or on win32 we want a - # frame pointer. + # frame pointer. It is not required to enable frame pointers on AArch64 + # Windows, but we enable it for compatibility with ETW. if test -z "$MOZ_OPTIMIZE" -o \ -n "$MOZ_PROFILING" -o \ -n "$MOZ_DEBUG" -o \ -n "$MOZ_MSAN" -o \ -n "$MOZ_ASAN" -o \ - "$OS_ARCH:$CPU_ARCH" = "WINNT:x86"; then + "$OS_ARCH:$CPU_ARCH" = "WINNT:x86" -o \ + "$OS_ARCH:$CPU_ARCH" = "WINNT:aarch64"; then MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR" else MOZ_FRAMEPTR_FLAGS="$MOZ_DISABLE_FRAME_PTR" From b8909530ab35bca0d795ea264d72d2640d88de46 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 23 Aug 2018 16:48:53 -0400 Subject: [PATCH 16/67] Bug 1485716 - part 2 - add aarch64 windows support to the stack walking code; r=aklotz This code is untested and has been cargo-culted a little bit from the existing x86 code, but should work OK; all the code in Windows is compiled with frame pointers, we're compiled with frame pointers after the previous patch, and so the frame pointer unwinding path makes the most sense. --- mozglue/misc/StackWalk.cpp | 12 +++++++++--- mozglue/misc/StackWalk.h | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mozglue/misc/StackWalk.cpp b/mozglue/misc/StackWalk.cpp index 58cd5fc65dd0..a3c226daafcc 100644 --- a/mozglue/misc/StackWalk.cpp +++ b/mozglue/misc/StackWalk.cpp @@ -207,7 +207,7 @@ WalkStackMain64(struct WalkStackData* aData) context = aData->context; } -#if defined(_M_IX86) || defined(_M_IA64) +#if defined(_M_IX86) || defined(_M_IA64) || defined(_M_ARM64) // Setup initial stack frame to walk from. STACKFRAME64 frame64; memset(&frame64, 0, sizeof(frame64)); @@ -219,6 +219,10 @@ WalkStackMain64(struct WalkStackData* aData) frame64.AddrPC.Offset = context->StIIP; frame64.AddrStack.Offset = context->SP; frame64.AddrFrame.Offset = context->RsBSP; +#elif defined _M_ARM64 + frame64.AddrPC.Offset = context->Pc; + frame64.AddrStack.Offset = context->Sp; + frame64.AddrFrame.Offset = context->Fp; #endif frame64.AddrPC.Mode = AddrModeFlat; frame64.AddrStack.Mode = AddrModeFlat; @@ -226,7 +230,7 @@ WalkStackMain64(struct WalkStackData* aData) frame64.AddrReturn.Mode = AddrModeFlat; #endif -#ifdef _WIN64 +#ifdef _M_AMD64 // If there are any active suppressions, then at least one thread (we don't // know which) is holding a lock that can deadlock RtlVirtualUnwind. Since // that thread may be the one that we're trying to unwind, we can't proceed. @@ -254,7 +258,7 @@ WalkStackMain64(struct WalkStackData* aData) DWORD64 addr; DWORD64 spaddr; -#if defined(_M_IX86) || defined(_M_IA64) +#if defined(_M_IX86) || defined(_M_IA64) || defined(_M_ARM64) // 32-bit frame unwinding. // Debug routines are not threadsafe, so grab the lock. EnterCriticalSection(&gDbgHelpCS); @@ -263,6 +267,8 @@ WalkStackMain64(struct WalkStackData* aData) IMAGE_FILE_MACHINE_IA64, #elif defined _M_IX86 IMAGE_FILE_MACHINE_I386, +#elif defined _M_ARM64 + IMAGE_FILE_MACHINE_ARM64, #endif aData->process, aData->thread, diff --git a/mozglue/misc/StackWalk.h b/mozglue/misc/StackWalk.h index 5ae6a0371d69..eea01be4582f 100644 --- a/mozglue/misc/StackWalk.h +++ b/mozglue/misc/StackWalk.h @@ -47,7 +47,8 @@ MozStackWalk(MozWalkStackCallback aCallback, uint32_t aSkipFrames, uint32_t aMaxFrames, void* aClosure); #if defined(_WIN32) && \ - (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)) + (defined(_M_IX86) || defined(_M_AMD64) || \ + defined(_M_IA64) || defined(_M_ARM64)) #include From ae15c6ad5c71472a6080ef5afcae724e60ff6198 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 23 Aug 2018 16:48:53 -0400 Subject: [PATCH 17/67] Bug 1485716 - part 3 - add aarch64 windows support to the profiler; r=mstange Frame pointers are enabled in Windows code always, and in our code by default after the first patch in this series. --- tools/profiler/core/PlatformMacros.h | 6 ++++++ tools/profiler/core/platform.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tools/profiler/core/PlatformMacros.h b/tools/profiler/core/PlatformMacros.h index 1028f6f0bb49..ace0e3827110 100644 --- a/tools/profiler/core/PlatformMacros.h +++ b/tools/profiler/core/PlatformMacros.h @@ -23,6 +23,7 @@ #undef GP_PLAT_amd64_darwin #undef GP_PLAT_x86_windows #undef GP_PLAT_amd64_windows +#undef GP_PLAT_arm64_windows #undef GP_ARCH_x86 #undef GP_ARCH_amd64 @@ -95,6 +96,11 @@ # define GP_ARCH_amd64 1 # define GP_OS_windows 1 +#elif defined(_MSC_VER) && defined(_M_ARM64) +# define GP_PLAT_arm64_windows 1 +# define GP_ARCH_arm64 1 +# define GP_OS_windows 1 + #else # error "Unsupported platform" #endif diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 4eb9d8425c91..d249c9df3e66 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -102,6 +102,12 @@ # define USE_MOZ_STACK_WALK #endif +// AArch64 Win64 builds use frame pointers. +#if defined(GP_PLAT_arm64_windows) +# define HAVE_NATIVE_UNWIND +# define USE_FRAME_POINTER_STACK_WALK +#endif + // Mac builds only have frame pointers when MOZ_PROFILING is specified, so // FramePointerStackWalk() only works in that case. We don't use MozStackWalk() // on Mac. From 28a1a1d5ddfa33bdda119778e47bcf916bdf7bc0 Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Thu, 23 Aug 2018 17:03:35 -0400 Subject: [PATCH 18/67] Bug 1330257 - 8. Add tests for Oreo auto-fill frontend; r=snorp Add some tests for the Oreo auto-fill frontend, similar to the tests for the a11y auto-fill frontend. However, because these tests depend on the ViewStructure class, they require SDK 23+ to run. Differential Revision: https://phabricator.services.mozilla.com/D3810 --- .../geckoview/test/ContentDelegateTest.kt | 231 ++++++++++++++++++ 1 file changed, 231 insertions(+) diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentDelegateTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentDelegateTest.kt index 2ad3c3105b75..5d0696dd98bd 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentDelegateTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentDelegateTest.kt @@ -4,6 +4,8 @@ package org.mozilla.geckoview.test +import android.app.assist.AssistStructure +import android.os.Build import org.mozilla.geckoview.GeckoResult import org.mozilla.geckoview.GeckoSession import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.AssertCalled @@ -16,7 +18,13 @@ import org.mozilla.geckoview.test.util.UiThreadUtils import android.os.Looper import android.support.test.filters.MediumTest +import android.support.test.filters.SdkSuppress import android.support.test.runner.AndroidJUnit4 +import android.text.InputType +import android.util.SparseArray +import android.view.View +import android.view.ViewStructure +import android.widget.EditText import org.hamcrest.Matchers.* import org.junit.Assume.assumeThat import org.junit.Test @@ -184,4 +192,227 @@ class ContentDelegateTest : BaseSessionTest() { throw UiThreadUtils.TimeoutException("Timed out") } } + + val ViewNode by lazy { + AssistStructure.ViewNode::class.java.getDeclaredConstructor().apply { isAccessible = true } + } + + val ViewNodeBuilder by lazy { + Class.forName("android.app.assist.AssistStructure\$ViewNodeBuilder") + .getDeclaredConstructor(AssistStructure::class.java, + AssistStructure.ViewNode::class.java, + Boolean::class.javaPrimitiveType) + .apply { isAccessible = true } + } + + // TextInputDelegateTest is parameterized, so we put this test under ContentDelegateTest. + @SdkSuppress(minSdkVersion = 23) + @WithDevToolsAPI + @Test fun autofill() { + // Test parts of the Oreo auto-fill API; there is another autofill test in + // SessionAccessibility for a11y auto-fill support. + mainSession.loadTestPath(FORMS_HTML_PATH) + // Wait for the auto-fill nodes to populate. + sessionRule.waitUntilCalled(object : Callbacks.TextInputDelegate { + // For the root document and the iframe document, each has a form group and + // a group for inputs outside of forms, so the total count is 4. + @AssertCalled(count = 4) + override fun notifyAutoFill(session: GeckoSession, notification: Int, virtualId: Int) { + } + }) + + val autoFills = mapOf( + "#user1" to "bar", "#user2" to "bar") + + if (Build.VERSION.SDK_INT >= 26) mapOf( + "#pass1" to "baz", "#pass2" to "baz", "#email1" to "a@b.c", + "#number1" to "24", "#tel1" to "42") + else mapOf( + "#pass1" to "bar", "#pass2" to "bar", "#email1" to "bar", + "#number1" to "", "#tel1" to "bar") + + // Set up promises to monitor the values changing. + val promises = autoFills.flatMap { entry -> + // Repeat each test with both the top document and the iframe document. + arrayOf("document", "$('#iframe').contentDocument").map { doc -> + mainSession.evaluateJS("""new Promise(resolve => + $doc.querySelector('${entry.key}').addEventListener( + 'input', event => resolve([event.target.value, '${entry.value}']), + { once: true }))""").asJSPromise() + } + } + + val rootNode = ViewNode.newInstance() + val rootStructure = ViewNodeBuilder.newInstance(AssistStructure(), rootNode, + /* async */ false) as ViewStructure + val autoFillValues = SparseArray() + + // Perform auto-fill and return number of auto-fills performed. + fun checkAutoFillChild(child: AssistStructure.ViewNode) { + // Seal the node info instance so we can perform actions on it. + if (child.childCount > 0) { + for (i in 0 until child.childCount) { + checkAutoFillChild(child.getChildAt(i)) + } + } + + if (child === rootNode) { + return + } + + assertThat("ID should be valid", child.id, not(equalTo(View.NO_ID))) + + if (Build.VERSION.SDK_INT >= 26) { + assertThat("Should have HTML tag", + child.htmlInfo.tag, not(isEmptyOrNullString())) + assertThat("Web domain should match", + child.webDomain, equalTo("android")) + } + + if (EditText::class.java.name == child.className) { + assertThat("Input should be enabled", child.isEnabled, equalTo(true)) + assertThat("Input should be focusable", + child.isFocusable, equalTo(true)) + assertThat("Input should be visible", + child.visibility, equalTo(View.VISIBLE)) + + if (Build.VERSION.SDK_INT < 26) { + autoFillValues.append(child.id, "bar") + return + } + + val htmlInfo = child.htmlInfo + assertThat("Should have HTML tag", htmlInfo.tag, equalTo("input")) + assertThat("Should have ID attribute", + htmlInfo.attributes.map { it.first }, hasItem("id")) + + assertThat("Autofill type should match", + child.autofillType, equalTo(View.AUTOFILL_TYPE_TEXT)) + + assertThat("Autofill hints should match", child.autofillHints, equalTo( + when (child.inputType) { + InputType.TYPE_CLASS_TEXT or + InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD -> + arrayOf(View.AUTOFILL_HINT_PASSWORD) + InputType.TYPE_CLASS_TEXT or + InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS -> + arrayOf(View.AUTOFILL_HINT_EMAIL_ADDRESS) + InputType.TYPE_CLASS_PHONE -> arrayOf(View.AUTOFILL_HINT_PHONE) + else -> null + })) + + autoFillValues.append(child.id, when (child.inputType) { + InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD -> "baz" + InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS -> "a@b.c" + InputType.TYPE_CLASS_NUMBER -> "24" + InputType.TYPE_CLASS_PHONE -> "42" + else -> "bar" + }) + } + } + + mainSession.textInput.onProvideAutofillVirtualStructure(rootStructure, 0) + checkAutoFillChild(rootNode) + mainSession.textInput.autofill(autoFillValues) + + // Wait on the promises and check for correct values. + for ((actual, expected) in promises.map { it.value.asJSList() }) { + assertThat("Auto-filled value must match", actual, equalTo(expected)) + } + } + + // TextInputDelegateTest is parameterized, so we put this test under ContentDelegateTest. + @SdkSuppress(minSdkVersion = 23) + @WithDevToolsAPI + @WithDisplay(width = 100, height = 100) + @Test fun autoFill_navigation() { + + fun countAutoFillNodes(cond: (AssistStructure.ViewNode) -> Boolean = + { it.className == "android.widget.EditText" }, + root: AssistStructure.ViewNode? = null): Int { + val node = if (root !== null) root else ViewNode.newInstance().also { + // Fill the nodes first. + val structure = ViewNodeBuilder.newInstance( + AssistStructure(), it, /* async */ false) as ViewStructure + mainSession.textInput.onProvideAutofillVirtualStructure(structure, 0) + } + return (if (cond(node)) 1 else 0) + + (if (node.childCount > 0) (0 until node.childCount).sumBy { + countAutoFillNodes(cond, node.getChildAt(it)) } else 0) + } + + // Wait for the accessibility nodes to populate. + mainSession.loadTestPath(FORMS_HTML_PATH) + sessionRule.waitUntilCalled(object : Callbacks.TextInputDelegate { + @AssertCalled(count = 4) + override fun notifyAutoFill(session: GeckoSession, notification: Int, virtualId: Int) { + assertThat("Should be starting auto-fill", notification, equalTo(forEachCall( + GeckoSession.TextInputDelegate.AUTO_FILL_NOTIFY_STARTED, + GeckoSession.TextInputDelegate.AUTO_FILL_NOTIFY_VIEW_ADDED))) + assertThat("ID should be valid", virtualId, not(equalTo(View.NO_ID))) + } + }) + assertThat("Initial auto-fill count should match", + countAutoFillNodes(), equalTo(14)) + + // Now wait for the nodes to clear. + mainSession.loadTestPath(HELLO_HTML_PATH) + sessionRule.waitUntilCalled(object : Callbacks.TextInputDelegate { + @AssertCalled(count = 1) + override fun notifyAutoFill(session: GeckoSession, notification: Int, virtualId: Int) { + assertThat("Should be canceling auto-fill", + notification, + equalTo(GeckoSession.TextInputDelegate.AUTO_FILL_NOTIFY_CANCELED)) + assertThat("ID should be valid", virtualId, equalTo(View.NO_ID)) + } + }) + assertThat("Should not have auto-fill fields", + countAutoFillNodes(), equalTo(0)) + + // Now wait for the nodes to reappear. + mainSession.waitForPageStop() + mainSession.goBack() + sessionRule.waitUntilCalled(object : Callbacks.TextInputDelegate { + @AssertCalled(count = 4) + override fun notifyAutoFill(session: GeckoSession, notification: Int, virtualId: Int) { + assertThat("Should be starting auto-fill", notification, equalTo(forEachCall( + GeckoSession.TextInputDelegate.AUTO_FILL_NOTIFY_STARTED, + GeckoSession.TextInputDelegate.AUTO_FILL_NOTIFY_VIEW_ADDED))) + assertThat("ID should be valid", virtualId, not(equalTo(View.NO_ID))) + } + }) + assertThat("Should have auto-fill fields again", + countAutoFillNodes(), equalTo(14)) + assertThat("Should not have focused field", + countAutoFillNodes({ it.isFocused }), equalTo(0)) + + mainSession.evaluateJS("$('#pass1').focus()") + sessionRule.waitUntilCalled(object : Callbacks.TextInputDelegate { + @AssertCalled(count = 1) + override fun notifyAutoFill(session: GeckoSession, notification: Int, virtualId: Int) { + assertThat("Should be entering auto-fill view", + notification, + equalTo(GeckoSession.TextInputDelegate.AUTO_FILL_NOTIFY_VIEW_ENTERED)) + assertThat("ID should be valid", virtualId, not(equalTo(View.NO_ID))) + } + }) + assertThat("Should have one focused field", + countAutoFillNodes({ it.isFocused }), equalTo(1)) + // The focused field, its siblings, and its parent should be visible. + assertThat("Should have at least six visible fields", + countAutoFillNodes({ node -> node.width > 0 && node.height > 0 }), + greaterThanOrEqualTo(6)) + + mainSession.evaluateJS("$('#pass1').blur()") + sessionRule.waitUntilCalled(object : Callbacks.TextInputDelegate { + @AssertCalled(count = 1) + override fun notifyAutoFill(session: GeckoSession, notification: Int, virtualId: Int) { + assertThat("Should be exiting auto-fill view", + notification, + equalTo(GeckoSession.TextInputDelegate.AUTO_FILL_NOTIFY_VIEW_EXITED)) + assertThat("ID should be valid", virtualId, not(equalTo(View.NO_ID))) + } + }) + assertThat("Should not have focused field", + countAutoFillNodes({ it.isFocused }), equalTo(0)) + } } From c7f063aba4645d1be0bd4300162bd68bfb760423 Mon Sep 17 00:00:00 2001 From: Sean Stangl Date: Mon, 13 Aug 2018 14:27:00 -0400 Subject: [PATCH 19/67] Bug 1483030 - Implement basic ARM64 codegen. r=djvj --- js/src/jit/arm64/CodeGenerator-arm64.cpp | 263 +++++++++++++++++++++-- js/src/jit/arm64/Lowering-arm64.cpp | 13 +- 2 files changed, 249 insertions(+), 27 deletions(-) diff --git a/js/src/jit/arm64/CodeGenerator-arm64.cpp b/js/src/jit/arm64/CodeGenerator-arm64.cpp index 153b26be79bf..43980c93b109 100644 --- a/js/src/jit/arm64/CodeGenerator-arm64.cpp +++ b/js/src/jit/arm64/CodeGenerator-arm64.cpp @@ -76,13 +76,42 @@ OutOfLineBailout::accept(CodeGeneratorARM64* codegen) void CodeGenerator::visitTestIAndBranch(LTestIAndBranch* test) { - MOZ_CRASH("visitTestIAndBranch"); + Register input = ToRegister(test->input()); + MBasicBlock* mirTrue = test->ifTrue(); + MBasicBlock* mirFalse = test->ifFalse(); + + masm.test32(input, input); + + // Jump to the True block if NonZero. + // Jump to the False block if Zero. + if (isNextBlock(mirFalse->lir())) { + jumpToBlock(mirTrue, Assembler::NonZero); + } else { + jumpToBlock(mirFalse, Assembler::Zero); + if (!isNextBlock(mirTrue->lir())) + jumpToBlock(mirTrue); + } } void CodeGenerator::visitCompare(LCompare* comp) { - MOZ_CRASH("visitCompare"); + const MCompare* mir = comp->mir(); + const MCompare::CompareType type = mir->compareType(); + const Assembler::Condition cond = JSOpToCondition(type, comp->jsop()); + const Register leftreg = ToRegister(comp->getOperand(0)); + const LAllocation* right = comp->getOperand(1); + const Register defreg = ToRegister(comp->getDef(0)); + + if (type == MCompare::Compare_Object || type == MCompare::Compare_Symbol) { + masm.cmpPtrSet(cond, leftreg, ToRegister(right), defreg); + return; + } + + if (right->isConstant()) + masm.cmp32Set(cond, leftreg, Imm32(ToInt32(right)), defreg); + else + masm.cmp32Set(cond, leftreg, ToRegister(right), defreg); } void @@ -209,12 +238,12 @@ toXRegister(const T* a) return ARMRegister(ToRegister(a), 64); } -js::jit::Operand +Operand toWOperand(const LAllocation* a) { if (a->isConstant()) - return js::jit::Operand(ToInt32(a)); - return js::jit::Operand(toWRegister(a)); + return Operand(ToInt32(a)); + return Operand(toWRegister(a)); } vixl::CPURegister @@ -256,13 +285,94 @@ CodeGenerator::visitAddI(LAddI* ins) void CodeGenerator::visitSubI(LSubI* ins) { - MOZ_CRASH("visitSubI"); + const LAllocation* lhs = ins->getOperand(0); + const LAllocation* rhs = ins->getOperand(1); + const LDefinition* dest = ins->getDef(0); + + // Platforms with three-operand arithmetic ops don't need recovery. + MOZ_ASSERT(!ins->recoversInput()); + + if (ins->snapshot()) { + masm.Subs(toWRegister(dest), toWRegister(lhs), toWOperand(rhs)); + bailoutIf(Assembler::Overflow, ins->snapshot()); + } else { + masm.Sub(toWRegister(dest), toWRegister(lhs), toWOperand(rhs)); + } } void CodeGenerator::visitMulI(LMulI* ins) { - MOZ_CRASH("visitMulI"); + const LAllocation* lhs = ins->getOperand(0); + const LAllocation* rhs = ins->getOperand(1); + const LDefinition* dest = ins->getDef(0); + MMul* mul = ins->mir(); + MOZ_ASSERT_IF(mul->mode() == MMul::Integer, !mul->canBeNegativeZero() && !mul->canOverflow()); + + Register lhsreg = ToRegister(lhs); + + if (rhs->isConstant()) { + // Bailout on -0.0. + int32_t constant = ToInt32(rhs); + if (mul->canBeNegativeZero() && constant <= 0) { + Assembler::Condition bailoutCond = (constant == 0) ? Assembler::LessThan : Assembler::Equal; + masm.Cmp(toWRegister(lhs), Operand(0)); + bailoutIf(bailoutCond, ins->snapshot()); + } + + switch (constant) { + case -1: + masm.neg32(lhsreg); + break; + case 0: + masm.Mov(ARMRegister(lhsreg, 32), wzr); + return; // escape overflow check; + case 1: + // nop + return; // escape overflow check; + case 2: + masm.add32(lhsreg, lhsreg); + break; + default: + // Use shift if cannot overflow and constant is a power of 2 + if (!mul->canOverflow() && constant > 0) { + int32_t shift = FloorLog2(constant); + if ((1 << shift) == constant) { + masm.lshift32(Imm32(shift), lhsreg); + return; + } + } + + // Otherwise, just multiply. + Label bailout; + Label* onZero = mul->canBeNegativeZero() ? &bailout : nullptr; + Label* onOverflow = mul->canOverflow() ? &bailout : nullptr; + + vixl::UseScratchRegisterScope temps(&masm.asVIXL()); + const Register scratch = temps.AcquireW().asUnsized(); + + masm.move32(Imm32(constant), scratch); + masm.mul32(lhsreg, scratch, ToRegister(dest), onOverflow, onZero); + if (onZero || onOverflow) + bailoutFrom(&bailout, ins->snapshot()); + return; // escape overflow check; + } + + // Overflow check. + if (mul->canOverflow()) + bailoutIf(Assembler::Overflow, ins->snapshot()); + } else { + Register rhsreg = ToRegister(rhs); + + Label bailout; + // TODO: x64 (but not other platforms) have an OOL path for onZero. + Label* onZero = mul->canBeNegativeZero() ? &bailout : nullptr; + Label* onOverflow = mul->canOverflow() ? &bailout : nullptr; + + masm.mul32(lhsreg, rhsreg, ToRegister(dest), onOverflow, onZero); + if (onZero || onOverflow) + bailoutFrom(&bailout, ins->snapshot()); + } } @@ -270,6 +380,7 @@ void CodeGenerator::visitDivI(LDivI* ins) { MOZ_CRASH("visitDivI"); + } void @@ -294,7 +405,42 @@ CodeGenerator::visitModI(LModI* ins) void CodeGenerator::visitModPowTwoI(LModPowTwoI* ins) { - MOZ_CRASH("visitModPowTwoI"); + Register lhs = ToRegister(ins->getOperand(0)); + ARMRegister lhsw = toWRegister(ins->getOperand(0)); + ARMRegister outw = toWRegister(ins->output()); + + int32_t shift = ins->shift(); + bool canBeNegative = !ins->mir()->isUnsigned() && ins->mir()->canBeNegativeDividend(); + + Label negative; + if (canBeNegative) { + // Switch based on sign of the lhs. + // Positive numbers are just a bitmask. + masm.branchTest32(Assembler::Signed, lhs, lhs, &negative); + } + + masm.And(outw, lhsw, Operand((uint32_t(1) << shift) - 1)); + + if (canBeNegative) { + Label done; + masm.jump(&done); + + // Negative numbers need a negate, bitmask, negate. + masm.bind(&negative); + masm.Neg(outw, Operand(lhsw)); + masm.And(outw, outw, Operand((uint32_t(1) << shift) - 1)); + + // Since a%b has the same sign as b, and a is negative in this branch, + // an answer of 0 means the correct result is actually -0. Bail out. + if (!ins->mir()->isTruncated()) { + masm.Negs(outw, Operand(outw)); + bailoutIf(Assembler::Zero, ins->snapshot()); + } else { + masm.Neg(outw, Operand(outw)); + } + + masm.bind(&done); + } } void @@ -306,13 +452,31 @@ CodeGenerator::visitModMaskI(LModMaskI* ins) void CodeGenerator::visitBitNotI(LBitNotI* ins) { - MOZ_CRASH("visitBitNotI"); + const LAllocation* input = ins->getOperand(0); + const LDefinition* output = ins->getDef(0); + masm.Mvn(toWRegister(output), toWOperand(input)); } void CodeGenerator::visitBitOpI(LBitOpI* ins) { - MOZ_CRASH("visitBitOpI"); + const ARMRegister lhs = toWRegister(ins->getOperand(0)); + const Operand rhs = toWOperand(ins->getOperand(1)); + const ARMRegister dest = toWRegister(ins->getDef(0)); + + switch (ins->bitop()) { + case JSOP_BITOR: + masm.Orr(dest, lhs, rhs); + break; + case JSOP_BITXOR: + masm.Eor(dest, lhs, rhs); + break; + case JSOP_BITAND: + masm.And(dest, lhs, rhs); + break; + default: + MOZ_CRASH("unexpected binary opcode"); + } } void @@ -336,7 +500,11 @@ CodeGenerator::visitPowHalfD(LPowHalfD* ins) MoveOperand CodeGeneratorARM64::toMoveOperand(const LAllocation a) const { - MOZ_CRASH("toMoveOperand"); + if (a.isGeneralReg()) + return MoveOperand(ToRegister(a)); + if (a.isFloatReg()) + return MoveOperand(ToFloatRegister(a)); + return MoveOperand(AsRegister(masm.getStackPointer()), ToStackOffset(a)); } class js::jit::OutOfLineTableSwitch : public OutOfLineCodeBase @@ -393,25 +561,45 @@ CodeGenerator::visitMathF(LMathF* math) void CodeGenerator::visitFloor(LFloor* lir) { - MOZ_CRASH("visitFloor"); + FloatRegister input = ToFloatRegister(lir->input()); + Register output = ToRegister(lir->output()); + + Label bailout; + masm.floor(input, output, &bailout); + bailoutFrom(&bailout, lir->snapshot()); } void CodeGenerator::visitFloorF(LFloorF* lir) { - MOZ_CRASH("visitFloorF"); + FloatRegister input = ToFloatRegister(lir->input()); + Register output = ToRegister(lir->output()); + + Label bailout; + masm.floorf(input, output, &bailout); + bailoutFrom(&bailout, lir->snapshot()); } void CodeGenerator::visitCeil(LCeil* lir) { - MOZ_CRASH("visitCeil"); + FloatRegister input = ToFloatRegister(lir->input()); + Register output = ToRegister(lir->output()); + + Label bailout; + masm.ceil(input, output, &bailout); + bailoutFrom(&bailout, lir->snapshot()); } void CodeGenerator::visitCeilF(LCeilF* lir) { - MOZ_CRASH("visitCeilF"); + FloatRegister input = ToFloatRegister(lir->input()); + Register output = ToRegister(lir->output()); + + Label bailout; + masm.ceilf(input, output, &bailout); + bailoutFrom(&bailout, lir->snapshot()); } void @@ -441,7 +629,9 @@ CodeGenerator::visitTruncF(LTruncF* lir) void CodeGenerator::visitClzI(LClzI* lir) { - MOZ_CRASH("visitClzI"); + ARMRegister input = toWRegister(lir->input()); + ARMRegister output = toWRegister(lir->output()); + masm.Clz(output, input); } void @@ -503,7 +693,8 @@ CodeGeneratorARM64::ToTempValue(LInstruction* ins, size_t pos) void CodeGenerator::visitValue(LValue* value) { - MOZ_CRASH("visitValue"); + ValueOperand result = ToOutValue(value); + masm.moveValue(value->value(), result); } void @@ -583,13 +774,15 @@ CodeGenerator::visitUnbox(LUnbox* unbox) void CodeGenerator::visitDouble(LDouble* ins) { - MOZ_CRASH("visitDouble"); + ARMFPRegister output(ToFloatRegister(ins->getDef(0)), 64); + masm.Fmov(output, ins->getDouble()); } void CodeGenerator::visitFloat32(LFloat32* ins) { - MOZ_CRASH("visitFloat32"); + ARMFPRegister output(ToFloatRegister(ins->getDef(0)), 32); + masm.Fmov(output, ins->getFloat()); } void @@ -613,25 +806,49 @@ CodeGenerator::visitTestFAndBranch(LTestFAndBranch* test) void CodeGenerator::visitCompareD(LCompareD* comp) { - MOZ_CRASH("visitCompareD"); + const FloatRegister left = ToFloatRegister(comp->left()); + const FloatRegister right = ToFloatRegister(comp->right()); + ARMRegister output = toWRegister(comp->output()); + Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->mir()->jsop()); + + masm.compareDouble(cond, left, right); + masm.cset(output, Assembler::ConditionFromDoubleCondition(cond)); } void CodeGenerator::visitCompareF(LCompareF* comp) { - MOZ_CRASH("visitCompareF"); + const FloatRegister left = ToFloatRegister(comp->left()); + const FloatRegister right = ToFloatRegister(comp->right()); + ARMRegister output = toWRegister(comp->output()); + Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->mir()->jsop()); + + masm.compareFloat(cond, left, right); + masm.cset(output, Assembler::ConditionFromDoubleCondition(cond)); } void CodeGenerator::visitCompareDAndBranch(LCompareDAndBranch* comp) { - MOZ_CRASH("visitCompareDAndBranch"); + const FloatRegister left = ToFloatRegister(comp->left()); + const FloatRegister right = ToFloatRegister(comp->right()); + Assembler::DoubleCondition doubleCond = JSOpToDoubleCondition(comp->cmpMir()->jsop()); + Assembler::Condition cond = Assembler::ConditionFromDoubleCondition(doubleCond); + + masm.compareDouble(doubleCond, left, right); + emitBranch(cond, comp->ifTrue(), comp->ifFalse()); } void CodeGenerator::visitCompareFAndBranch(LCompareFAndBranch* comp) { - MOZ_CRASH("visitCompareFAndBranch"); + const FloatRegister left = ToFloatRegister(comp->left()); + const FloatRegister right = ToFloatRegister(comp->right()); + Assembler::DoubleCondition doubleCond = JSOpToDoubleCondition(comp->cmpMir()->jsop()); + Assembler::Condition cond = Assembler::ConditionFromDoubleCondition(doubleCond); + + masm.compareFloat(doubleCond, left, right); + emitBranch(cond, comp->ifTrue(), comp->ifFalse()); } void diff --git a/js/src/jit/arm64/Lowering-arm64.cpp b/js/src/jit/arm64/Lowering-arm64.cpp index 9b015c935d51..bd2c7e102829 100644 --- a/js/src/jit/arm64/Lowering-arm64.cpp +++ b/js/src/jit/arm64/Lowering-arm64.cpp @@ -82,7 +82,10 @@ LIRGenerator::visitUnbox(MUnbox* unbox) // avoid multiple loads. lir = new(alloc()) LUnbox(useRegisterAtStart(box)); } else { - lir = new(alloc()) LUnbox(useAtStart(box)); + // FIXME: It should be possible to useAtStart() here, but the DEBUG + // code in CodeGenerator::visitUnbox() needs to handle non-Register + // cases. ARM64 doesn't have an Operand type. + lir = new(alloc()) LUnbox(useRegisterAtStart(box)); } if (unbox->fallible()) @@ -178,21 +181,23 @@ LIRGeneratorARM64::lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* void LIRGeneratorARM64::defineUntypedPhi(MPhi* phi, size_t lirIndex) { - MOZ_CRASH("defineUntypedPhi"); + defineTypedPhi(phi, lirIndex); } void LIRGeneratorARM64::lowerUntypedPhiInput(MPhi* phi, uint32_t inputPosition, LBlock* block, size_t lirIndex) { - MOZ_CRASH("lowerUntypedPhiInput"); + lowerTypedPhiInput(phi, inputPosition, block, lirIndex); } void LIRGeneratorARM64::lowerForShift(LInstructionHelper<1, 2, 0>* ins, MDefinition* mir, MDefinition* lhs, MDefinition* rhs) { - MOZ_CRASH("lowerForShift"); + ins->setOperand(0, useRegister(lhs)); + ins->setOperand(1, useRegisterOrConstant(rhs)); + define(ins, mir); } void From 7d327a197ecb2509e1e69a815cbbd6b56bb89495 Mon Sep 17 00:00:00 2001 From: Tomislav Jovanovic Date: Fri, 10 Aug 2018 14:12:36 +0200 Subject: [PATCH 20/67] Bug 1369209 - Implement management.install for themes only r=robwu,kmag Differential Revision: https://phabricator.services.mozilla.com/D3106 --HG-- extra : rebase_source : b9f0c006346b132ed655255525ce33294c3526da --- .../test/browser/browser-common.ini | 3 + .../test/browser/browser_ext_management.js | 80 ++++++++++++++++++ .../test/browser/install_other-1.0-fx.xpi | Bin 0 -> 246 bytes .../test/browser/install_theme-1.0-fx.xpi | Bin 0 -> 274 bytes .../extensions/parent/ext-management.js | 22 +++++ .../extensions/schemas/management.json | 46 +++++++++- 6 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 browser/components/extensions/test/browser/browser_ext_management.js create mode 100644 browser/components/extensions/test/browser/install_other-1.0-fx.xpi create mode 100644 browser/components/extensions/test/browser/install_theme-1.0-fx.xpi diff --git a/browser/components/extensions/test/browser/browser-common.ini b/browser/components/extensions/test/browser/browser-common.ini index 5eea24e3cabf..389ede56da22 100644 --- a/browser/components/extensions/test/browser/browser-common.ini +++ b/browser/components/extensions/test/browser/browser-common.ini @@ -28,6 +28,8 @@ support-files = file_inspectedwindow_reload_target.sjs file_indexedDB.html file_serviceWorker.html + install_other-1.0-fx.xpi + install_theme-1.0-fx.xpi webNav_createdTarget.html webNav_createdTargetSource.html webNav_createdTargetSource_subframe.html @@ -105,6 +107,7 @@ skip-if = (verify && (os == 'linux' || os == 'mac')) [browser_ext_incognito_views.js] [browser_ext_incognito_popup.js] [browser_ext_lastError.js] +[browser_ext_management.js] [browser_ext_menus.js] [browser_ext_menus_accesskey.js] [browser_ext_menus_activeTab.js] diff --git a/browser/components/extensions/test/browser/browser_ext_management.js b/browser/components/extensions/test/browser/browser_ext_management.js new file mode 100644 index 000000000000..5252f7a4a028 --- /dev/null +++ b/browser/components/extensions/test/browser/browser_ext_management.js @@ -0,0 +1,80 @@ +"use strict"; + +const BASE = "http://mochi.test:8888/browser/browser/components/extensions/test/browser/"; + +function waitForTransition(element, propertyName) { + return BrowserTestUtils.waitForEvent(element, "transitionend", false, event => { + return event.target == element && event.propertyName == propertyName; + }); +} + +add_task(async function test_management_install() { + await SpecialPowers.pushPrefEnv({set: [ + ["xpinstall.signatures.required", false], + ]}); + + registerCleanupFunction(async () => { + await SpecialPowers.popPrefEnv(); + }); + + let extension = ExtensionTestUtils.loadExtension({ + manifest: { + browser_action: { + "browser_style": false, + }, + permissions: ["management"], + }, + background() { + let addons; + browser.test.onMessage.addListener((msg, init) => { + addons = init; + browser.test.sendMessage("ready"); + }); + browser.browserAction.onClicked.addListener(async () => { + try { + let {url, hash} = addons.shift(); + browser.test.log(`Installing XPI from ${url} with hash ${hash || "missing"}`); + let {id} = await browser.management.install({url, hash}); + let {type} = await browser.management.get(id); + browser.test.sendMessage("installed", {id, type}); + } catch (e) { + browser.test.log(`management.install() throws ${e}`); + browser.test.sendMessage("failed", e.message); + } + }); + }, + }); + + let addons = [{ + url: BASE + "install_theme-1.0-fx.xpi", + hash: "sha256:aa232d8391d82a9c1014364efbe1657ff6d8dfc88b3c71e99881b1f3843fdad3", + }, { + url: BASE + "install_other-1.0-fx.xpi", + }]; + + await extension.startup(); + extension.sendMessage("addons", addons); + await extension.awaitMessage("ready"); + + // Test installing a static WE theme. + let transitionDone = waitForTransition(document.documentElement, "background-color"); + clickBrowserAction(extension); + + let {id, type} = await extension.awaitMessage("installed"); + is(id, "tiger@persona.beard", "Static web extension theme installed"); + is(type, "theme", "Extension type is correct"); + + await transitionDone; + let style = window.getComputedStyle(document.documentElement); + is(style.backgroundColor, "rgb(255, 165, 0)", "Background is the new black"); + + let addon = await AddonManager.getAddonByID("tiger@persona.beard"); + await addon.uninstall(); + + // Test installing a standard WE. + clickBrowserAction(extension); + let error = await extension.awaitMessage("failed"); + is(error, "Incompatible addon", "Standard web extension rejected"); + + await extension.unload(); +}); diff --git a/browser/components/extensions/test/browser/install_other-1.0-fx.xpi b/browser/components/extensions/test/browser/install_other-1.0-fx.xpi new file mode 100644 index 0000000000000000000000000000000000000000..66be85efd5903e4b541700afd26f03b1aa9af6f4 GIT binary patch literal 246 zcmWIWW@Zs#U}E54u;ml-t$Fjzq>6!o;UEz60 )US?Wqafx15aem(FXHSC|n3mo- zvggc}D~~4q*mPylqceYORJB=^Wmm++CFN;NST8bZCf}5hf|KWi^#ecn>S%iE1~sj8 z%m_BRV%)&3E++CMMNNGg!_uzCqN@Ul8$znGipuO(Nd%Y}v!=MzdAemybgs;r6qn`d znI(54rDanThp-2uAVYvRBa;XNZf62r%D~8=0HS~Z#nA!YtZX1bMj*5X(n~=c1^@^z BNwoj~ literal 0 HcmV?d00001 diff --git a/browser/components/extensions/test/browser/install_theme-1.0-fx.xpi b/browser/components/extensions/test/browser/install_theme-1.0-fx.xpi new file mode 100644 index 0000000000000000000000000000000000000000..0ef2b3d67222966d9a4b4d31185256616aba4f60 GIT binary patch literal 274 zcmWIWW@Zs#U}E54P~{WyEv--DpT@wzAi>DMzzd{v6Z10DQj1IUvWoNba{D&&9a0cz z`>s~Yekez(wB!@(ojYee{Z+QHH+oNB_WqsY+EC@hhX2j)_itP`MdvQ_PHDA$JQ9;X zFX7MHUuoDR_jKL)b6g?n3CC85@2b17JMDL$V#_(n1V_&s7ROm5P5A%M^?Y?}&4W9I zJdeJxoE25vR#j_u_IRe|L+fc5?cN?Mw_6rpJMV;qik^k}PmYw2{d?A>*fR!rGct)V i;PwL07YvLH3LpvyP&^di&B_K6WCTKMAbk+TVE_Q%T3n(4 literal 0 HcmV?d00001 diff --git a/toolkit/components/extensions/parent/ext-management.js b/toolkit/components/extensions/parent/ext-management.js index 420240b6baf6..288b9a271598 100644 --- a/toolkit/components/extensions/parent/ext-management.js +++ b/toolkit/components/extensions/parent/ext-management.js @@ -187,6 +187,28 @@ this.management = class extends ExtensionAPI { }); }, + async install({url, hash}) { + let listener = { + onDownloadEnded(install) { + if (install.addon.appDisabled || install.addon.type !== "theme") { + install.cancel(); + return false; + } + }, + }; + + let install = await AddonManager.getInstallForURL(url, "application/x-xpinstall", hash); + install.addListener(listener); + try { + await install.install(); + } catch (e) { + Cu.reportError(e); + throw new ExtensionError("Incompatible addon"); + } + await install.addon.enable(); + return {id: install.addon.id}; + }, + async getSelf() { let addon = await AddonManager.getAddonByID(extension.id); return getExtensionInfoForAddon(extension, addon); diff --git a/toolkit/components/extensions/schemas/management.json b/toolkit/components/extensions/schemas/management.json index f00fade4a983..c42f03bbc3e9 100644 --- a/toolkit/components/extensions/schemas/management.json +++ b/toolkit/components/extensions/schemas/management.json @@ -44,7 +44,7 @@ }, { "id": "ExtensionType", - "description": "The type of this extension. Will always be 'extension'.", + "description": "The type of this extension, 'extension' or 'theme'.", "type": "string", "enum": ["extension", "theme"] }, @@ -99,7 +99,7 @@ "optional": true }, "type": { - "description": "The type of this extension. Will always return 'extension'.", + "description": "The type of this extension, 'extension' or 'theme'.", "$ref": "ExtensionType" }, "homepageUrl": { @@ -196,6 +196,48 @@ } ] }, + { + "name": "install", + "type": "function", + "requireUserInput": true, + "permissions": ["management"], + "description": "Installs and enables a theme extension from the given url.", + "async": "callback", + "parameters": [ + { + "name": "options", + "type": "object", + "properties": { + "url": { + "$ref": "manifest.HttpURL", + "description": "URL pointing to the XPI file on addons.mozilla.org or similar." + }, + "hash": { + "type": "string", + "optional": true, + "pattern": "^(sha256|sha512):[0-9a-fA-F]{64,128}$", + "description": "A hash of the XPI file, using sha256 or stronger." + } + } + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [ + { + "name": "result", + "type": "object", + "properties": { + "id": { + "$ref": "manifest.ExtensionID" + } + } + } + ] + } + ] + }, { "name": "getSelf", "type": "function", From 5fc43565d7be592c5262fad624549d580d84e80f Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 17 Aug 2018 16:14:43 -0700 Subject: [PATCH 21/67] Bug 1484373: Part 1 - Allow querying to ContentFrameMessageManager. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D3691 --HG-- extra : rebase_source : 65652ca62cf87293ec9cebaeda6da747ab5e2fa1 --- dom/base/ContentFrameMessageManager.h | 8 ++++++++ dom/base/InProcessTabChildMessageManager.cpp | 1 + dom/ipc/TabChild.cpp | 1 + 3 files changed, 10 insertions(+) diff --git a/dom/base/ContentFrameMessageManager.h b/dom/base/ContentFrameMessageManager.h index 7c6f4bad8314..b4660b15a9fd 100644 --- a/dom/base/ContentFrameMessageManager.h +++ b/dom/base/ContentFrameMessageManager.h @@ -16,6 +16,10 @@ namespace mozilla { namespace dom { +#define NS_CONTENTFRAMEMESSAGEMANAGER_IID \ +{ 0x97e192a6, 0xab7a, 0x4c8f, \ + { 0xb7, 0xdd, 0xf7, 0xec, 0x36, 0x38, 0x71, 0xb5 } } + /** * Base class for implementing the WebIDL ContentFrameMessageManager class. */ @@ -26,6 +30,8 @@ public: using DOMEventTargetHelper::AddRef; using DOMEventTargetHelper::Release; + NS_DECLARE_STATIC_IID_ACCESSOR(NS_CONTENTFRAMEMESSAGEMANAGER_IID) + virtual already_AddRefed GetContent(ErrorResult& aError) = 0; virtual already_AddRefed GetDocShell(ErrorResult& aError) = 0; virtual already_AddRefed GetTabEventTarget() = 0; @@ -50,6 +56,8 @@ protected: {} }; +NS_DEFINE_STATIC_IID_ACCESSOR(ContentFrameMessageManager, NS_CONTENTFRAMEMESSAGEMANAGER_IID) + } // namespace dom } // namespace mozilla diff --git a/dom/base/InProcessTabChildMessageManager.cpp b/dom/base/InProcessTabChildMessageManager.cpp index 0d2ab0be19d3..50dc6a79e45d 100644 --- a/dom/base/InProcessTabChildMessageManager.cpp +++ b/dom/base/InProcessTabChildMessageManager.cpp @@ -147,6 +147,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(InProcessTabChildMessageManager) NS_INTERFACE_MAP_ENTRY(nsIMessageSender) NS_INTERFACE_MAP_ENTRY(nsIInProcessContentFrameMessageManager) + NS_INTERFACE_MAP_ENTRY(ContentFrameMessageManager) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper) diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index f138e7f72d83..0f07c36d5582 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -3563,6 +3563,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TabChildMessageManager) NS_INTERFACE_MAP_ENTRY(nsIMessageSender) + NS_INTERFACE_MAP_ENTRY(ContentFrameMessageManager) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper) From 61d9aacb688c5b941bcef1fdde46697588c9cdff Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sun, 19 Aug 2018 17:42:59 -0700 Subject: [PATCH 22/67] Bug 1484373: Part 2a - Add Tuple ForEach helper function. r=froydnj It's currently fairly difficult to perform some operation on each member of a tuple. This is a particular issue in the context of adding a cycle collection helper, where we need to perform traverse and unlink operations on each member of a tuple, and don't have a way to do so without several layers of templates. This patch adds a ForEach function which will call a function on each element of the tuple. This would typically be used with a lambda function with a single `auto&` argument. --HG-- extra : rebase_source : 577f7c823ab7ee8d1fdedfbd26393c1f1664b965 --- mfbt/Tuple.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/mfbt/Tuple.h b/mfbt/Tuple.h index d99ea5c7c415..334439e9c2cd 100644 --- a/mfbt/Tuple.h +++ b/mfbt/Tuple.h @@ -100,6 +100,9 @@ struct TupleImpl { { return true; } + + template + void ForEach(const F& aFunc) {} }; /* @@ -191,6 +194,27 @@ struct TupleImpl { return Head(*this) == Head(aOther) && Tail(*this) == Tail(aOther); } + + template + void ForEach(const F& aFunc) const & + { + aFunc(Head(*this)); + Tail(*this).ForEach(aFunc); + } + + template + void ForEach(const F& aFunc) & + { + aFunc(Head(*this)); + Tail(*this).ForEach(aFunc); + } + + template + void ForEach(const F& aFunc) && + { + aFunc(std::move(Head(*this))); + std::move(Tail(*this)).ForEach(aFunc); + } private: HeadT mHead; // The element stored at this index in the tuple. }; @@ -420,6 +444,50 @@ auto Get(Tuple&& aTuple) return std::move(mozilla::Get(aTuple)); } +/** + * Helpers which call a function for each member of the tuple in turn. This will + * typically be used with a lambda function with an `auto&` argument: + * + * Tuple> tuple{a, b, c}; + * + * ForEach(tuple, [](auto& aElem) { + * aElem = nullptr; + * }); + */ + +template +inline void +ForEach(const Tuple<>& aTuple, const F& aFunc) +{ +} + +template +inline void +ForEach(Tuple<>& aTuple, const F& aFunc) +{ +} + +template +void +ForEach(const Tuple& aTuple, const F& aFunc) +{ + aTuple.ForEach(aTuple, aFunc); +} + +template +void +ForEach(Tuple& aTuple, const F& aFunc) +{ + aTuple.ForEach(aFunc); +} + +template +void +ForEach(Tuple&& aTuple, const F& aFunc) +{ + std::forward>(aTuple).ForEach(aFunc); +} + /** * A convenience function for constructing a tuple out of a sequence of * values without specifying the type of the tuple. From bb6ad284b5af066a096ebdbe1103152a8bfd3fe1 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sun, 19 Aug 2018 17:43:29 -0700 Subject: [PATCH 23/67] Bug 1484373: Part 2b - Add cycle collection helpers for Tuple types. r=smaug --HG-- extra : rebase_source : 268282522c8c217137974113416d26313b1c0249 --- xpcom/base/TupleCycleCollection.h | 35 +++++++++++++++++++++++++++++++ xpcom/base/moz.build | 1 + 2 files changed, 36 insertions(+) create mode 100644 xpcom/base/TupleCycleCollection.h diff --git a/xpcom/base/TupleCycleCollection.h b/xpcom/base/TupleCycleCollection.h new file mode 100644 index 000000000000..3eac110fe6c8 --- /dev/null +++ b/xpcom/base/TupleCycleCollection.h @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 TupleCycleCollection_h +#define TupleCycleCollection_h + +#include "mozilla/Tuple.h" +#include "nsCycleCollectionTraversalCallback.h" + +template +inline void +ImplCycleCollectionUnlink(mozilla::Tuple& aField) +{ + ForEach(aField, [](auto& aElem) { + ImplCycleCollectionUnlink(aElem); + }); +} + +template +inline void +ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, + mozilla::Tuple& aField, + const char* aName, + uint32_t aFlags = 0) +{ + aFlags |= CycleCollectionEdgeNameArrayFlag; + ForEach(aField, [&](auto& aElem) { + ImplCycleCollectionTraverse(aCallback, aElem, aName, aFlags); + }); +} + +#endif // TupleCycleCollection_h diff --git a/xpcom/base/moz.build b/xpcom/base/moz.build index c2dbba28fddc..d17973c7ffa1 100644 --- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -122,6 +122,7 @@ EXPORTS.mozilla += [ 'StaticMonitor.h', 'StaticMutex.h', 'StaticPtr.h', + 'TupleCycleCollection.h', ] # nsDebugImpl isn't unified because we disable PGO so that NS_ABORT_OOM isn't From acf635a29b2b85c60bea31452f4ac0835a22f253 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 18 Aug 2018 09:43:22 -0700 Subject: [PATCH 24/67] Bug 1484373: Part 2c - Add Promise::Then handler which accepts a lambda. r=smaug This makes it easier to add promise handlers from C++ in a manner similar to JavaScript. Differential Revision: https://phabricator.services.mozilla.com/D3692 --HG-- extra : rebase_source : efa6735da4b22677b684ae790aede6aac6bb1bad --- dom/promise/Promise-inl.h | 166 ++++++++++++++++++++++++++++++++++++++ dom/promise/Promise.cpp | 44 ++++++++++ dom/promise/Promise.h | 35 ++++++++ dom/promise/moz.build | 1 + 4 files changed, 246 insertions(+) create mode 100644 dom/promise/Promise-inl.h diff --git a/dom/promise/Promise-inl.h b/dom/promise/Promise-inl.h new file mode 100644 index 000000000000..b96f2efcb543 --- /dev/null +++ b/dom/promise/Promise-inl.h @@ -0,0 +1,166 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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_Promise_inl_h +#define mozilla_dom_Promise_inl_h + +#include "mozilla/TupleCycleCollection.h" +#include "mozilla/TypeTraits.h" +#include "mozilla/ResultExtensions.h" +#include "mozilla/dom/PromiseNativeHandler.h" + +namespace mozilla { +namespace dom { + +class PromiseNativeThenHandlerBase : public PromiseNativeHandler +{ + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS(PromiseNativeThenHandlerBase) + + PromiseNativeThenHandlerBase(Promise& aPromise) + : mPromise(&aPromise) + {} + + void + ResolvedCallback(JSContext* aCx, JS::Handle aValue) override; + + void + RejectedCallback(JSContext* aCx, JS::Handle aValue) override; + +protected: + virtual ~PromiseNativeThenHandlerBase() = default; + + virtual already_AddRefed + CallResolveCallback(JSContext* aCx, JS::Handle aValue) = 0; + + virtual void Traverse(nsCycleCollectionTraversalCallback&) = 0; + virtual void Unlink() = 0; + + RefPtr mPromise; +}; + +namespace { + +template ::Type>::value, + bool = (IsConvertible::value || + IsConvertible::value)> +struct StorageTypeHelper +{ + using Type = T; +}; + +template +struct StorageTypeHelper +{ + using Type = nsCOMPtr; +}; + +template +struct StorageTypeHelper, true, true> +{ + using Type = nsCOMPtr; +}; + +template +struct StorageTypeHelper +{ + using Type = RefPtr; +}; + +template