Sat, 03 Jan 2015 20:18:00 +0100
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.
michael@0 | 1 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Text attribute changed event for misspelled text</title> |
michael@0 | 5 | |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../common.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../role.js"></script> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../states.js"></script> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../events.js"></script> |
michael@0 | 22 | <script type="application/javascript" |
michael@0 | 23 | src="../attributes.js"></script> |
michael@0 | 24 | |
michael@0 | 25 | <script type="application/javascript"> |
michael@0 | 26 | |
michael@0 | 27 | const nsIDOMNSEditableElement = |
michael@0 | 28 | Components.interfaces.nsIDOMNSEditableElement; |
michael@0 | 29 | |
michael@0 | 30 | Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm"); |
michael@0 | 31 | |
michael@0 | 32 | function spelledTextInvoker(aID) |
michael@0 | 33 | { |
michael@0 | 34 | this.DOMNode = getNode(aID); |
michael@0 | 35 | |
michael@0 | 36 | this.eventSeq = [ |
michael@0 | 37 | new invokerChecker(EVENT_TEXT_ATTRIBUTE_CHANGED, this.DOMNode) |
michael@0 | 38 | ]; |
michael@0 | 39 | |
michael@0 | 40 | this.invoke = function spelledTextInvoker_invoke() |
michael@0 | 41 | { |
michael@0 | 42 | var editor = this.DOMNode.QueryInterface(nsIDOMNSEditableElement).editor; |
michael@0 | 43 | var spellChecker = new InlineSpellChecker(editor); |
michael@0 | 44 | spellChecker.enabled = true; |
michael@0 | 45 | |
michael@0 | 46 | //var spellchecker = editor.getInlineSpellChecker(true); |
michael@0 | 47 | //spellchecker.enableRealTimeSpell = true; |
michael@0 | 48 | |
michael@0 | 49 | this.DOMNode.value = "valid text inalid tixt"; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | this.finalCheck = function spelledTextInvoker_finalCheck() |
michael@0 | 53 | { |
michael@0 | 54 | var defAttrs = buildDefaultTextAttrs(this.DOMNode, kInputFontSize, |
michael@0 | 55 | kNormalFontWeight, |
michael@0 | 56 | kInputFontFamily); |
michael@0 | 57 | testDefaultTextAttrs(aID, defAttrs); |
michael@0 | 58 | |
michael@0 | 59 | var attrs = { }; |
michael@0 | 60 | var misspelledAttrs = { |
michael@0 | 61 | "invalid": "spelling" |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | testTextAttrs(aID, 0, attrs, defAttrs, 0, 11); |
michael@0 | 65 | testTextAttrs(aID, 11, misspelledAttrs, defAttrs, 11, 17); |
michael@0 | 66 | testTextAttrs(aID, 17, attrs, defAttrs, 17, 18); |
michael@0 | 67 | testTextAttrs(aID, 18, misspelledAttrs, defAttrs, 18, 22); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | this.getID = function spelledTextInvoker_getID() |
michael@0 | 71 | { |
michael@0 | 72 | return "text attribute change for misspelled text"; |
michael@0 | 73 | } |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | /** |
michael@0 | 77 | * Do tests. |
michael@0 | 78 | */ |
michael@0 | 79 | //gA11yEventDumpID = "eventdump"; // debug stuff |
michael@0 | 80 | //gA11yEventDumpToConsole = true; |
michael@0 | 81 | |
michael@0 | 82 | var gQueue = null; |
michael@0 | 83 | function doTests() |
michael@0 | 84 | { |
michael@0 | 85 | // Synth focus before spellchecking turning on to make sure editor |
michael@0 | 86 | // gets a time for initialization. |
michael@0 | 87 | |
michael@0 | 88 | gQueue = new eventQueue(); |
michael@0 | 89 | gQueue.push(new synthFocus("input")); |
michael@0 | 90 | gQueue.push(new spelledTextInvoker("input")); |
michael@0 | 91 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 95 | addA11yLoadEvent(doTests); |
michael@0 | 96 | </script> |
michael@0 | 97 | </head> |
michael@0 | 98 | |
michael@0 | 99 | <body> |
michael@0 | 100 | |
michael@0 | 101 | <a target="_blank" |
michael@0 | 102 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=345759" |
michael@0 | 103 | title="Implement text attributes"> |
michael@0 | 104 | Mozilla Bug 345759 |
michael@0 | 105 | </a> |
michael@0 | 106 | <p id="display"></p> |
michael@0 | 107 | <div id="content" style="display: none"></div> |
michael@0 | 108 | <pre id="test"> |
michael@0 | 109 | </pre> |
michael@0 | 110 | |
michael@0 | 111 | <input id="input"/> |
michael@0 | 112 | |
michael@0 | 113 | <div id="eventdump"></div> |
michael@0 | 114 | </body> |
michael@0 | 115 | </html> |