Merge mozilla-central to autoland. a=merge CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Sun, 17 Jun 2018 00:57:36 +0300
changeset 422803 94e0de0c19d1dfaeb32d6a982df38168ace23825
parent 422802 67e1c2f8534a3acf8e62ea025ad0f3ddc6a240e8 (current diff)
parent 422787 d9ad37d3b0b24e5b343dbc41781808655f0c0a80 (diff)
child 422804 f527be41b97db03959f4c8116e5f76f58d49a1a5
push id104354
push userccoroiu@mozilla.com
push dateSun, 17 Jun 2018 09:54:46 +0000
treeherdermozilla-inbound@c40cc0a89bc7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to autoland. a=merge CLOSED TREE
--- a/devtools/shared/css/generated/properties-db.js
+++ b/devtools/shared/css/generated/properties-db.js
@@ -9403,16 +9403,20 @@ exports.PREFERENCES = [
     "-webkit-animation-play-state",
     "layout.css.prefixes.webkit"
   ],
   [
     "-webkit-animation-timing-function",
     "layout.css.prefixes.webkit"
   ],
   [
+    "-webkit-appearance",
+    "layout.css.webkit-appearance.enabled"
+  ],
+  [
     "-webkit-backface-visibility",
     "layout.css.prefixes.webkit"
   ],
   [
     "-webkit-background-clip",
     "layout.css.prefixes.webkit"
   ],
   [
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -243,16 +243,17 @@
 #include "nsWindowSizes.h"
 #include "mozilla/dom/Location.h"
 #include "mozilla/dom/FontFaceSet.h"
 #include "gfxPrefs.h"
 #include "nsISupportsPrimitives.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
+#include "mozilla/dom/SVGDocument.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/dom/DocGroup.h"
 #include "mozilla/dom/TabGroup.h"
 #ifdef MOZ_XUL
 #include "mozilla/dom/ListBoxObject.h"
 #include "mozilla/dom/MenuBoxObject.h"
 #include "mozilla/dom/ScrollBoxObject.h"
 #include "mozilla/dom/TreeBoxObject.h"
@@ -4187,19 +4188,23 @@ nsIDocument::AddOnDemandBuiltInUASheet(S
   // Prepend here so that we store the sheets in mOnDemandBuiltInUASheets in
   // the same order that they should end up in the style set.
   mOnDemandBuiltInUASheets.InsertElementAt(0, aSheet);
 
   if (aSheet->IsApplicable()) {
     // This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
     if (nsIPresShell* shell = GetShell()) {
       // Note that prepending here is necessary to make sure that html.css etc.
-      // do not override Firefox OS/Mobile's content.css sheet. Maybe we should
-      // have an insertion point to match the order of
+      // does not override Firefox OS/Mobile's content.css sheet.
+      //
+      // Maybe we should have an insertion point to match the order of
       // nsDocumentViewer::CreateStyleSet though?
+      //
+      // FIXME(emilio): We probably should, randomly prepending stuff here is
+      // very prone to subtle bugs, behavior differences...
       shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet);
       shell->ApplicableStylesChanged();
     }
   }
 
   NotifyStyleSheetAdded(aSheet, false);
 }
 
@@ -5388,16 +5393,22 @@ already_AddRefed<AnonymousContent>
 nsIDocument::InsertAnonymousContent(Element& aElement, ErrorResult& aRv)
 {
   nsIPresShell* shell = GetShell();
   if (!shell || !shell->GetCanvasFrame()) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
+  // We're about to insert random content here that will be rendered. We're
+  // going to need more than svg.css here...
+  if (IsSVGDocument()) {
+    AsSVGDocument()->EnsureNonSVGUserAgentStyleSheetsLoaded();
+  }
+
   nsAutoScriptBlocker scriptBlocker;
   nsCOMPtr<Element> container = shell->GetCanvasFrame()
                                      ->GetCustomContentContainer();
   if (!container) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
--- a/dom/svg/SVGDocument.cpp
+++ b/dom/svg/SVGDocument.cpp
@@ -103,21 +103,26 @@ SVGDocument::EnsureNonSVGUserAgentStyleS
     // style sheets in this case, but we'll need B2G/Fennec's
     // content.css. We could load all the sheets registered with the
     // nsIStyleSheetService (and maybe we should) but most likely it isn't
     // desirable or necessary for foreignObject in SVG-as-an-image. Instead we
     // only load the "agent-style-sheets" that nsStyleSheetService::Init()
     // pulls in from the category manager. That keeps memory use of
     // SVG-as-an-image down.
     //
-    // We do this before adding UASheet() etc. below because
-    // EnsureOnDemandBuiltInUASheet prepends, and B2G/Fennec's
-    // content.css must come after UASheet() etc.
+    // We do this before adding the other sheets below because
+    // EnsureOnDemandBuiltInUASheet prepends, and B2G/Fennec's/GeckoView's
+    // content.css must come after those UASheet() etc.
+    //
+    // FIXME(emilio, bug 1468133): We may already have loaded some of the other
+    // on-demand built-in UA sheets, including svg.css, so this looks somewhat
+    // bogus... Also, this should probably just use the stylesheet service which
+    // also has the right sheets cached and parsed here...
     nsCOMPtr<nsICategoryManager> catMan =
-    do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
+      do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
     if (catMan) {
       nsCOMPtr<nsISimpleEnumerator> sheets;
       catMan->EnumerateCategory("agent-style-sheets", getter_AddRefs(sheets));
       if (sheets) {
         bool hasMore;
         while (NS_SUCCEEDED(sheets->HasMoreElements(&hasMore)) && hasMore) {
           nsCOMPtr<nsISupports> sheet;
           if (NS_FAILED(sheets->GetNext(getter_AddRefs(sheet))))
--- a/dom/svg/SVGDocument.h
+++ b/dom/svg/SVGDocument.h
@@ -18,16 +18,17 @@ class SVGContextPaint;
 
 namespace dom {
 
 class SVGForeignObjectElement;
 
 class SVGDocument final : public XMLDocument
 {
   friend class SVGForeignObjectElement; // To call EnsureNonSVGUserAgentStyleSheetsLoaded
+  friend class nsIDocument; // Same reason.
 
 public:
   SVGDocument()
     : XMLDocument("image/svg+xml")
     , mHasLoadedNonSVGUserAgentStyleSheets(false)
   {
     mType = eSVG;
   }
--- a/intl/chardet/nsCyrillicDetector.cpp
+++ b/intl/chardet/nsCyrillicDetector.cpp
@@ -125,16 +125,17 @@ void nsCyrXPCOMDetector::Report(const ch
   mObserver->Notify(aCharset, eBestAnswer);
 }
 
 //---------------------------------------------------------------------
 nsCyrXPCOMStringDetector:: nsCyrXPCOMStringDetector(uint8_t aItems,
                       const uint8_t ** aCyrillicClass,
                       const char **aCharsets)
 	     : nsCyrillicDetector(aItems, aCyrillicClass, aCharsets)
+	     , mResult(nullptr)
 {
 }
 
 //---------------------------------------------------------------------
 nsCyrXPCOMStringDetector::~nsCyrXPCOMStringDetector()
 {
 }
 
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -179,29 +179,20 @@ ViewportFrame::BuildDisplayListForTopLay
       BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
     }
   }
 
   nsIPresShell* shell = PresShell();
   if (nsCanvasFrame* canvasFrame = shell->GetCanvasFrame()) {
     if (Element* container = canvasFrame->GetCustomContentContainer()) {
       if (nsIFrame* frame = container->GetPrimaryFrame()) {
-        // Enter this frame for display list building, but only if it is
-        // actually a top layer frame. There is a bug affecting SVG documents
-        // that makes the custom content container not be a top layer frame in
-        // them, because SVG documents don't load `ua.css` when the custom
-        // content container is created. `ua.css` contains the rule that makes
-        // this a top layer frame. This bug is being fixed in bug 1157592.
-        // We have to do this workaround because otherwise we risk building
-        // display items for this frame twice; if the custom content container
-        // frame is not a top layer frame, it's not out-of-flow, so we'll have
-        // built display items for it already when we entered its parent frame.
-        if (frame->StyleDisplay()->mTopLayer != NS_STYLE_TOP_LAYER_NONE) {
-          BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
-        }
+        MOZ_ASSERT(frame->StyleDisplay()->mTopLayer != NS_STYLE_TOP_LAYER_NONE,
+                   "ua.css should ensure this");
+        MOZ_ASSERT(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW);
+        BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
       }
     }
   }
 }
 
 #ifdef DEBUG
 void
 ViewportFrame::AppendFrames(ChildListID     aListID,
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/1468640.html
@@ -0,0 +1,10 @@
+<script>
+function go() {
+  a.attachShadow({mode: "closed"}).innerHTML = b.outerHTML;
+  a.setAttribute("o", "");
+}
+</script>
+<body onload=go()>
+<meter id="b">
+<style></style>
+<div id="a">
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -283,8 +283,9 @@ load 1409183.html
 pref(dom.webcomponents.shadowdom.enabled,true) load 1445682.html
 pref(dom.webcomponents.shadowdom.enabled,true) load 1449243.html
 load 1450691.html
 pref(dom.webcomponents.shadowdom.enabled,true) load 1453206.html
 load 1454140.html
 load 1455108.html
 load 1457288.html
 load 1457985.html
+pref(dom.webcomponents.shadowdom.enabled,true) load 1468640.html
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -354,15 +354,16 @@ skip-if = toolkit == 'android' # TIMED_O
 [test_visited_image_loading_empty.html]
 skip-if = toolkit == 'android' # TIMED_OUT for android
 [test_visited_lying.html]
 skip-if = toolkit == 'android' # TIMED_OUT for android
 [test_visited_pref.html]
 skip-if = toolkit == 'android' # TIMED_OUT for android
 [test_visited_reftests.html]
 skip-if = toolkit == 'android' # TIMED_OUT for android
+[test_webkit_appearance_basic.html]
 [test_webkit_device_pixel_ratio.html]
 [test_webkit_flex_display.html]
 [test_first_letter_restrictions.html]
 [test_first_line_restrictions.html]
 [test_placeholder_restrictions.html]
 [test_mql_event_listener_leaks.html]
 [test_non_matching_sheet_media.html]
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -8074,16 +8074,25 @@ if (IsCSSPropertyPrefEnabled("layout.css
     domProp: "webkitMaskSize",
     inherited: false,
     type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
     alias_for: "mask-size",
     subproperties: [ "mask-size" ],
   };
 }
 
+if (IsCSSPropertyPrefEnabled("layout.css.webkit-appearance.enabled")) {
+  gCSSProperties["-webkit-appearance"] = {
+    domProp: "WebkitAppearance",
+    inherited: false,
+    type: CSS_TYPE_LONGHAND,
+    alias_for: "-moz-appearance",
+  };
+}
+
 if (IsCSSPropertyPrefEnabled("layout.css.prefixes.gradients")) {
   gCSSProperties["background"].other_values.push(
     "-moz-radial-gradient(10% bottom, #ffffff, black) scroll no-repeat",
     "-moz-linear-gradient(10px 10px -45deg, red, blue) repeat",
     "-moz-linear-gradient(10px 10px -0.125turn, red, blue) repeat",
     "-moz-repeating-radial-gradient(10% bottom, #ffffff, black) scroll no-repeat",
     "-moz-repeating-linear-gradient(10px 10px -45deg, red, blue) repeat",
     "url(404.png), -moz-linear-gradient(20px 20px -45deg, blue, green), -moz-element(#a) black",
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_webkit_appearance_basic.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1429713
+-->
+<head>
+  <title>Test pref layout.css.webkit-appearance.enabled</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/AddTask.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1429713">Mozilla Bug 1429713</a>
+<div id="content" style="display: none">
+  <iframe id="iframe"></iframe>
+</div>
+<script type="text/javascript">
+</script>
+<pre id="test">
+<script class="testbody" type="application/javascript">
+
+function iframe_reload() {
+  return new Promise(resolve => {
+    iframe.addEventListener("load", _ => resolve());
+    iframe.contentWindow.location.reload();
+  });
+}
+
+add_task(async function runTests() {
+  // Pref changes only take affect after a page is reloaded, which is why we
+  // use an iframe here and reload it after the pref changes.
+
+  const iframe = document.getElementById("iframe");
+
+  // Test pref enabled:
+
+  await SpecialPowers.pushPrefEnv({
+    "set": [["layout.css.webkit-appearance.enabled", true]],
+  });
+
+  await iframe_reload();
+
+  let win = iframe.contentWindow;
+  let testElem = win.document.body;
+  testElem.style["-webkit-appearance"] = "none";
+  is(window.getComputedStyle(testElem)["-webkit-appearance"], "none",
+     "Pref should enable -webkit-appearance support");
+
+  // Test pref disabled:
+
+  await SpecialPowers.pushPrefEnv({
+    "set": [["layout.css.webkit-appearance.enabled", false]],
+  });
+
+  await iframe_reload();
+
+  win = iframe.contentWindow;
+  testElem = win.document.body;
+  testElem.style["-webkit-appearance"] = "none";
+  is(window.getComputedStyle(testElem)["-webkit-appearance"], undefined,
+     "Pref should disable -webkit-appearance support");
+});
+
+</script>
+</pre>
+</body>
+</html>
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3040,16 +3040,19 @@ pref("layout.float-fragments-inside-colu
 // The number of frames times the frame rate is the time required to
 // pass without painting used to guess that we'll not paint again soon
 pref("layout.idle_period.required_quiescent_frames", 2);
 
 // The amount of time (milliseconds) needed between an idle period's
 // end and the start of the next tick to avoid jank.
 pref("layout.idle_period.time_limit", 1);
 
+// Whether -webkit-appearance is aliased to -moz-appearance
+pref("layout.css.webkit-appearance.enabled", false);
+
 // Is support for the Web Animations API enabled?
 // Before enabling this by default, make sure also CSSPseudoElement interface
 // has been spec'ed properly, or we should add a separate pref for
 // CSSPseudoElement interface. See Bug 1174575 for further details.
 #ifdef RELEASE_OR_BETA
 pref("dom.animations-api.core.enabled", false);
 #else
 pref("dom.animations-api.core.enabled", true);
--- a/python/mozbuild/mozbuild/codecoverage/manifest_handler.py
+++ b/python/mozbuild/mozbuild/codecoverage/manifest_handler.py
@@ -1,14 +1,18 @@
 # 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/.
 
 from collections import defaultdict
-import urlparse
+
+try:
+    import urlparse
+except ImportError:
+    import urllib.parse as urlparse
 
 from mozpack.chrome.manifest import (
     Manifest,
     ManifestChrome,
     ManifestOverride,
     ManifestResource,
     parse_manifest,
 )
--- a/python/mozbuild/mozpack/chrome/manifest.py
+++ b/python/mozbuild/mozpack/chrome/manifest.py
@@ -1,17 +1,22 @@
 # 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/.
 
 from __future__ import absolute_import
 
 import re
 import os
-from urlparse import urlparse
+
+try:
+    from urlparse import urlparse
+except ImportError:
+    from urllib.parse import urlparse
+
 import mozpack.path as mozpath
 from mozpack.chrome.flags import Flags
 from mozpack.errors import errors
 
 
 class ManifestEntry(object):
     '''
     Base class for all manifest entry types.
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -173,21 +173,23 @@ impl<'lr> TShadowRoot for GeckoShadowRoo
     {
         debug_assert!(!self.0.mServoStyles.mPtr.is_null());
 
         let author_styles = unsafe {
             &*(self.0.mServoStyles.mPtr as *const structs::RawServoAuthorStyles
                 as *const bindings::RawServoAuthorStyles)
         };
 
+
         let author_styles = AuthorStyles::<GeckoStyleSheet>::from_ffi(author_styles);
 
         debug_assert!(
             author_styles.quirks_mode == self.as_node().owner_doc().quirks_mode() ||
-                author_styles.stylesheets.is_empty()
+                author_styles.stylesheets.is_empty() ||
+                author_styles.stylesheets.dirty()
         );
 
         &author_styles.data
     }
 
     #[inline]
     fn elements_with_id<'a>(&self, id: &Atom) -> Result<&'a [GeckoElement<'lr>], ()>
     where
--- a/servo/components/style/properties/longhand/box.mako.rs
+++ b/servo/components/style/properties/longhand/box.mako.rs
@@ -621,16 +621,17 @@
                             -moz-window-button-box -moz-window-button-box-maximized -moz-window-button-close
                             -moz-window-button-maximize -moz-window-button-minimize -moz-window-button-restore
                             -moz-window-frame-bottom -moz-window-frame-left -moz-window-frame-right -moz-window-titlebar
                             -moz-window-titlebar-maximized
                          """,
                          gecko_ffi_name="mAppearance",
                          gecko_constant_prefix="ThemeWidgetType_NS_THEME",
                          products="gecko",
+                         alias="-webkit-appearance:layout.css.webkit-appearance.enabled",
                          spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance)",
                          animation_value_type="discrete")}
 
 ${helpers.predefined_type("-moz-binding", "url::UrlOrNone", "computed::url::UrlOrNone::none()",
                           products="gecko",
                           animation_value_type="none",
                           gecko_ffi_name="mBinding",
                           spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding)")}