Merge autoland to mozilla-central. a=merge
authorNarcis Beleuzu <nbeleuzu@mozilla.com>
Tue, 04 Sep 2018 12:50:51 +0300
changeset 489688 7d542c1d11cd
parent 489687 dd76062be73d (current diff)
parent 489686 f8fe981dd967 (diff)
child 489689 bdf475b97f93
child 490360 c2c2b68be096
push id9740
push userarchaeopteryx@coole-files.de
push dateTue, 04 Sep 2018 16:57:14 +0000
treeherdermozilla-beta@0311d9ebb702 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone63.0a1
first release with
nightly linux32
7d542c1d11cd / 63.0a1 / 20180904100126 / files
nightly linux64
7d542c1d11cd / 63.0a1 / 20180904100126 / files
nightly mac
7d542c1d11cd / 63.0a1 / 20180904100126 / files
nightly win32
7d542c1d11cd / 63.0a1 / 20180904100126 / files
nightly win64
7d542c1d11cd / 63.0a1 / 20180904100126 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge autoland to mozilla-central. a=merge
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/fragid-shadow-10.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<style>
+  #shadow rect {
+    fill: red !important;
+  }
+</style>
+<div id="host"></div>
+<svg height="0">
+  <!-- use an empty g to force fragid-shadow-resource.svg to load before onload -->
+  <use href="fragid-shadow-resource.svg#empty" />
+</svg>
+<script>
+  host.attachShadow({ mode: "open" }).innerHTML = `
+    <svg width="100" height="100">
+      <use href="fragid-shadow-resource.svg#shadow" />
+    </svg>
+  `;
+</script>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/fragid-shadow-9.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<style>
+  #shadow {
+    fill: red;
+  }
+</style>
+<div id="host"></div>
+<script>
+  host.attachShadow({ mode: "open" }).innerHTML = `
+    <style>
+      #shadow {
+        fill: lime;
+      }
+    </style>
+    <svg width="100" height="100">
+      <defs>
+        <g id="shadow" width="100" height="100">
+          <rect width="100" height="100" />
+        </g>
+      </defs>
+      <use href="#shadow" />
+    </svg>
+  `;
+</script>
--- a/layout/reftests/svg/fragid-shadow-resource.svg
+++ b/layout/reftests/svg/fragid-shadow-resource.svg
@@ -1,8 +1,11 @@
 <svg xmlns="http://www.w3.org/2000/svg">
   <defs>
     <g id="empty" />
     <pattern id="rect" width="100" height="100">
       <rect fill="lime" width="100" height="100" />
     </pattern>
+    <g id="shadow" width="100" height="100">
+      <rect fill="lime" width="100" height="100" />
+    </g>
   </defs>
 </svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -557,8 +557,10 @@ fuzzy-if(skiaContent,0-1,0-100) == tspan
 pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-1.html fragid-shadow-ref.html
 pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-2.html fragid-shadow-ref.html
 pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-3.html fragid-shadow-ref.html
 pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-4.html fragid-shadow-ref.html
 pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-5.html fragid-shadow-ref.html
 pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-6.html fragid-shadow-ref.html
 pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-7.html fragid-shadow-ref.html
 pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-8.html fragid-shadow-ref.html
+pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-9.html fragid-shadow-ref.html
+pref(dom.webcomponents.shadowdom.enabled,true) == fragid-shadow-10.html fragid-shadow-ref.html
--- a/mobile/android/tests/browser/robocop/robocop.ini
+++ b/mobile/android/tests/browser/robocop/robocop.ini
@@ -45,16 +45,17 @@ skip-if = true # Bug 1390059
 [src/org/mozilla/gecko/tests/testGetUserMedia.java]
 # failures across the board, bug 1092202 & bug 1144926
 skip-if = true
 [src/org/mozilla/gecko/tests/testHistory.java]
 disabled=see bug 915350
 [src/org/mozilla/gecko/tests/testHomeBanner.java]
 [src/org/mozilla/gecko/tests/testIdnSupport.java]
 [src/org/mozilla/gecko/tests/testInputUrlBar.java]
+[src/org/mozilla/gecko/tests/testIntentUri.java]
 [src/org/mozilla/gecko/tests/testJarReader.java]
 [src/org/mozilla/gecko/tests/testLinkContextMenu.java]
 [src/org/mozilla/gecko/tests/testHomeListsProvider.java]
 disabled=see bug 952310
 [src/org/mozilla/gecko/tests/testLoad.java]
 skip-if = true # Bug 1390059
 [src/org/mozilla/gecko/tests/testMailToContextMenu.java]
 [src/org/mozilla/gecko/tests/testNewTab.java]
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/helpers/NavigationHelper.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/helpers/NavigationHelper.java
@@ -43,17 +43,17 @@ final public class NavigationHelper {
 
     /**
      * Returns a new URL with the docshell HTTP server host prefix.
      */
     public static String adjustUrl(final String url) {
         fAssertNotNull("url is not null", url);
 
         if (url.startsWith("about:") || url.startsWith("chrome:") ||
-                url.startsWith("view-source:")) {
+                url.startsWith("intent:") || url.startsWith("view-source:")) {
             return url;
         }
 
         return sContext.getAbsoluteHostnameUrl(url);
     }
 
     public static void goBack() {
         if (DeviceHelper.isTablet()) {
new file mode 100644
--- /dev/null
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testIntentUri.java
@@ -0,0 +1,26 @@
+/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
+ * vim: ts=4 sw=4 expandtab:
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+package org.mozilla.gecko.tests;
+
+import org.mozilla.gecko.tests.helpers.GeckoHelper;
+import org.mozilla.gecko.tests.helpers.NavigationHelper;
+
+import java.net.URLEncoder;
+
+public class testIntentUri extends UITest {
+    public void testIntentUrlFallback() {
+        final String targetPage = getAbsoluteHostnameUrl(mStringHelper.ROBOCOP_TEXT_PAGE_URL);
+        final String encodedTargetPage = URLEncoder.encode(targetPage);
+        final String intentUri = "intent://this.url/wont/be/loaded" +
+                "#Intent;scheme=https;package=org.mozilla.notinstalled;" +
+                "S.browser_fallback_url=" + encodedTargetPage + ";end";
+
+        GeckoHelper.blockForReady();
+
+        NavigationHelper.enterAndLoadUrl(intentUri);
+        mToolbar.assertTitle(targetPage);
+    }
+}
--- a/services/fxaccounts/FxAccountsCommands.js
+++ b/services/fxaccounts/FxAccountsCommands.js
@@ -119,16 +119,17 @@ class FxAccountsCommands {
       }
       switch (command) {
         case COMMAND_SENDTAB:
           try {
             await this.sendTab.handle(sender, payload);
           } catch (e) {
             log.error(`Error while handling incoming Send Tab payload.`, e);
           }
+          break;
         default:
           log.info(`Unknown command: ${command}.`);
       }
     }
   }
 }
 
 /**
@@ -197,17 +198,17 @@ class SendTab {
     const data = JSON.parse(decoder.decode(bytes));
     const current = data.hasOwnProperty("current") ? data.current :
                                                      data.entries.length - 1;
     const tabSender = {
       id: sender ? sender.id : "",
       name: sender ? sender.name : "",
     };
     const {title, url: uri} = data.entries[current];
-    console.log(`Tab received with FxA commands: ${title} from ${tabSender.name}.`);
+    log.info(`Tab received with FxA commands: ${title} from ${tabSender.name}.`);
     Observers.notify("fxaccounts:commands:open-uri", [{uri, title, sender: tabSender}]);
   }
 
   async _getKid() {
     let {kXCS} = await this._fxAccounts.getKeys();
     return kXCS;
   }
 
--- a/servo/components/style/stylist.rs
+++ b/servo/components/style/stylist.rs
@@ -1124,18 +1124,16 @@ impl Stylist {
             cfg!(feature = "gecko") || style_attribute.is_none() || pseudo_element.is_none(),
             "Style attributes do not apply to pseudo-elements"
         );
         debug_assert!(pseudo_element.map_or(true, |p| !p.is_precomputed()));
 
         let rule_hash_target = element.rule_hash_target();
 
         let matches_user_rules = rule_hash_target.matches_user_and_author_rules();
-        let matches_author_rules =
-            matches_user_rules && self.author_styles_enabled == AuthorStylesEnabled::Yes;
 
         // Normal user-agent rules.
         if let Some(map) = self.cascade_data
             .user_agent
             .cascade_data
             .normal_rules(pseudo_element)
         {
             map.get_all_matching_rules(
@@ -1190,118 +1188,125 @@ impl Stylist {
                 if applicable_declarations.len() != length_before_preshints {
                     for declaration in &applicable_declarations[length_before_preshints..] {
                         assert_eq!(declaration.level(), CascadeLevel::PresHints);
                     }
                 }
             }
         }
 
-        let mut match_document_author_rules = matches_author_rules;
+        if self.author_styles_enabled == AuthorStylesEnabled::No {
+            return;
+        }
+
+        let mut match_document_author_rules = matches_user_rules;
         let mut shadow_cascade_order = 0;
 
         // XBL / Shadow DOM rules, which are author rules too.
         //
         // TODO(emilio): Cascade order here is wrong for Shadow DOM. In
         // particular, normally document rules override ::slotted() rules, but
         // for !important it should be the other way around. So probably we need
         // to add some sort of AuthorScoped cascade level or something.
-        if matches_author_rules {
-            if let Some(shadow) = rule_hash_target.shadow_root() {
-                if let Some(map) = shadow.style_data().and_then(|data| data.host_rules(pseudo_element)) {
-                    context.with_shadow_host(Some(rule_hash_target), |context| {
-                        map.get_all_matching_rules(
-                            element,
-                            rule_hash_target,
-                            applicable_declarations,
-                            context,
-                            flags_setter,
-                            CascadeLevel::InnerShadowNormal,
-                            shadow_cascade_order,
-                        );
-                    });
-                    shadow_cascade_order += 1;
-                }
-            }
-
-            // Match slotted rules in reverse order, so that the outer slotted
-            // rules come before the inner rules (and thus have less priority).
-            let mut slots = SmallVec::<[_; 3]>::new();
-            let mut current = rule_hash_target.assigned_slot();
-            while let Some(slot) = current {
-                slots.push(slot);
-                current = slot.assigned_slot();
-            }
-
-            for slot in slots.iter().rev() {
-                let shadow = slot.containing_shadow().unwrap();
-                if let Some(map) = shadow.style_data().and_then(|data| data.slotted_rules(pseudo_element)) {
-                    context.with_shadow_host(Some(shadow.host()), |context| {
-                        map.get_all_matching_rules(
-                            element,
-                            rule_hash_target,
-                            applicable_declarations,
-                            context,
-                            flags_setter,
-                            CascadeLevel::InnerShadowNormal,
-                            shadow_cascade_order,
-                        );
-                    });
-                    shadow_cascade_order += 1;
-                }
+        if let Some(shadow) = rule_hash_target.shadow_root() {
+            if let Some(map) = shadow.style_data().and_then(|data| data.host_rules(pseudo_element)) {
+                context.with_shadow_host(Some(rule_hash_target), |context| {
+                    map.get_all_matching_rules(
+                        element,
+                        rule_hash_target,
+                        applicable_declarations,
+                        context,
+                        flags_setter,
+                        CascadeLevel::InnerShadowNormal,
+                        shadow_cascade_order,
+                    );
+                });
+                shadow_cascade_order += 1;
             }
+        }
 
-            if let Some(containing_shadow) = rule_hash_target.containing_shadow() {
-                let cascade_data = containing_shadow.style_data();
-                let host = containing_shadow.host();
-                if let Some(map) = cascade_data.and_then(|data| data.normal_rules(pseudo_element)) {
-                    context.with_shadow_host(Some(host), |context| {
-                        map.get_all_matching_rules(
-                            element,
-                            rule_hash_target,
-                            applicable_declarations,
-                            context,
-                            flags_setter,
-                            CascadeLevel::SameTreeAuthorNormal,
-                            shadow_cascade_order,
-                        );
-                    });
-                    shadow_cascade_order += 1;
-                }
+        // Match slotted rules in reverse order, so that the outer slotted
+        // rules come before the inner rules (and thus have less priority).
+        let mut slots = SmallVec::<[_; 3]>::new();
+        let mut current = rule_hash_target.assigned_slot();
+        while let Some(slot) = current {
+            slots.push(slot);
+            current = slot.assigned_slot();
+        }
 
-                // NOTE(emilio): Hack so <svg:use> matches document rules as
-                // expected.
-                //
-                // This is not a problem for invalidation and that kind of stuff
-                // because they still don't match rules based on elements
-                // outside of the shadow tree, and because the <svg:use> subtree
-                // is immutable and recreated each time the source tree changes.
-                //
-                // See: https://github.com/w3c/svgwg/issues/504
-                //
-                // Note that we always resolve URLs against the document, so we
-                // can't get into a nested shadow situation here.
-                //
-                // See: https://github.com/w3c/svgwg/issues/505
-                //
-                // FIXME(emilio, bug 1487259): We now do after bug 1483882, we
-                // should jump out of the <svg:use> shadow tree chain now.
-                //
-                // Unless the used node is cross-doc, I guess, in which case doc
-                // rules are probably ok...
-                let host_is_svg_use =
-                    host.is_svg_element() &&
-                    host.local_name() == &*local_name!("use");
-
-                match_document_author_rules = host_is_svg_use;
+        for slot in slots.iter().rev() {
+            let shadow = slot.containing_shadow().unwrap();
+            if let Some(map) = shadow.style_data().and_then(|data| data.slotted_rules(pseudo_element)) {
+                context.with_shadow_host(Some(shadow.host()), |context| {
+                    map.get_all_matching_rules(
+                        element,
+                        rule_hash_target,
+                        applicable_declarations,
+                        context,
+                        flags_setter,
+                        CascadeLevel::InnerShadowNormal,
+                        shadow_cascade_order,
+                    );
+                });
+                shadow_cascade_order += 1;
             }
         }
 
-        // FIXME(emilio): This doesn't account for the author_styles_enabled
-        // stuff...
+        let mut current_containing_shadow = rule_hash_target.containing_shadow();
+        while let Some(containing_shadow) = current_containing_shadow {
+            let cascade_data = containing_shadow.style_data();
+            let host = containing_shadow.host();
+            if let Some(map) = cascade_data.and_then(|data| data.normal_rules(pseudo_element)) {
+                context.with_shadow_host(Some(host), |context| {
+                    map.get_all_matching_rules(
+                        element,
+                        rule_hash_target,
+                        applicable_declarations,
+                        context,
+                        flags_setter,
+                        CascadeLevel::SameTreeAuthorNormal,
+                        shadow_cascade_order,
+                    );
+                });
+                shadow_cascade_order += 1;
+            }
+
+            let host_is_svg_use_element =
+                host.is_svg_element() &&
+                host.local_name() == &*local_name!("use");
+
+            if !host_is_svg_use_element {
+                match_document_author_rules = false;
+                break;
+            }
+
+            debug_assert!(
+                cascade_data.is_none(),
+                "We allow no stylesheets in <svg:use> subtrees"
+            );
+
+            // NOTE(emilio): Hack so <svg:use> matches the rules of the
+            // enclosing tree.
+            //
+            // This is not a problem for invalidation and that kind of stuff
+            // because they still don't match rules based on elements
+            // outside of the shadow tree, and because the <svg:use>
+            // subtrees are immutable and recreated each time the source
+            // tree changes.
+            //
+            // We historically allow cross-document <svg:use> to have these
+            // rules applied, but I think that's not great. Gecko is the
+            // only engine supporting that.
+            //
+            // See https://github.com/w3c/svgwg/issues/504 for the relevant
+            // spec discussion.
+            current_containing_shadow = host.containing_shadow();
+            match_document_author_rules = current_containing_shadow.is_none();
+        }
+
         let cut_xbl_binding_inheritance =
             element.each_xbl_cascade_data(|cascade_data, quirks_mode| {
                 if let Some(map) = cascade_data.normal_rules(pseudo_element) {
                     // NOTE(emilio): This is needed because the XBL stylist may
                     // think it has a different quirks mode than the document.
                     let mut matching_context = MatchingContext::new(
                         context.matching_mode(),
                         context.bloom_filter,
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -32,23 +32,21 @@ ChromeUtils.defineModuleGetter(this, "Ne
 ChromeUtils.defineModuleGetter(this, "AppConstants",
                                "resource://gre/modules/AppConstants.jsm");
 ChromeUtils.defineModuleGetter(this, "ServiceWorkerCleanUp",
                                "resource://gre/modules/ServiceWorkerCleanUp.jsm");
 
 ChromeUtils.defineModuleGetter(this, "PerTestCoverageUtils",
   "resource://testing-common/PerTestCoverageUtils.jsm");
 
-// We're loaded with "this" not set to the global in some cases, so we
-// have to play some games to get at the global object here.  Normally
-// we'd try "this" from a function called with undefined this value,
-// but this whole file is in strict mode.  So instead fall back on
-// returning "this" from indirect eval, which returns the global.
-if (!(function() { var e = eval; return e("this"); })().File) { // eslint-disable-line no-eval
+try {
     Cu.importGlobalProperties(["DOMParser", "File", "InspectorUtils", "NodeFilter"]);
+} catch (e) {
+ // We are in window scope hence DOMParser, File, InspectorUtils and NodeFilter
+ // are already defined, So do nothing.
 }
 
 // Allow stuff from this scope to be accessed from non-privileged scopes. This
 // would crash if used outside of automation.
 Cu.forcePermissiveCOWs();
 
 function SpecialPowersAPI() {
   this._consoleListeners = [];