|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet |
|
4 href="chrome://mochikit/content/tests/SimpleTest/test.css" |
|
5 type="text/css"?> |
|
6 <!-- |
|
7 https://bugzilla.mozilla.org/show_bug.cgi?id=437844 |
|
8 https://bugzilla.mozilla.org/show_bug.cgi?id=348233 |
|
9 --> |
|
10 <window title="Mozilla Bug 437844 and Bug 348233" |
|
11 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
12 |
|
13 <script type="application/javascript" |
|
14 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
15 <script type="application/javascript" |
|
16 src="chrome://mochikit/content/chrome-harness.js"></script> |
|
17 <script type="application/javascript" |
|
18 src="RegisterUnregisterChrome.js"></script> |
|
19 |
|
20 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
21 <a target="_blank" |
|
22 href="https://bugzilla.mozilla.org/show_bug.cgi?id=437844"> |
|
23 Mozilla Bug 437844 |
|
24 </a> |
|
25 <a target="_blank" |
|
26 href="https://bugzilla.mozilla.org/show_bug.cgi?id=348233"> |
|
27 Mozilla Bug 348233 |
|
28 </a> |
|
29 |
|
30 <p id="display"></p> |
|
31 <div id="content" style="display: none"> |
|
32 </div> |
|
33 <pre id="test"> |
|
34 </pre> |
|
35 </body> |
|
36 |
|
37 <script class="testbody" type="application/javascript"> |
|
38 <![CDATA[ |
|
39 |
|
40 SimpleTest.expectAssertions(19, 20); |
|
41 |
|
42 /** Test for Bug 437844 and Bug 348233 **/ |
|
43 SimpleTest.waitForExplicitFinish(); |
|
44 |
|
45 let prefs = Components.classes["@mozilla.org/preferences-service;1"] |
|
46 .getService(Components.interfaces.nsIPrefBranch); |
|
47 prefs.setCharPref("intl.uidirection.en-US", "rtl"); |
|
48 |
|
49 let rootDir = getRootDirectory(window.location.href); |
|
50 let manifest = rootDir + "rtlchrome/rtl.manifest"; |
|
51 |
|
52 //copy rtlchrome to profile/rtlchrome and generate .manifest |
|
53 let filePath = chromeURIToFile(manifest); |
|
54 let tempProfileDir = copyDirToTempProfile(filePath.path, 'rtlchrome'); |
|
55 if (tempProfileDir.path.lastIndexOf('\\') >= 0) { |
|
56 manifest = "content rtlchrome /" + tempProfileDir.path.replace(/\\/g, '/') + "\n"; |
|
57 } else { |
|
58 manifest = "content rtlchrome " + tempProfileDir.path + "\n"; |
|
59 } |
|
60 manifest += "override chrome://global/locale/intl.css chrome://rtlchrome/content/rtlchrome/rtl.css\n"; |
|
61 manifest += "override chrome://global/locale/global.dtd chrome://rtlchrome/content/rtlchrome/rtl.dtd\n"; |
|
62 |
|
63 let cleanupFunc = createManifestTemporarily(tempProfileDir, manifest); |
|
64 |
|
65 // Load about:plugins in an iframe |
|
66 let frame = document.createElement("iframe"); |
|
67 frame.setAttribute("src", "about:plugins"); |
|
68 frame.addEventListener("load", function () { |
|
69 frame.removeEventListener("load", arguments.callee, false); |
|
70 is(frame.contentDocument.dir, "rtl", "about:plugins should be RTL in RTL locales"); |
|
71 |
|
72 let gDirSvc = Components.classes["@mozilla.org/file/directory_service;1"]. |
|
73 getService(Components.interfaces.nsIDirectoryService). |
|
74 QueryInterface(Components.interfaces.nsIProperties); |
|
75 let tmpd = gDirSvc.get("ProfD", Components.interfaces.nsIFile); |
|
76 |
|
77 frame = document.createElement("iframe"); |
|
78 frame.setAttribute("src", "file://" + tmpd.path); // a file:// URI, bug 348233 |
|
79 frame.addEventListener("load", function () { |
|
80 frame.removeEventListener("load", arguments.callee, false); |
|
81 |
|
82 is(frame.contentDocument.body.dir, "rtl", "file:// listings should be RTL in RTL locales"); |
|
83 |
|
84 cleanupFunc(); |
|
85 prefs.clearUserPref("intl.uidirection.en-US"); |
|
86 SimpleTest.finish(); |
|
87 }, false); |
|
88 document.documentElement.appendChild(frame); |
|
89 }, false); |
|
90 document.documentElement.appendChild(frame); |
|
91 |
|
92 ]]> |
|
93 </script> |
|
94 |
|
95 </window> |