blob: 5f2fe1517de49c70d2eea4ea4fd5ba9207abda75 (
plain)
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
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
%{C++
#include "mozilla/dom/MimeType.h"
#include "mozilla/net/ContentRange.h"
%}
/**
* The nsIBaseChannel interface allows C++ code to query the interface
* of channels safely to gain access to content range functionality.
* This allows subclasses to optionally handle range-requests on their
* types using fetch/XMLHttpRequest even if they are not accessed via
* HTTP and therefore normally do not have support for headers.
*/
native ContentRangeRef(RefPtr<mozilla::net::ContentRange>);
native MimeTypeRef(RefPtr<TMimeType<char>>);
[uuid(036d5cd7-9a53-40e3-9c72-c2ffaa15aa2b)]
interface nsIBaseChannel : nsISupports {
/**
* Used by fetch and XMLHttpRequest to get only the range specified in the
* Range request header (if given) for the response body (e.g, for blob URLs)
*/
attribute ContentRangeRef contentRange;
/**
* Used by fetch and XMLHttpRequest to get the standards-compliant value they
* should set for the Content-Type header on response (if nullptr, they will
* use Firefox-specific values from nsIChannel::GetContentType and GetCharset).
*/
attribute MimeTypeRef fullMimeType;
%{C++
RefPtr<mozilla::net::ContentRange> ContentRange() {
RefPtr<mozilla::net::ContentRange> range;
mozilla::Unused << GetContentRange(&range);
return range;
}
bool SetContentRangeFromHeader(const nsACString& aHeader, uint64_t aSize) {
RefPtr<mozilla::net::ContentRange> range =
new mozilla::net::ContentRange(aHeader, aSize);
if (!range->IsValid()) {
return false;
}
SetContentRange(range);
return true;
}
RefPtr<CMimeType> FullMimeType() {
RefPtr<CMimeType> type;
mozilla::Unused << GetFullMimeType(&type);
return type;
}
%}
};
|