toolkit/content/tests/chrome/test_bug437844.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/tests/chrome/test_bug437844.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,95 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet 
     1.7 +  href="chrome://mochikit/content/tests/SimpleTest/test.css"
     1.8 +  type="text/css"?>
     1.9 +<!--
    1.10 +https://bugzilla.mozilla.org/show_bug.cgi?id=437844
    1.11 +https://bugzilla.mozilla.org/show_bug.cgi?id=348233
    1.12 +-->
    1.13 +<window title="Mozilla Bug 437844 and Bug 348233"
    1.14 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.15 +
    1.16 +  <script type="application/javascript" 
    1.17 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.18 +  <script type="application/javascript" 
    1.19 +          src="chrome://mochikit/content/chrome-harness.js"></script>
    1.20 +  <script type="application/javascript"
    1.21 +          src="RegisterUnregisterChrome.js"></script>
    1.22 +
    1.23 +  <body  xmlns="http://www.w3.org/1999/xhtml">
    1.24 +    <a target="_blank" 
    1.25 +       href="https://bugzilla.mozilla.org/show_bug.cgi?id=437844">
    1.26 +      Mozilla Bug 437844
    1.27 +    </a>
    1.28 +    <a target="_blank" 
    1.29 +       href="https://bugzilla.mozilla.org/show_bug.cgi?id=348233">
    1.30 +      Mozilla Bug 348233
    1.31 +    </a>
    1.32 +
    1.33 +    <p id="display"></p>
    1.34 +    <div id="content" style="display: none">
    1.35 +    </div>
    1.36 +    <pre id="test">
    1.37 +    </pre>
    1.38 +  </body>
    1.39 +
    1.40 +  <script class="testbody" type="application/javascript">
    1.41 +    <![CDATA[
    1.42 +
    1.43 +      SimpleTest.expectAssertions(19, 20);
    1.44 +
    1.45 +      /** Test for Bug 437844 and Bug 348233 **/
    1.46 +      SimpleTest.waitForExplicitFinish();
    1.47 +
    1.48 +      let prefs = Components.classes["@mozilla.org/preferences-service;1"]
    1.49 +                            .getService(Components.interfaces.nsIPrefBranch);
    1.50 +      prefs.setCharPref("intl.uidirection.en-US", "rtl");
    1.51 +
    1.52 +      let rootDir = getRootDirectory(window.location.href);
    1.53 +      let manifest = rootDir + "rtlchrome/rtl.manifest";
    1.54 +
    1.55 +      //copy rtlchrome to profile/rtlchrome and generate .manifest
    1.56 +      let filePath = chromeURIToFile(manifest);
    1.57 +      let tempProfileDir = copyDirToTempProfile(filePath.path, 'rtlchrome');
    1.58 +      if (tempProfileDir.path.lastIndexOf('\\') >= 0) {
    1.59 +        manifest = "content rtlchrome /" + tempProfileDir.path.replace(/\\/g, '/') + "\n";
    1.60 +      } else {
    1.61 +        manifest = "content rtlchrome " + tempProfileDir.path + "\n";
    1.62 +      }
    1.63 +      manifest += "override chrome://global/locale/intl.css chrome://rtlchrome/content/rtlchrome/rtl.css\n";
    1.64 +      manifest += "override chrome://global/locale/global.dtd chrome://rtlchrome/content/rtlchrome/rtl.dtd\n";
    1.65 +
    1.66 +      let cleanupFunc = createManifestTemporarily(tempProfileDir, manifest);
    1.67 +
    1.68 +      // Load about:plugins in an iframe
    1.69 +      let frame = document.createElement("iframe");
    1.70 +      frame.setAttribute("src", "about:plugins");
    1.71 +      frame.addEventListener("load", function () {
    1.72 +          frame.removeEventListener("load", arguments.callee, false);
    1.73 +          is(frame.contentDocument.dir, "rtl", "about:plugins should be RTL in RTL locales");
    1.74 +
    1.75 +          let gDirSvc    = Components.classes["@mozilla.org/file/directory_service;1"].
    1.76 +                                      getService(Components.interfaces.nsIDirectoryService).
    1.77 +                                      QueryInterface(Components.interfaces.nsIProperties);
    1.78 +          let tmpd = gDirSvc.get("ProfD", Components.interfaces.nsIFile);
    1.79 +
    1.80 +          frame = document.createElement("iframe");
    1.81 +          frame.setAttribute("src", "file://" + tmpd.path); // a file:// URI, bug 348233
    1.82 +          frame.addEventListener("load", function () {
    1.83 +              frame.removeEventListener("load", arguments.callee, false);
    1.84 +
    1.85 +              is(frame.contentDocument.body.dir, "rtl", "file:// listings should be RTL in RTL locales");
    1.86 +
    1.87 +              cleanupFunc();
    1.88 +              prefs.clearUserPref("intl.uidirection.en-US");
    1.89 +              SimpleTest.finish();
    1.90 +            }, false);
    1.91 +          document.documentElement.appendChild(frame);
    1.92 +        }, false);
    1.93 +      document.documentElement.appendChild(frame);
    1.94 +
    1.95 +    ]]>
    1.96 +  </script>
    1.97 +
    1.98 +</window>

mercurial