toolkit/devtools/server/tests/mochitest/test_styles-svg.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=921191
     5 Bug 921191 - allow inspection/editing of SVG elements' CSS properties
     6 -->
     7 <head>
     8   <meta charset="utf-8">
     9   <title>Test for Bug </title>
    11   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    12   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
    13   <script type="application/javascript;version=1.8" src="inspector-helpers.js"></script>
    14   <script type="application/javascript;version=1.8">
    15 Components.utils.import("resource://gre/modules/devtools/Loader.jsm");
    16 const {Promise: promise} = Components.utils.import("resource://gre/modules/Promise.jsm", {});
    18 const inspector = devtools.require("devtools/server/actors/inspector");
    20 window.onload = function() {
    21   SimpleTest.waitForExplicitFinish();
    22   runNextTest();
    23 }
    25 var gWalker = null;
    26 var gStyles = null;
    27 var gClient = null;
    29 addTest(function setup() {
    30   let url = document.getElementById("inspectorContent").href;
    31   attachURL(url, function(err, client, tab, doc) {
    32     let {InspectorFront} = devtools.require("devtools/server/actors/inspector");
    33     let inspector = InspectorFront(client, tab);
    34     promiseDone(inspector.getWalker().then(walker => {
    35       ok(walker, "getWalker() should return an actor.");
    36       gClient = client;
    37       gWalker = walker;
    38       return inspector.getPageStyle();
    39     }).then(styles => {
    40       gStyles = styles;
    41     }).then(runNextTest));
    42   });
    43 });
    45 addTest(function inheritedUserStyles() {
    46   let node = node;
    47   promiseDone(gWalker.querySelector(gWalker.rootNode, "#svgcontent rect").then(node => {
    48     return gStyles.getApplied(node, { inherited: true, filter: "user" });
    49   }).then(applied => {
    50     is(applied.length, 3, "Should have 3 rules");
    51     is(applied[1].rule.cssText, "fill: rgb(1, 2, 3);", "cssText is right");
    52   }).then(runNextTest));
    53 });
    55 addTest(function cleanup() {
    56   delete gStyles;
    57   delete gWalker;
    58   delete gClient;
    59   runNextTest();
    60 });
    62   </script>
    63 </head>
    64 <body>
    65 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=921191">Mozilla Bug 921191</a>
    66 <a id="inspectorContent" target="_blank" href="inspector-styles-data.html">Test Document</a>
    67 <p id="display"></p>
    68 <div id="content" style="display: none">
    70 </div>
    71 <pre id="test">
    72 </pre>
    73 </body>
    74 </html>

mercurial