Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_LoadTainting_h
8
#define mozilla_LoadTainting_h
9
10
namespace mozilla {
11
12
// Define an enumeration to reflect the concept of response tainting from the
13
// the fetch spec:
14
//
16
//
17
// Roughly the tainting means:
18
//
19
// * Basic: the request resulted in a same-origin or non-http load
20
// * CORS: the request resulted in a cross-origin load with CORS headers
21
// * Opaque: the request resulted in a cross-origin load without CORS headers
22
//
23
// The enumeration is purposefully designed such that more restrictive tainting
24
// corresponds to a higher integral value.
25
//
26
// NOTE: Checking the tainting is not currently adequate. You *must* still
27
// check the final URL and CORS mode on the channel.
28
//
29
// These values are currently only set on the channel LoadInfo when the request
30
// was initiated through fetch() or when a service worker interception occurs.
31
// In the future we should set the tainting value within necko so that it is
32
// consistently applied. Once that is done consumers can replace checks against
33
// the final URL and CORS mode with checks against tainting.
34
enum class LoadTainting : uint8_t { Basic = 0, CORS = 1, Opaque = 2 };
35
36
} // namespace mozilla
37
38
#endif // mozilla_LoadTainting_h