Граф коммитов

33 Коммитов

Автор SHA1 Сообщение Дата
Boris Zbarsky 6213894581 Bug 1455676 part 3. Remove nsIDOMNode usage from widget/. r=qdot 2018-05-29 22:58:48 -04:00
Rob Wu 2209797ba5 Bug 1433030 - Initialize nsTransferable::mPrivateData with false r=jdm
Initialize mPrivateData to false by default again, because the
change that changed the default value from true to false, i.e.
https://hg.mozilla.org/mozilla-central/rev/9e19b58d6494
prevented the clipboard from being backed by the filesystem,
as shown at https://bugzilla.mozilla.org/show_bug.cgi?id=1433030#c7

MozReview-Commit-ID: DEw5ETVqab8

--HG--
extra : rebase_source : 0d15a91c28ae3dee9c7e767a5b2c959574610b0f
2018-03-07 10:21:50 +01:00
Rob Wu 877c911eae Bug 335545 - Make DataStruct non-copyable r=mstange
DataStruct cannot safely be copied if its mCacheFD member is set.
Currently there is no code for this case, but to avoid problems later,
mark the copy and assignment constructors private and delete them.

A move-constructor was added to compensate for the deleted copy
constructor. nsTransferable::AddDataFlavor uses this new constructor
instead of the previous implicit default copy constructor.

MozReview-Commit-ID: 3N5xjFXOUKB

--HG--
extra : rebase_source : dc609f20c7048b3630fa99fe2deef3f5be155334
2018-02-25 17:36:08 +01:00
Rob Wu ed4e35a109 Bug 335545 - Store clipboard data in memory XOR file r=mstange
Ensure that only DataStruct::mData + mDataLen, XOR
DataStruct::mCacheFD is used.
(Previously it was possible that all of these members were populated,
 which is a waste of memory.)

The effect of this change is visible when SetTransferData is called
multiple times with the same flavor, but with one below the threshold
for storing in-memory, and the other above (=store in a file).

MozReview-Commit-ID: 4UlkKAYsjf

--HG--
extra : rebase_source : 75398f84f039bdf2ff0195342f3db8efbdce6d3d
2017-09-03 03:21:45 +02:00
Rob Wu 1b8a4cf8e6 Bug 335545 - Use nsAnonymousTemporaryFile for clipboard cache r=mstange
The cache file is never directly exposed to consumers of DataStruct,
so it does not make sense to keep the clipboardcache file around
forever.

The only change in this commit is to switch from using a filename to
using a file descriptor. In the destructor, the FD is explicitly closed
(which releases the file data).  nsAnonymousTemporaryFile takes care
of removing the file when the destructor is not called (e.g. crashes).

Previously, the clipboard cache was stored in a file called:
TmpD/clipboardcache-N

As of this commit, the clipboard cache is stored at:
TmpD/mozilla-temp-randomN (macOS and Linux)
TmpD/mozilla-temp-files/mozilla-temp-randomN (Windows)
(see xpcom/io/nsAnonymousTemporaryFile.{h,cpp} for more details)

To verify that these files are really gone:
1. Create a document with 500k+ characters, open it in Firefox.
2. Copy its content - this will trigger the clipboard cache.
3. Look for the open file descriptor of the deleted file:
   ( macOS and Linux: )
   lsof +L1 | grep mozilla-temp
4. Copy anything (under the 500k threshold), or quit/kill Firefox.
5. Repeat step 3 and observe that the number of file descriptors
   has decreased.

MozReview-Commit-ID: 85GlKQrNUl5

--HG--
extra : rebase_source : 6937143639d6a6280ffe8b53b4c2fa4b1e7ef55d
2017-09-03 02:29:10 +02:00
Arthur Edelstein 7d2a9476f0 Bug 1433030 - Stop nsTransferable writing to /tmp in PB windows r=jdm
We shouldn't assume it's safe to write to /tmp unless we know
for sure we are not in a private browsing window. So
use mPrivateData = true as default.

Based on a patch by Neill Miller:
https://trac.torproject.org/projects/tor/ticket/21830
2018-02-12 10:34:00 +02:00
Masatoshi Kimura dbd92543c6 Bug 1313150 - Remove |weak| parameter from nsIMutableArray methods. r=froydnj
MozReview-Commit-ID: 7JoD4VYzZp3

--HG--
extra : rebase_source : 5db437f1c34608aa223916874d62b48c59baeae8
2017-10-21 23:53:02 +09:00
Wes Kocher b3c0b118ec Backed out 3 changesets (bug 335545) for asan failures in test_bug1123480.xul a=backout
Backed out changeset 25a686779a94 (bug 335545)
Backed out changeset b83ddb70c8b5 (bug 335545)
Backed out changeset ea69ee15ed90 (bug 335545)

MozReview-Commit-ID: LkJgt3eSs2J
2017-09-26 15:26:07 -07:00
Rob Wu 81c80f8357 Bug 335545 - Store clipboard data in memory XOR file r=mstange
Ensure that only DataStruct::mData + mDataLen, XOR
DataStruct::mCacheFD is used.
(Previously it was possible that all of these members were populated,
 which is a waste of memory.)

The effect of this change is visible when SetTransferData is called
multiple times with the same flavor, but with one below the threshold
for storing in-memory, and the other above (=store in a file).

MozReview-Commit-ID: 4UlkKAYsjf

--HG--
extra : rebase_source : fff484301dc87f12685575084993b6bf877f9a9b
2017-09-03 03:21:45 +02:00
Rob Wu 764aecbcc4 Bug 335545 - Use nsAnonymousTemporaryFile for clipboard cache r=mstange
The cache file is never directly exposed to consumers of DataStruct,
so it does not make sense to keep the clipboardcache file around
forever.

The only change in this commit is to switch from using a filename to
using a file descriptor. In the destructor, the FD is explicitly closed
(which releases the file data).  nsAnonymousTemporaryFile takes care
of removing the file when the destructor is not called (e.g. crashes).

Previously, the clipboard cache was stored in a file called:
TmpD/clipboardcache-N

As of this commit, the clipboard cache is stored at:
TmpD/mozilla-temp-randomN (macOS and Linux)
TmpD/mozilla-temp-files/mozilla-temp-randomN (Windows)
(see xpcom/io/nsAnonymousTemporaryFile.{h,cpp} for more details)

To verify that these files are really gone:
1. Create a document with 500k+ characters, open it in Firefox.
2. Copy its content - this will trigger the clipboard cache.
3. Look for the open file descriptor of the deleted file:
   ( macOS and Linux: )
   lsof +L1 | grep mozilla-temp
4. Copy anything (under the 500k threshold), or quit/kill Firefox.
5. Repeat step 3 and observe that the number of file descriptors
   has decreased.

MozReview-Commit-ID: 85GlKQrNUl5

--HG--
extra : rebase_source : b0c6e9540e53ad5e713a9db55f3001d7f53c308a
2017-09-03 02:29:10 +02:00
Sebastian Hengst b98981f4a0 Backed out changeset dff1e1774422 (bug 335545) for failing clipboard mochitest widget/tests/test_bug1123480.xul on Linux x64 asan. r=backout 2017-09-21 00:00:52 +02:00
Sebastian Hengst 83c050d603 Backed out changeset e96494792b66 (bug 335545) 2017-09-20 23:59:57 +02:00
Rob Wu b53439701a Bug 335545 - Store clipboard data in memory XOR file r=mstange
Ensure that only DataStruct::mData + mDataLen, XOR
DataStruct::mCacheFD is used.
(Previously it was possible that all of these members were populated,
 which is a waste of memory.)

The effect of this change is visible when SetTransferData is called
multiple times with the same flavor, but with one below the threshold
for storing in-memory, and the other above (=store in a file).

MozReview-Commit-ID: 4UlkKAYsjf

--HG--
extra : rebase_source : c9a5a7a3f5a6f3e6ab1bfb8662372cbbac837a00
2017-09-03 03:21:45 +02:00
Rob Wu ecc04a9245 Bug 335545 - Use nsAnonymousTemporaryFile for clipboard cache r=mstange
The cache file is never directly exposed to consumers of DataStruct,
so it does not make sense to keep the clipboardcache file around
forever.

The only change in this commit is to switch from using a filename to
using a file descriptor. In the destructor, the FD is explicitly closed
(which releases the file data).  nsAnonymousTemporaryFile takes care
of removing the file when the destructor is not called (e.g. crashes).

Previously, the clipboard cache was stored in a file called:
TmpD/clipboardcache-N

As of this commit, the clipboard cache is stored at:
TmpD/mozilla-temp-randomN (macOS and Linux)
TmpD/mozilla-temp-files/mozilla-temp-randomN (Windows)
(see xpcom/io/nsAnonymousTemporaryFile.{h,cpp} for more details)

To verify that these files are really gone:
1. Create a document with 500k+ characters, open it in Firefox.
2. Copy its content - this will trigger the clipboard cache.
3. Look for the open file descriptor of the deleted file:
   ( macOS and Linux: )
   lsof +L1 | grep mozilla-temp
4. Copy anything (under the 500k threshold), or quit/kill Firefox.
5. Repeat step 3 and observe that the number of file descriptors
   has decreased.

MozReview-Commit-ID: 85GlKQrNUl5

--HG--
extra : rebase_source : eb05c1d4600f62373aa1b7e472154b57b99e6bf8
2017-09-03 02:29:10 +02:00
Nicholas Nethercote f582d96b98 Bug 1390428 (part 9) - Remove nsXPIDLCString. r=erahm.
This is straightforward, with only two notable things.

- `#include "nsXPIDLString.h" is replaced with `#include "nsString.h"`
  throughout, because all nsXPIDLString.h did was include nsString.h. The
  exception is for files which already include nsString.h, in which case the
  patch just removes the nsXPIDLString.h inclusion.

- The patch removes the |xpidl_string| gtest, but improves the |voided| test to
  cover some of its ground, e.g. testing Adopt(nullptr).

--HG--
extra : rebase_source : 452cc4a08046a1adb1a8099a7e85a1917de5add8
2017-08-17 15:29:03 +10:00
Nicholas Nethercote 8a72cf2251 Bug 1390428 (part 2, attempt 2) - Remove more nsXPIDLCString local variables. r=erahm.
--HG--
extra : rebase_source : 69d58b0cfb56efc6b03d8e2d7be2ce3c3e6cd843
2017-08-21 20:01:27 +10:00
Makoto Kato 3147d216e4 Bug 1312936 - Part 1. Use ACString for nsITranserable.getAnyTransferData. r=masayuki
MozReview-Commit-ID: L8eWccMBtVj

--HG--
extra : rebase_source : 39afc27d9b25db779e543446b791a9afd36b2788
2016-10-26 11:07:16 +09:00
Eric Rahm 52edf921c1 Bug 1310017 - Remove nsISupportsArray usage from nsITransferable and nsIFormatConverter. r=smaug
This converts |nsITransferable.flavorsTransferableCanExport| and
|nsITransferable.flavorsTransferableCanImport| to return a |nsIArray|.

|nsIFormatConverter.getInputDataFlavors| and
|nsIFormatConverter.getOutputDataFlavors| are updated as well.
2016-10-16 12:43:56 -07:00
Nicholas Nethercote 04be8d005a Bug 1296164 (part 1) - Use [must_use] on nsIFile.{create,createUnique}. r=froydnj.
And fix numerous missing checks that this change identifies.

--HG--
extra : rebase_source : 97b0a6e8f9375c937dadb59c1110bb54b7633134
2016-08-18 13:30:12 +10:00
Hector Zhao 6b5f4e624b Bug 664717 - Part 1: Switch to requestingPrincipal in nsITransferable. r=ckerschb
MozReview-Commit-ID: Hndb5ftbEuL

--HG--
extra : transplant_source : %A5z%B2%C8%A7%7C%20%98rx%8A%89%E6%80a%E5%B65%19%26
2016-07-01 16:01:11 +08:00
Thomas Zimmermann 48ef99e762 Bug 1265386: Fix white-space errors in widget/, r=nfroyd
MozReview-Commit-ID: ATXI7dYFHmA
2016-07-22 10:56:13 +02:00
Carsten "Tomcat" Book d2a1babef4 Backed out changeset 2bea1e1e403d (bug 1265386) for bustage on a CLOSED TREE 2016-07-21 13:59:02 +02:00
Thomas Zimmermann d8818e0d94 Bug 1265386: Fix white-space errors in widget/, r=nfroyd
MozReview-Commit-ID: ATXI7dYFHmA
2016-07-21 13:29:30 +02:00
Alexandre Lissy facb2f088c Bug 1281499 - Add missing include and namespace for MakeUnique<> r=mstange
MozReview-Commit-ID: DpBZrnx47g8

--HG--
extra : rebase_source : d0acf2ae074020fc8b1ffc1d51f80058b7f92c99
2016-06-22 17:38:40 +02:00
Jonathan Kingston 4512426a78 Bug 1192945 - Use channel->asyncOpen2 in widget/windows/nsDataObj.cpp. r=ckerschb
MozReview-Commit-ID: 5whNAj5KAjf

--HG--
extra : transplant_source : H%B0%2A%D0%90W%DEQn%9ET%92%273%B4%FB%E9S%D2%FA
2015-08-10 12:56:47 -07:00
Randell Jesup 05bb25d9c0 Backed out changeset 36e71bcb0266 (bug 1192945) 2016-06-10 02:24:08 -04:00
Jonathan Kingston d0636b7947 Bug 1192945 - Use channel->ascynOpen2 in widget/windows/nsDataObj.cpp . r=ckerschb, r=jmathies
MozReview-Commit-ID: 5whNAj5KAjf

--HG--
extra : rebase_source : cbe970274e34fdf32d1f60539a22b004ca0bea51
2015-08-10 12:56:47 -07:00
Jonathan Watt 05a14131e5 Bug 1265953, part 2 - Convert much of the rest of the widget code from nsAutoPtr to UniquePtr. r=mstange 2016-04-19 21:51:25 +01:00
Nathan Froyd e255b900f5 Bug 1220392 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in widget/; r=roc 2015-10-30 14:35:28 -04:00
Emanuel Hoogeveen 7d1e52f2ff Bug 905127 - Part 1 - Make some functions from nsNetUtil not inline. r=jduell 2015-07-07 04:17:00 +02:00
Mike Hommey b077d9624d Bug 1134920 - Use moz_xmalloc/moz_xrealloc/free instead of nsMemory::Alloc/Realloc/Free. r=nfroyd 2015-04-01 13:51:45 +09:00
Michael Schloh von Bennewitz f8a246c05b Bug 1123480 - Component: widget nsTransferable private browsing correction. r=jdm
This patch mitigates violation of private browsing disk access. The DataStruct API and implementation is modified to obey private browsing design when used by objects such as nsTransferable (during clipboard data caching for example.)

Without this patch, a user is misled by use of private browsing when copying (or in some case just selecting) large blocks of text. A condition (presently hard coded at one million bytes kLargeDatasetSize) produces a cache file on disk regardless of whether private browsing is in use. This violates Mozilla's design (documented online at https://support.mozilla.org/kb/private-browsing-browse-web-without-saving-info/ and https://wiki.mozilla.org/PrivateBrowsing) This patch simply corrects the violation, discovered and resolved by the Tor Browser community.
2015-02-18 06:52:00 -05:00
Mason Chang 8180f9229c Bug 1085696. Part 1 Move widget/xpwidget to /widget. r=roc
--HG--
rename : widget/xpwidgets/ContentHelper.cpp => widget/ContentHelper.cpp
rename : widget/xpwidgets/ContentHelper.h => widget/ContentHelper.h
rename : widget/xpwidgets/GfxDriverInfo.cpp => widget/GfxDriverInfo.cpp
rename : widget/xpwidgets/GfxDriverInfo.h => widget/GfxDriverInfo.h
rename : widget/xpwidgets/GfxInfoBase.cpp => widget/GfxInfoBase.cpp
rename : widget/xpwidgets/GfxInfoBase.h => widget/GfxInfoBase.h
rename : widget/xpwidgets/GfxInfoCollector.cpp => widget/GfxInfoCollector.cpp
rename : widget/xpwidgets/GfxInfoCollector.h => widget/GfxInfoCollector.h
rename : widget/xpwidgets/GfxInfoWebGL.cpp => widget/GfxInfoWebGL.cpp
rename : widget/xpwidgets/GfxInfoWebGL.h => widget/GfxInfoWebGL.h
rename : widget/xpwidgets/GfxInfoX11.cpp => widget/GfxInfoX11.cpp
rename : widget/xpwidgets/GfxInfoX11.h => widget/GfxInfoX11.h
rename : widget/xpwidgets/InputData.cpp => widget/InputData.cpp
rename : widget/xpwidgets/PuppetWidget.cpp => widget/PuppetWidget.cpp
rename : widget/xpwidgets/PuppetWidget.h => widget/PuppetWidget.h
rename : widget/xpwidgets/ScreenProxy.cpp => widget/ScreenProxy.cpp
rename : widget/xpwidgets/ScreenProxy.h => widget/ScreenProxy.h
rename : widget/shared/SharedWidgetUtils.cpp => widget/SharedWidgetUtils.cpp
rename : widget/xpwidgets/WidgetUtils.cpp => widget/WidgetUtils.cpp
rename : widget/xpwidgets/nsAppShellSingleton.h => widget/nsAppShellSingleton.h
rename : widget/xpwidgets/nsBaseAppShell.cpp => widget/nsBaseAppShell.cpp
rename : widget/xpwidgets/nsBaseAppShell.h => widget/nsBaseAppShell.h
rename : widget/xpwidgets/nsBaseClipboard.cpp => widget/nsBaseClipboard.cpp
rename : widget/xpwidgets/nsBaseClipboard.h => widget/nsBaseClipboard.h
rename : widget/xpwidgets/nsBaseDragService.cpp => widget/nsBaseDragService.cpp
rename : widget/xpwidgets/nsBaseDragService.h => widget/nsBaseDragService.h
rename : widget/xpwidgets/nsBaseFilePicker.cpp => widget/nsBaseFilePicker.cpp
rename : widget/xpwidgets/nsBaseFilePicker.h => widget/nsBaseFilePicker.h
rename : widget/xpwidgets/nsBaseScreen.cpp => widget/nsBaseScreen.cpp
rename : widget/xpwidgets/nsBaseScreen.h => widget/nsBaseScreen.h
rename : widget/xpwidgets/nsBaseWidget.cpp => widget/nsBaseWidget.cpp
rename : widget/xpwidgets/nsBaseWidget.h => widget/nsBaseWidget.h
rename : widget/xpwidgets/nsClipboardHelper.cpp => widget/nsClipboardHelper.cpp
rename : widget/xpwidgets/nsClipboardHelper.h => widget/nsClipboardHelper.h
rename : widget/xpwidgets/nsClipboardProxy.cpp => widget/nsClipboardProxy.cpp
rename : widget/xpwidgets/nsClipboardProxy.h => widget/nsClipboardProxy.h
rename : widget/xpwidgets/nsColorPickerProxy.cpp => widget/nsColorPickerProxy.cpp
rename : widget/xpwidgets/nsColorPickerProxy.h => widget/nsColorPickerProxy.h
rename : widget/xpwidgets/nsContentProcessWidgetFactory.cpp => widget/nsContentProcessWidgetFactory.cpp
rename : widget/xpwidgets/nsFilePickerProxy.cpp => widget/nsFilePickerProxy.cpp
rename : widget/xpwidgets/nsFilePickerProxy.h => widget/nsFilePickerProxy.h
rename : widget/xpwidgets/nsHTMLFormatConverter.cpp => widget/nsHTMLFormatConverter.cpp
rename : widget/xpwidgets/nsHTMLFormatConverter.h => widget/nsHTMLFormatConverter.h
rename : widget/xpwidgets/nsIWidgetListener.cpp => widget/nsIWidgetListener.cpp
rename : widget/xpwidgets/nsIdleService.cpp => widget/nsIdleService.cpp
rename : widget/xpwidgets/nsIdleService.h => widget/nsIdleService.h
rename : widget/xpwidgets/nsNativeTheme.cpp => widget/nsNativeTheme.cpp
rename : widget/xpwidgets/nsNativeTheme.h => widget/nsNativeTheme.h
rename : widget/xpwidgets/nsPrimitiveHelpers.cpp => widget/nsPrimitiveHelpers.cpp
rename : widget/xpwidgets/nsPrimitiveHelpers.h => widget/nsPrimitiveHelpers.h
rename : widget/xpwidgets/nsPrintOptionsImpl.cpp => widget/nsPrintOptionsImpl.cpp
rename : widget/xpwidgets/nsPrintOptionsImpl.h => widget/nsPrintOptionsImpl.h
rename : widget/xpwidgets/nsPrintSession.cpp => widget/nsPrintSession.cpp
rename : widget/xpwidgets/nsPrintSession.h => widget/nsPrintSession.h
rename : widget/xpwidgets/nsPrintSettingsImpl.cpp => widget/nsPrintSettingsImpl.cpp
rename : widget/xpwidgets/nsPrintSettingsImpl.h => widget/nsPrintSettingsImpl.h
rename : widget/xpwidgets/nsScreenManagerProxy.cpp => widget/nsScreenManagerProxy.cpp
rename : widget/xpwidgets/nsScreenManagerProxy.h => widget/nsScreenManagerProxy.h
rename : widget/xpwidgets/nsTransferable.cpp => widget/nsTransferable.cpp
rename : widget/xpwidgets/nsTransferable.h => widget/nsTransferable.h
rename : widget/xpwidgets/nsXPLookAndFeel.cpp => widget/nsXPLookAndFeel.cpp
rename : widget/xpwidgets/nsXPLookAndFeel.h => widget/nsXPLookAndFeel.h
2014-10-23 10:16:45 -07:00