Merge mozilla-central to autoland. a=merge CLOSED TREE
authorshindli <shindli@mozilla.com>
Wed, 24 Oct 2018 12:48:51 +0300
changeset 491088 731dae6216168604aaec0a5dc0f9f6e5865faf41
parent 491087 7e0caa46aba1915115b4a5dffe08633f9d213e79 (current diff)
parent 491057 3a314e76d8c148e223cf683b15ba2a357ebe4b42 (diff)
child 491089 7bda40ae7f004f43c3afbfb66f7a3b5a2ea2eaa9
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersmerge
milestone65.0a1
Merge mozilla-central to autoland. a=merge CLOSED TREE
testing/web-platform/meta/css/css-masking/clip-path-svg-content/clip-path-content-invisible.svg.ini
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* global window, BrowserLoader */
 
 "use strict";
 
 const Services = require("Services");
 const promise = require("promise");
+const flags = require("devtools/shared/flags");
 const EventEmitter = require("devtools/shared/event-emitter");
 const {executeSoon} = require("devtools/shared/DevToolsUtils");
 const {Toolbox} = require("devtools/client/framework/toolbox");
 const ReflowTracker = require("devtools/client/inspector/shared/reflow-tracker");
 const Store = require("devtools/client/inspector/store");
 const InspectorStyleChangeTracker = require("devtools/client/inspector/shared/style-change-tracker");
 
 // Use privileged promise in panel documents to prevent having them to freeze
@@ -286,17 +287,20 @@ Inspector.prototype = {
     // We can display right panel with: tab bar, markup view and breadbrumb. Right after
     // the splitter set the right and left panel sizes, in order to avoid resizing it
     // during load of the inspector.
     this.panelDoc.getElementById("inspector-main-content").style.visibility = "visible";
 
     // Setup the sidebar panels.
     this.setupSidebar();
 
-    await this.once("markuploaded");
+    if (flags.testing) {
+      await this.once("markuploaded");
+    }
+
     this.isReady = true;
 
     // All the components are initialized. Take care of the remaining initialization
     // and setup.
     this.breadcrumbs = new HTMLBreadcrumbs(this);
     this.setupExtensionSidebars();
     this.setupSearchBox();
     await this.setupToolbar();
--- a/devtools/server/actors/device.js
+++ b/devtools/server/actors/device.js
@@ -1,39 +1,88 @@
 /* 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/. */
 
 "use strict";
 
+const {Ci, Cc} = require("chrome");
 const Services = require("Services");
 const protocol = require("devtools/shared/protocol");
 const {LongStringActor} = require("devtools/server/actors/string");
 const {DebuggerServer} = require("devtools/server/main");
 const {getSystemInfo} = require("devtools/shared/system");
 const {deviceSpec} = require("devtools/shared/specs/device");
+const {AppConstants} = require("resource://gre/modules/AppConstants.jsm");
 
 exports.DeviceActor = protocol.ActorClassWithSpec(deviceSpec, {
-  _desc: null,
+  initialize: function(conn) {
+    protocol.Actor.prototype.initialize.call(this, conn);
+    // pageshow and pagehide event release wake lock, so we have to acquire
+    // wake lock again by pageshow event
+    this._onPageShow = this._onPageShow.bind(this);
+    if (this._window) {
+      this._window.addEventListener("pageshow", this._onPageShow, true);
+    }
+    this._acquireWakeLock();
+  },
+
+  destroy: function() {
+    protocol.Actor.prototype.destroy.call(this);
+    this._releaseWakeLock();
+    if (this._window) {
+      this._window.removeEventListener("pageshow", this._onPageShow, true);
+    }
+  },
 
   getDescription: function() {
     return getSystemInfo();
   },
 
   screenshotToDataURL: function() {
-    const window = Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType);
+    const window = this._window;
     const { devicePixelRatio } = window;
     const canvas = window.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
     const width = window.innerWidth;
     const height = window.innerHeight;
     canvas.setAttribute("width", Math.round(width * devicePixelRatio));
     canvas.setAttribute("height", Math.round(height * devicePixelRatio));
     const context = canvas.getContext("2d");
     const flags =
           context.DRAWWINDOW_DRAW_CARET |
           context.DRAWWINDOW_DRAW_VIEW |
           context.DRAWWINDOW_USE_WIDGET_LAYERS;
     context.scale(devicePixelRatio, devicePixelRatio);
     context.drawWindow(window, 0, 0, width, height, "rgb(255,255,255)", flags);
     const dataURL = canvas.toDataURL("image/png");
     return new LongStringActor(this.conn, dataURL);
   },
+
+  _acquireWakeLock: function() {
+    if (AppConstants.platform !== "android") {
+      return;
+    }
+
+    const pm = Cc["@mozilla.org/power/powermanagerservice;1"]
+               .getService(Ci.nsIPowerManagerService);
+    this._wakelock = pm.newWakeLock("screen", this._window);
+  },
+
+  _releaseWakeLock: function() {
+    if (this._wakelock) {
+      try {
+        this._wakelock.unlock();
+      } catch (e) {
+        // Ignore error since wake lock is already unlocked
+      }
+      this._wakelock = null;
+    }
+  },
+
+  _onPageShow: function() {
+    this._releaseWakeLock();
+    this._acquireWakeLock();
+  },
+
+  get _window() {
+    return Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType);
+  },
 });
--- a/dom/power/PowerManagerService.cpp
+++ b/dom/power/PowerManagerService.cpp
@@ -134,27 +134,26 @@ PowerManagerService::NewWakeLock(const n
   }
 
   return wakelock.forget();
 }
 
 NS_IMETHODIMP
 PowerManagerService::NewWakeLock(const nsAString &aTopic,
                                  mozIDOMWindow *aWindow,
-                                 nsISupports **aWakeLock)
+                                 nsIWakeLock **aWakeLock)
 {
   mozilla::ErrorResult rv;
   RefPtr<WakeLock> wakelock =
     NewWakeLock(aTopic, nsPIDOMWindowInner::From(aWindow), rv);
   if (rv.Failed()) {
     return rv.StealNSResult();
   }
 
-  nsCOMPtr<nsIDOMEventListener> eventListener = wakelock.get();
-  eventListener.forget(aWakeLock);
+  wakelock.forget(aWakeLock);
   return NS_OK;
 }
 
 already_AddRefed<WakeLock>
 PowerManagerService::NewWakeLockOnBehalfOfProcess(const nsAString& aTopic,
                                                   ContentParent* aContentParent)
 {
   RefPtr<WakeLock> wakelock = new WakeLock();
--- a/dom/power/WakeLock.cpp
+++ b/dom/power/WakeLock.cpp
@@ -20,16 +20,17 @@ using namespace mozilla::hal;
 namespace mozilla {
 namespace dom {
 
 NS_INTERFACE_MAP_BEGIN(WakeLock)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventListener)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
+  NS_INTERFACE_MAP_ENTRY(nsIWakeLock)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(WakeLock)
 NS_IMPL_RELEASE(WakeLock)
 
 WakeLock::WakeLock()
   : mLocked(false)
   , mHidden(true)
@@ -253,16 +254,24 @@ WakeLock::HandleEvent(Event *aEvent)
   if (type.EqualsLiteral("pageshow")) {
     DoLock();
     return NS_OK;
   }
 
   return NS_OK;
 }
 
+NS_IMETHODIMP
+WakeLock::Unlock()
+{
+  ErrorResult error;
+  Unlock(error);
+  return error.StealNSResult();
+}
+
 nsPIDOMWindowInner*
 WakeLock::GetParentObject() const
 {
   nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(mWindow);
   return window;
 }
 
 } // namespace dom
--- a/dom/power/WakeLock.h
+++ b/dom/power/WakeLock.h
@@ -5,36 +5,39 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_power_WakeLock_h
 #define mozilla_dom_power_WakeLock_h
 
 #include "nsCOMPtr.h"
 #include "nsIDOMEventListener.h"
 #include "nsIObserver.h"
+#include "nsIWakeLock.h"
 #include "nsString.h"
 #include "nsWeakReference.h"
 #include "nsWrapperCache.h"
 #include "mozilla/ErrorResult.h"
 
 class nsPIDOMWindowInner;
 
 namespace mozilla {
 namespace dom {
 
 class ContentParent;
 
 class WakeLock final
   : public nsIDOMEventListener
   , public nsIObserver
   , public nsSupportsWeakReference
+  , public nsIWakeLock
 {
 public:
   NS_DECL_NSIDOMEVENTLISTENER
   NS_DECL_NSIOBSERVER
+  NS_DECL_NSIWAKELOCK
 
   NS_DECL_ISUPPORTS
 
   // Note: WakeLock lives for the lifetime of the document in order to avoid
   // exposing GC behavior to pages. This means that
   // |var foo = navigator.requestWakeLock('cpu'); foo = null;|
   // doesn't unlock the 'cpu' resource.
 
--- a/dom/power/moz.build
+++ b/dom/power/moz.build
@@ -5,16 +5,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM")
 
 XPIDL_SOURCES += [
     'nsIDOMWakeLockListener.idl',
     'nsIPowerManagerService.idl',
+    'nsIWakeLock.idl',
 ]
 
 XPIDL_MODULE = 'dom_power'
 
 EXPORTS.mozilla.dom += [
     'WakeLock.h',
 ]
 
--- a/dom/power/nsIPowerManagerService.idl
+++ b/dom/power/nsIPowerManagerService.idl
@@ -7,26 +7,27 @@
 
 %{C++
 #define NS_POWERMANAGERSERVICE_CID { 0x18c2e238, 0x3a0a, 0x4153, {0x89, 0xfc, 0x16, 0x6b, 0x3b, 0x14, 0x65, 0xa1 } }
 #define POWERMANAGERSERVICE_CONTRACTID "@mozilla.org/power/powermanagerservice;1"
 %}
 
 interface nsIDOMMozWakeLockListener;
 interface mozIDOMWindow;
+interface nsIWakeLock;
 
 /**
  * For use with non-content code.
  */
 [scriptable, builtinclass, uuid(ba7ca4c1-9d92-4425-a83b-85dd7fa953f7)]
 interface nsIPowerManagerService : nsISupports
 {
   void              addWakeLockListener(in nsIDOMMozWakeLockListener aListener);
   void              removeWakeLockListener(in nsIDOMMozWakeLockListener aListener);
   AString           getWakeLockState(in AString aTopic);
 
   /**
    * Return a wake lock (MozWakeLock) object of aTopic associated with aWindow.
    * A wake lock without associated window, e.g. used in chrome, is
    * always considered invisible.
    */
-  nsISupports newWakeLock(in AString aTopic, [optional] in mozIDOMWindow aWindow);
+  nsIWakeLock newWakeLock(in AString aTopic, [optional] in mozIDOMWindow aWindow);
 };
new file mode 100644
--- /dev/null
+++ b/dom/power/nsIWakeLock.idl
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+[scriptable, builtinclass, uuid(e27e57ce-fa63-4035-b9ef-27c5dc0cc3ae)]
+interface nsIWakeLock : nsISupports
+{
+  void unlock();
+};
--- a/dom/tests/browser/browser.ini
+++ b/dom/tests/browser/browser.ini
@@ -76,8 +76,9 @@ support-files =
 [browser_noopener.js]
 skip-if = (verify && debug && (os == 'linux'))
 support-files =
   test_noopener_source.html
   test_noopener_target.html
 [browser_noopener_null_uri.js]
 [browser_test_performance_metrics_off.js]
 skip-if = verify
+[browser_wakelock.js]
new file mode 100644
--- /dev/null
+++ b/dom/tests/browser/browser_wakelock.js
@@ -0,0 +1,27 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+"use strict";
+
+add_task(async () => {
+  info("creating test window");
+  let win = await BrowserTestUtils.openNewBrowserWindow();
+
+  const pm = Cc["@mozilla.org/power/powermanagerservice;1"]
+             .getService(Ci.nsIPowerManagerService);
+
+  is(pm.getWakeLockState("screen"), "unlocked", "Wakelock should be unlocked state");
+
+  info("aquiring wakelock");
+  const wakelock = pm.newWakeLock("screen", win);
+  isnot(pm.getWakeLockState("screen"), "unlocked", "Wakelock shouldn't be unlocked state");
+
+  info("releasing wakelock");
+  wakelock.unlock();
+  is(pm.getWakeLockState("screen"), "unlocked", "Wakelock should be unlocked state");
+
+  info("closing test window");
+  await BrowserTestUtils.closeWindow(win);
+});
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/clipPath-basic-08.svg
@@ -0,0 +1,22 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
+
+  <title>Testcase for basic clipPath</title>
+
+  <!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=1501057 -->
+
+  <defs>
+    <clipPath id="clip1">
+      <rect width="100%" height="100%" visibility="hidden"/>
+    </clipPath>
+    <clipPath id="clip2">
+      <rect width="100%" height="100%" visibility="hidden"/>
+      <rect width="100%" height="100%" visibility="hidden"/>
+    </clipPath>
+  </defs>
+
+  <rect width="100%" height="100%" fill="lime"/>
+
+  <rect width="100%" height="50%" fill="red" clip-path="url(#clip1)"/>
+  <rect width="100%" y="50%" height="50%" fill="red" clip-path="url(#clip2)"/>
+
+</svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -72,16 +72,17 @@ fuzzy-if(/^Windows\x20NT\x2010\.0/.test(
 == clipPath-and-transform-01.svg pass.svg
 == clipPath-basic-01.svg pass.svg
 == clipPath-basic-02.svg pass.svg
 == clipPath-basic-03.svg pass.svg
 == clipPath-basic-04.svg pass.svg
 == clipPath-basic-05.svg pass.svg
 == clipPath-basic-06.svg pass.svg
 == clipPath-basic-07.svg pass.svg
+== clipPath-basic-08.svg pass.svg
 == clipPath-on-outflowElement-01a.html clipPath-on-outflowElement-01-ref.html
 == clipPath-on-outflowElement-01b.html clipPath-on-outflowElement-01-ref.html
 fuzzy(0-1,0-32400) == clipPath-on-outflowElement-02a.html clipPath-on-outflowElement-02-ref.html
 fuzzy(0-1,0-32400) == clipPath-on-outflowElement-02b.html clipPath-on-outflowElement-02-ref.html
 == clipPath-polygon-01.svg pass.svg
 == clipPath-polygon-elementFromPoint-01.svg pass.svg
 != clipPath-on-thin-object.svg about:blank
 == clipPath-winding-01.svg pass.svg
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -51,17 +51,17 @@ nsSVGClipPathFrame::ApplyClipPath(gfxCon
 
   RefPtr<Path> clipPath;
 
   nsSVGDisplayableFrame* singleClipPathChild = nullptr;
   IsTrivial(&singleClipPathChild);
 
   if (singleClipPathChild) {
     SVGGeometryFrame* pathFrame = do_QueryFrame(singleClipPathChild);
-    if (pathFrame) {
+    if (pathFrame && pathFrame->StyleVisibility()->IsVisible()) {
       SVGGeometryElement* pathElement =
         static_cast<SVGGeometryElement*>(pathFrame->GetContent());
       gfxMatrix toChildsUserSpace = pathElement->
         PrependLocalTransformsTo(GetClipPathTransform(aClippedFrame) * aMatrix,
                                  eUserSpaceToParent);
       gfxMatrix newMatrix =
         aContext.CurrentMatrixDouble().PreMultiply(toChildsUserSpace).NudgeToIntegers();
       if (!newMatrix.IsSingular()) {
--- a/taskcluster/scripts/misc/build-clang-trunk-mingw.sh
+++ b/taskcluster/scripts/misc/build-clang-trunk-mingw.sh
@@ -163,16 +163,22 @@ ADDLIB $2
 SAVE
 END
 EOF
   llvm-ranlib tmp.a
   mv tmp.a $1
 }
 
 build_libcxx() {
+  # Below, we specify -g -gcodeview to build static libraries with debug information.
+  # Because we're not distributing these builds, this is fine. If one were to distribute
+  # the builds, perhaps one would want to make those flags conditional or investigation
+  # other options.
+  DEBUG_FLAGS="-g -gcodeview"
+
   mkdir libunwind
   pushd libunwind
   cmake \
       -DCMAKE_BUILD_TYPE=Release \
       -DCMAKE_INSTALL_PREFIX=$CROSS_PREFIX_DIR \
       -DCMAKE_C_COMPILER=$CC \
       -DCMAKE_CXX_COMPILER=$CXX \
       -DCMAKE_CROSSCOMPILING=TRUE \
@@ -183,17 +189,17 @@ build_libcxx() {
       -DCMAKE_AR=$INSTALL_DIR/bin/llvm-ar \
       -DCMAKE_RANLIB=$INSTALL_DIR/bin/llvm-ranlib \
       -DLLVM_NO_OLD_LIBSTDCXX=TRUE \
       -DCXX_SUPPORTS_CXX11=TRUE \
       -DLIBUNWIND_USE_COMPILER_RT=TRUE \
       -DLIBUNWIND_ENABLE_THREADS=TRUE \
       -DLIBUNWIND_ENABLE_SHARED=FALSE \
       -DLIBUNWIND_ENABLE_CROSS_UNWINDING=FALSE \
-      -DCMAKE_CXX_FLAGS="-nostdinc++ -I$SRC_DIR/libcxx/include -DPSAPI_VERSION=2" \
+      -DCMAKE_CXX_FLAGS="${DEBUG_FLAGS} -nostdinc++ -I$SRC_DIR/libcxx/include -DPSAPI_VERSION=2" \
       $SRC_DIR/libunwind
   make $make_flags
   make $make_flags install
   popd
 
   mkdir libcxxabi
   pushd libcxxabi
   cmake \
@@ -211,17 +217,17 @@ build_libcxx() {
       -DLIBCXXABI_USE_COMPILER_RT=ON \
       -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
       -DLIBCXXABI_ENABLE_THREADS=ON \
       -DLIBCXXABI_TARGET_TRIPLE=$machine-w64-mingw32 \
       -DLIBCXXABI_ENABLE_SHARED=OFF \
       -DLIBCXXABI_LIBCXX_INCLUDES=$SRC_DIR/libcxx/include \
       -DLLVM_NO_OLD_LIBSTDCXX=TRUE \
       -DCXX_SUPPORTS_CXX11=TRUE \
-      -DCMAKE_CXX_FLAGS="-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_HAS_THREAD_API_WIN32" \
+      -DCMAKE_CXX_FLAGS="${DEBUG_FLAGS} -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_HAS_THREAD_API_WIN32" \
       $SRC_DIR/libcxxabi
   make $make_flags VERBOSE=1
   popd
 
   mkdir libcxx
   pushd libcxx
   cmake \
       -DCMAKE_BUILD_TYPE=Release \
@@ -244,17 +250,17 @@ build_libcxx() {
       -DLIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG=TRUE \
       -DLIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB=TRUE \
       -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
       -DLIBCXX_ENABLE_FILESYSTEM=OFF \
       -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE \
       -DLIBCXX_CXX_ABI=libcxxabi \
       -DLIBCXX_CXX_ABI_INCLUDE_PATHS=$SRC_DIR/libcxxabi/include \
       -DLIBCXX_CXX_ABI_LIBRARY_PATH=../libcxxabi/lib \
-      -DCMAKE_CXX_FLAGS="-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS" \
+      -DCMAKE_CXX_FLAGS="${DEBUG_FLAGS} -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS" \
       $SRC_DIR/libcxx
   make $make_flags VERBOSE=1
   make $make_flags install
 
   # libc++.a depends on libunwind.a. Whild linker will automatically link
   # to libc++.a in C++ mode, it won't pick libunwind.a, requiring caller
   # to explicitly pass -lunwind. Wo work around that, we merge libunwind.a
   # into libc++.a.
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-masking/clip-path-svg-content/clip-path-content-invisible.svg.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[clip-path-content-invisible.svg]
-  expected: FAIL