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
//
// DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl/nsIContentPolicy.idl
//


/// `typedef uint32_t  nsContentPolicyType;`
///

/// ```text
/// /**
///  * The type of nsIContentPolicy::TYPE_*
///  */
/// ```
///

pub type nsContentPolicyType = libc::uint32_t;


/// `interface nsIContentPolicy : nsISupports`
///

/// ```text
/// /**
///  * Interface for content policy mechanism.  Implementations of this
///  * interface can be used to control loading of various types of out-of-line
///  * content, or processing of certain types of in-line content.
///  *
///  * WARNING: do not block the caller from shouldLoad or shouldProcess (e.g.,
    ///  * by launching a dialog to prompt the user for something).
///  */
/// ```
///

// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.

#[repr(C)]
pub struct nsIContentPolicy {
    vtable: *const nsIContentPolicyVTable,

    /// This field is a phantomdata to ensure that the VTable type and any
    /// struct containing it is not safe to send across threads, as XPCOM is
    /// generally not threadsafe.
    ///
    /// XPCOM interfaces in general are not safe to send across threads.
    __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}

// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIContentPolicy.
unsafe impl XpCom for nsIContentPolicy {
    const IID: nsIID = nsID(0xcaad4f1f, 0xd047, 0x46ac,
        [0xae, 0x9d, 0xdc, 0x59, 0x8e, 0x4f, 0xb9, 0x1b]);
}

// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIContentPolicy {
    #[inline]
    unsafe fn addref(&self) {
        self.AddRef();
    }
    #[inline]
    unsafe fn release(&self) {
        self.Release();
    }
}

// This trait is implemented on all types which can be coerced to from nsIContentPolicy.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIContentPolicyCoerce {
    /// Cheaply cast a value of this type from a `nsIContentPolicy`.
    fn coerce_from(v: &nsIContentPolicy) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentPolicyCoerce for nsIContentPolicy {
    #[inline]
    fn coerce_from(v: &nsIContentPolicy) -> &Self {
        v
    }
}

impl nsIContentPolicy {
    /// Cast this `nsIContentPolicy` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIContentPolicyCoerce>(&self) -> &T {
        T::coerce_from(self)
    }
}

// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIContentPolicy {
    type Target = nsISupports;
    #[inline]
    fn deref(&self) -> &nsISupports {
        unsafe {
            ::std::mem::transmute(self)
        }
    }
}

// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIContentPolicyCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIContentPolicy) -> &Self {
        T::coerce_from(v)
    }
}

// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIContentPolicy
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIContentPolicyVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* short shouldLoad (in nsContentPolicyType aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeTypeGuess, in nsISupports aExtra, [optional] in nsIPrincipal aRequestPrincipal); */
    pub ShouldLoad: unsafe extern "system" fn (this: *const nsIContentPolicy, aContentType: nsContentPolicyType, aContentLocation: *const nsIURI, aRequestOrigin: *const nsIURI, aContext: *const nsISupports, aMimeTypeGuess: &::nsstring::nsACString, aExtra: *const nsISupports, aRequestPrincipal: *const nsIPrincipal, _retval: *mut libc::int16_t) -> nsresult,

    /* short shouldProcess (in nsContentPolicyType aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeType, in nsISupports aExtra, [optional] in nsIPrincipal aRequestPrincipal); */
    pub ShouldProcess: unsafe extern "system" fn (this: *const nsIContentPolicy, aContentType: nsContentPolicyType, aContentLocation: *const nsIURI, aRequestOrigin: *const nsIURI, aContext: *const nsISupports, aMimeType: &::nsstring::nsACString, aExtra: *const nsISupports, aRequestPrincipal: *const nsIPrincipal, _retval: *mut libc::int16_t) -> nsresult,
}


// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIContentPolicy {
    /// ```text
    /// /**
    ///    * Indicates a unset or bogus policy type.
    ///    */
    /// ```
    ///

    pub const TYPE_INVALID: i64 = 0;

    /// ```text
    /// /**
    ///    * Gecko/Firefox developers: Avoid using TYPE_OTHER. Especially for
    ///    * requests that are coming from webpages. Or requests in general which
    ///    * you expect that security checks will be done on.
    ///    * Always use a more specific type if one is available. And do not hesitate
    ///    * to add more types as appropriate.
    ///    * But if you are fairly sure that no one would care about your more specific
    ///    * type, then it's ok to use TYPE_OTHER.
    ///    *
    ///    * Extension developers: Whenever it is reasonable, use one of the existing
    ///    * content types. If none of the existing content types are right for
    ///    * something you are doing, file a bug in the Core/DOM component that
    ///    * includes a patch that adds your new content type to the end of the list of
    ///    * TYPE_* constants here. But, don't start using your new content type until
    ///    * your patch has been accepted, because it will be uncertain what exact
    ///    * value and name your new content type will have; in that interim period,
    ///    * use TYPE_OTHER. In your patch, document your new content type in the style
    ///    * of the existing ones. In the bug you file, provide a more detailed
    ///    * description of the new type of content you want Gecko to support, so that
    ///    * the existing implementations of nsIContentPolicy can be properly modified
    ///    * to deal with that new type of content.
    ///    *
    ///    * Implementations of nsIContentPolicy should treat this the same way they
    ///    * treat unknown types, because existing users of TYPE_OTHER may be converted
    ///    * to use new content types.
    ///    *
    ///    * Note that the TYPE_INTERNAL_* constants are never passed to content
    ///    * policy implementations.  They are mapped to other TYPE_* constants, and
    ///    * are only intended for internal usage inside Gecko.
    ///    */
    /// ```
    ///

    pub const TYPE_OTHER: i64 = 1;

    /// ```text
    /// /**
    ///    * Indicates an executable script (such as JavaScript).
    ///    */
    /// ```
    ///

    pub const TYPE_SCRIPT: i64 = 2;

    /// ```text
    /// /**
    ///    * Indicates an image (e.g., IMG elements).
    ///    */
    /// ```
    ///

    pub const TYPE_IMAGE: i64 = 3;

    /// ```text
    /// /**
    ///    * Indicates a stylesheet (e.g., STYLE elements).
    ///    */
    /// ```
    ///

    pub const TYPE_STYLESHEET: i64 = 4;

    /// ```text
    /// /**
    ///    * Indicates a generic object (plugin-handled content typically falls under
        ///    * this category).
    ///    */
    /// ```
    ///

    pub const TYPE_OBJECT: i64 = 5;

    /// ```text
    /// /**
    ///    * Indicates a document at the top-level (i.e., in a browser).
    ///    */
    /// ```
    ///

    pub const TYPE_DOCUMENT: i64 = 6;

    /// ```text
    /// /**
    ///    * Indicates a document contained within another document (e.g., IFRAMEs,
        ///    * FRAMES, and OBJECTs).
    ///    */
    /// ```
    ///

    pub const TYPE_SUBDOCUMENT: i64 = 7;

    /// ```text
    /// /**
    ///    * Indicates a timed refresh.
    ///    *
    ///    * shouldLoad will never get this, because it does not represent content
    ///    * to be loaded (the actual load triggered by the refresh will go through
        ///    * shouldLoad as expected).
    ///    *
    ///    * shouldProcess will get this for, e.g., META Refresh elements and HTTP
    ///    * Refresh headers.
    ///    */
    /// ```
    ///

    pub const TYPE_REFRESH: i64 = 8;

    /// ```text
    /// /**
    ///    * Indicates an XBL binding request, triggered either by -moz-binding CSS
    ///    * property.
    ///    */
    /// ```
    ///

    pub const TYPE_XBL: i64 = 9;

    /// ```text
    /// /**
    ///    * Indicates a ping triggered by a click on <A PING="..."> element.
    ///    */
    /// ```
    ///

    pub const TYPE_PING: i64 = 10;

    /// ```text
    /// /**
    ///    * Indicates an XMLHttpRequest. Also used for document.load and for EventSource.
    ///    */
    /// ```
    ///

    pub const TYPE_XMLHTTPREQUEST: i64 = 11;


    pub const TYPE_DATAREQUEST: i64 = 11;

    /// ```text
    /// /**
    ///    * Indicates a request by a plugin.
    ///    */
    /// ```
    ///

    pub const TYPE_OBJECT_SUBREQUEST: i64 = 12;

    /// ```text
    /// /**
    ///    * Indicates a DTD loaded by an XML document.
    ///    */
    /// ```
    ///

    pub const TYPE_DTD: i64 = 13;

    /// ```text
    /// /**
    ///    * Indicates a font loaded via @font-face rule.
    ///    */
    /// ```
    ///

    pub const TYPE_FONT: i64 = 14;

    /// ```text
    /// /**
    ///    * Indicates a video or audio load.
    ///    */
    /// ```
    ///

    pub const TYPE_MEDIA: i64 = 15;

    /// ```text
    /// /**
    ///    * Indicates a WebSocket load.
    ///    */
    /// ```
    ///

    pub const TYPE_WEBSOCKET: i64 = 16;

    /// ```text
    /// /**
    ///    * Indicates a Content Security Policy report.
    ///    */
    /// ```
    ///

    pub const TYPE_CSP_REPORT: i64 = 17;

    /// ```text
    /// /**
    ///    * Indicates a style sheet transformation.
    ///    */
    /// ```
    ///

    pub const TYPE_XSLT: i64 = 18;

    /// ```text
    /// /**
    ///    * Indicates a beacon post.
    ///    */
    /// ```
    ///

    pub const TYPE_BEACON: i64 = 19;

    /// ```text
    /// /**
    ///    * Indicates a load initiated by the fetch() function from the Fetch
    ///    * specification.
    ///    */
    /// ```
    ///

    pub const TYPE_FETCH: i64 = 20;

    /// ```text
    /// /**
    ///    * Indicates a <img srcset> or <picture> request.
    ///    */
    /// ```
    ///

    pub const TYPE_IMAGESET: i64 = 21;

    /// ```text
    /// /**
    ///    * Indicates a web manifest.
    ///    */
    /// ```
    ///

    pub const TYPE_WEB_MANIFEST: i64 = 22;

    /// ```text
    /// /**
    ///    * Indicates an save-as link download from the front-end code.
    ///    */
    /// ```
    ///

    pub const TYPE_SAVEAS_DOWNLOAD: i64 = 43;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for scripts loaded through script
    ///    * elements.
    ///    *
    ///    * This will be mapped to TYPE_SCRIPT before being passed to content policy
    ///    * implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_SCRIPT: i64 = 23;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for scripts loaded through a dedicated
    ///    * worker.
    ///    *
    ///    * This will be mapped to TYPE_SCRIPT before being passed to content policy
    ///    * implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_WORKER: i64 = 24;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for scripts loaded through a shared
    ///    * worker.
    ///    *
    ///    * This will be mapped to TYPE_SCRIPT before being passed to content policy
    ///    * implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_SHARED_WORKER: i64 = 25;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for content loaded from embed elements.
    ///    *
    ///    * This will be mapped to TYPE_OBJECT.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_EMBED: i64 = 26;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for content loaded from object elements.
    ///    *
    ///    * This will be mapped to TYPE_OBJECT.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_OBJECT: i64 = 27;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for content loaded from frame elements.
    ///    *
    ///    * This will be mapped to TYPE_SUBDOCUMENT.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_FRAME: i64 = 28;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for content loaded from iframe elements.
    ///    *
    ///    * This will be mapped to TYPE_SUBDOCUMENT.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_IFRAME: i64 = 29;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for content loaded from audio elements.
    ///    *
    ///    * This will be mapped to TYPE_MEDIA.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_AUDIO: i64 = 30;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for content loaded from video elements.
    ///    *
    ///    * This will be mapped to TYPE_MEDIA.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_VIDEO: i64 = 31;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for content loaded from track elements.
    ///    *
    ///    * This will be mapped to TYPE_MEDIA.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_TRACK: i64 = 32;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for an XMLHttpRequest.
    ///    *
    ///    * This will be mapped to TYPE_XMLHTTPREQUEST.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_XMLHTTPREQUEST: i64 = 33;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for EventSource.
    ///    *
    ///    * This will be mapped to TYPE_DATAREQUEST.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_EVENTSOURCE: i64 = 34;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for scripts loaded through a service
    ///    * worker.
    ///    *
    ///    * This will be mapped to TYPE_SCRIPT before being passed to content policy
    ///    * implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_SERVICE_WORKER: i64 = 35;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for *preloaded* scripts
    ///    * loaded through script elements.
    ///    *
    ///    * This will be mapped to TYPE_SCRIPT before being passed
    ///    * to content policy implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_SCRIPT_PRELOAD: i64 = 36;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for normal images.
    ///    *
    ///    * This will be mapped to TYPE_IMAGE before being passed
    ///    * to content policy implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_IMAGE: i64 = 37;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for *preloaded* images.
    ///    *
    ///    * This will be mapped to TYPE_IMAGE before being passed
    ///    * to content policy implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_IMAGE_PRELOAD: i64 = 38;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for normal stylesheets.
    ///    *
    ///    * This will be mapped to TYPE_STYLESHEET before being passed
    ///    * to content policy implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_STYLESHEET: i64 = 39;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for *preloaded* stylesheets.
    ///    *
    ///    * This will be mapped to TYPE_STYLESHEET before being passed
    ///    * to content policy implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_STYLESHEET_PRELOAD: i64 = 40;

    /// ```text
    /// /**
    ///    * Indicates an internal constant for favicon.
    ///    *
    ///    * This will be mapped to TYPE_IMAGE before being passed
    ///    * to content policy implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_IMAGE_FAVICON: i64 = 41;

    /// ```text
    /// /**
    ///    * Indicates an importScripts() inside a worker script.
    ///    *
    ///    * This will be mapped to TYPE_SCRIPT before being passed to content policy
    ///    * implementations.
    ///    */
    /// ```
    ///

    pub const TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS: i64 = 42;

    /// ```text
    /// /**
    ///    * Returned from shouldLoad or shouldProcess if the load or process request
    ///    * is rejected based on details of the request.
    ///    */
    /// ```
    ///

    pub const REJECT_REQUEST: i64 = -1;

    /// ```text
    /// /**
    ///    * Returned from shouldLoad or shouldProcess if the load/process is rejected
    ///    * based solely on its type (of the above flags).
    ///    *
    ///    * NOTE that it is not meant to stop future requests for this type--only the
    ///    * current request.
    ///    */
    /// ```
    ///

    pub const REJECT_TYPE: i64 = -2;

    /// ```text
    /// /**
    ///    * Returned from shouldLoad or shouldProcess if the load/process is rejected
    ///    * based on the server it is hosted on or requested from (aContentLocation or
        ///    * aRequestOrigin), e.g., if you block an IMAGE because it is served from
    ///    * goatse.cx (even if you don't necessarily block other types from that
        ///    * server/domain).
    ///    *
    ///    * NOTE that it is not meant to stop future requests for this server--only the
    ///    * current request.
    ///    */
    /// ```
    ///

    pub const REJECT_SERVER: i64 = -3;

    /// ```text
    /// /**
    ///    * Returned from shouldLoad or shouldProcess if the load/process is rejected
    ///    * based on some other criteria. Mozilla callers will handle this like
    ///    * REJECT_REQUEST; third-party implementors may, for example, use this to
    ///    * direct their own callers to consult the extra parameter for additional
    ///    * details.
    ///    */
    /// ```
    ///

    pub const REJECT_OTHER: i64 = -4;

    /// ```text
    /// /**
    ///    * Returned from shouldLoad or shouldProcess if the load or process request
    ///    * is not rejected.
    ///    */
    /// ```
    ///

    pub const ACCEPT: i64 = 1;

    /// ```text
    /// /**
    ///    * Should the resource at this location be loaded?
    ///    * ShouldLoad will be called before loading the resource at aContentLocation
    ///    * to determine whether to start the load at all.
    ///    *
    ///    * @param aContentType      the type of content being tested. This will be one
    ///    *                          one of the TYPE_* constants.
    ///    *
    ///    * @param aContentLocation  the location of the content being checked; must
    ///    *                          not be null
    ///    *
    ///    * @param aRequestOrigin    OPTIONAL. the location of the resource that
    ///    *                          that is loading the request. This will generally
    ///    *                          be the URI of the loading principal for the
    ///    *                          resulting request (as determined by its
        ///    *                          LoadInfo), but may vary depending on the
    ///    *                          caller. Can be null if inapplicable.
    ///    *
    ///    * @param aContext          OPTIONAL. the nsIDOMNode or nsIDOMWindow that
    ///    *                          initiated the request, or something that can QI
    ///    *                          to one of those; can be null if inapplicable.
    ///    *                          Note that for navigation events (new windows and
        ///    *                          link clicks), this is the NEW window.
    ///    *
    ///    * @param aMimeTypeGuess    OPTIONAL. a guess for the requested content's
    ///    *                          MIME type, based on information available to
    ///    *                          the request initiator (e.g., an OBJECT's type
        ///    *                          attribute); does not reliably reflect the
    ///    *                          actual MIME type of the requested content
    ///    *
    ///    * @param aExtra            an OPTIONAL argument, pass-through for non-Gecko
    ///    *                          callers to pass extra data to callees.
    ///    *
    ///    * @param aRequestPrincipal an OPTIONAL argument, defines the principal that
    ///    *                          caused the load. This is optional only for
    ///    *                          non-gecko code: all gecko code should set this
    ///    *                          argument. This should generally be the same as
    ///    *                          the triggering principal for the resulting
    ///    *                          request (as determined by its LoadInfo), but may
    ///    *                          vary depending on the caller. Sometimes it will
    ///    *                          be the loading principal or final channel
    ///    *                          principal instead.
    ///    *
    ///    * @return ACCEPT or REJECT_*
    ///    *
    ///    * @note shouldLoad can be called while the DOM and layout of the document
    ///    * involved is in an inconsistent state.  This means that implementors of
    ///    * this method MUST NOT do any of the following:
    ///    * 1)  Modify the DOM in any way (e.g. setting attributes is a no-no).
///    * 2)  Query any DOM properties that depend on layout (e.g. offset*
///    *     properties).
///    * 3)  Query any DOM properties that depend on style (e.g. computed style).
///    * 4)  Query any DOM properties that depend on the current state of the DOM
///    *     outside the "context" node (e.g. lengths of node lists).
///    * 5)  [JavaScript implementations only] Access properties of any sort on any
///    *     object without using XPCNativeWrapper (either explicitly or
///    *     implicitly).  Due to various DOM0 things, this leads to item 4.
///    * If you do any of these things in your shouldLoad implementation, expect
///    * unpredictable behavior, possibly including crashes, content not showing
///    * up, content showing up doubled, etc.  If you need to do any of the things
///    * above, do them off timeout or event.
///    */
/// ```
///

/// `short shouldLoad (in nsContentPolicyType aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeTypeGuess, in nsISupports aExtra, [optional] in nsIPrincipal aRequestPrincipal);`
#[inline]
pub unsafe fn ShouldLoad(&self, aContentType: nsContentPolicyType, aContentLocation: *const nsIURI, aRequestOrigin: *const nsIURI, aContext: *const nsISupports, aMimeTypeGuess: &::nsstring::nsACString, aExtra: *const nsISupports, aRequestPrincipal: *const nsIPrincipal, _retval: *mut libc::int16_t) -> nsresult {
((*self.vtable).ShouldLoad)(self, aContentType, aContentLocation, aRequestOrigin, aContext, aMimeTypeGuess, aExtra, aRequestPrincipal, _retval)
}


/// ```text
/// /**
///    * Should the resource be processed?
///    * ShouldProcess will be called once all the information passed to it has
///    * been determined about the resource, typically after part of the resource
///    * has been loaded.
///    *
///    * @param aContentType      the type of content being tested. This will be one
///    *                          one of the TYPE_* constants.
///    *
///    * @param aContentLocation  OPTIONAL; the location of the resource being
///    *                          requested: MAY be, e.g., a post-redirection URI
///    *                          for the resource.
///    *
///    * @param aRequestOrigin    OPTIONAL. the location of the resource that
///    *                          initiated this load request; can be null if
///    *                          inapplicable
///    *
///    * @param aContext          OPTIONAL. the nsIDOMNode or nsIDOMWindow that
///    *                          initiated the request, or something that can QI
///    *                          to one of those; can be null if inapplicable.
///    *
///    * @param aMimeType         the MIME type of the requested resource (e.g.,
///    *                          image/png), as reported by the networking library,
///    *                          if available (may be empty if inappropriate for
///    *                          the type, e.g., TYPE_REFRESH).
///    *
///    * @param aExtra            an OPTIONAL argument, pass-through for non-Gecko
///    *                          callers to pass extra data to callees.
///    *
///    * @return ACCEPT or REJECT_*
///    *
///    * @note shouldProcess can be called while the DOM and layout of the document
///    * involved is in an inconsistent state.  See the note on shouldLoad to see
///    * what this means for implementors of this method.
///    */
/// ```
///

/// `short shouldProcess (in nsContentPolicyType aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeType, in nsISupports aExtra, [optional] in nsIPrincipal aRequestPrincipal);`
#[inline]
pub unsafe fn ShouldProcess(&self, aContentType: nsContentPolicyType, aContentLocation: *const nsIURI, aRequestOrigin: *const nsIURI, aContext: *const nsISupports, aMimeType: &::nsstring::nsACString, aExtra: *const nsISupports, aRequestPrincipal: *const nsIPrincipal, _retval: *mut libc::int16_t) -> nsresult {
((*self.vtable).ShouldProcess)(self, aContentType, aContentLocation, aRequestOrigin, aContext, aMimeType, aExtra, aRequestPrincipal, _retval)
}


}