This file is indexed.

/usr/share/idl/firefox/nsIDOMWindowUtils.idl is in firefox-dev 11.0+build1-0ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is
 * Mozilla.org
 * Portions created by the Initial Developer are Copyright (C) 2004
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either of the GNU General Public License Version 2 or later (the "GPL"),
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"

/**
 * nsIDOMWindowUtils is intended for infrequently-used methods related
 * to the current nsIDOMWindow.  Some of the methods may require
 * elevated privileges; the method implementations should contain the
 * necessary security checks.  Access this interface by calling
 * getInterface on a DOMWindow.
 */

%{C++
#include "nsColor.h"
#include "nsRect.h"
#include "gfxContext.h"
%}

[ref] native nsConstRect(const nsRect);
native nscolor(nscolor);
[ptr] native gfxContext(gfxContext);
typedef unsigned long long nsViewID;

interface nsICycleCollectorListener;
interface nsIDOMNode;
interface nsIDOMNodeList;
interface nsIDOMElement;
interface nsIDOMHTMLCanvasElement;
interface nsIDOMEvent;
interface nsITransferable;
interface nsIQueryContentEventResult;
interface nsIDOMWindow;
interface nsIDOMBlob;
interface nsIDOMFile;
interface nsIFile;
interface nsIDOMTouch;

[scriptable, uuid(e01171b0-712a-47ce-8552-b7b2ef0a2507)]
interface nsIDOMWindowUtils : nsISupports {

  /**
   * Image animation mode of the window. When this attribute's value
   * is changed, the implementation should set all images in the window
   * to the given value. That is, when set to kDontAnimMode, all images
   * will stop animating. The attribute's value must be one of the
   * animationMode values from imgIContainer.
   * @note Images may individually override the window's setting after
   *       the window's mode is set. Therefore images given different modes
   *       since the last setting of the window's mode may behave
   *       out of line with the window's overall mode.
   * @note The attribute's value is the window's overall mode. It may
   *       for example continue to report kDontAnimMode after all images
   *       have subsequently been individually animated.
   * @note Only images immediately in this window are affected;
   *       this is not recursive to subwindows.
   * @see imgIContainer
   */
  attribute unsigned short imageAnimationMode;

  /**
   * Whether the charset of the window's current document has been forced by
   * the user.
   * Cannot be accessed from unprivileged context (not content-accessible)
   */
  readonly attribute boolean docCharsetIsForced;

  /**
   * Get current cursor type from this window
   * @return the current value of nsCursor
   */
  short getCursorType();

  /**
   * Function to get metadata associated with the window's current document
   * @param aName the name of the metadata.  This should be all lowercase.
   * @return the value of the metadata, or the empty string if it's not set
   *
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   */
  AString getDocumentMetadata(in AString aName);

  /**
   * Force an immediate redraw of this window.  The parameter specifies
   * the number of times to redraw, and the return value is the length,
   * in milliseconds, that the redraws took.  If aCount is not specified
   * or is 0, it is taken to be 1.
   */
  unsigned long redraw([optional] in unsigned long aCount);

  /**
   * Set the CSS viewport to be |widthPx| x |heightPx| in units of CSS
   * pixels, regardless of the size of the enclosing widget/view.
   * This will trigger reflow.
   *
   * The caller of this method must have UniversalXPConnect
   * privileges.
   */
  void setCSSViewport(in float aWidthPx, in float aHeightPx);

  /**
   * For any scrollable element, this allows you to override the
   * visible region and draw more than what is visible, which is
   * useful for asynchronous drawing. The "displayport" will be
   * <xPx, yPx, widthPx, heightPx> in units of CSS pixels,
   * regardless of the size of the enclosing container.  This
   * will *not* trigger reflow.
   *
   * For the root scroll area, pass in the root document element.
   * For scrollable elements, pass in the container element (for
   * instance, the element with overflow: scroll).
   *
   * <x, y> is relative to the top-left of what would normally be
   * the visible area of the element. This means that the pixels
   * rendered to the displayport take scrolling into account,
   * for example.
   *
   * It's legal to set a displayport that extends beyond the overflow
   * area in any direction (left/right/top/bottom).
   * 
   * It's also legal to set a displayport that extends beyond the
   * area's bounds.  No pixels are rendered outside the area bounds.
   *
   * The caller of this method must have UniversalXPConnect
   * privileges.
   */
  void setDisplayPortForElement(in float aXPx, in float aYPx,
                                in float aWidthPx, in float aHeightPx,
                                in nsIDOMElement aElement);

  /**
   * Get/set the resolution at which rescalable web content is drawn.
   * Currently this is only (some) thebes content.
   *
   * Setting a new resolution does *not* trigger reflow.  This API is
   * entirely separate from textZoom and fullZoom; a resolution scale
   * can be applied together with both textZoom and fullZoom.
   *
   * The effect of is API for gfx code to allocate more or fewer
   * pixels for rescalable content by a factor of |resolution| in
   * either or both dimensions.  setResolution() together with
   * setDisplayport() can be used to implement a non-reflowing
   * scale-zoom in concert with another entity that can draw with a
   * scale.  For example, to scale a content |window| inside a
   * <browser> by a factor of 2.0
   *
   *   window.setDisplayport(x, y, oldW / 2.0, oldH / 2.0);
   *   window.setResolution(2.0, 2.0);
   *   // elsewhere
   *   browser.setViewportScale(2.0, 2.0);
   *
   * The caller of this method must have UniversalXPConnect
   * privileges.
   */
  void setResolution(in float aXResolution, in float aYResolution);

  /** Synthesize a mouse event. The event types supported are:
   *    mousedown, mouseup, mousemove, mouseover, mouseout, contextmenu
   *
   * Events are sent in coordinates offset by aX and aY from the window.
   *
   * Note that additional events may be fired as a result of this call. For
   * instance, typically a click event will be fired as a result of a
   * mousedown and mouseup in sequence.
   *
   * Normally at this level of events, the mouseover and mouseout events are
   * only fired when the window is entered or exited. For inter-element
   * mouseover and mouseout events, a movemove event fired on the new element
   * should be sufficient to generate the correct over and out events as well.
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * The event is dispatched via the toplevel window, so it could go to any
   * window under the toplevel window, in some cases it could never reach this
   * window at all.
   *
   * @param aType event type
   * @param aX x offset in CSS pixels
   * @param aY y offset in CSS pixels
   * @param aButton button to synthesize
   * @param aClickCount number of clicks that have been performed
   * @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
   * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
   *                           during dispatch
   */
  void sendMouseEvent(in AString aType,
                      in float aX,
                      in float aY,
                      in long aButton,
                      in long aClickCount,
                      in long aModifiers,
                      [optional] in boolean aIgnoreRootScrollFrame);

  /** Synthesize a touch event. The event types supported are:
   *    touchstart, touchend, touchmove, and touchcancel
   *
   * Events are sent in coordinates offset by aX and aY from the window.
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * The event is dispatched via the toplevel window, so it could go to any
   * window under the toplevel window, in some cases it could never reach this
   * window at all.
   *
   * @param aType event type
   * @param xs array of offsets in CSS pixels for each touch to be sent
   * @param ys array of offsets in CSS pixels for each touch to be sent
   * @param rxs array of radii in CSS pixels for each touch to be sent
   * @param rys array of radii in CSS pixels for each touch to be sent
   * @param rotationAngles array of angles in degrees for each touch to be sent
   * @param forces array of forces (floats from 0 to 1) for each touch to be sent
   * @param count number of touches in this set
   * @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
   * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
   *                           during dispatch
   *
   * returns true if the page called prevent default on this touch event
   */
  boolean sendTouchEvent(in AString aType,
                         [array, size_is(count)] in PRUint32 aIdentifiers,
                         [array, size_is(count)] in PRInt32 aXs,
                         [array, size_is(count)] in PRInt32 aYs,
                         [array, size_is(count)] in PRUint32 aRxs,
                         [array, size_is(count)] in PRUint32 aRys,
                         [array, size_is(count)] in float aRotationAngles,
                         [array, size_is(count)] in float aForces,
                         in PRUint32 count,
                         in long aModifiers,
                         [optional] in boolean aIgnoreRootScrollFrame);

  /** The same as sendMouseEvent but ensures that the event is dispatched to
   *  this DOM window or one of its children.
   */
  void sendMouseEventToWindow(in AString aType,
                              in float aX,
                              in float aY,
                              in long aButton,
                              in long aClickCount,
                              in long aModifiers,
                              [optional] in boolean aIgnoreRootScrollFrame);

  /** Synthesize a mouse scroll event for a window. The event types supported
   *  are: 
   *    DOMMouseScroll
   *    MozMousePixelScroll
   *
   * Events are sent in coordinates offset by aX and aY from the window.
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * @param aType event type
   * @param aX x offset in CSS pixels
   * @param aY y offset in CSS pixels
   * @param aButton button to synthesize
   * @param aScrollFlags flag bits --- see nsMouseScrollFlags in nsGUIEvent.h
   * @param aDelta the direction and amount to scroll (in lines or pixels,
   * depending on the event type)
   * @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
   */
  void sendMouseScrollEvent(in AString aType,
                            in float aX,
                            in float aY,
                            in long aButton,
                            in long aScrollFlags,
                            in long aDelta,
                            in long aModifiers);

  /**
   * Synthesize a key event to the window. The event types supported are:
   *   keydown, keyup, keypress
   *
   * Key events generally end up being sent to the focused node.
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * @param aType event type
   * @param aKeyCode key code
   * @param aCharCode character code
   * @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
   * @param aPreventDefault if true, preventDefault() the event before dispatch
   *
   * @return false if the event had preventDefault() called on it,
   *               true otherwise.  In other words, true if and only if the
   *               default action was taken.
   */
  boolean sendKeyEvent(in AString aType,
                       in long aKeyCode,
                       in long aCharCode,
                       in long aModifiers,
                       [optional] in boolean aPreventDefault);

  /**
   * See nsIWidget::SynthesizeNativeKeyEvent
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   */
  void sendNativeKeyEvent(in long aNativeKeyboardLayout,
                          in long aNativeKeyCode,
                          in long aModifierFlags,
                          in AString aCharacters,
                          in AString aUnmodifiedCharacters);

  /**
   * See nsIWidget::SynthesizeNativeMouseEvent
   *
   * Will be called on the widget that contains aElement.
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   */
  void sendNativeMouseEvent(in long aScreenX,
                            in long aScreenY,
                            in long aNativeMessage,
                            in long aModifierFlags,
                            in nsIDOMElement aElement);

  /**
   * See nsIWidget::ActivateNativeMenuItemAt
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   */
  void activateNativeMenuItemAt(in AString indexString);

  /**
   * See nsIWidget::ForceUpdateNativeMenuAt
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   */
  void forceUpdateNativeMenuAt(in AString indexString);

  /**
   * Focus the element aElement. The element should be in the same document
   * that the window is displaying. Pass null to blur the element, if any,
   * that currently has focus, and focus the document.
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * @param aElement the element to focus
   *
   * Do not use this method. Just use element.focus if available or
   * nsIFocusManager::SetFocus instead.
   *
   */
  void focus(in nsIDOMElement aElement);

  /**
   * Force a garbage collection followed by a cycle collection.
   *
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges in non-debug builds. Available to all callers in debug builds.
   *
   * @param aListener listener that receives information about the CC graph
   *                  (see @mozilla.org/cycle-collector-logger;1 for a logger
   *                   component)
   */
  void garbageCollect([optional] in nsICycleCollectorListener aListener);

  /**
   * Force a cycle collection without garbage collection.
   *
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges in non-debug builds. Available to all callers in debug builds.
   *
   * @param aListener listener that receives information about the CC graph
   *                  (see @mozilla.org/cycle-collector-logger;1 for a logger
   *                   component)
   */
  void cycleCollect([optional] in nsICycleCollectorListener aListener);

  /**
   * Force processing of any queued paints
   */

  void processUpdates();

  /** Synthesize a simple gesture event for a window. The event types
   *  supported are: MozSwipeGesture, MozMagnifyGestureStart,
   *  MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart,
   *  MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture, and
   *  MozTapGesture.
   *
   * Cannot be accessed from unprivileged context (not
   * content-accessible) Will throw a DOM security error if called
   * without UniversalXPConnect privileges.
   *
   * @param aType event type
   * @param aX x offset in CSS pixels
   * @param aY y offset in CSS pixels
   * @param aDirection direction, using constants defined in nsIDOMSimpleGestureEvent
   * @param aDelta  amount of magnification or rotation for magnify and rotation events
   * @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
   */
  void sendSimpleGestureEvent(in AString aType,
                              in float aX,
                              in float aY,
                              in unsigned long aDirection,
                              in double aDelta,
                              in long aModifiers);

  /**
   * Retrieve the element at point aX, aY in the window's document.
   *
   * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll
   *        frame when retrieving the element. If false, this method returns
   *        null for coordinates outside of the viewport.
   * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
   */
  nsIDOMElement elementFromPoint(in float aX,
                                 in float aY,
                                 in boolean aIgnoreRootScrollFrame,
                                 in boolean aFlushLayout);

  /**
   * Retrieve all nodes that intersect a rect in the window's document.
   *
   * @param aX x reference for the rectangle in CSS pixels
   * @param aY y reference for the rectangle in CSS pixels
   * @param aTopSize How much to expand up the rectangle
   * @param aRightSize How much to expand right the rectangle
   * @param aBottomSize How much to expand down the rectangle
   * @param aLeftSize How much to expand left the rectangle
   * @param aIgnoreRootScrollFrame whether or not to ignore the root scroll
   *        frame when retrieving the element. If false, this method returns
   *        null for coordinates outside of the viewport.
   * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
   */
  nsIDOMNodeList nodesFromRect(in float aX,
                               in float aY,
                               in float aTopSize, 
                               in float aRightSize,
                               in float aBottomSize,
                               in float aLeftSize,
                               in boolean aIgnoreRootScrollFrame,
                               in boolean aFlushLayout);

  /**
   * Compare the two canvases, returning the number of differing pixels and
   * the maximum difference in a channel.  This will throw an error if
   * the dimensions of the two canvases are different.
   *
   * This method requires UniversalXPConnect privileges.
   */
  PRUint32 compareCanvases(in nsIDOMHTMLCanvasElement aCanvas1,
                           in nsIDOMHTMLCanvasElement aCanvas2,
                           out unsigned long aMaxDifference);

  /**
   * Returns true if a MozAfterPaint event has been queued but not yet
   * fired.
   */
  readonly attribute boolean isMozAfterPaintPending;

  /**
   * Suppresses/unsuppresses user initiated event handling in window's document
   * and subdocuments.
   *
   * @throw NS_ERROR_DOM_SECURITY_ERR if called without UniversalXPConnect
   *        privileges and NS_ERROR_FAILURE if window doesn't have a document.
   */
  void suppressEventHandling(in boolean aSuppress);

  void clearMozAfterPaintEvents();

  /**
   * Disable or enable non synthetic test mouse events on *all* windows.
   *
   * Cannot be accessed from unprivileged context (not content-accessible).
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * @param aDisable  If true, disable all non synthetic test mouse events
   *               on all windows.  Otherwise, enable them.
   */
  void disableNonTestMouseEvents(in boolean aDisable);

  /**
   * Returns the scroll position of the window's currently loaded document.
   *
   * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
   * @see nsIDOMWindow::scrollX/Y
   */
  void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY);

  /**
   * Get IME open state. TRUE means 'Open', otherwise, 'Close'.
   * This property works only when IMEEnabled is IME_STATUS_ENABLED.
   */
  readonly attribute boolean IMEIsOpen;

  /**
   * WARNING: These values must be same as nsIWidget's values.
   */

  /**
   * DISABLED means users cannot use IME completely.
   * Note that this state is *not* same as |ime-mode: disabled;|.
   */
  const unsigned long IME_STATUS_DISABLED = 0;

  /**
   * ENABLED means users can use all functions of IME. This state is same as
   * |ime-mode: normal;|.
   */
  const unsigned long IME_STATUS_ENABLED  = 1;

  /**
   * PASSWORD means users cannot use most functions of IME. But on GTK2,
   * users can use "Simple IM" which only supports dead key inputting.
   * The behavior is same as the behavior of the native password field.
   * This state is same as |ime-mode: disabled;|.
   */
  const unsigned long IME_STATUS_PASSWORD = 2;

  /**
   * PLUGIN means a plug-in has focus. At this time we should not touch to
   * controlling the IME state.
   */
  const unsigned long IME_STATUS_PLUGIN   = 3;

  /**
   * Get IME status, see above IME_STATUS_* definitions.
   */
  readonly attribute unsigned long IMEStatus;

  /**
   * Get the number of screen pixels per CSS pixel.
   */
  readonly attribute float screenPixelsPerCSSPixel;

  /**
   * Dispatches aEvent via the nsIPresShell object of the window's document.
   * The event is dispatched to aTarget, which should be an object
   * which implements nsIContent interface (#element, #text, etc).
   *
   * Cannot be accessed from unprivileged context (not
   * content-accessible) Will throw a DOM security error if called
   * without UniversalXPConnect privileges.
   *
   * @note Event handlers won't get aEvent as parameter, but a similar event.
   *       Also, aEvent should not be reused.
   */
  boolean dispatchDOMEventViaPresShell(in nsIDOMNode aTarget,
                                       in nsIDOMEvent aEvent,
                                       in boolean aTrusted);

  /**
   * Returns the real classname (possibly of the mostly-transparent security
   * wrapper) of aObj.
   */
  [implicit_jscontext] string getClassName(in jsval aObject);

  /**
   * Generate a content command event.
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * @param aType Type of command content event to send.  Can be one of "cut",
   *        "copy", "paste", "delete", "undo", "redo", or "pasteTransferable".
   * @param aTransferable an instance of nsITransferable when aType is
   *        "pasteTransferable"
   */
  void sendContentCommandEvent(in AString aType,
                               [optional] in nsITransferable aTransferable);

  /**
   * Synthesize a composition event to the window.
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * @param aType     The event type: "compositionstart", "compositionend" or
   *                  "compositionupdate".
   * @param aData     The data property value.  Note that this isn't applied
   *                  for compositionstart event because its value is the
   *                  selected text which is automatically computed.
   * @param aLocale   The locale property value.
   */
  void sendCompositionEvent(in AString aType,
                            in AString aData,
                            in AString aLocale);

  /**
   * Synthesize a text event to the window.
   *
   * Cannot be accessed from unprivileged context (not content-accessible)
   * Will throw a DOM security error if called without UniversalXPConnect
   * privileges.
   *
   * Currently, this method doesn't support 4 or more clauses composition
   * string.
   *
   * @param aCompositionString  composition string
   * @param a*ClauseLengh       the length of nth clause, set 0 when you
   *                            don't need second or third clause.
   * @param a*ClauseAttr        the attribute of nth clause, uese following
   *                            const values.
   * @param aCaretStart         the caret position in the composition string,
   *                            if you set negative value, this method don't
   *                            set the caret position to the event.
   * @param aCaretLength        the caret length, if this is one or more,
   *                            the caret will be wide caret, otherwise,
   *                            it's collapsed.
   *                            XXX nsEditor doesn't support wide caret yet.
   */

  // NOTE: These values must be same to NS_TEXTRANGE_* in nsGUIEvent.h

  const unsigned long COMPOSITION_ATTR_RAWINPUT              = 0x02;
  const unsigned long COMPOSITION_ATTR_SELECTEDRAWTEXT       = 0x03;
  const unsigned long COMPOSITION_ATTR_CONVERTEDTEXT         = 0x04;
  const unsigned long COMPOSITION_ATTR_SELECTEDCONVERTEDTEXT = 0x05;

  void sendTextEvent(in AString aCompositionString,
                     in long aFirstClauseLength,
                     in unsigned long aFirstClauseAttr,
                     in long aSecondClauseLength,
                     in unsigned long aSecondClauseAttr,
                     in long aThirdClauseLength,
                     in unsigned long aThirdClauseAttr,
                     in long aCaretStart,
                     in long aCaretLength);

  /**
   * Synthesize a query content event.
   *
   * @param aType  On of the following const values.  And see also each comment
   *               for the other parameters and the result.
   */
  nsIQueryContentEventResult sendQueryContentEvent(in unsigned long aType,
                                                   in unsigned long aOffset,
                                                   in unsigned long aLength,
                                                   in long aX,
                                                   in long aY);

  // NOTE: following values are same as NS_QUERY_* in nsGUIEvent.h

  /**
   * QUERY_SELECTED_TEXT queries the first selection range's information.
   *
   * @param aOffset   Not used.
   * @param aLength   Not used.
   * @param aX        Not used.
   * @param aY        Not used.
   *
   * @return offset, reversed and text properties of the result are available.
   */
  const unsigned long QUERY_SELECTED_TEXT                       = 3200;

  /**
   * QUERY_TEXT_CONTENT queries the text at the specified range.
   *
   * @param aOffset   The first character's offset.  0 is the first character.
   * @param aLength   The length of getting text.  If the aLength is too long,
   *                  the result text is shorter than this value.
   * @param aX        Not used.
   * @param aY        Not used.
   *
   * @return text property of the result is available.
   */
  const unsigned long QUERY_TEXT_CONTENT                        = 3201;

  /**
   * QUERY_CARET_RECT queries the (collapsed) caret rect of the offset.
   * If the actual caret is there at the specified offset, this returns the
   * actual caret rect.  Otherwise, this guesses the caret rect from the
   * metrics of the text.
   *
   * @param aOffset   The caret offset.  0 is the left side of the first
   *                  caracter in LTR text.
   * @param aLength   Not used.
   * @param aX        Not used.
   * @param aY        Not used.
   *
   * @return left, top, width and height properties of the result are available.
   *         The left and the top properties are offset in the client area of
   *         the DOM window.
   */
  const unsigned long QUERY_CARET_RECT                          = 3203;

  /**
   * QUERY_TEXT_RECT queries the specified text's rect.
   *
   * @param aOffset   The first character's offset.  0 is the first character.
   * @param aLength   The length of getting text.  If the aLength is too long,
   *                  the extra length is ignored.
   * @param aX        Not used.
   * @param aY        Not used.
   *
   * @return left, top, width and height properties of the result are available.
   *         The left and the top properties are offset in the client area of
   *         the DOM window.
   */
  const unsigned long QUERY_TEXT_RECT                           = 3204;

  /**
   * QUERY_TEXT_RECT queries the focused editor's rect.
   *
   * @param aOffset   Not used.
   * @param aLength   Not used.
   * @param aX        Not used.
   * @param aY        Not used.
   *
   * @return left, top, width and height properties of the result are available.
   */
  const unsigned long QUERY_EDITOR_RECT                         = 3205;

  /**
   * QUERY_CHARACTER_AT_POINT queries the character information at the
   * specified point.  The point is offset in the window.
   * NOTE: If there are some panels at the point, this method send the query
   * event to the panel's widget automatically.
   *
   * @param aOffset   Not used.
   * @param aLength   Not used.
   * @param aX        X offset in the widget.
   * @param aY        Y offset in the widget.
   *
   * @return offset, notFound, left, top, width and height properties of the
   *         result are available.
   */
  const unsigned long QUERY_CHARACTER_AT_POINT                  = 3208;

  /**
   * Synthesize a selection set event to the window.
   *
   * This sets the selection as the specified information.
   *
   * @param aOffset  The caret offset of the selection start.
   * @param aLength  The length of the selection.  If this is too long, the
   *                 extra length is ignored.
   * @param aReverse If true, the selection set from |aOffset + aLength| to
   *                 |aOffset|.  Otherwise, set from |aOffset| to
   *                 |aOffset + aLength|.
   * @return True, if succeeded.  Otherwise, false.
   */
  boolean sendSelectionSetEvent(in unsigned long aOffset,
                                in unsigned long aLength,
                                in boolean aReverse);

  /**
   * Perform the equivalent of:
   *   window.getComputedStyle(aElement, aPseudoElement).
   *     getPropertyValue(aPropertyName)
   * except that, when the link whose presence in history is allowed to
   * influence aElement's style is visited, get the value the property
   * would have if allowed all properties to change as a result of
   * :visited selectors (except for cases where getComputedStyle uses
   * data from the frame).
   *
   * This is easier to implement than adding our property restrictions
   * to this API, and is sufficient for the present testing
   * requirements (which are essentially testing 'color').
   */
  AString getVisitedDependentComputedStyle(in nsIDOMElement aElement,
                                           in AString aPseudoElement,
                                           in AString aPropertyName);

  /**
   * Returns the parent of obj.
   *
   * @param obj The JavaScript object whose parent is to be gotten.
   * @return the parent.
   */
  [implicit_jscontext] jsval getParent(in jsval obj);

  /**
   * Get the id of the outer window of this window.  This will never throw.
   */
  readonly attribute unsigned long long outerWindowID;

  /**
   * Get the id of the current inner window of this window.  If there
   * is no current inner window, throws NS_ERROR_NOT_AVAILABLE.
   */
  readonly attribute unsigned long long currentInnerWindowID;

  /**
   * Put the window into a state where scripts are frozen and events
   * suppressed, for use when the window has launched a modal prompt.
   */
  [noscript] void enterModalState();

  /**
   * Resume normal window state, where scripts can run and events are
   * delivered.
   */
  [noscript] void leaveModalState();

  /**
   * Same as enterModalState, but returns the window associated with the
   * current JS context.
   */
  nsIDOMWindow enterModalStateWithWindow();

  /**
   * Same as leaveModalState, but takes a window associated with the active
   * context when enterModalStateWithWindow was called. The currently context
   * might be different at the moment (see bug 621764).
   */
  void leaveModalStateWithWindow(in nsIDOMWindow aWindow);

  /**
   * Is the window is in a modal state? [See enterModalState()]
   */
  [noscript] boolean isInModalState();

  /**
   * Suspend/resume timeouts on this window and its descendant windows.
   */
  void suspendTimeouts();
  void resumeTimeouts();

  /**
   * Set the network status to online from the Offline mode error page.
   *
   * The caller of this method must be about:neterror.
   */
  void goOnline();

  /**
   * What type of layer manager the widget associated with this window is
   * using. "Basic" is unaccelerated; other types are accelerated. Throws an
   * error if there is no widget associated with this window.
   */
  readonly attribute AString layerManagerType;

  /**
   * The DPI of the display
   */
  readonly attribute float displayDPI;

  /**
   * Return the outer window with the given ID, if any.  Can return null.
   */
  nsIDOMWindow getOuterWindowWithId(in unsigned long long aOuterWindowID);

  [noscript] void RenderDocument(in nsConstRect aRect,
                                 in PRUint32 aFlags,
                                 in nscolor aBackgroundColor,
                                 in gfxContext aThebesContext);

  /**
   * advanceTimeAndRefresh allows the caller to take over the refresh
   * driver timing for a window.  A call to advanceTimeAndRefresh does
   * three things:
   *  (1) It marks the refresh driver for this presentation so that it
   *      no longer refreshes on its own, but is instead driven entirely
   *      by the caller (except for the refresh that happens when a
   *      document comes out of the bfcache).
   *  (2) It advances the refresh driver's current refresh time by the
   *      argument given.  Negative advances are permitted.
   *  (3) It does a refresh (i.e., notifies refresh observers) at that
   *      new time.
   *
   * Note that this affects other connected docshells of the same type
   * in the same docshell tree, such as parent frames.
   *
   * When callers have completed their use of advanceTimeAndRefresh,
   * they must call restoreNormalRefresh.
   */
  void advanceTimeAndRefresh(in long long aMilliseconds);

  /**
   * Undoes the effects of advanceTimeAndRefresh.
   */
  void restoreNormalRefresh();

  /**
   * Method for testing nsStyleAnimation::ComputeDistance.
   *
   * Returns the distance between the two values as reported by
   * nsStyleAnimation::ComputeDistance for the given element and
   * property.
   */
  double computeAnimationDistance(in nsIDOMElement element,
                                  in AString property,
                                  in AString value1,
                                  in AString value2);

  /**
   * Wrap an nsIFile in an nsIDOMFile
   */
  nsIDOMFile wrapDOMFile(in nsIFile aFile);

  /**
   * Get the type of the currently focused html input, if any.
   */
  readonly attribute string focusedInputType;

  /**
   * Given a view ID from the compositor process, retrieve the element
   * associated with a view. For scrollpanes for documents, the root
   * element of the document is returned.
   */
  nsIDOMElement findElementWithViewId(in nsViewID aId);

  /**
   * Checks the layer tree for this window and returns true
   * if all layers have transforms that are translations by integers,
   * no leaf layers overlap, and the union of the leaf layers is exactly
   * the bounds of the window. Always returns true in non-DEBUG builds.
   */
  boolean leafLayersPartitionWindow();

  /**
   * true if the (current inner) window may have event listeners for touch events.
   */
  readonly attribute boolean mayHaveTouchEventListeners;
 
  /**
   * Check if any ThebesLayer painting has been done for this element,
   * clears the painted flags if they have.
   */
  boolean checkAndClearPaintedState(in nsIDOMElement aElement);

  /*
   * Get internal id of the stored blob.
   */
  long long getFileId(in nsIDOMBlob aBlob);

  /*
   * Get file ref count info for given database and file id.
   *
   */
  boolean getFileReferences(in AString aDatabaseName, in long long aId,
                            [optional] out long aRefCnt,
                            [optional] out long aDBRefCnt,
                            [optional] out long aSliceRefCnt);

  /**
   * Begin opcode-level profiling of all JavaScript execution in the window's
   * runtime.
   */
  void startPCCountProfiling();

  /**
   * Stop opcode-level profiling of JavaScript execution in the runtime, and
   * collect all counts for use by getPCCount methods.
   */
  void stopPCCountProfiling();

  /**
   * Purge collected PC counters.
   */
  void purgePCCounts();

  /**
   * Get the number of scripts with opcode-level profiling information.
   */
  long getPCCountScriptCount();

  /**
   * Get a JSON string for a short summary of a script and the PC counts
   * accumulated for it.
   */
  AString getPCCountScriptSummary(in long script);

  /**
   * Get a JSON string with full information about a profiled script,
   * including the decompilation of the script and placement of decompiled
   * operations within it, and PC counts for each operation.
   */
  AString getPCCountScriptContents(in long script);

  /**
   * Returns true if painting is suppressed for this window and false
   * otherwise.
   */
  readonly attribute boolean paintingSuppressed;
};