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

81 Коммитов

Автор SHA1 Сообщение Дата
Edgar Chen 239696f93b Bug 1858627 - Add nsIClipboard API to return nsIAsyncSetClipboardData synchrously; r=ipc-reviewers,nika
This is a sync version of `nsIClipboard.asyncGetData`, which can be used for
synchronous clipboard APIs, e.g. DataTransfer, to support the clipboard seqence
number concept, see bug 1879401.

Differential Revision: https://phabricator.services.mozilla.com/D201364
2024-03-13 20:44:06 +00:00
Edgar Chen 671c3b21b5 Bug 1858627 - Use ManagedEndpoint for PClipboardReadRequest construction; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D201657
2024-03-13 20:44:06 +00:00
Cristian Tuns d5255e21a3 Backed out 4 changesets (bug 1858627) for causing build bustages with "-p style --lib" CLOSED TREE
Backed out changeset 7f3f50c77406 (bug 1858627)
Backed out changeset 96327aab8126 (bug 1858627)
Backed out changeset 0655d0feb163 (bug 1858627)
Backed out changeset d3a1b3ac7611 (bug 1858627)
2024-03-13 05:23:51 -04:00
Edgar Chen a14b5b8d7f Bug 1858627 - Add nsIClipboard API to return nsIAsyncSetClipboardData synchrously; r=ipc-reviewers,nika
This is a sync version of `nsIClipboard.asyncGetData`, which can be used for
synchronous clipboard APIs, e.g. DataTransfer, to support the clipboard seqence
number concept, see bug 1879401.

Depends on D201657

Differential Revision: https://phabricator.services.mozilla.com/D201364
2024-03-13 01:07:17 +00:00
Edgar Chen 5c139ae15f Bug 1858627 - Use ManagedEndpoint for PClipboardReadRequest construction; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D201657
2024-03-13 01:07:16 +00:00
Norisz Fay cb12fbf3c2 Backed out 4 changesets (bug 1858627) for causing build bustage CLOSED TREE
Backed out changeset eaf5e6b7ddd4 (bug 1858627)
Backed out changeset 9efc1874ac78 (bug 1858627)
Backed out changeset 8f4ca2ab875b (bug 1858627)
Backed out changeset 02f94f12c3ef (bug 1858627)
2024-03-13 01:47:31 +02:00
Edgar Chen daca613d2e Bug 1858627 - Add nsIClipboard API to return nsIAsyncSetClipboardData synchrously; r=ipc-reviewers,nika
This is a sync version of `nsIClipboard.asyncGetData`, which can be used for
synchronous clipboard APIs, e.g. DataTransfer, to support the clipboard seqence
number concept, see bug 1879401.

Depends on D201657

Differential Revision: https://phabricator.services.mozilla.com/D201364
2024-03-12 21:51:53 +00:00
Edgar Chen 095c6aa3f6 Bug 1858627 - Use ManagedEndpoint for PClipboardReadRequest construction; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D201657
2024-03-12 21:51:52 +00:00
Natalia Csoregi f56ca9f231 Backed out 4 changesets (bug 1858627) for causing clipboard/paste failures. CLOSED TREE
Backed out changeset ad694926aa45 (bug 1858627)
Backed out changeset aca702ea720f (bug 1858627)
Backed out changeset 1d5175296606 (bug 1858627)
Backed out changeset 05b957fe3079 (bug 1858627)
2024-03-06 11:52:20 +02:00
Edgar Chen 0f5ea10151 Bug 1858627 - Add nsIClipboard API to return nsIAsyncSetClipboardData synchrously; r=ipc-reviewers,nika
This is a sync version of `nsIClipboard.asyncGetData`, which can be used for
synchronous clipboard APIs, e.g. DataTransfer, to support the clipboard seqence
number concept, see bug 1879401.

Depends on D201657

Differential Revision: https://phabricator.services.mozilla.com/D201364
2024-03-06 00:30:58 +00:00
Edgar Chen 692393278f Bug 1858627 - Use ManagedEndpoint for PClipboardReadRequest construction; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D201657
2024-03-06 00:30:58 +00:00
Greg Stoll 6b9e711a99 Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-13 11:26:48 +00:00
Cristian Tuns 2b828fa42e Backed out changeset 9dfe3fe4ccc5 (bug 1871135) for causing mochitest failures in nsClipboardProxy.cpp CLOSED TREE 2024-02-12 12:04:41 -05:00
Greg Stoll cbb35c98d7 Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-12 16:05:06 +00:00
Cristian Tuns ea5dd880a4 Backed out changeset 3caca1d10dcc (bug 1871135) for causing build bustages in nsBaseClipboard.cpp CLOSED TREE 2024-02-12 09:59:09 -05:00
Greg Stoll 5a2f92686a Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-12 00:49:39 +00:00
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