-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathns_xulrunner_20.idl
1686 lines (1453 loc) · 63.5 KB
/
ns_xulrunner_20.idl
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
#include "ns_generic.idl"
///////////////////////////////////////////////////////////////////////////////
// nsIDOM3Document
///////////////////////////////////////////////////////////////////////////////
interface nsIDOMDOMConfiguration;
/**
* For more information on this interface, please see
* http://www.w3.org/TR/DOM-Level-3-Core/
*/
[scriptable, uuid(c0568f22-b9d5-427a-9642-b6a797edc5cd)]
interface nsIDOM3Document : nsISupports
{
// Introduced in DOM Level 3:
readonly attribute DOMString inputEncoding;
// Introduced in DOM Level 3:
readonly attribute DOMString xmlEncoding;
// Introduced in DOM Level 3:
attribute boolean xmlStandalone;
// raises(DOMException) on setting
// Introduced in DOM Level 3:
attribute DOMString xmlVersion;
// raises(DOMException) on setting
// Introduced in DOM Level 3:
attribute boolean strictErrorChecking;
// Introduced in DOM Level 3:
attribute DOMString documentURI;
// Introduced in DOM Level 3:
nsIDOMNode adoptNode(in nsIDOMNode source)
raises(DOMException);
// Introduced in DOM Level 3:
readonly attribute nsIDOMDOMConfiguration domConfig;
// Introduced in DOM Level 3:
void normalizeDocument();
// Introduced in DOM Level 3:
nsIDOMNode renameNode(in nsIDOMNode node,
in DOMString namespaceURI,
in DOMString qualifiedName)
raises(DOMException);
};
///////////////////////////////////////////////////////////////////////////////
// nsIDOMWindow2
///////////////////////////////////////////////////////////////////////////////
interface nsIDOMEventTarget;
interface nsIDOMOfflineResourceList;
interface nsIDOMBlob;
[scriptable, uuid(efff0d88-3b94-4375-bdeb-676a847ecd7d)]
interface nsIDOMWindow2 : nsIDOMWindow
{
/**
* Get the window root for this window. This is useful for hooking
* up event listeners to this window and every other window nested
* in the window root.
*/
[noscript] readonly attribute nsIDOMEventTarget windowRoot;
/**
* Get the application cache object for this window.
*/
readonly attribute nsIDOMOfflineResourceList applicationCache;
/**
* Deprecated, but can't remove yet since we don't want to change interfaces.
*/
[noscript] DOMString createBlobURL(in nsIDOMBlob blob);
[noscript] void revokeBlobURL(in DOMString URL);
};
///////////////////////////////////////////////////////////////////////////////
// nsITransfer
///////////////////////////////////////////////////////////////////////////////
interface nsIURI;
interface nsICancelable;
interface nsIMIMEInfo;
interface nsILocalFile;
[scriptable, uuid(3a982955-dc44-422e-8734-8462bf8d2121)]
interface nsITransfer : nsIWebProgressListener2 {
/**
* Initializes the transfer with certain properties. This function must
* be called prior to accessing any properties on this interface.
*
* @param aSource The source URI of the transfer. Must not be null.
*
* @param aTarget The target URI of the transfer. Must not be null.
*
* @param aDisplayName The user-readable description of the transfer.
* Can be empty.
*
* @param aMIMEInfo The MIME info associated with the target,
* including MIME type and helper app when appropriate.
* This parameter is optional.
*
* @param startTime Time when the download started (ie, when the first
* response from the server was received)
* XXX presumably wbp and exthandler do this differently
*
* @param aTempFile The location of a temporary file; i.e. a file in which
* the received data will be stored, but which is not
* equal to the target file. (will be moved to the real
* target by the caller, when the download is finished)
* May be null.
*
* @param aCancelable An object that can be used to abort the download.
* Must not be null.
* Implementations are expected to hold a strong
* reference to this object until the download is
* finished, at which point they should release the
* reference.
*/
void init(in nsIURI aSource,
in nsIURI aTarget,
in AString aDisplayName,
in nsIMIMEInfo aMIMEInfo,
in PRTime startTime,
in nsILocalFile aTempFile,
in nsICancelable aCancelable);
};
///////////////////////////////////////////////////////////////////////////////
// nsIMIMEInfo
///////////////////////////////////////////////////////////////////////////////
interface nsIURI;
interface nsIFile;
interface nsIUTF8StringEnumerator;
interface nsIHandlerApp;
interface nsIArray;
interface nsIMutableArray;
interface nsIInterfaceRequestor;
typedef long nsHandlerInfoAction;
/**
* nsIHandlerInfo gives access to the information about how a given protocol
* scheme or MIME-type is handled.
*/
[scriptable, uuid(325e56a7-3762-4312-aec7-f1fcf84b4145)]
interface nsIHandlerInfo : nsISupports {
/**
* The type of this handler info. For MIME handlers, this is the MIME type.
* For protocol handlers, it's the scheme.
*
* @return String representing the type.
*/
readonly attribute ACString type;
/**
* A human readable description of the handler type
*/
attribute AString description;
/**
* The application the user has said they want associated with this content
* type. This is not always guaranteed to be set!!
*/
attribute nsIHandlerApp preferredApplicationHandler;
/**
* Applications that can handle this content type.
*
* The list will include the preferred handler, if any. Elements of this
* array are nsIHandlerApp objects, and this attribute will always reference
* an array, whether or not there are any possible handlers. If there are
* no possible handlers, the array will contain no elements, so just check
* its length (nsIArray::length) to see if there are any possible handlers.
*/
readonly attribute nsIMutableArray possibleApplicationHandlers;
/**
* Indicates whether a default application handler exists,
* i.e. whether launchWithFile with action = useSystemDefault is possible
* and defaultDescription will contain usable information.
*/
readonly attribute boolean hasDefaultHandler;
/**
* A pretty name description of the associated default application. Only
* usable if hasDefaultHandler is true.
*/
readonly attribute AString defaultDescription;
/**
* Launches the application with the specified URI, in a way that
* depends on the value of preferredAction. preferredAction must be
* useHelperApp or useSystemDefault.
*
* @note Only the URI scheme is used to determine how to launch. This is
* essentially a pass-by-value operation. This means that in the case of
* a file: URI, the handler that is registered for file: will be launched
* and our code will not make any decision based on the content-type or
* extension, though the invoked file: handler is free to do so.
*
* @param aURI
* The URI to launch this application with
*
* @param aWindowContext
* The window to parent the dialog against, and, if a web handler
* is chosen, it is loaded in this window as well. See
* nsIHandlerApp.launchWithURI for more details.
*
* @throw NS_ERROR_INVALID_ARG if preferredAction is not valid for this
* call. Other exceptions may be thrown.
*/
void launchWithURI(in nsIURI aURI,
[optional] in nsIInterfaceRequestor aWindowContext);
/**
* preferredAction is how the user specified they would like to handle
* this content type: save to disk, use specified helper app, use OS
* default handler or handle using navigator; possible value constants
* listed below
*/
attribute nsHandlerInfoAction preferredAction;
const long saveToDisk = 0;
/**
* Used to indicate that we know nothing about what to do with this. You
* could consider this to be not initialized.
*/
const long alwaysAsk = 1;
const long useHelperApp = 2;
const long handleInternally = 3;
const long useSystemDefault = 4;
/**
* alwaysAskBeforeHandling: if true, we should always give the user a
* dialog asking how to dispose of this content.
*/
attribute boolean alwaysAskBeforeHandling;
};
/**
* nsIMIMEInfo extends nsIHandlerInfo with a bunch of information specific to
* MIME content-types. There is a one-to-many relationship between MIME types
* and file extensions. This means that a MIMEInfo object may have multiple
* file extensions associated with it. However, the reverse is not true.
*
* MIMEInfo objects are generally retrieved from the MIME Service
* @see nsIMIMEService
*/
[scriptable, uuid(1c21acef-c7a1-40c6-9d40-a20480ee53a1)]
interface nsIMIMEInfo : nsIHandlerInfo {
/**
* Gives you an array of file types associated with this type.
*
* @return Number of elements in the array.
* @return Array of extensions.
*/
nsIUTF8StringEnumerator getFileExtensions();
/**
* Set File Extensions. Input is a comma delimited list of extensions.
*/
void setFileExtensions(in AUTF8String aExtensions);
/**
* Returns whether or not the given extension is
* associated with this MIME info.
*
* @return TRUE if the association exists.
*/
boolean extensionExists(in AUTF8String aExtension);
/**
* Append a given extension to the set of extensions
*/
void appendExtension(in AUTF8String aExtension);
/**
* Returns the first extension association in
* the internal set of extensions.
*
* @return The first extension.
*/
attribute AUTF8String primaryExtension;
/**
* The MIME type of this MIMEInfo.
*
* @return String representing the MIME type.
*
* @deprecated use nsIHandlerInfo::type instead.
*/
readonly attribute ACString MIMEType;
/**
* Returns whether or not these two nsIMIMEInfos are logically
* equivalent.
*
* @returns PR_TRUE if the two are considered equal
*/
boolean equals(in nsIMIMEInfo aMIMEInfo);
/**
* Returns a list of nsILocalHandlerApp objects containing
* handlers associated with this mimeinfo. Implemented per
* platform using information in this object to generate the
* best list. Typically used for an "open with" style user
* option.
*
* @return nsIArray of nsILocalHandlerApp
*/
readonly attribute nsIArray possibleLocalHandlers;
/**
* Launches the application with the specified file, in a way that
* depends on the value of preferredAction. preferredAction must be
* useHelperApp or useSystemDefault.
*
* @param aFile The file to launch this application with.
*
* @throw NS_ERROR_INVALID_ARG if action is not valid for this function.
* Other exceptions may be thrown.
*/
void launchWithFile(in nsIFile aFile);
};
///////////////////////////////////////////////////////////////////////////////
// nsIDOMHTMLInputElement
///////////////////////////////////////////////////////////////////////////////
interface nsIControllers;
interface nsIDOMFileList;
interface nsIDOMValidityState;
/**
* The nsIDOMHTMLInputElement interface is the interface to a [X]HTML
* input element.
*
* This interface is trying to follow the DOM Level 2 HTML specification:
* http://www.w3.org/TR/DOM-Level-2-HTML/
*
* with changes from the work-in-progress WHATWG HTML specification:
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(0805059d-f18f-4095-ae6b-0bf6df80b7b8)]
interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
{
attribute DOMString accept;
attribute DOMString alt;
attribute DOMString autocomplete;
attribute boolean autofocus;
attribute boolean defaultChecked;
attribute boolean checked;
attribute boolean disabled;
readonly attribute nsIDOMHTMLFormElement form;
attribute DOMString formAction;
attribute DOMString formEnctype;
attribute DOMString formMethod;
attribute boolean formNoValidate;
attribute DOMString formTarget;
readonly attribute nsIDOMFileList files;
attribute boolean indeterminate;
readonly attribute nsIDOMHTMLElement list;
attribute long maxLength;
attribute boolean multiple;
attribute DOMString name;
attribute DOMString pattern;
attribute DOMString placeholder;
attribute boolean readOnly;
attribute boolean required;
attribute DOMString accessKey;
attribute DOMString align;
attribute unsigned long size;
attribute DOMString src;
attribute DOMString type;
attribute DOMString defaultValue;
attribute DOMString value;
// The following lines are parte of the constraint validation API, see:
// http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
readonly attribute boolean willValidate;
readonly attribute nsIDOMValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(in DOMString error);
void select();
attribute long selectionStart;
attribute long selectionEnd;
void setSelectionRange(in long selectionStart, in long selectionEnd);
attribute long tabIndex;
attribute DOMString useMap;
readonly attribute nsIControllers controllers;
readonly attribute long textLength;
void mozGetFileNameArray([optional] out unsigned long aLength,
[array,size_is(aLength), retval] out wstring aFileNames);
void mozSetFileNameArray([array,size_is(aLength)] in wstring aFileNames,
in unsigned long aLength);
/**
* This non-standard method prevents to check types manually to know if the
* element is a text field.
*/
boolean mozIsTextField(in boolean aExcludePassword);
void blur();
void focus();
void click();
};
///////////////////////////////////////////////////////////////////////////////
// nsIDOMHTMLButtonElement
///////////////////////////////////////////////////////////////////////////////
interface nsIDOMValidityState;
[scriptable, uuid(bcae78a1-9f9b-46bf-abb5-a3fe410d97ae)]
interface nsIDOMHTMLButtonElement : nsIDOMHTMLElement
{
attribute boolean autofocus;
attribute boolean disabled;
readonly attribute nsIDOMHTMLFormElement form;
attribute DOMString formAction;
attribute DOMString formEnctype;
attribute DOMString formMethod;
attribute boolean formNoValidate;
attribute DOMString formTarget;
attribute DOMString name;
attribute DOMString type;
attribute DOMString value;
attribute DOMString accessKey;
attribute long tabIndex;
void blur();
void focus();
void click();
// The following lines are parte of the constraint validation API, see:
// http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
readonly attribute boolean willValidate;
readonly attribute nsIDOMValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(in DOMString error);
};
interface nsIDOMHTMLFormElement;
///////////////////////////////////////////////////////////////////////////////
// nsIDOMHTMLAnchorElement
///////////////////////////////////////////////////////////////////////////////
[scriptable, uuid(4e237175-3628-4dc8-892f-5270edc3c71a)]
interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement
{
attribute DOMString href;
attribute DOMString target;
attribute DOMString ping;
attribute DOMString rel;
attribute DOMString hreflang;
attribute DOMString type;
/**
* An alias for the textContent attribute.
*/
[Null(Stringify)]
attribute DOMString text;
// URL decomposition IDL attributes
attribute DOMString protocol;
attribute DOMString host;
attribute DOMString hostname;
attribute DOMString port;
attribute DOMString pathname;
attribute DOMString search;
attribute DOMString hash;
attribute DOMString accessKey;
attribute DOMString charset;
attribute DOMString coords;
attribute DOMString name;
attribute DOMString rev;
attribute DOMString shape;
attribute long tabIndex;
DOMString toString();
void blur();
void focus();
};
///////////////////////////////////////////////////////////////////////////////
// nsIDOMHTMLSelectElement
///////////////////////////////////////////////////////////////////////////////
interface nsIDOMValidityState;
interface nsIDOMHTMLOptionsCollection;
[scriptable, uuid(e3c6d960-972c-4a5e-a8f4-6ca65d578abf)]
interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement
{
attribute boolean autofocus;
attribute boolean disabled;
readonly attribute nsIDOMHTMLFormElement form;
attribute boolean multiple;
attribute DOMString name;
attribute long size;
readonly attribute DOMString type;
readonly attribute nsIDOMHTMLOptionsCollection options;
attribute unsigned long length;
nsIDOMNode item(in unsigned long index);
nsIDOMNode namedItem(in DOMString name);
void add(in nsIDOMHTMLElement element,
in nsIDOMHTMLElement before)
raises(DOMException);
void remove(in long index);
attribute long selectedIndex;
attribute DOMString value;
attribute long tabIndex;
void blur();
void focus();
// The following lines are parte of the constraint validation API, see:
// http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
readonly attribute boolean willValidate;
readonly attribute nsIDOMValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(in DOMString error);
};
///////////////////////////////////////////////////////////////////////////////
// nsIDOMHTMLOptionElement
///////////////////////////////////////////////////////////////////////////////
[scriptable, uuid(611d00f5-1eb8-4571-b995-2a2019d2d11c)]
interface nsIDOMHTMLOptionElement : nsIDOMHTMLElement
{
attribute boolean disabled;
readonly attribute nsIDOMHTMLFormElement form;
attribute DOMString label;
attribute boolean defaultSelected;
attribute boolean selected;
attribute DOMString value;
attribute DOMString text;
readonly attribute long index;
};
///////////////////////////////////////////////////////////////////////////////
// nsIPrincipal
///////////////////////////////////////////////////////////////////////////////
[uuid(0575ea96-4561-4dc6-a818-3c4c97c2430d)]
interface nsIPrincipal : nsISupports //nsISerializable
{
// TODO: fill out (if necessary)
void placeholder();
};
///////////////////////////////////////////////////////////////////////////////
// nsIScriptSecurityManager
///////////////////////////////////////////////////////////////////////////////
interface nsIURI;
interface nsIChannel;
native jsid(jsid);
[scriptable, uuid(50eda256-4dd2-4c7c-baed-96983910af9f)]
interface nsIScriptSecurityManager : nsIXPCSecurityManager
{
///////////////// Security Checks //////////////////
/**
* Checks whether the running script is allowed to access aProperty.
*/
[noscript] void checkPropertyAccess(in JSContextPtr aJSContext,
in JSObjectPtr aJSObject,
in string aClassName,
in jsid aProperty,
in PRUint32 aAction);
/**
* Check that the script currently running in context "cx" can load "uri".
*
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
* should be denied.
*
* @param cx the JSContext of the script causing the load
* @param uri the URI that is being loaded
*/
[noscript] void checkLoadURIFromScript(in JSContextPtr cx, in nsIURI uri);
/**
* Default CheckLoadURI permissions
*/
// Default permissions
const unsigned long STANDARD = 0;
// Indicate that the load is a load of a new document that is not
// user-triggered. Here "user-triggered" could be broadly interpreted --
// for example, scripted sets of window.location.href might be treated as
// "user-triggered" in some circumstances. A typical example of a load
// that is not user-triggered is a <meta> refresh load. If this flag is
// set, the load will be denied if the originating principal's URI has the
// nsIProtocolHandler::URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT flag set.
const unsigned long LOAD_IS_AUTOMATIC_DOCUMENT_REPLACEMENT = 1 << 0;
// Allow the loading of chrome URLs by non-chrome URLs. Use with great
// care! This will actually allow the loading of any URI which has the
// nsIProtocolHandler::URI_IS_UI_RESOURCE protocol handler flag set. Ths
// probably means at least chrome: and resource:.
const unsigned long ALLOW_CHROME = 1 << 1;
// Don't allow URLs which would inherit the caller's principal (such as
// javascript: or data:) to load. See
// nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT.
const unsigned long DISALLOW_INHERIT_PRINCIPAL = 1 << 2;
// Alias for DISALLOW_INHERIT_PRINCIPAL for backwards compat with
// JS-implemented extensions.
const unsigned long DISALLOW_SCRIPT_OR_DATA = DISALLOW_INHERIT_PRINCIPAL;
// Don't allow javascript: URLs to load
// WARNING: Support for this value was added in Mozilla 1.7.8 and
// Firefox 1.0.4. Use in prior versions WILL BE IGNORED.
// When using this, make sure that you actually want DISALLOW_SCRIPT, not
// DISALLOW_INHERIT_PRINCIPAL
const unsigned long DISALLOW_SCRIPT = 1 << 3;
/**
* Check that content with principal aPrincipal can load "uri".
*
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
* should be denied.
*
* @param aPrincipal the principal identifying the actor causing the load
* @param uri the URI that is being loaded
* @param flags the permission set, see above
*/
void checkLoadURIWithPrincipal(in nsIPrincipal aPrincipal,
in nsIURI uri,
in unsigned long flags);
/**
* Check that content from "from" can load "uri".
*
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
* should be denied.
*
* @param from the URI causing the load
* @param uri the URI that is being loaded
* @param flags the permission set, see above
*
* @deprecated Use checkLoadURIWithPrincipal instead of this function.
*/
void checkLoadURI(in nsIURI from, in nsIURI uri,
in unsigned long flags);
/**
* Similar to checkLoadURIWithPrincipal but there are two differences:
*
* 1) The URI is a string, not a URI object.
* 2) This function assumes that the URI may still be subject to fixup (and
* hence will check whether fixed-up versions of the URI are allowed to
* load as well); if any of the versions of this URI is not allowed, this
* function will return error code NS_ERROR_DOM_BAD_URI.
*/
void checkLoadURIStrWithPrincipal(in nsIPrincipal aPrincipal,
in AUTF8String uri,
in unsigned long flags);
/**
* Same as CheckLoadURI but takes string arguments for ease of use
* by scripts
*
* @deprecated Use checkLoadURIStrWithPrincipal instead of this function.
*/
void checkLoadURIStr(in AUTF8String from, in AUTF8String uri,
in unsigned long flags);
/**
* Check that the function 'funObj' is allowed to run on 'targetObj'
*
* Will return error code NS_ERROR_DOM_SECURITY_ERR if the function
* should not run
*
* @param cx The current active JavaScript context.
* @param funObj The function trying to run..
* @param targetObj The object the function will run on.
*/
[noscript] void checkFunctionAccess(in JSContextPtr cx, in voidPtr funObj,
in voidPtr targetObj);
/**
* Return true if content from the given principal is allowed to
* execute scripts.
*/
[noscript] boolean canExecuteScripts(in JSContextPtr cx,
in nsIPrincipal principal);
///////////////// Principals ///////////////////////
/**
* Return the principal of the innermost frame of the currently
* executing script. Will return null if there is no script
* currently executing.
*/
[noscript] nsIPrincipal getSubjectPrincipal();
/**
* Return the all-powerful system principal.
*/
nsIPrincipal getSystemPrincipal();
/**
* Return a principal with the specified certificate fingerprint, subject
* name (the full name or concatenated set of names of the entity
* represented by the certificate), pretty name, certificate, and
* codebase URI. The certificate fingerprint and subject name MUST be
* nonempty; otherwise an error will be thrown. Similarly, aCert must
* not be null.
*/
[noscript] nsIPrincipal
getCertificatePrincipal(in AUTF8String aCertFingerprint,
in AUTF8String aSubjectName,
in AUTF8String aPrettyName,
in nsISupports aCert,
in nsIURI aURI);
/**
* Return a principal that has the same origin as aURI.
*/
nsIPrincipal getCodebasePrincipal(in nsIURI aURI);
///////////////// Capabilities API /////////////////////
/**
* Request that 'capability' can be enabled by scripts or applets
* running with 'principal'. Will prompt user if
* necessary. Returns nsIPrincipal::ENABLE_GRANTED or
* nsIPrincipal::ENABLE_DENIED based on user's choice.
*/
[noscript] short requestCapability(in nsIPrincipal principal,
in string capability);
/**
* Return true if the currently executing script has 'capability' enabled.
*/
boolean isCapabilityEnabled(in string capability);
/**
* Enable 'capability' in the innermost frame of the currently executing
* script.
*/
void enableCapability(in string capability);
/**
* Remove 'capability' from the innermost frame of the currently
* executing script. Any setting of 'capability' from enclosing
* frames thus comes into effect.
*/
void revertCapability(in string capability);
/**
* Disable 'capability' in the innermost frame of the currently executing
* script.
*/
void disableCapability(in string capability);
//////////////// Master Certificate Functions ////////////////////
/**
* Allow 'certificateID' to enable 'capability.' Can only be performed
* by code signed by the system certificate.
*/
// XXXbz Capabilities can't have non-ascii chars?
// XXXbz ideally we'd pass a subjectName here too, and the nsISupports
// cert we're enabling for...
void setCanEnableCapability(in AUTF8String certificateFingerprint,
in string capability,
in short canEnable);
///////////////////////
/**
* Return the principal of the specified object in the specified context.
*/
[noscript] nsIPrincipal getObjectPrincipal(in JSContextPtr cx,
in JSObjectPtr obj);
/**
* Returns true if the principal of the currently running script is the
* system principal, false otherwise.
*/
[noscript] boolean subjectPrincipalIsSystem();
/**
* Returns OK if aJSContext and target have the same "origin"
* (scheme, host, and port).
*/
[noscript] void checkSameOrigin(in JSContextPtr aJSContext,
in nsIURI aTargetURI);
/**
* Returns OK if aSourceURI and target have the same "origin"
* (scheme, host, and port).
* ReportError flag suppresses error reports for functions that
* don't need reporting.
*/
void checkSameOriginURI(in nsIURI aSourceURI,
in nsIURI aTargetURI,
in boolean reportError);
/**
* Returns the principal of the global object of the given context, or null
* if no global or no principal.
*/
[noscript] nsIPrincipal getPrincipalFromContext(in JSContextPtr cx);
/**
* Get the principal for the given channel. This will typically be the
* channel owner if there is one, and the codebase principal for the
* channel's URI otherwise. aChannel must not be null.
*/
nsIPrincipal getChannelPrincipal(in nsIChannel aChannel);
/**
* Check whether a given principal is a system principal. This allows us
* to avoid handing back the system principal to script while allowing
* script to check whether a given principal is system.
*/
boolean isSystemPrincipal(in nsIPrincipal aPrincipal);
/**
* Same as getSubjectPrincipal(), only faster. cx must *never* be
* passed null, and it must be the context on the top of the
* context stack. Does *not* reference count the returned
* principal.
*/
[noscript,notxpcom] nsIPrincipal getCxSubjectPrincipal(in JSContextPtr cx);
[noscript,notxpcom] nsIPrincipal getCxSubjectPrincipalAndFrame(in JSContextPtr cx,
out JSStackFramePtr fp);
/**
* If no scripted code is running "above" (or called from) fp, then
* instead of looking at cx->globalObject, we will return |principal|.
* This function only affects |cx|. If someone pushes another context onto
* the context stack, then it supersedes this call.
* NOTE: If |fp| is non-null popContextPrincipal must be called before fp
* has finished executing.
*
* @param cx The context to clamp.
* @param fp The frame pointer to clamp at. May be 'null'.
* @param principal The principal to clamp to.
*/
[noscript] void pushContextPrincipal(in JSContextPtr cx,
in JSStackFramePtr fp,
in nsIPrincipal principal);
/**
* Removes a clamp set by pushContextPrincipal from cx. This must be
* called in a stack-like fashion (e.g., given two contexts |a| and |b|,
* it is not legal to do: push(a) push(b) pop(a)).
*/
[noscript] void popContextPrincipal(in JSContextPtr cx);
};
///////////////////////////////////////////////////////////////////////////////
// nsICacheService
///////////////////////////////////////////////////////////////////////////////
interface nsISimpleEnumerator;
interface nsICacheListener;
interface nsICacheSession;
interface nsICacheVisitor;
interface nsIEventTarget;
typedef long nsCacheStoragePolicy;
[scriptable, uuid(14dbe1e9-f3bc-45af-92f4-2c574fcd4e39)]
interface nsICacheService : nsISupports
{
/**
* Create a cache session
*
* A cache session represents a client's access into the cache. The cache
* session is not "owned" by the cache service. Hence, it is possible to
* create duplicate cache sessions. Entries created by a cache session
* are invisible to other cache sessions, unless the cache sessions are
* equivalent.
*
* @param clientID - Specifies the name of the client using the cache.
* @param storagePolicy - Limits the storage policy for all entries
* accessed via the returned session. As a result, devices excluded
* by the storage policy will not be searched when opening entries
* from the returned session.
* @param streamBased - Indicates whether or not the data being cached
* can be represented as a stream. The storagePolicy must be
* consistent with the value of this field. For example, a non-stream-
* based cache entry can only have a storage policy of STORE_IN_MEMORY.
* @return new cache session.
*/
nsICacheSession createSession(in string clientID,
in nsCacheStoragePolicy storagePolicy,
in boolean streamBased);
/**
* Visit entries stored in the cache. Used to implement about:cache.
*/
void visitEntries(in nsICacheVisitor visitor);
/**
* Evicts all entries in all devices implied by the storage policy.
*
* @note This function may evict some items but will throw if it fails to evict
* everything.
*/
void evictEntries(in nsCacheStoragePolicy storagePolicy);
/**
* Event target which is used for I/O operations
*/
readonly attribute nsIEventTarget cacheIOTarget;
};
///////////////////////////////////////////////////////////////////////////////
// nsIScriptableUnicodeConverter
///////////////////////////////////////////////////////////////////////////////
interface nsIInputStream;
%{C++
// {0A698C44-3BFF-11d4-9649-00C0CA135B4E}
#define NS_ISCRIPTABLEUNICODECONVERTER_CID { 0x0A698C44, 0x3BFF, 0x11d4, { 0x96, 0x49, 0x00, 0xC0, 0xCA, 0x13, 0x5B, 0x4E } }
#define NS_ISCRIPTABLEUNICODECONVERTER_CONTRACTID "@mozilla.org/intl/scriptableunicodeconverter"
%}
/**
* This interface is a unicode encoder for use by scripts
*
* @created 8/Jun/2000
* @author Makoto Kato [m_kato@ga2.so-net.ne.jp]
*/
[scriptable, uuid(f36ee324-5c1c-437f-ba10-2b4db7a18031)]
interface nsIScriptableUnicodeConverter : nsISupports
{
/**
* Converts the data from Unicode to one Charset.
* Returns the converted string. After converting, Finish should be called
* and its return value appended to this return value.
*/
ACString ConvertFromUnicode(in AString aSrc);
/**
* Returns the terminator string.
* Should be called after ConvertFromUnicode() and appended to that
* function's return value.
*/
ACString Finish();
/**
* Converts the data from one Charset to Unicode.
*/
AString ConvertToUnicode(in ACString aSrc);
/**
* Converts an array of bytes to a unicode string.
*/
AString convertFromByteArray([const,array,size_is(aCount)] in octet aData,
in unsigned long aCount);