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

65 Коммитов

Автор SHA1 Сообщение Дата
Edgar Chen fd9072b080 Bug 1866994 - Handle clipboard contextmenu in parent process; r=geckoview-reviewers,extension-reviewers,webidl,win-reviewers,saschanaz,robwu,nika,Gijs,m_kato,emilio
This patch makes the clipboard context menu trigger from the parent process rather
than the content process. A new method, `confirmUserPaste`, is added on `nsIPromptService`
to trigger frontend UI.

The behavior of handling multiple requests should remain unchanged, new tests are
added to ensure that.

Differential Revision: https://phabricator.services.mozilla.com/D190405
2023-11-28 15:38:01 +00:00
Edgar Chen 14d41cb7f9 Bug 1852947 - Redesign the async clipboard read API; r=nika
In bug 1755863, we introduce two async APIs in `nsIClipboard` to make async
clipboard API reads the clipboard data asynchronously. When reading, async
clipboard API first check the available types, and then retrieve the actual data
for that type. This process has a potential race condition: the clipboard content
might change between the time between the time we check the types and when we
retrieve the data. Although we currently fetch the actual data immediately after
checking available types (in line with the spec), this minimizes the chance of
encountering this race condition. However, if we would like to support retrieving
the data only when `getType()` is invoked (bug 1691825), this potential race
condition could become a significant issue.

Furthermore, bug 1777448 aims to have a way to track the clipboard data and suppress
the paste context menu when the clipboard data originates from a same-origin page.
This also requires a better way to track read requests, clipboard content and
invalidate the request when the system's clipboard content is changed.

After some refacting around nsBaseClipboard, all platform now use sequence
number to track clipboard content, so `nsIAsyncGetClipboardData` can be associated
with a sequence number and deemed invalid if the associated sequence number isn't
matched the latest system value.

With these new API, it also becomes possible to write some tests.

Depends on D191409

Differential Revision: https://phabricator.services.mozilla.com/D182108
2023-11-14 09:21:24 +00:00
Noemi Erli 5b3d25d180 Backed out changeset b0ff38a7d9fb (bug 1852947) for causing aInstanceSize related assertion failures 2023-11-11 03:25:58 +02:00
Edgar Chen 02532aabad Bug 1852947 - Redesign the async clipboard read API; r=nika
In bug 1755863, we introduce two async APIs in `nsIClipboard` to make async
clipboard API reads the clipboard data asynchronously. When reading, async
clipboard API first check the available types, and then retrieve the actual data
for that type. This process has a potential race condition: the clipboard content
might change between the time between the time we check the types and when we
retrieve the data. Although we currently fetch the actual data immediately after
checking available types (in line with the spec), this minimizes the chance of
encountering this race condition. However, if we would like to support retrieving
the data only when `getType()` is invoked (bug 1691825), this potential race
condition could become a significant issue.

Furthermore, bug 1777448 aims to have a way to track the clipboard data and suppress
the paste context menu when the clipboard data originates from a same-origin page.
This also requires a better way to track read requests, clipboard content and
invalidate the request when the system's clipboard content is changed.

After some refacting around nsBaseClipboard, all platform now use sequence
number to track clipboard content, so `nsIAsyncGetClipboardData` can be associated
with a sequence number and deemed invalid if the associated sequence number isn't
matched the latest system value.

With these new API, it also becomes possible to write some tests.

Depends on D191409

Differential Revision: https://phabricator.services.mozilla.com/D182108
2023-11-10 15:04:26 +00:00
Noemi Erli 2a178d7869 Backed out changeset 7355802744d1 (bug 1852947) for causing failures in test_clipboard_asyncGetData.html CLOSED TREE 2023-11-09 12:32:56 +02:00
Edgar Chen b131b4d3fc Bug 1852947 - Redesign the async clipboard read API; r=nika
In bug 1755863, we introduce two async APIs in `nsIClipboard` to make async
clipboard API reads the clipboard data asynchronously. When reading, async
clipboard API first check the available types, and then retrieve the actual data
for that type. This process has a potential race condition: the clipboard content
might change between the time between the time we check the types and when we
retrieve the data. Although we currently fetch the actual data immediately after
checking available types (in line with the spec), this minimizes the chance of
encountering this race condition. However, if we would like to support retrieving
the data only when `getType()` is invoked (bug 1691825), this potential race
condition could become a significant issue.

Furthermore, bug 1777448 aims to have a way to track the clipboard data and suppress
the paste context menu when the clipboard data originates from a same-origin page.
This also requires a better way to track read requests, clipboard content and
invalidate the request when the system's clipboard content is changed.

After some refacting around nsBaseClipboard, all platform now use sequence
number to track clipboard content, so `nsIAsyncGetClipboardData` can be associated
with a sequence number and deemed invalid if the associated sequence number isn't
matched the latest system value.

With these new API, it also becomes possible to write some tests.

Depends on D191409

Differential Revision: https://phabricator.services.mozilla.com/D182108
2023-11-09 07:47:00 +00:00
Norisz Fay ced0683cec Backed out changeset c8561b4726a2 (bug 1852947) for causing bustage on nsClipboardProxy.cpp CLOSED TREE 2023-11-08 23:44:50 +02:00
Edgar Chen 820da1024f Bug 1852947 - Redesign the async clipboard read API; r=nika
In bug 1755863, we introduce two async APIs in `nsIClipboard` to make async
clipboard API reads the clipboard data asynchronously. When reading, async
clipboard API first check the available types, and then retrieve the actual data
for that type. This process has a potential race condition: the clipboard content
might change between the time between the time we check the types and when we
retrieve the data. Although we currently fetch the actual data immediately after
checking available types (in line with the spec), this minimizes the chance of
encountering this race condition. However, if we would like to support retrieving
the data only when `getType()` is invoked (bug 1691825), this potential race
condition could become a significant issue.

Furthermore, bug 1777448 aims to have a way to track the clipboard data and suppress
the paste context menu when the clipboard data originates from a same-origin page.
This also requires a better way to track read requests, clipboard content and
invalidate the request when the system's clipboard content is changed.

After some refacting around nsBaseClipboard, all platform now use sequence
number to track clipboard content, so `nsIAsyncGetClipboardData` can be associated
with a sequence number and deemed invalid if the associated sequence number isn't
matched the latest system value.

With these new API, it also becomes possible to write some tests.

Depends on D191409

Differential Revision: https://phabricator.services.mozilla.com/D182108
2023-11-08 20:11:08 +00:00
Edgar Chen 6103cbd875 Bug 1861927 - Part 1: Rename nsIAsyncSetClipboardDataCallback to nsIAsyncClipboardRequestCallback; r=nika
It is going to be reused for clipboard read, so make the name more generic.

Differential Revision: https://phabricator.services.mozilla.com/D188526
2023-10-30 09:46:19 +00:00
Edgar Chen 08e77bb26e Bug 1832701 - Part 2: Add IPCTransferable for clipboard write parameters; r=nika
Move IPCTransferable* into a separated file to avoid circular dependency and
use `hg cp` in order to keep the history.

Differential Revision: https://phabricator.services.mozilla.com/D178070
2023-05-16 21:25:37 +00:00
Edgar Chen 5bd3109c7d Bug 1832701 - Part 1: Rename IPCDataTransfer* to IPCTransferable*; r=nika
Since IPCDataTransfer* is actually used for nsITransferable, so rename them to
IPCTransferable* as follows,
- Rename IPCDataTransfer to IPCTransferableData.
- Rename IPCDataTransferItem to IPCTransferableDataItem.
- Rename IPCDataTransferData to IPCTransferableDataType.
- Rename IPCDataTransferString to IPCTransferableDataString.
- Rename IPCDataTransferCString to IPCTransferableDataCString.
- Rename IPCDataTransferInputStream to IPCTransferableDataInputStream.
- Rename IPCDataTransferImageContainer to IPCTransferableDataImageContainer.
- Rename IPCDataTransferBlob to IPCTransferableDataBlob.

Differential Revision: https://phabricator.services.mozilla.com/D178069
2023-05-16 21:25:37 +00:00
Iulian Moraru bc9ede8f91 Backed out 2 changesets (bug 1832701) for causing bc failures on browser_test_clipboardcache.js. CLOSED TREE
Backed out changeset 888814f19788 (bug 1832701)
Backed out changeset 1946d69582b0 (bug 1832701)
2023-05-16 15:54:58 +03:00
Edgar Chen ae99332eb9 Bug 1832701 - Part 2: Add IPCTransferable for clipboard write parameters; r=nika
Move IPCTransferable* into a separated file to avoid circular dependency and
use `hg cp` in order to keep the history.

Differential Revision: https://phabricator.services.mozilla.com/D178070
2023-05-16 10:51:13 +00:00
Edgar Chen 50a7356c9e Bug 1832701 - Part 1: Rename IPCDataTransfer* to IPCTransferable*; r=nika
Since IPCDataTransfer* is actually used for nsITransferable, so rename them to
IPCTransferable* as follows,
- Rename IPCDataTransfer to IPCTransferableData.
- Rename IPCDataTransferItem to IPCTransferableDataItem.
- Rename IPCDataTransferData to IPCTransferableDataType.
- Rename IPCDataTransferString to IPCTransferableDataString.
- Rename IPCDataTransferCString to IPCTransferableDataCString.
- Rename IPCDataTransferInputStream to IPCTransferableDataInputStream.
- Rename IPCDataTransferImageContainer to IPCTransferableDataImageContainer.
- Rename IPCDataTransferBlob to IPCTransferableDataBlob.

Differential Revision: https://phabricator.services.mozilla.com/D178069
2023-05-16 10:51:13 +00:00
Cristian Tuns d1e1774929 Backed out 2 changesets (bug 1832701) for causing build bustages in ipc_message_utils.h CLOSED TREE
Backed out changeset cf53463469ba (bug 1832701)
Backed out changeset 2147a1728010 (bug 1832701)
2023-05-15 16:23:32 -04:00
Edgar Chen 6ef9eed598 Bug 1832701 - Part 2: Add IPCTransferable for clipboard write parameters; r=nika
Move IPCTransferable* into a separated file to avoid circular dependency and
use `hg cp` in order to keep the history.

Differential Revision: https://phabricator.services.mozilla.com/D178070
2023-05-15 19:12:19 +00:00
Edgar Chen 287fc0f6f4 Bug 1832701 - Part 1: Rename IPCDataTransfer* to IPCTransferable*; r=nika
Since IPCDataTransfer* is actually used for nsITransferable, so rename them to
IPCTransferable* as follows,
- Rename IPCDataTransfer to IPCTransferableData.
- Rename IPCDataTransferItem to IPCTransferableDataItem.
- Rename IPCDataTransferData to IPCTransferableDataType.
- Rename IPCDataTransferString to IPCTransferableDataString.
- Rename IPCDataTransferCString to IPCTransferableDataCString.
- Rename IPCDataTransferInputStream to IPCTransferableDataInputStream.
- Rename IPCDataTransferImageContainer to IPCTransferableDataImageContainer.
- Rename IPCDataTransferBlob to IPCTransferableDataBlob.

Differential Revision: https://phabricator.services.mozilla.com/D178069
2023-05-15 19:12:19 +00:00
Edgar Chen 8a1d360c1a Bug 1712122 - Part 3: Cancel pending write request when a new write request is made; r=nika,geckoview-reviewers,m_kato
The Async Clipboard API now allows using arbitrary promises for passing write data,
potentially enabling websites to delay writing data to an arbitrary future, which
may surprise the user. This patch introduces a solution: a new write request will
automatically cancel any previous pending request.

To implement that, this patch introduces a new method to nsIClipboard, new XPCOM
interfaces, and new IPC to efficiently track individual write requests. Additionally,
a new helper base class, ClipboardSetDataHelper, is introduced in widget to facilitate
platform code sharing.

Differential Revision: https://phabricator.services.mozilla.com/D174090
2023-05-14 21:02:08 +00:00
Tom Schuster 58b5467f89 Bug 1690532 - Making the nsITransferable to use a correct cookieJarSettings when doing a Image Copy on Windows. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D176427
2023-04-27 19:22:43 +00:00
Tom Schuster 1509ba1c86 Bug 1808146 - When creating a file promise for images, remember the referrer. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D172920
2023-03-22 21:55:08 +00:00
Edgar Chen 3d5bc9089c Bug 1817166 - Remove unused argument from nsContentUtils::TransferableToIPCTransferable; r=nika
After Bug 1781129, aChild is no longer needed to allocate Shmem, but aParent is
still needed to grant access for file in https://searchfox.org/mozilla-central/rev/b579290e6b830d1b3f0a941203b0c0e1e56c42a3/dom/base/nsContentUtils.cpp#8171-8182.

Differential Revision: https://phabricator.services.mozilla.com/D170063
2023-02-16 16:56:53 +00:00
Edgar Chen e5fe0a40c0 Bug 1796548 - Introduce a generic method to check clipboard capabilities in nsIClipboard; r=geckoview-reviewers,nika,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D166475
2023-01-16 19:50:17 +00:00
Edgar Chen a3612c4de0 Bug 1802125 - Use nsIClipboard.AsyncGetData to handle GetClipboardAsync IPC; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D162874
2022-11-28 12:22:51 +00:00
Stanca Serban 6e6332bbd3 Backed out changeset dab070a6ba77 (bug 1802125) for causing wpt failures on /clipboard-apis. CLOSED TREE 2022-11-25 18:35:18 +02:00
Edgar Chen a1e10a5441 Bug 1802125 - Use nsIClipboard.AsyncGetData to handle GetClipboardAsync IPC; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D162874
2022-11-25 10:49:47 +00:00
Tom Schuster c1cdfabc87 Bug 1799156 - Filter unknown DataTransferItem flavors. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D161487
2022-11-21 10:18:38 +00:00
James Teh 681e69a5ca Bug 1774285 - Avoid a11y instantiation after clipboard copy. r=nlapre,jamie CLOSED TREE
This prevents a11y from getting instantiated shortly after clipboard paste, in
order to prevent hangs with the Windows 11 suggested actions feature.

When combined with the previous patch, the behavior is the following:

 * For users with a11y already-enabled:

   * No hang (due to clipboard flush).
   * Quick actions menu is positioned at selection offset.

 * For users with a11y disabled (most):

   * No hang (due to no a11y instantiation + clipboard flush).
   * Quick actions menu is positioned at pointer (cursor) offset.

Co-Authored-By: Emilio Cobos Álvarez <emilio@crisal.io>

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

Depends on D160646
2022-10-28 14:48:25 +00:00
Nika Layzell 91a521bf3a Bug 1781129 - Part 1: Use BigBuffer for IPCDataTransfer, r=edgar
The IPCDataTransfer type is used to transfer Clipboard/Drag & Drop payloads
over IPC to allow them to be written to or read from the relevant system
interfaces. Previously, the system which was used was somewhat complex, and
tried to use Shmem in some cases to store buffers out of line. Now that
BigBuffer is available, it can be simplified substantially.

In addition, this change removed the memory buffer overload of GetSurfaceData,
as the only consumer was using it to immediately send the payload over IPC as a
nsCString. It was changed to instead use `BigBuffer` as that is more efficient
in a large buffer situation, and reduces the number of required copies.

Differential Revision: https://phabricator.services.mozilla.com/D151852
2022-08-26 16:08:05 +00:00
Marian-Vasile Laza 9274b092fe Backed out 4 changesets (bug 1781129) for causing mochitest failures on test_bug490879.html. CLOSED TREE
Backed out changeset 37da1d18cde9 (bug 1781129)
Backed out changeset 1ae213bfa43e (bug 1781129)
Backed out changeset dcebc98ea1f1 (bug 1781129)
Backed out changeset 0df2f2832755 (bug 1781129)
2022-08-22 23:07:56 +03:00
Nika Layzell 6c8af6eff5 Bug 1781129 - Part 1: Use BigBuffer for IPCDataTransfer, r=edgar
The IPCDataTransfer type is used to transfer Clipboard/Drag & Drop payloads
over IPC to allow them to be written to or read from the relevant system
interfaces. Previously, the system which was used was somewhat complex, and
tried to use Shmem in some cases to store buffers out of line. Now that
BigBuffer is available, it can be simplified substantially.

In addition, this change removed the memory buffer overload of GetSurfaceData,
as the only consumer was using it to immediately send the payload over IPC as a
nsCString. It was changed to instead use `BigBuffer` as that is more efficient
in a large buffer situation, and reduces the number of required copies.

Differential Revision: https://phabricator.services.mozilla.com/D151852
2022-08-22 15:38:14 +00:00
Edgar Chen 3e5030eb96 Bug 1755863 - Part 2: Add async API/IPC for getting matching data flavors from clipboard; r=nika,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152516
2022-08-15 20:27:26 +00:00
Edgar Chen f6014ee7c6 Bug 1755863 - Part 1: Add async API for getting data on nsIClipboard; r=geckoview-reviewers,NeilDeakin,m_kato,nika
Differential Revision: https://phabricator.services.mozilla.com/D145378
2022-08-15 20:27:24 +00:00
Christian Holler 146a80ecff Bug 1783844 - Remove IPC::Principal type remains from codebase. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D154091
2022-08-10 13:39:11 +00:00
Marian-Vasile Laza 0bebd4fea4 Backed out 4 changesets (bug 1781129) for causing bustages on nsContentUtils.cpp. CLOSED TREE
Backed out changeset 8557305bcd46 (bug 1781129)
Backed out changeset df6f98df9559 (bug 1781129)
Backed out changeset 905393f66985 (bug 1781129)
Backed out changeset 0d0f19a4db70 (bug 1781129)
2022-08-02 23:29:56 +03:00
Nika Layzell 5eebe3259a Bug 1781129 - Part 1: Use BigBuffer for IPCDataTransfer, r=edgar
The IPCDataTransfer type is used to transfer Clipboard/Drag & Drop payloads
over IPC to allow them to be written to or read from the relevant system
interfaces. Previously, the system which was used was somewhat complex, and
tried to use Shmem in some cases to store buffers out of line. Now that
BigBuffer is available, it can be simplified substantially.

In addition, this change removed the memory buffer overload of GetSurfaceData,
as the only consumer was using it to immediately send the payload over IPC as a
nsCString. It was changed to instead use `BigBuffer` as that is more efficient
in a large buffer situation, and reduces the number of required copies.

Differential Revision: https://phabricator.services.mozilla.com/D151852
2022-08-02 18:09:40 +00:00
Marian-Vasile Laza 00079e8784 Backed out 4 changesets (bug 1781129) for causing bustages on nsContentUtils.cpp. CLOSED TREE
Backed out changeset 4a92d58726aa (bug 1781129)
Backed out changeset bce3f99441c0 (bug 1781129)
Backed out changeset fc135243503e (bug 1781129)
Backed out changeset 726458f976ff (bug 1781129)
2022-08-02 20:32:01 +03:00
Nika Layzell 452233a5a1 Bug 1781129 - Part 1: Use BigBuffer for IPCDataTransfer, r=edgar
The IPCDataTransfer type is used to transfer Clipboard/Drag & Drop payloads
over IPC to allow them to be written to or read from the relevant system
interfaces. Previously, the system which was used was somewhat complex, and
tried to use Shmem in some cases to store buffers out of line. Now that
BigBuffer is available, it can be simplified substantially.

In addition, this change removed the memory buffer overload of GetSurfaceData,
as the only consumer was using it to immediately send the payload over IPC as a
nsCString. It was changed to instead use `BigBuffer` as that is more efficient
in a large buffer situation, and reduces the number of required copies.

Differential Revision: https://phabricator.services.mozilla.com/D151852
2022-08-02 17:15:41 +00:00
Edgar Chen 076d44606d Bug 1768597 - Part 2: Use nsContentUtils::IPCTransferableToTransferable to convert IPCDataTransfer into nsITransferable; r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D145941
2022-05-17 08:12:03 +00:00
Norisz Fay eef7d5c5ac Backed out changeset 00f6bd7aa727 (bug 1755481) for causing multiple clipboard related failures CLOSED TREE 2022-02-16 12:14:58 +02:00
Mirko Brodesser 8aa76ff1d7 Bug 1755481: rename `nsIClipboard::getData` to `nsIClipboard::getSomeData` and document it. r=mccr8
Before, it was confusing. One could have assumed that the method gets
the data for all flavors.

Differential Revision: https://phabricator.services.mozilla.com/D138776
2022-02-16 09:03:00 +00:00
Stephen A Pohl b739277c24 Bug 1719427: Refactor scrollbar drawing code across platforms. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D129265
2021-11-15 12:39:38 +00:00
criss 8ace361058 Backed out 4 changesets (bug 1719427) for causing build bustages. CLOSED TREE
Backed out changeset d6948ef7f495 (bug 1719427)
Backed out changeset 4df7017f6bc9 (bug 1719427)
Backed out changeset 8c5bb08f80e9 (bug 1719427)
Backed out changeset e32004dd2014 (bug 1719427)
2021-11-15 13:46:20 +02:00
Stephen A Pohl 0468798e53 Bug 1719427: Refactor scrollbar drawing code across platforms. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D129265
2021-11-15 11:15:54 +00:00
Boris Zbarsky 5eb248348f Bug 1557847. Stop using [array] in nsIClipboard. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D34243

--HG--
extra : moz-landing-system : lando
2019-06-09 01:06:39 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Tom Schuster 6296f48a85 Bug 1493292 - Remove aDataLen parameters from nsITransferable.setTransferData. r=smaug
Depends on D11201

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

--HG--
extra : moz-landing-system : lando
2018-11-20 17:00:09 +00:00
Csoregi Natalia df7483024d Backed out 6 changesets (bug 1493292) for bustage on /nsTransferable.cpp. CLOSED TREE
Backed out changeset f198bf91320b (bug 1493292)
Backed out changeset 6487aa307123 (bug 1493292)
Backed out changeset f2cabd69c568 (bug 1493292)
Backed out changeset 71430fceb4a3 (bug 1493292)
Backed out changeset 3a9b6d65d8c7 (bug 1493292)
Backed out changeset 55769869037c (bug 1493292)
2018-11-20 17:13:18 +02:00
Tom Schuster 8be0fec340 Bug 1493292 - Remove aDataLen parameters from nsITransferable.setTransferData. r=smaug
Depends on D11201

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

--HG--
extra : moz-landing-system : lando
2018-11-20 14:47:04 +00:00
Boris Zbarsky 0216588e17 Bug 1507540 part 5. Use more notxpcom attributes in widget/. r=ehsan 2018-11-19 20:17:54 -05:00
Tom Schuster 028ba5d31e Bug 1497831 - Use nsTArray instead of nsIArray for nsITransferable. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D8194

--HG--
extra : moz-landing-system : lando
2018-10-10 20:25:54 +00:00