In the past we used a fixed value for the firstPartyDomain of
NullPrincipal, now we derive it from the path of NullPrincipal, so it
will be unique everytime we create it.
This helper class allows us to create simple channels that open an underlying
input stream when the channel is first opened, using a closure function,
without having to expose the nsBaseChannel class to non-necko code.
MozReview-Commit-ID: 6jiImdMXUp0
--HG--
extra : rebase_source : b8d30a28593940c41109b1352eb0c549213c5f89
Several of our simple channel implementations work naturally with direct
nsIStreamListener output. Currently, these implementations need to create a
pipe, pump data in to that pipe, and then allow nsBaseChannel to pump data out
of the other side of that pipe, into its own stream listener.
This change allows them to output data directly to nsBaseChannel's stream
listener, which removes unnecessary complexity and overhead.
MozReview-Commit-ID: JCGKTt6Kn9x
--HG--
extra : rebase_source : 200dd2641bfa703f658c2c5171a68df3a035be0a
If the call to NewChannel2 returns NS_ERROR_NOT_IMPLEMENTED or NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED that means the implementation is actually missing, so it is OK to fall back to NewChannel.
If it fails with any other error code, we just return it.
MozReview-Commit-ID: JmgEmPqu6zJ
--HG--
rename : netwerk/test/unit/test_bug894586.js => netwerk/test/unit/test_1351443-missing-NewChannel2.js
extra : rebase_source : 5d41df330a15ad7b679d9bed52e6fbf90bdc4ed8
These APIs are intended to use the mechanism defined in Part 1.
Part 3 implements the usage of these APIs to synchronize permissions.
MozReview-Commit-ID: HNKyDPtoaHl
This eliminates some of the pointer math and makes the method a bit safer.
The function's behaviour remains the same as before.
MozReview-Commit-ID: 94wBk6xvkd6
--HG--
extra : rebase_source : 9fac33114b16d0910e63b474222acf0bc1db500f
While writing a gtest I discovered the parsing an IPv6 address didn't work due to the brackets.
MozReview-Commit-ID: 9mmKS72hf7Y
--HG--
extra : rebase_source : 757a19a50a50b2af232f0b44f6faacf7280b554a
When we load about:blank in a remote tab, it will have
LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL flag set, which will make
NullPrinicipal as its document principal. So we add
NULL_PRINCIPAL_FIRST_PARTY_DOMAIN as its firstPartyDomain.
So when we load data:, or javascript: URI in a remote tab, it will inherit the
principal from about:blank, hence also inherit the origin attributes.
There are also some about: pages will use codebase principal, so we also
set ABOUT_URI_FIRST_PARTY_DOMAIN as firstPartyDomain on their
principals.
There's an antipattern where nsLiteralString is used as an unnecessary intermediary in converting from CharT* to CharT*,
e.g. CallAFunctionThatTakesACharPointer(NS_LITERAL_CSTRING("foo").get());
or
NS_NAMED_LITERAL_STRING(foo, "abc");
CallAFunctionThatTakesACharPointer(foo.get());
This patch rewrites the callsites that can be trivially changed to use char*/char16_t*.
I'd somewhat like to remove nsTLiteralString::get() altogether, but in code that's less straightforward than these examples, get() is useful enough to keep.
MozReview-Commit-ID: Kh1rUziVllo
--HG--
extra : rebase_source : c21a65694d6e1c42fd88f73632f7ac8f38d005ae
There's an antipattern where nsLiteralString is used as an unnecessary intermediary in converting from CharT* to CharT*,
e.g. CallAFunctionThatTakesACharPointer(NS_LITERAL_CSTRING("foo").get());
or
NS_NAMED_LITERAL_STRING(foo, "abc");
CallAFunctionThatTakesACharPointer(foo.get());
This patch rewrites the callsites that can be trivially changed to use char*/char16_t*.
I'd somewhat like to remove nsTLiteralString::get() altogether, but in code that's less straightforward than these examples, get() is useful enough to keep.
MozReview-Commit-ID: Kh1rUziVllo
--HG--
extra : rebase_source : c21a65694d6e1c42fd88f73632f7ac8f38d005ae