Commit Graph

60 Commits

Author SHA1 Message Date
Sebastian Hengst
d91e9954eb Backed out 4 changesets (bug 525063) on request from Andi. a=backout
Backed out changeset 516c4fb1e4b8 (bug 525063)
Backed out changeset 6ff8aaef2866 (bug 525063)
Backed out changeset bf13e4103150 (bug 525063)
Backed out changeset d7d2f08e051c (bug 525063)
2018-04-13 16:01:28 +03:00
Tristan Bourvon
6095241db8 Bug 525063 - Initialize uninitialized class attributes in m-c. r=ehsan 2018-04-10 21:11:02 +02:00
Boris Zbarsky
d54406240d Bug 1449631 part 6. Remove nsIDOMEventTarget::DispatchEvent. r=smaug
MozReview-Commit-ID: 8YMgmMwZkAL
2018-04-05 13:42:41 -04:00
Kris Maglione
4c402a31f9 Bug 1451215: Run codespell on code. r=aswan
MozReview-Commit-ID: HIilZTKcQUY
2018-04-03 22:22:07 -07:00
Dave Townsend
a37ff0462a Bug 1448500: Add speculative request content policy type. r=bz, r=kmag
Adds a new TYPE_SPECULATIVE to nsIContentPolicy uses it as the type for
speculative connection channels from the IO service. I believe I've added it to
all the content policies in tree to make sure it behaves the same as TYPE_OTHER
used to.

The webextension test shows that the webextension proxy API sees speculative
lookups requested through the IO service.

MozReview-Commit-ID: DQ4Kq0xdUOD
2018-03-23 15:27:08 -07:00
Kris Maglione
fd4b15b0bb Bug 1410755: Follow-up: Fix assertion in debug builds. r=me
MozReview-Commit-ID: G9Hjrpm7Owg
2018-03-26 22:57:19 -07:00
Kris Maglione
284dfd93d5 Bug 1410755: Follow-up: Fix static analysis bustage. r=bustage
MozReview-Commit-ID: GDtg3LoBJhS
2018-03-26 22:40:11 -07:00
Kris Maglione
b67da89606 Bug 1410755: Add StreamFilterParent as a request to the channel load group. r=mixedpuppy
When the base request that we are filtering finishes, it generally removes it
self from the document's load group. If that happens before the parser has
started (which tends to be the case for XML documents that haven't consumed
any data), it can unblock the load event too early. Adding the
StreamFilterParent to the load group while the request is still pending
prevents this problem.

MozReview-Commit-ID: InxAVZQy9kT
2018-03-24 16:51:35 -07:00
Kris Maglione
916798e102 Bug 1444680: Follow-up: Fix StreamFilter race that turns up when running tests in parallel. r=mixedpuppy
MozReview-Commit-ID: 9qGEmtq5J4H
2018-03-12 18:31:58 -07:00
Kris Maglione
a0895a8cc3 Bug 1444680: Follow-up: Release StreamFilterParent::mChannel on main thread. r=mixedpuppy a=bustage DONTBUILD CLOSED TREE
Running the StreamFilter tests as parallel xpcshell tests uncovered a race, in
which we sometimes wind up releasing the last reference to an HttpChannel on a
background thread, and its destructor attempts to free things which can only
be freed on the main thread.
2018-03-12 15:04:02 -07:00
Kris Maglione
2534340750 Bug 1444539: Disconnect StreamFilters on redirect. r=mixedpuppy
MozReview-Commit-ID: AuCjXTlsFSC
2018-03-09 14:38:41 -08:00
Kris Maglione
fd8a0b2ac6 Bug 1415644: Create a list of restricted domains. r=aswan,mixedpuppy
MozReview-Commit-ID: A0AkaBG33In
2018-03-03 16:28:18 -08:00
Kris Maglione
9a668fe793 Bug 1430508: Return 0 for ProcessId() when channel IPC is closed. r=dragana
There are some corner cases where we try to attach StreamFilter endpoints to a
channel after its IPC has been closed from from the other side, but request
listeners haven't been notified. This causes crashes in any of several places.

This patch changes nsHttpChannel::ProcessId to return 0 when IPC is closed, so
callers can detect that it's no longer possible to attach endpoints to it.

MozReview-Commit-ID: BZTOqezih0P
2018-01-14 17:40:09 -08:00
Shane Caraveo
616ecb3d39 Bug 1149250 add support for https upgrades from webextensions, r=bz,mayhemer,rpl
MozReview-Commit-ID: ChIs2Q6bgEn
2017-12-08 12:12:37 -08:00
Peter Snyder
9308fe1009 Bug 1377689 - merge identical headers in set{Request,Response}Header, r=bz,mixedpuppy
MozReview-Commit-ID: Kpli9YzEvlt
2017-12-04 22:48:54 -06:00
Nika Layzell
5a9f61464e Bug 1418048 - Add a callback-based Send API to async returning IPDL methods, r=billm
Currently if you write an async IPDL method which has a return value, we expose
a SendXXX method which returns a MozPromise. This MozPromise can then be
->Then-ed to run code when it is resolved or rejected.

Unfortunately, using this API loses ordering guarantees which IPDL provides.
MozPromise::Then takes an event target, which the resolve runnable is dispatched
to. This means that the resolve callback's code doesn't have any ordering
guarantees relative to the processing of other IPC messages coming over the same
protocol.

This adds a new overload to SendXXX with two additional arguments, a lambda
callback which is called if the call succeeds, and a lambda callback which is
called if the call fails. These will be called in order with other IPC messages
sent over the same protocol.

MozReview-Commit-ID: FZHJJaSDoZy
2017-11-20 17:55:32 -05:00
Kris Maglione
272fef97cc Bug 1414549: Correctly handle GetDeliveryTarget failure. r=mixedpuppy
getter_AddRefs nulls its parameter before passing it to the getter function,
which means that on failure, we wind up with a null IO thread, rather than its
original main thread value.

MozReview-Commit-ID: 1SSIeNtiBq9
2017-11-05 19:22:38 -08:00
NARCIS BELEUZU
8095e5b55f Backed out changeset 209df98be467 (bug 1398120) for frequently failing on toolkit/components/extensions/test/mochitest/test-oop-extensions/test_ext_webrequest_responseBody.html r=backout, a=backout on a CLOSED TREE 2017-11-03 14:35:44 +02:00
Kris Maglione
a0f797696a Bug 1398120: Fix some StreamFilter state handling inconsistencies. r=mixedpuppy
MozReview-Commit-ID: 2mLZ9DeqpE0
2017-11-02 12:27:45 -07:00
Kris Maglione
0f0043a084 Bug 1405506: Flush buffered data when disconnecting suspended channel. r=mixedpuppy
MozReview-Commit-ID: F9rIhQHr8i
2017-10-31 18:19:40 -07:00
Kris Maglione
0951de1842 Bug 1411817: Add do_AddRef overloads for nsCOMPtr<T> and nsRevocableEventPtr<T>. r=froydnj
MozReview-Commit-ID: gEU7whtNHc
2017-10-25 19:46:50 -07:00
Kris Maglione
a7853ee371 Bug 1402944: Follow-up: Clean up isProxy matching exemptions a bit. r=trivial
MozReview-Commit-ID: 8fbwNPXsCkI
2017-10-25 13:54:00 -07:00
Kris Maglione
edb5338a4e Bug 1405286: Part 4 - Don't overwrite existing state with finishedtransferringdata. r=mixedpuppy
In cases where data transfer finishes immediately after we close a request, we
can sometimes wind up overwriting that state information with
"finishedtransferringdata", which allows scripted callers to break certain
invariants and cause crashes.

MozReview-Commit-ID: Do3GttF3M9S
2017-10-14 20:01:18 -07:00
Kris Maglione
12b1b432af Bug 1405286: Part 3 - Test that filterResponseData from cached onHeadersReceived doesn't crash. r=mixedpuppy
It currently isn't possible to suspend a channel from onHeadersReceived for a
cached response. And since it's not possible to add a new stream filter after
a response has started, adding a stream filter at that point will crash if the
channel is still registered.

This test is a basic sanity check for that scenario.

MozReview-Commit-ID: ALYUtxX7mci
2017-10-14 19:25:35 -07:00
Kris Maglione
dc934d5217 Bug 1405286: Part 2 - Ensure ordered processing of StreamFilter events. r=mixedpuppy
Our current StreamFilter code doesn't behave well when data delivery is
targeted to a thread pool, rather than a single thread.

Thread pools don't guarantee ordered processing of events. It's theoretically
always possible for multiple events dispatched to a pool to be processed in
parallel, or even slightly out of order.

For the most part, this should only be a theoretical concern, unless several
data events are dispatched at the same time, and the pool has enough available
threads to service all of them (which is an unlikely scenario in this code).
However, when data delivery is targeted to a thread pool, the OnDataAvailable
callbacks do not have access to the thread pool itself, only the thread that
the callback was dispatched to. This means that after each OnDataAvailable
call, we likely store a new IO thread, and writes end up queued to a different
single thread depending on exactly when they happen.

Threads in thread pools often wind up executing long-running runnables, such
as synchronous IO or network operations. Which means that we introduce
arbitrary delays for some writes, and are likely to wind up with highly
arbitrary ordering.


This patch solves both of these problems by introducing strict event queue
ordering, and also dispatching IO events to the original explicit delivery
target, rather than whatever the current thread happened to be at the time of
the last data event.

MozReview-Commit-ID: 1SdYjS6ltqw
2017-10-14 18:58:53 -07:00
Ben Kelly
34cf9299c7 Bug 1380255 P3 Disable channel thread retargeting when webrequest is tracing the channel. r=kmag 2017-10-12 19:23:16 -07:00
Shane Caraveo
cf8c5452ed Bug 1305237 Expose frameAncestors to webextensions, r=bz,kmag
MozReview-Commit-ID: 64lIMu6neaD
2017-10-10 09:54:22 -07:00
Nicholas Nethercote
7dbfdaf890 Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP
2017-10-03 09:05:19 +11:00
Wes Kocher
ce6083bc04 Backed out 2 changesets (bug 1305237) for crashtest failures in 403574-1.xhtml and 1282985-1.svg a=backout
Backed out changeset 96b5d596cc27 (bug 1305237)
Backed out changeset 5fe72402746f (bug 1305237)

MozReview-Commit-ID: CjCWY73Hps1
2017-10-02 16:41:56 -07:00
Shane Caraveo
a7b37edbc1 Bug 1305237 Expose frameAncestors to webextensions, r=bz,kmag
MozReview-Commit-ID: 8gvEiqJEsP3
2017-10-02 15:11:54 -07:00
Wes Kocher
26e25c2519 Backed out 2 changesets (bug 1305237) for bc failures in browser_WebRequest_ancestors.js a=backout
Backed out changeset 163a2b0bb0a0 (bug 1305237)
Backed out changeset e05bab140564 (bug 1305237)

MozReview-Commit-ID: GLlbWYZqyVS
2017-10-02 13:35:03 -07:00
Shane Caraveo
29494e6337 Bug 1305237 Expose frameAncestors to webextensions, r=bz,kmag
MozReview-Commit-ID: Dcf2AaUqBsb
2017-10-02 11:06:31 -07:00
Wes Kocher
4253ce7dce Merge inbound to m-c a=merge
MozReview-Commit-ID: 7zOjePOWzOM
2017-09-28 16:56:44 -07:00
Ryan VanderMeulen
252c89b8d4 Backed out changesets d0d30a90efa1 and fd1d81b93380 (bug 1305237) for causing bug 1403932. 2017-09-28 17:55:43 -04:00
Shane Caraveo
d7ebe7ee66 Bug 1305237 Expose frameAncestors to webextensions, r=bz,kmag
MozReview-Commit-ID: HpneTIKPoS1
2017-09-27 07:58:17 -07:00
Nicholas Nethercote
9fda5528d2 Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.

- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>

- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
  - Count() --> Length()
  - ObjectAt() --> ElementAt()
  - AppendObject() --> AppendElement()
  - RemoveObjectAt() --> RemoveElementAt()

- ns*Hashtable<nsISupportsHashKey, ...> -->
  ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>

- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
  - This requires adding a Get() method to nsRefPtrHashtable that it lacks but
    nsInterfaceHashtable has.

- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
  - nsArrayBase::Create() --> nsTArray()
  - GetLength() --> Length()
  - do_QueryElementAt() --> operator[]

The patch also has some changes to Rust code that manipulates nsIAtom.

MozReview-Commit-ID: DykOl8aEnUJ
2017-09-26 08:33:21 +10:00
Kris Maglione
baa806b321 Bug 1402944: Part 9 - Optimize request/response header handling. r=mixedpuppy,ehsan
We don't use the initial Map returned by ChannelWrapper as a map, so there's no
need for the overhead involved in creating it. We also don't need the header map
generated by HeaderChanger unless headers are actually being modified, which
for many listeners they never are, so there's no need for the map creation and
string lower-casing overhead prior to modification time.

MozReview-Commit-ID: K2uK93Oo542
2017-09-23 16:25:19 -07:00
Kris Maglione
9880082601 Bug 1402944: Part 7 - Move traceable channel registration to ChannelWrapper. r=mixedpuppy,ehsan
MozReview-Commit-ID: 6hGmh4VpJMQ
2017-09-27 18:15:39 -07:00
Kris Maglione
813dfdec77 Bug 1402944: Part 5 - Move request filtering and permission matching into ChannelWrapper. r=mixedpuppy,ehsan
This allows us to reuse the same URLInfo objects for each permission or
extension that we match, and also avoids a lot of XPConnect overhead we wind
up incurring when we access URI objects from the JS side.

MozReview-Commit-ID: GqgVRjQ3wYQ
2017-09-27 18:15:12 -07:00
Kris Maglione
d4776d075c Bug 1402944: Part 4 - Fold start/stop listener into ChannelWrapper. r=mixedpuppy,ehsan
MozReview-Commit-ID: 52zZNjgaCEj
2017-09-26 13:39:30 -07:00
Kris Maglione
7f5cb37174 Bug 1402944: Part 3 - Move error checks into ChannelWrapper. r=mixedpuppy,ehsan
MozReview-Commit-ID: 7uLonYWnLcX
2017-09-26 13:38:54 -07:00
Kris Maglione
b0e7882fea Bug 1402944: Part 2 - Move error string logic into ChannelWrapper. r=mixedpuppy,ehsan
MozReview-Commit-ID: 4rOeoliLTV7
2017-09-22 18:43:18 -07:00
Kris Maglione
581c7102af Bug 1399646: Part 3 - Improve handling of StreamFilters at shutdown. r=mixedpuppy
The main change here is to disconnect stream filters immediately if we try to
send start or data events to a window that's already been destroyed.

It also fixes a race where we end up in the wrong state if a stop event
arrives while the channel is being disconnected.

MozReview-Commit-ID: LwxXxoRUDgQ
2017-09-13 13:40:08 -07:00
Kris Maglione
512395766f Bug 1399005: Always dispatch OnStop from the IO thread. r=mixedpuppy
Normally, we try to use the same thread for the IO and actor threads, which
means there's some basic assurance that OnStopRequest is always dispatched
after the last OnDataAvailable call. However, in cases where callers retarget
data delivery to a different background thread, it's possible for the main
thread to process the OnStopRequest runnable before the IO thread has
processed the last OnDataAvailable runnable, which can cause problems.

Dispatching the OnStop runnable through the IO thread guarantees at last basic
consistency in order of dispatch. In the case where the IO thread is the same
as the actor thread, the runnable is processed synchronously, and there's no
behavior change. In other cases, it's dispatched to the IO thread first, and
waits in the same queue as the already-dispatched OnDataAvailable events.

MozReview-Commit-ID: H2GD66WKxNn
2017-09-11 20:04:48 -07:00
Kris Maglione
1007cea3a2 Bug 1396652: Fix WebRequestService destructor ordering issue. r=mixedpuppy
MozReview-Commit-ID: HYDNYzb5bnM
2017-09-07 19:04:01 -07:00
Kris Maglione
24b8044c1b Bug 1398045: Correctly handle channels that don't support weak references. r=mixedpuppy
MozReview-Commit-ID: GX6zUAzVrBZ
2017-09-08 08:56:42 -07:00
Kris Maglione
4d0147a996 Bug 1255894: Part 11 - Move StreamFilterParent to STS thread. r=dragana
MozReview-Commit-ID: L5aPENDjVB3
2017-08-27 21:06:42 -07:00
Kris Maglione
6fc8c74694 Bug 1255894: Part 10 - Move StreamFilterParent to necko child process. r=billm,dragana
MozReview-Commit-ID: 4JKUC7x3QgN
2017-09-07 17:28:27 -07:00
Kris Maglione
bd93d990bf Bug 1397536: Avoid newURI overhead for MatchPattern. r=ehsan,mixedpuppy
Ehsan, can you please review the (trivial) WebIDL changes, and Shane the
WebRequest logic?

The change to allow strings in MatchPattern arguments removes a huge amount of
XPConnect overhead that accumulates when creating nsIURI objects for
WebRequest processing.

The change to re-use existing URI objects removes a huge amount of URI
creation overhead.

MozReview-Commit-ID: 3DJjAKJK1Sa
2017-09-06 21:56:45 -07:00
Kris Maglione
77ecf1916f Bug 1396856: Part 3 - Add a WebIDL wrapper class for necko channels. r=ehsan,mixedpuppy
Ehsan, can you please review the DOM bindings, and Shane the request logic?

The bulk of the overhead WebRequest API is in its access to nsIChannel and
friends through XPConnect. Since it's not really feasible to convert channels
to use WebIDL bindings directly, this generic channel wrapper class serves the
same purpose.

MozReview-Commit-ID: 4mNP8HiKWK
2017-09-06 14:38:23 -07:00