tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug613807-1.html (2251B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <script src="/tests/SimpleTest/EventUtils.js"></script>
      5 </head>
      6 <body>
      7 <textarea id="t" rows="4" style="-moz-appearance: none"></textarea>
      8 <script>
      9  if (typeof(addLoadEvent) == 'undefined') {
     10    _newCallStack = function(path) {
     11      var rval = function () {
     12        var callStack = arguments.callee.callStack;
     13        for (var i = 0; i < callStack.length; i++) {
     14          if (callStack[i].apply(this, arguments) === false) {
     15            break;
     16          }
     17        }
     18        try {
     19          this[path] = null;
     20        } catch (e) {
     21          // pass
     22        }
     23      };
     24      rval.callStack = [];
     25      return rval;
     26    };
     27    function addLoadEvent(func) {
     28      var existing = window.onload;
     29      var regfunc = existing;
     30      if (!(typeof(existing) == 'function'
     31            && typeof(existing.callStack) == "object"
     32            && existing.callStack !== null)) {
     33        regfunc = _newCallStack("onload");
     34        if (typeof(existing) == 'function') {
     35          regfunc.callStack.push(existing);
     36        }
     37        window.onload = regfunc;
     38      }
     39      regfunc.callStack.push(func);
     40    };
     41  }
     42 
     43  addLoadEvent(function() {
     44    var area = document.getElementById('t');
     45    area.focus();
     46 
     47    var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);
     48 
     49    // input raw characters
     50    synthesizeCompositionChange(
     51      { composition:
     52        { string: "\u306D",
     53          clauses: [
     54            { length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }
     55          ]
     56        },
     57        caret: { start: 1, length: 0 }
     58      });
     59    synthesizeCompositionChange(
     60      { composition:
     61        { string: "\u306D\u3053",
     62          clauses: [
     63            { length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }
     64          ]
     65        },
     66        caret: { start: 2, length: 0 }
     67      });
     68 
     69    // convert
     70    synthesizeCompositionChange(
     71      { composition:
     72        { string: "\u732B",
     73          clauses: [
     74            { length: 1, attr: COMPOSITION_ATTR_SELECTED_CLAUSE }
     75          ]
     76        },
     77        caret: { start: 1, length: 0 }
     78      });
     79 
     80    // commit
     81    synthesizeComposition({ type: "compositioncommitasis" });
     82 
     83    document.body.clientWidth;
     84 
     85    // undo
     86    synthesizeKey("Z", {accelKey: true});
     87  });
     88 </script>
     89 </body>
     90 </html>