Commit Graph

650 Commits

Author SHA1 Message Date
Daniel Varga
153ba7a50e Backed out changeset 6babd3b956aa (bug 1502403) for wpt leak at mozilla::dom::FileReader::ReadFileContent 2018-10-30 12:50:37 +02:00
Andrea Marchesini
c549894865 Bug 1502403 - FileReader should dispatch loadstart asynchronously, r=smaug 2018-10-30 07:57:31 +01:00
Andrea Marchesini
a0fc57507e Bug 1502375 - FilePropertyBag should inherit BlobPropertyBag, r=smaug 2018-10-27 10:26:31 +02:00
Andrea Marchesini
2ed3dd4f7d Bug 1500370 - MemoryBlobImpl and TestNonBlockingAsyncInputStream must expose nsITellableInterface, r=mayhemer 2018-10-19 15:31:36 +02:00
Andrea Marchesini
4ebf5b4364 Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj
In the current code there are 3 main issues:

1. nsFileStream is not really thread-safe. There is nothing to protect the
internal members and we see crashes.

2. nsPipeInputStream doesn't implement ::Seek() method and that caused issues
in devtools when a nsHttpChannel sends POST data using a pipe. In order to fix
this, bug 1494176 added a check in nsHttpChannel: if the stream doesn't
implement ::Seek(), let's clone it. This was an hack around nsPipeInputStream,
and it's bad.

3. When nsHttpChannel sends POST data using a file stream, nsFileStream does
I/O on main-thread because of the issue 2. Plus, ::Seek() is called on the
main-thread causing issue 1.

Note that nsPipeInputStream implements only ::Tell(), of the nsISeekableStream
methods. It doesn't implement ::Seek() and it doesn't implement ::SetEOF().

With this patch I want to fix point 2 and point 3 (and consequentially issue 1
- but we need a separate fix for it - follow up). The patch does:

1. it splits nsISeekableStream in 2 interfaces: nsITellableStream and
nsISeekableStream.
2. nsPipeInputStream implements only nsITellableStream.  Doing this, we don't
need the ::Seek() check for point 2 in nsHttpChannel: a simple QI check is
enough.
3. Because we don't call ::Seek() in nsHttpChannel, nsFileStream doesn't do I/O
on the main-thread, and we don't crash doing so.
2018-10-18 13:35:35 +02:00
Nathan Froyd
9a4405226c Bug 1499849 - make FileReader timers slightly more efficient; r=baku
Instead of creating a timer and then setting the timer's target, we can
determine the timer's target and pass it in directly when the timer is
created.  This reordering of steps is slightly more efficient, since
SetTarget() is both a virtual call and requires locking, both of which
can be skipped if we know the target at timer creation time.
2018-10-17 19:57:35 -04:00
Andrew McCreight
837f0af066 Bug 1493737 - Fix many trivial calls to do_QueryInterface r=smaug
If class A is derived from class B, then an instance of class A can be
converted to B via a static cast, so a slower QI is not needed.

Differential Revision: https://phabricator.services.mozilla.com/D6861

--HG--
extra : moz-landing-system : lando
2018-10-01 21:38:01 +00:00
Andrea Marchesini
84d1287168 Bug 1452253 - FileReader should use js_free for js_pod_malloc allocations, r=smaug 2018-09-18 16:57:04 +02:00
Ehsan Akhgari
d19f79f590 Bug 1489812 - Part 1: Port nsIEditorUtils.slurpBlob() to C++; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5373
2018-09-10 08:42:26 -04:00
Sylvestre Ledru
aa37bde79b Bug 1489454 - Remove all trailing whitespaces (again) r=Ehsan
This also includes moving some files to the regular format.

Differential Revision: https://phabricator.services.mozilla.com/D5249

--HG--
extra : moz-landing-system : lando
2018-09-07 14:47:51 +00:00
Andrea Marchesini
b42fd5e8a5 Bug 1486900 - IPCBlobInputStreamChild should be able to shutdown before receiving the remote stream, r=smaug 2018-08-29 11:10:57 +02:00
Nicholas Nethercote
ac5efebb4b Bug 1486690 - Remove unnecessary checks after moz_xmalloc() calls. r=glandium
There are surprisingly many of them.

(Plus a couple of unnecessary checks after `new` calls that were nearby.)

--HG--
extra : rebase_source : 47b6d5d7c5c99b1b50b396daf7a3b67abfd74fc1
2018-08-28 15:56:01 +10:00
Henri Sivonen
5adc82bb21 Bug 1485029 - Use SIMD for PopulateBufferForBinaryString() in FileReader.cpp. r=smaug
MozReview-Commit-ID: Gwoj13lFJsJ

Differential Revision: https://phabricator.services.mozilla.com/D3889

--HG--
extra : moz-landing-system : lando
2018-08-22 13:59:43 +00:00
Csoregi Natalia
0ed25650ef Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-08-08 13:02:49 +03:00
Alex Gaynor
8f9e8a51b2 Bug 1446509 - added final versions of macro for declaring AddRef and Decref; r=froydnj
Also make use of them in a few places.

Differential Revision: https://phabricator.services.mozilla.com/D2678

--HG--
extra : moz-landing-system : lando
2018-08-07 18:25:49 +00:00
Kris Maglione
25c94b46d8 Bug 1481021: Part 1 - Fix tests that rely on permissive COWs or SpecialPowers side-effects in frame script scopes. r=bz
Right now, a lot of test code relies on side-effects of SpecialPowers being
loaded into frame script globals. In particular:

- It forces permissive COWs from those scopes, which allows frame scripts to
  pass objects from those scopes to unprivileged content that they otherwise
  wouldn't.
- It imports a bunch of helper modules and WebIDL globals which would
  otherwise not be available.

Fortunately, this seems to only impact test code at this point. But there's a
real down-the-road risk of it impacting shipping code, which ends up working
in automation due to the side-effects of SpecialPowers, but failing in real
world use.

MozReview-Commit-ID: G27eSSOHymX

--HG--
extra : rebase_source : 1702e63fed719fc92def2bdbbb8a7c53572432db
extra : source : 41bedc526dd6ec6b7e8c7be1c832ac60c81d6263
2018-08-07 14:13:06 -07:00
Brindusan Cristian
16ec846afc Backed out 2 changesets (bug 1481021) for bc failures on security/sandbox/test/browser_bug1393259.js.
Backed out changeset c53c7b0249ad (bug 1481021)
Backed out changeset 41bedc526dd6 (bug 1481021)
2018-08-08 03:22:16 +03:00
Kris Maglione
c1969dbca2 Bug 1481021: Part 1 - Fix tests that rely on permissive COWs or SpecialPowers side-effects in frame script scopes. r=bz
Right now, a lot of test code relies on side-effects of SpecialPowers being
loaded into frame script globals. In particular:

- It forces permissive COWs from those scopes, which allows frame scripts to
  pass objects from those scopes to unprivileged content that they otherwise
  wouldn't.
- It imports a bunch of helper modules and WebIDL globals which would
  otherwise not be available.

Fortunately, this seems to only impact test code at this point. But there's a
real down-the-road risk of it impacting shipping code, which ends up working
in automation due to the side-effects of SpecialPowers, but failing in real
world use.

MozReview-Commit-ID: G27eSSOHymX

--HG--
extra : rebase_source : c528dffe3a54eec75ad6cb358980b783b00eb4a4
2018-08-07 14:13:06 -07:00
Andrea Marchesini
a8f7b3a10f Bug 1480354 - Better approach for nested blobs construction, r=smaug 2018-08-03 08:58:32 +02:00
Andrea Marchesini
f6768a8ff6 Bug 1228139 - Remove nsIURIWithPrincipal - part 3 - main part, r=bz
nsIURIWithPrincipal is currently used to retrieve the nsIPrincipal from a
BlobURL object.  BlobURLProtocolHandler has a hashtable containing, for each
blobURL, a BlobImpl and its nsIPrincipal. This patch introduces
BlobURLProtocolHandler::GetBlobURLPrincipal() that retrieves the nsIPrincipal
from this hashtable.

This patch fixes also a bug in how the revocation of blobURLs is broadcasted to
other processes. This should be done immediately because each process creates
its own timer to revoke them after 5 seconds.

An important change is related to NS_SecurityCompareURIs() where, if 1 (or
both) of the 2 URIs to compare, is a revoked BlobURL, we will QI its URL to
nsIStandardURL and fail out at that point.
2018-07-24 22:15:57 +02:00
Andrea Marchesini
8c37ca27d9 Bug 1228139 - Remove nsIURIWithPrincipal - part 2 - BlobURL comparison should not check the principal, r=bz 2018-07-24 22:15:17 +02:00
Andrea Marchesini
bc5414c5f3 Bug 1471189 - Removing 'Terminating' state in workers, r=mrbkap 2018-07-12 19:33:41 +02:00
Matt Howell
638dfe2577 Bug 1052582 Part 2 - Create and use a separate malloc arena for ArrayBuffer contents. r=sfink
MozReview-Commit-ID: 7IlFvr3hoA8

--HG--
extra : rebase_source : 862a259389e7085f4b5c6cb2b27d3f72627e36b3
2018-05-23 14:57:42 -07:00
Jeff Gilbert
5b753da289 Bug 1470325 - s/FooBinding/Foo_Binding/g - r=qdot
MozReview-Commit-ID: JtTcLL5OPF0
2018-06-26 17:05:01 -07:00
Chris Peterson
2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Andrea Marchesini
447d4ed775 Bug 1469126 - Multipart Blobs should use nsMultiplexInputStream only when needed, r=smaug 2018-06-18 11:35:46 -04:00
Andrea Marchesini
9a9a71e436 Bug 1469126 - GetAllocationSize should report unique blobs when dealing with nested blobs, r=smaug 2018-06-18 11:35:46 -04:00
Andrea Marchesini
281d3ab8fa Bug 1466061 - unknown blob URLs, when opened as top-level domain, should show an error page , r=mayhemer 2018-06-13 09:25:59 -07:00
Andrea Marchesini
c60afa7b18 Bug 1466314 - StreamBlobImpl should wrap the cloned stream with InputStreamLengthWrapper if needed, r=smaug 2018-06-13 08:37:26 -07:00
Andrea Marchesini
4f109464b2 Bug 1466314 - StreamBlobImpl CTOR must receive an already_AddRefed inputStream, r=smaug 2018-06-13 08:37:26 -07:00
Joel Maher
50b91c0a14 Bug 1405428 - skip-if = verify on mochitests which do not pass test-verify. r=gbrown 2018-06-10 05:01:47 -04:00
Miko Mynttinen
4c85ef17cc Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 1e7eea4f2d4ec16ec0c559a8afb26976ddbf4d07
2018-06-01 17:59:07 +02:00
arthur.iakab
7e765f798b Backed out 2 changesets (bug 1465060) for build bustages on security/sandbox/linux/reporter/SandboxReporter.cpp
Backed out changeset 7c8905b6b226 (bug 1465060)
Backed out changeset 10446073eca8 (bug 1465060)
2018-06-03 19:25:41 +03:00
Miko Mynttinen
8d9dc85cd4 Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 619d0e0ff63a2453c80f0c4d9beb906d43fa9b01
2018-06-01 17:59:07 +02:00
Andrea Marchesini
05c0b87539 Bug 1466023 - Move blobURL and fontTableURI code in a separate directory, r=qdot
--HG--
rename : dom/file/BlobURL.cpp => dom/file/uri/BlobURL.cpp
rename : dom/file/BlobURL.h => dom/file/uri/BlobURL.h
rename : dom/file/BlobURLProtocolHandler.cpp => dom/file/uri/BlobURLProtocolHandler.cpp
rename : dom/file/BlobURLProtocolHandler.h => dom/file/uri/BlobURLProtocolHandler.h
rename : dom/file/FontTableURIProtocolHandler.cpp => dom/file/uri/FontTableURIProtocolHandler.cpp
rename : dom/file/FontTableURIProtocolHandler.h => dom/file/uri/FontTableURIProtocolHandler.h
2018-06-02 15:51:42 +02:00
Andrea Marchesini
6b34ff8dfc Bug 1466023 - Get rid of GenerateURIStringForBlobURL, r=qdot 2018-06-02 15:51:42 +02:00
Andrea Marchesini
d13a49eca5 Bug 1466023 - nsHostObjectURI renamed BlobURL, r=qdot
--HG--
rename : dom/file/nsHostObjectURI.cpp => dom/file/BlobURL.cpp
rename : dom/file/nsHostObjectURI.h => dom/file/BlobURL.h
2018-06-02 15:51:42 +02:00
Andrea Marchesini
962ddd4872 Bug 1466023 - Get rid of RTSP scheme, r=qdot 2018-06-02 15:51:42 +02:00
Andrea Marchesini
7ba8b77e07 Bug 1466023 - Separate FontTableURI and BlobURL, r=qdot
This patch splits FontTableURI and BlobURL in 2 classes:
FontTableURIProtocolHandler and BlobURLProtocolHandler
both under mozilla::dom.

It also removes a memory reporter because that report is already covered by the
BlobURL one.

--HG--
rename : dom/file/nsHostObjectProtocolHandler.cpp => dom/file/BlobURLProtocolHandler.cpp
rename : dom/file/nsHostObjectProtocolHandler.h => dom/file/BlobURLProtocolHandler.h
2018-06-02 15:51:42 +02:00
Andrea Marchesini
426e4b7015 Bug 1466023 - Remove an internal parameter only in NS_GetBlobForBlobURI, r=qdot 2018-06-02 15:51:41 +02:00
Andrea Marchesini
d64c4294eb Bug 1466023 - Get rid of NS_GetStreamForBlobURI, r=qdot 2018-06-02 15:51:41 +02:00
Emilio Cobos Álvarez
fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Andrea Marchesini
044ba75ddf Bug 1461426 - IPCBlobInputStreamParent should be sent as underlying stream to the content, r=smaug 2018-05-29 20:02:03 +02:00
Andrea Marchesini
9f5a134c05 Bug 1463767 - ReleasingTimerHolder should expose nsINamed::GetName only if MOZ_COLLECTING_RUNNABLE_TELEMETRY is defined, r=smaug 2018-05-25 14:46:44 +02:00
Andrea Marchesini
5b45972dd9 Bug 1434553 - IPCBlobInputStreamParent reference must be increamented before calling any IPC method, r=me 2018-05-23 12:37:44 +02:00
Andrea Marchesini
7dcc1b6880 Bug 1434553 - Implement nsIInputStreamLength and nsIAsyncInputStreamLength - part 9 - necko and docShell, r=mayhemer, r=smaug 2018-05-23 07:12:36 +02:00
Andrea Marchesini
1b19a3a663 Bug 1434553 - Implement nsIInputStreamLength and nsIAsyncInputStreamLength - part 3 - InputStreamLengthHelper, r=froydnj 2018-05-23 07:12:35 +02:00
Andrea Marchesini
c866348d1e Bug 1434553 - Implement nsIInputStreamLength and nsIAsyncInputStreamLength - part 2 - IPCBlobInputStream exposes nsIInputStreamLength, r=smaug 2018-05-23 07:12:35 +02:00
Andrea Marchesini
5cc80bc69f Bug 1453971 - ReleasingTimerHolder::Create should use a timer to avoid nsIAsyncShutdownBlocker (implemented in JS) to run during stable state, r=smaug 2018-05-22 17:50:25 +02:00
Kris Maglione
8340513b0c Bug 1463287: Add QueryInterface helper macro for concrete class types. r=bz
Using concrete class types with static IIDs in QueryInterface methods is a
pretty common pattern which isn't supported by any existing helper macros.
That's lead to separate ad-hoc implementations, with varying degrees of
dodginess, being scattered around the tree.

This patch adds a helper macro with a canonical (and safe) implementation, and
updates existing ad-hoc users to use it.

MozReview-Commit-ID: HaTGF7MN5Cv

--HG--
extra : rebase_source : ace930129d85960d22bc3048ca3bb19bbbd4a63e
extra : histedit_source : 03a87f746d957789d41381e4e1bfcc4fd7eebaf2%2C9c5bae9feeeef7721105db67be0f83e0ded66bb7
2018-05-21 16:33:18 -07:00