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


/// `typedef uint16_t  CSPDirective;`
///

/// ```text
/// /**
///  * nsIContentSecurityPolicy
///  * Describes an XPCOM component used to model and enforce CSPs.  Instances of
///  * this class may have multiple policies within them, but there should only be
///  * one of these per document/principal.
///  */
/// ```
///

pub type CSPDirective = libc::uint16_t;


/// `interface nsIContentSecurityPolicy : nsISerializable`
///


// 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 nsIContentSecurityPolicy {
    vtable: *const nsIContentSecurityPolicyVTable,

    /// 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 nsIContentSecurityPolicy.
unsafe impl XpCom for nsIContentSecurityPolicy {
    const IID: nsIID = nsID(0xb3c4c0ae, 0xbd5e, 0x4cad,
        [0x87, 0xe0, 0x8d, 0x21, 0x0d, 0xbb, 0x3f, 0x9f]);
}

// 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 nsIContentSecurityPolicy {
    #[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 nsIContentSecurityPolicy.
// 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 nsIContentSecurityPolicyCoerce {
    /// Cheaply cast a value of this type from a `nsIContentSecurityPolicy`.
    fn coerce_from(v: &nsIContentSecurityPolicy) -> &Self;
}

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

impl nsIContentSecurityPolicy {
    /// Cast this `nsIContentSecurityPolicy` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIContentSecurityPolicyCoerce>(&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 nsIContentSecurityPolicy {
    type Target = nsISerializable;
    #[inline]
    fn deref(&self) -> &nsISerializable {
        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: nsISerializableCoerce> nsIContentSecurityPolicyCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIContentSecurityPolicy) -> &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 nsIContentSecurityPolicy
// 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 nsIContentSecurityPolicyVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISerializableVTable,

    /* [binaryname(GetPolicyString)] AString getPolicy (in unsigned long index); */
    pub GetPolicyString: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, index: libc::uint32_t, _retval: &mut ::nsstring::nsAString) -> nsresult,

    /* [noscript,nostdcall,notxpcom] CSPPolicyPtr GetPolicy (in unsigned long index); */
    /// Unable to generate binding because `nostdcall is unsupported`
    pub GetPolicy: *const ::libc::c_void,

    /* readonly attribute unsigned long policyCount; */
    pub GetPolicyCount: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aPolicyCount: *mut libc::uint32_t) -> nsresult,

    /* readonly attribute bool upgradeInsecureRequests; */
    pub GetUpgradeInsecureRequests: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aUpgradeInsecureRequests: *mut bool) -> nsresult,

    /* readonly attribute bool blockAllMixedContent; */
    pub GetBlockAllMixedContent: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aBlockAllMixedContent: *mut bool) -> nsresult,

    /* readonly attribute bool enforcesFrameAncestors; */
    pub GetEnforcesFrameAncestors: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aEnforcesFrameAncestors: *mut bool) -> nsresult,

    /* bool getReferrerPolicy (out unsigned long policy); */
    pub GetReferrerPolicy: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, policy: *mut libc::uint32_t, _retval: *mut bool) -> nsresult,

    /* void appendPolicy (in AString policyString, in boolean reportOnly, in boolean deliveredViaMetaTag); */
    pub AppendPolicy: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, policyString: &::nsstring::nsAString, reportOnly: bool, deliveredViaMetaTag: bool) -> nsresult,

    /* boolean getAllowsInline (in nsContentPolicyType aContentPolicyType, in AString aNonce, in boolean aParserCreated, in nsISupports aElementOrContent, in unsigned long aLineNumber); */
    pub GetAllowsInline: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aContentPolicyType: nsContentPolicyType, aNonce: &::nsstring::nsAString, aParserCreated: bool, aElementOrContent: *const nsISupports, aLineNumber: libc::uint32_t, _retval: *mut bool) -> nsresult,

    /* boolean getAllowsEval (out boolean shouldReportViolations); */
    pub GetAllowsEval: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, shouldReportViolations: *mut bool, _retval: *mut bool) -> nsresult,

    /* uint32_t getCSPSandboxFlags (); */
    pub GetCSPSandboxFlags: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, _retval: *mut uint32_t) -> nsresult,

    /* void logViolationDetails (in unsigned short violationType, in AString sourceFile, in AString scriptSample, in int32_t lineNum, [optional] in AString nonce, [optional] in AString content); */
    pub LogViolationDetails: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, violationType: libc::uint16_t, sourceFile: &::nsstring::nsAString, scriptSample: &::nsstring::nsAString, lineNum: int32_t, nonce: &::nsstring::nsAString, content: &::nsstring::nsAString) -> nsresult,

    /* void setRequestContext (in nsIDOMDocument aDocument, in nsIPrincipal aPrincipal); */
    pub SetRequestContext: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aDocument: *const nsIDOMDocument, aPrincipal: *const nsIPrincipal) -> nsresult,

    /* [noscript] void ensureEventTarget (in nsIEventTarget aEventTarget); */
    pub EnsureEventTarget: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aEventTarget: *const nsIEventTarget) -> nsresult,

    /* bool requireSRIForType (in nsContentPolicyType aContentType); */
    pub RequireSRIForType: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aContentType: nsContentPolicyType, _retval: *mut bool) -> nsresult,

    /* boolean permitsAncestry (in nsIDocShell docShell); */
    pub PermitsAncestry: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, docShell: *const nsIDocShell, _retval: *mut bool) -> nsresult,

    /* boolean permits (in nsIURI aURI, in CSPDirective aDir, in boolean aSpecific); */
    pub Permits: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, aURI: *const nsIURI, aDir: CSPDirective, aSpecific: bool, _retval: *mut bool) -> nsresult,

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

    /* AString toJSON (); */
    pub ToJSON: unsafe extern "system" fn (this: *const nsIContentSecurityPolicy, _retval: &mut ::nsstring::nsAString) -> 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 nsIContentSecurityPolicy {
    /// ```text
    /// /**
    ///    * Directives supported by Content Security Policy.  These are enums for
    ///    * the CSPDirective type.
    ///    * The NO_DIRECTIVE entry is  used for checking default permissions and
    ///    * returning failure when asking CSP which directive to check.
    ///    *
    ///    * NOTE: When implementing a new directive, you will need to add it here but also
    ///    * add it to the CSPStrDirectives array in nsCSPUtils.h.
    ///    */
    /// ```
    ///

    pub const NO_DIRECTIVE: i64 = 0;


    pub const DEFAULT_SRC_DIRECTIVE: i64 = 1;


    pub const SCRIPT_SRC_DIRECTIVE: i64 = 2;


    pub const OBJECT_SRC_DIRECTIVE: i64 = 3;


    pub const STYLE_SRC_DIRECTIVE: i64 = 4;


    pub const IMG_SRC_DIRECTIVE: i64 = 5;


    pub const MEDIA_SRC_DIRECTIVE: i64 = 6;


    pub const FRAME_SRC_DIRECTIVE: i64 = 7;


    pub const FONT_SRC_DIRECTIVE: i64 = 8;


    pub const CONNECT_SRC_DIRECTIVE: i64 = 9;


    pub const REPORT_URI_DIRECTIVE: i64 = 10;


    pub const FRAME_ANCESTORS_DIRECTIVE: i64 = 11;


    pub const REFLECTED_XSS_DIRECTIVE: i64 = 12;


    pub const BASE_URI_DIRECTIVE: i64 = 13;


    pub const FORM_ACTION_DIRECTIVE: i64 = 14;


    pub const REFERRER_DIRECTIVE: i64 = 15;


    pub const WEB_MANIFEST_SRC_DIRECTIVE: i64 = 16;


    pub const UPGRADE_IF_INSECURE_DIRECTIVE: i64 = 17;


    pub const CHILD_SRC_DIRECTIVE: i64 = 18;


    pub const BLOCK_ALL_MIXED_CONTENT: i64 = 19;


    pub const REQUIRE_SRI_FOR: i64 = 20;


    pub const SANDBOX_DIRECTIVE: i64 = 21;


    pub const WORKER_SRC_DIRECTIVE: i64 = 22;


    pub const VIOLATION_TYPE_INLINE_SCRIPT: i64 = 1;


    pub const VIOLATION_TYPE_EVAL: i64 = 2;


    pub const VIOLATION_TYPE_INLINE_STYLE: i64 = 3;


    pub const VIOLATION_TYPE_NONCE_SCRIPT: i64 = 4;


    pub const VIOLATION_TYPE_NONCE_STYLE: i64 = 5;


    pub const VIOLATION_TYPE_HASH_SCRIPT: i64 = 6;


    pub const VIOLATION_TYPE_HASH_STYLE: i64 = 7;


    pub const VIOLATION_TYPE_REQUIRE_SRI_FOR_STYLE: i64 = 8;


    pub const VIOLATION_TYPE_REQUIRE_SRI_FOR_SCRIPT: i64 = 9;

    /// ```text
    /// /**
    ///    * Accessor method for a read-only string version of the policy at a given
    ///    * index.
    ///    */
    /// ```
    ///

    /// `[binaryname(GetPolicyString)] AString getPolicy (in unsigned long index);`
    #[inline]
    pub unsafe fn GetPolicyString(&self, index: libc::uint32_t, _retval: &mut ::nsstring::nsAString) -> nsresult {
        ((*self.vtable).GetPolicyString)(self, index, _retval)
    }


    /// ```text
    /// /**
    ///    * Accessor method for a read-only pointer the policy object at a given
    ///    * index. Returns a null pointer if the index is larger than the current
    ///    * policy count.
    ///    */
    /// ```
    ///

    /// `[noscript,nostdcall,notxpcom] CSPPolicyPtr GetPolicy (in unsigned long index);`
    const _GetPolicy: () = ();

    /// ```text
    /// /**
    ///    * Returns the number of policies attached to this CSP instance.  Useful with
    ///    * getPolicy().
    ///    */
    /// ```
    ///

    /// `readonly attribute unsigned long policyCount;`
    #[inline]
    pub unsafe fn GetPolicyCount(&self, aPolicyCount: *mut libc::uint32_t) -> nsresult {
        ((*self.vtable).GetPolicyCount)(self, aPolicyCount)
    }


    /// ```text
    /// /**
    ///    * Returns whether this policy uses the directive upgrade-insecure-requests.
    ///    * Please note that upgrade-insecure-reqeusts also applies if the parent or
    ///    * including document (context) makes use of the directive.
    ///    */
    /// ```
    ///

    /// `readonly attribute bool upgradeInsecureRequests;`
    #[inline]
    pub unsafe fn GetUpgradeInsecureRequests(&self, aUpgradeInsecureRequests: *mut bool) -> nsresult {
        ((*self.vtable).GetUpgradeInsecureRequests)(self, aUpgradeInsecureRequests)
    }


    /// ```text
    /// /**
    ///    * Returns whether this policy uses the directive block-all-mixed-content.
    ///    * Please note that block-all-mixed-content takes presedence in case the
    ///    * directive upgrade-insecure-requests is defined in the same policy and
    ///    * will therefore block all mixed content without even trying to perform
    ///    * an upgrade.
    ///    */
    /// ```
    ///

    /// `readonly attribute bool blockAllMixedContent;`
    #[inline]
    pub unsafe fn GetBlockAllMixedContent(&self, aBlockAllMixedContent: *mut bool) -> nsresult {
        ((*self.vtable).GetBlockAllMixedContent)(self, aBlockAllMixedContent)
    }


    /// ```text
    /// /**
    ///    * Returns whether this policy enforces the frame-ancestors directive.
    ///    */
    /// ```
    ///

    /// `readonly attribute bool enforcesFrameAncestors;`
    #[inline]
    pub unsafe fn GetEnforcesFrameAncestors(&self, aEnforcesFrameAncestors: *mut bool) -> nsresult {
        ((*self.vtable).GetEnforcesFrameAncestors)(self, aEnforcesFrameAncestors)
    }


    /// ```text
    /// /**
    ///    * Obtains the referrer policy (as integer) for this browsing context as
    ///    * specified in CSP.  If there are multiple policies and...
    ///    *  - only one sets a referrer policy: that policy is returned
    ///    *  - more than one sets different referrer policies: no-referrer is returned
    ///    *  - more than one set equivalent policies: that policy is returned
    ///    * For the enumeration of policies see ReferrerPolicy.h and nsIHttpChannel.
    ///    *
    ///    * @param aPolicy
    ///    *        The referrer policy to use for the protected resource.
    ///    * @return
    ///    *        true if a referrer policy is specified, false if it's unspecified.
    ///    */
    /// ```
    ///

    /// `bool getReferrerPolicy (out unsigned long policy);`
    #[inline]
    pub unsafe fn GetReferrerPolicy(&self, policy: *mut libc::uint32_t, _retval: *mut bool) -> nsresult {
        ((*self.vtable).GetReferrerPolicy)(self, policy, _retval)
    }


    /// ```text
    /// /**
    ///    * Parse and install a CSP policy.
    ///    * @param aPolicy
    ///    *        String representation of the policy
    ///    *        (e.g., header value, meta content)
    ///    * @param reportOnly
    ///    *        Should this policy affect content, script and style processing or
    ///    *        just send reports if it is violated?
    ///    * @param deliveredViaMetaTag
    ///    *        Indicates whether the policy was delivered via the meta tag.
    ///    */
    /// ```
    ///

    /// `void appendPolicy (in AString policyString, in boolean reportOnly, in boolean deliveredViaMetaTag);`
    #[inline]
    pub unsafe fn AppendPolicy(&self, policyString: &::nsstring::nsAString, reportOnly: bool, deliveredViaMetaTag: bool) -> nsresult {
        ((*self.vtable).AppendPolicy)(self, policyString, reportOnly, deliveredViaMetaTag)
    }



    /// `boolean getAllowsInline (in nsContentPolicyType aContentPolicyType, in AString aNonce, in boolean aParserCreated, in nsISupports aElementOrContent, in unsigned long aLineNumber);`
    #[inline]
    pub unsafe fn GetAllowsInline(&self, aContentPolicyType: nsContentPolicyType, aNonce: &::nsstring::nsAString, aParserCreated: bool, aElementOrContent: *const nsISupports, aLineNumber: libc::uint32_t, _retval: *mut bool) -> nsresult {
        ((*self.vtable).GetAllowsInline)(self, aContentPolicyType, aNonce, aParserCreated, aElementOrContent, aLineNumber, _retval)
    }


    /// ```text
    /// /**
    ///    * whether this policy allows eval and eval-like functions
    ///    * such as setTimeout("code string", time).
    ///    * @param shouldReportViolations
    ///    *     Whether or not the use of eval should be reported.
    ///    *     This function returns "true" when violating report-only policies, but
    ///    *     when any policy (report-only or otherwise) is violated,
    ///    *     shouldReportViolations is true as well.
    ///    * @return
    ///    *     Whether or not the effects of the eval call should be allowed
    ///    *     (block the call if false).
    ///    */
    /// ```
    ///

    /// `boolean getAllowsEval (out boolean shouldReportViolations);`
    #[inline]
    pub unsafe fn GetAllowsEval(&self, shouldReportViolations: *mut bool, _retval: *mut bool) -> nsresult {
        ((*self.vtable).GetAllowsEval)(self, shouldReportViolations, _retval)
    }


    /// ```text
    /// /**
    ///    * Delegate method called by the service when the protected document is loaded.
    ///    * Returns the union of all the sandbox flags contained in CSP policies. This is the most
    ///    * restrictive interpretation of flags set in multiple policies.
    ///    * See nsSandboxFlags.h for the possible flags.
    ///    *
    ///    * @return
    ///    *    sandbox flags or SANDBOXED_NONE if no sandbox directive exists
    ///    */
    /// ```
    ///

    /// `uint32_t getCSPSandboxFlags ();`
    #[inline]
    pub unsafe fn GetCSPSandboxFlags(&self, _retval: *mut uint32_t) -> nsresult {
        ((*self.vtable).GetCSPSandboxFlags)(self, _retval)
    }


    /// ```text
    /// /**
    ///    * For each violated policy (of type violationType), log policy violation on
    ///    * the Error Console and send a report to report-uris present in the violated
    ///    * policies.
    ///    *
    ///    * @param violationType
    ///    *     one of the VIOLATION_TYPE_* constants, e.g. inline-script or eval
    ///    * @param sourceFile
    ///    *     name of the source file containing the violation (if available)
    ///    * @param contentSample
    ///    *     sample of the violating content (to aid debugging)
    ///    * @param lineNum
    ///    *     source line number of the violation (if available)
    ///    * @param aNonce
    ///    *     (optional) If this is a nonce violation, include the nonce so we can
    ///    *     recheck to determine which policies were violated and send the
    ///    *     appropriate reports.
    ///    * @param aContent
    ///    *     (optional) If this is a hash violation, include contents of the inline
    ///    *     resource in the question so we can recheck the hash in order to
    ///    *     determine which policies were violated and send the appropriate
    ///    *     reports.
    ///    */
    /// ```
    ///

    /// `void logViolationDetails (in unsigned short violationType, in AString sourceFile, in AString scriptSample, in int32_t lineNum, [optional] in AString nonce, [optional] in AString content);`
    #[inline]
    pub unsafe fn LogViolationDetails(&self, violationType: libc::uint16_t, sourceFile: &::nsstring::nsAString, scriptSample: &::nsstring::nsAString, lineNum: int32_t, nonce: &::nsstring::nsAString, content: &::nsstring::nsAString) -> nsresult {
        ((*self.vtable).LogViolationDetails)(self, violationType, sourceFile, scriptSample, lineNum, nonce, content)
    }


    /// ```text
    /// /**
    ///    * Called after the CSP object is created to fill in appropriate request
    ///    * context. Either use
    ///    *  * aDocument (preferred), or if no document is available, then provide
    ///    *  * aPrincipal
    ///    */
    /// ```
    ///

    /// `void setRequestContext (in nsIDOMDocument aDocument, in nsIPrincipal aPrincipal);`
    #[inline]
    pub unsafe fn SetRequestContext(&self, aDocument: *const nsIDOMDocument, aPrincipal: *const nsIPrincipal) -> nsresult {
        ((*self.vtable).SetRequestContext)(self, aDocument, aPrincipal)
    }


    /// ```text
    /// /**
    ///    *  Ensure we have a nsIEventTarget to use to label CSPReportSenderRunnable
    ///    */
    /// ```
    ///

    /// `[noscript] void ensureEventTarget (in nsIEventTarget aEventTarget);`
    #[inline]
    pub unsafe fn EnsureEventTarget(&self, aEventTarget: *const nsIEventTarget) -> nsresult {
        ((*self.vtable).EnsureEventTarget)(self, aEventTarget)
    }



    /// `bool requireSRIForType (in nsContentPolicyType aContentType);`
    #[inline]
    pub unsafe fn RequireSRIForType(&self, aContentType: nsContentPolicyType, _retval: *mut bool) -> nsresult {
        ((*self.vtable).RequireSRIForType)(self, aContentType, _retval)
    }


    /// ```text
    /// /**
    ///    * Verifies ancestry as permitted by the policy.
    ///    *
    ///    * NOTE: Calls to this may trigger violation reports when queried, so this
    ///    * value should not be cached.
    ///    *
    ///    * @param docShell
    ///    *    containing the protected resource
    ///    * @return
    ///    *    true if the frame's ancestors are all allowed by policy (except for
        ///    *    report-only policies, which will send reports and then return true
        ///    *    here when violated).
    ///    */
    /// ```
    ///

    /// `boolean permitsAncestry (in nsIDocShell docShell);`
    #[inline]
    pub unsafe fn PermitsAncestry(&self, docShell: *const nsIDocShell, _retval: *mut bool) -> nsresult {
        ((*self.vtable).PermitsAncestry)(self, docShell, _retval)
    }


    /// ```text
    /// /**
    ///    * Checks if a specific directive permits loading of a URI.
    ///    *
    ///    * NOTE: Calls to this may trigger violation reports when queried, so the
    ///    * return value should not be cached.
    ///    *
    ///    * @param aURI
    ///    *    The URI about to be loaded or used.
    ///    * @param aDir
    ///    *    The CSPDirective to query (see above constants *_DIRECTIVE).
    ///    * @param aSpecific
    ///    *    If "true" and the directive is specified to fall back to "default-src"
    ///    *    when it's not explicitly provided, directivePermits will NOT try
    ///    *    default-src when the specific directive is not used.  Setting this to
    ///    *    "false" allows CSP to fall back to default-src.  This function
    ///    *    behaves the same for both values of canUseDefault when querying
    ///    *    directives that don't fall-back.
    ///    * @return
    ///    *    Whether or not the provided URI is allowed by CSP under the given
    ///    *    directive. (block the pending operation if false).
    ///    */
    /// ```
    ///

    /// `boolean permits (in nsIURI aURI, in CSPDirective aDir, in boolean aSpecific);`
    #[inline]
    pub unsafe fn Permits(&self, aURI: *const nsIURI, aDir: CSPDirective, aSpecific: bool, _retval: *mut bool) -> nsresult {
        ((*self.vtable).Permits)(self, aURI, aDir, aSpecific, _retval)
    }


    /// ```text
    /// /**
    ///    * Delegate method called by the service when sub-elements of the protected
    ///    * document are being loaded.  Given a bit of information about the request,
    ///    * decides whether or not the policy is satisfied.
    ///    *
    ///    * Calls to this may trigger violation reports when queried, so
    ///    * this value should not be cached.
    ///    */
    /// ```
    ///

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


    /// ```text
    /// /**
    ///    * Returns the CSP in JSON notation.
    ///    */
    /// ```
    ///

    /// `AString toJSON ();`
    #[inline]
    pub unsafe fn ToJSON(&self, _retval: &mut ::nsstring::nsAString) -> nsresult {
        ((*self.vtable).ToJSON)(self, _retval)
    }


}