Commit Graph

1877 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
9673ac8ad9 Bug 1308080 - Make <details> use a shadow tree as per spec. r=TYLin,smaug
The behavior changes match WebKit and Blink. I can look into upstreaming
some of these to WPT.

Differential Revision: https://phabricator.services.mozilla.com/D34754
2022-09-13 21:52:50 +00:00
Emilio Cobos Álvarez
65467ff64a Bug 1740989 - Implement focus fixup rule. r=smaug
This implements the proposal in the linked spec issue, and makes
it nightly-only pending resolution + edits.

Differential Revision: https://phabricator.services.mozilla.com/D155970
2022-09-01 11:28:47 +00:00
Iulian Moraru
5c4c8e97c7 Backed out changeset d8f983951128 (bug 1740989) for causing mochitest-chrome failures on test_modal_prompts.html. CLOSED TREE 2022-09-01 01:03:29 +03:00
Emilio Cobos Álvarez
be87a9cbef Bug 1740989 - Implement focus fixup rule. r=smaug
This implements the proposal in the linked spec issue, and makes
it nightly-only pending resolution + edits.

Differential Revision: https://phabricator.services.mozilla.com/D155970
2022-08-31 17:10:17 +00:00
Nika Layzell
06dc83036a Bug 1781129 - Part 3: Remove Shmem overload of GetSurfaceData, r=edgar
After the previous changes there was only one consumer left of the Shmem
version of GetSurfaceData, which could easily be changed to use BigBuffer,
removing the need for that overload.

After that consumer is removed, the interface was also simplified as the
generic logic in the implementation was no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D151854
2022-08-26 16:08:06 +00:00
Nika Layzell
3720f45f4e Bug 1781129 - Part 2: Use BigBuffer for ShmemImage, r=edgar
The ShmemImage type was previously implemented using a Shmem, however due to
the usage patterns, `BigBuffer` is probably a better fit, and allows unifying
more code in nsContentUtils.

Differential Revision: https://phabricator.services.mozilla.com/D151853
2022-08-26 16:08:05 +00:00
Nika Layzell
1a89493eda 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
Tom Ritter
b07b1b325d Bug 1780362: Check the principal to see if it system in more places for RFP r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D155244
2022-08-23 14:31:03 +00:00
Marian-Vasile Laza
699c73da04 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
6dc701c685 Bug 1781129 - Part 3: Remove Shmem overload of GetSurfaceData, r=edgar
After the previous changes there was only one consumer left of the Shmem
version of GetSurfaceData, which could easily be changed to use BigBuffer,
removing the need for that overload.

After that consumer is removed, the interface was also simplified as the
generic logic in the implementation was no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D151854
2022-08-22 15:38:15 +00:00
Nika Layzell
b79f86a646 Bug 1781129 - Part 2: Use BigBuffer for ShmemImage, r=edgar
The ShmemImage type was previously implemented using a Shmem, however due to
the usage patterns, `BigBuffer` is probably a better fit, and allows unifying
more code in nsContentUtils.

Differential Revision: https://phabricator.services.mozilla.com/D151853
2022-08-22 15:38:15 +00:00
Nika Layzell
98496de2a9 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
Andreas Farre
3cab76dcc7 Bug 1595491 - Part 1: Make <embed> and <object> behave more like <iframe>. r=smaug,emilio
By making image loading in <embed> and <object> behave more like when
an <iframe> loads an image, we can make sure that the synthetic
document generated is process switched if the image is cross
origin. This is done by making image loading in nsObjectLoadingContent
follow the document loading path.

We also make sure that we pass the image size back to the embedder
element to not get stuck with the intrinsic size.

To avoid named targeting being able to target these synthetic
documents, as well as showing up in `Window.frames` and being counted
in `Window.length`, we keep a filtered list of non-synthetic browsing
contexts for that use-case.

This feature is controlled by two prefs:

* browser.opaqueResponseBlocking.syntheticBrowsingContext

  This triggers the creation of synthetic documents for images loaded
  in <object> or embed.

* browser.opaqueResponseBlocking.syntheticBrowsingContext.filter

  This turns on the filtering of synthetic browsing contexts in named
  targeting, `Window.length` and `Window.frames`.

Differential Revision: https://phabricator.services.mozilla.com/D148117
2022-08-16 16:42:58 +00:00
mleclair
a5ae4c3777 Bug 1774693: Added Set-Cookie as forbidden header name r=kershaw
Differential Revision: https://phabricator.services.mozilla.com/D154663
2022-08-15 23:13:58 +00:00
Marian-Vasile Laza
7002988694 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
1a2fce7ce5 Bug 1781129 - Part 3: Remove Shmem overload of GetSurfaceData, r=edgar
After the previous changes there was only one consumer left of the Shmem
version of GetSurfaceData, which could easily be changed to use BigBuffer,
removing the need for that overload.

After that consumer is removed, the interface was also simplified as the
generic logic in the implementation was no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D151854
2022-08-02 18:09:41 +00:00
Nika Layzell
b788910211 Bug 1781129 - Part 2: Use BigBuffer for ShmemImage, r=edgar
The ShmemImage type was previously implemented using a Shmem, however due to
the usage patterns, `BigBuffer` is probably a better fit, and allows unifying
more code in nsContentUtils.

Differential Revision: https://phabricator.services.mozilla.com/D151853
2022-08-02 18:09:40 +00:00
Nika Layzell
5ebb32b7ee 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
9719ac97bc 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
2850888d2f Bug 1781129 - Part 3: Remove Shmem overload of GetSurfaceData, r=edgar
After the previous changes there was only one consumer left of the Shmem
version of GetSurfaceData, which could easily be changed to use BigBuffer,
removing the need for that overload.

After that consumer is removed, the interface was also simplified as the
generic logic in the implementation was no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D151854
2022-08-02 17:15:42 +00:00
Nika Layzell
3869a08065 Bug 1781129 - Part 2: Use BigBuffer for ShmemImage, r=edgar
The ShmemImage type was previously implemented using a Shmem, however due to
the usage patterns, `BigBuffer` is probably a better fit, and allows unifying
more code in nsContentUtils.

Differential Revision: https://phabricator.services.mozilla.com/D151853
2022-08-02 17:15:41 +00:00
Nika Layzell
1558d73a4f 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
criss
4957cabd9c Merge autoland to mozilla-central. a=merge 2022-07-30 12:25:16 +03:00
Nika Layzell
63a28ee824 Bug 1772006 - Part 5: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-07-30 00:12:48 +00:00
Emilio Cobos Álvarez
7a9e682999 Bug 1780788 - Use abstract strings as in-arguments for ipdl. r=nika,necko-reviewers,media-playback-reviewers,alwu,dragana
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.

Non-virtual actors can still use `nsString` if they need to on the
receiving end.

Differential Revision: https://phabricator.services.mozilla.com/D152519
2022-07-25 20:19:48 +00:00
Tom Ritter
ed4d20d9e6 Bug 1770498: De-duplicate the CookieJar check into a local function r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D151679
2022-07-15 20:39:20 +00:00
Tom Ritter
7f3cda25e4 Bug 1770498: Create ShouldRFP(nsILoadInfo) and make ShouldRFP(nsIPrincipal) explicitly dangerous r=timhuang
- Move ShouldRFP(char*), ShouldRFP(docshell), ShouldRFP(Document)
  below some utility code.

- Now that we know we should check the CookieJarSettings, using
  ShouldRFP(nsIPrincipal) is dangerous.  We mark it as dangerous
  and annotate the existing uses of it.

- At the same time, an nsILoadInfo has the CookieJarSettings we
  want to check, so create a ShouldRFP(nsILoadInfo) that checks
  it and cascades to the (marked-dangerous-but-not-dangerous-for-
  this-call) principal function.

- We also correct a situation where WorkerLoadInfo does not
  initialize the shouldRFP member.

Differential Revision: https://phabricator.services.mozilla.com/D150591
2022-07-15 20:39:20 +00:00
Tom Ritter
7890eb6f2b Bug 1770498: Use the CookieJarSetting's ShouldRFP Member in nsContentUtils::ShouldRFP r=timhuang
Now that the ShouldRFP member is correctly populated (we hope)
in CookieJarSettings, we can use it in our ShouldRFP methods.

There are two general scenarios:
  An exempted domain frames a non-exempted domain.
     The inner frame should be non-exempted.
  A non-exempted domain frames an exempted domain
     The inner frame should be non-exempted.

In the first scenario, CookieJarSettings.shouldRFP member
will be false (exempted.)  We clearly cannot blindly rely
on the member, it would be wrong here.

In the second scenario, CookieJarSettings.shouldRFP member
will be true (non-exempted). This is the scenario we really
need CookieJarSettings for.

----

We take the opportunity to add an additional check for the
'exempted domain framed by a non-exempted domain' scenario.
This additional check takes advantage of the first party
isolation key (for FPI) or partition key (for dFPI).

Differential Revision: https://phabricator.services.mozilla.com/D150589
2022-07-15 20:39:19 +00:00
Tom Ritter
75145ea167 Bug 1770498: Use the final channel URI for SubDocument types also r=ckerschb
Testing indicated that for a SubDocument, the loading principal
is that of the parent document, but the final channel uri is
the uri of the subdocument.  In this situation, use the final
channel uri just as we do for a Document.

Differential Revision: https://phabricator.services.mozilla.com/D150586
2022-07-15 20:39:18 +00:00
Tom Ritter
a37f21cfe4 Bug 1770498: Abstract the Document check so it can be used in more places r=ckerschb
In rare cases, we will need to see if we ShouldRFP using
only a URI and OA.  (This is already the case for a
top-level load.)

Abstract this check into its own function, but at the
same time explicitly label it as dangerous and require
the developer to provide a justification why they need
to use it to hopefully prevent misuse.

Differential Revision: https://phabricator.services.mozilla.com/D150585
2022-07-15 20:39:18 +00:00
Tom Ritter
5b0139ec13 Bug 1770498: Simplify Principal-based ShouldRFP check r=ckerschb,freddyb
- Reorder ShouldRFP(char* justification) to put it first
 - Add a log line about a null dochsell to be consistent
 - Significantly alter the ShouldRFP(nsIPrincipal) check:

   Before, it was a coarse function, if you weren't system
   principal, it just checked the pref.

   Now, it has been combined with the ShouldRFP(nsIPrincipal, OriginAttributes)
   function, which was fine-grained. That function didn't
   need to exist, because we can _get_ the OriginAttributes
   _from_ the principal.

   Because before we were retrieving the OA from the loadInfo
   (and not the principal) we add an assert to ensure they're
   the same.

   We eliminate the ShouldRFP(nsIPrincipal, OriginAttributes)
   function entirely and convert its one caller into just
   passing the principal.

   One result of all of this is that the ShouldRFP(nsIPrincipal)
   check has been turned into a fine-grained check.

Differential Revision: https://phabricator.services.mozilla.com/D146945
2022-07-15 20:39:17 +00:00
Emilio Cobos Álvarez
aa13814e76 Bug 1765083 - Introduce FocusOptions.focusVisible. r=smaug,pip-reviewers
As per:

 * https://github.com/whatwg/html/issues/7830
 * https://github.com/whatwg/html/pull/8087

Replace the internal preventFocusRing with the new flag.

Differential Revision: https://phabricator.services.mozilla.com/D151326
2022-07-11 22:04:34 +00:00
Sean Feng
be8b0c6ff4 Bug 1778345 - Align PerformanceEventTiming::GetAnElement with the spec r=emilio
There are two bugs in this function, first the function doesn't do
the `is not connected` check correctly as it supposes to use
`IsInComposed()` but rather `IsInUnComposed()`. Second, it
doesn't get the root of the element correctly.

Also this patch converts the function be static so that it can be
reused.

Differential Revision: https://phabricator.services.mozilla.com/D151081
2022-07-06 20:11:44 +00:00
Jim Blandy
769dc2dbf0 Bug 1777656: Delete mozilla::ipc::SharedMemory::SharedMemorytype. r=nika,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D150852
2022-07-05 20:08:31 +00:00
Tom Schuster
3d20becf03 Bug 1774866 - Support error stacks in main-thread structuredClone(). r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D149696
2022-06-27 19:21:09 +00:00
criss
c1b045ddda Backed out 9 changesets (bug 1772006) causing build bustages on nsTString.cpp. CLOSED TREE
Backed out changeset f17c7565707b (bug 1772006)
Backed out changeset c725fe1f5882 (bug 1772006)
Backed out changeset d19663161261 (bug 1772006)
Backed out changeset b6611ab002d9 (bug 1772006)
Backed out changeset 790f42b64af9 (bug 1772006)
Backed out changeset 79a734b4e4d9 (bug 1772006)
Backed out changeset 42730aae16ea (bug 1772006)
Backed out changeset b2542aef3054 (bug 1772006)
Backed out changeset 962bfea4a309 (bug 1772006)
2022-06-11 01:13:42 +03:00
Nika Layzell
c1e4a1e52c Bug 1772006 - Part 6: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-06-10 21:12:08 +00:00
Emilio Cobos Álvarez
71c7e5b18f Bug 1604562 - Use wrapped principal as needed for CORS requests triggered by expanded principals. r=necko-reviewers,freddyb,kershaw
As long as they only wrap one principal, we have a meaningful origin to
use for the CORS request.

This is another alternative for the fix.

Differential Revision: https://phabricator.services.mozilla.com/D148396
2022-06-08 15:30:08 +00:00
Nika Layzell
fdd73ae9e2 Bug 1773088 - Part 1: Stop requiring an actor to serialize blobs over IPC, r=asuth
This does a somewhat-shallow removal of the argument from the implementation
and all call-sites. Removing it from StructuredCloneData's serialization is
handled in the next part, as it is more widely used and complex.

Differential Revision: https://phabricator.services.mozilla.com/D148531
2022-06-08 15:24:27 +00:00
Tom Schuster
f3b67bc713 Bug 1762952 - structuredClone should not always allow cloning SharedArrayBuffers. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D148548
2022-06-07 21:53:22 +00:00
Kagami Sascha Rosylight
419a8cd0b6 Bug 1769290 - Part 7: Apply mozilla-js-handle-rooted-typedef against dom/base r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D148280
2022-06-05 20:54:59 +00:00
criss
6dc135405c Backed out changeset 9bf6a5eb2ed5 (bug 1770498) for causing mochitest failures on browser_navigator.js . CLOSED TREE 2022-06-02 19:53:39 +03:00
Tom Ritter
8a69d1a801 Bug 1770498: Simplify Principal-based ShouldRFP check r=ckerschb,freddyb
Differential Revision: https://phabricator.services.mozilla.com/D146945
2022-06-02 15:31:24 +00:00
Emilio Cobos Álvarez
657914334f Bug 1730284 - Factor out some IntersectionObserver code. r=smaug,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D146573
2022-05-25 20:45:55 +00:00
Noemi Erli
7c6784310f Backed out 2 changesets (bug 1730284) for causing devtools,web-platform and mochitest failures CLOSED TREE
Backed out changeset 98834b863104 (bug 1730284)
Backed out changeset 1ec157459e8c (bug 1730284)
2022-05-25 22:51:20 +03:00
Emilio Cobos Álvarez
bd6f693097 Bug 1730284 - Factor out some IntersectionObserver code. r=smaug,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D146573
2022-05-25 17:54:22 +00:00
Edgar Chen
8d28075ddd Bug 1524237 - Use Shmem for sending large string data in IPCDataTransfer; r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D146096
2022-05-25 15:53:39 +00:00
Edgar Chen
4a4d466b58 Bug 1732920 - Add data type for IPCDataTransferData; r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D146074
2022-05-17 18:47:39 +00:00
Edgar Chen
5d6ff032ab Bug 1768597 - Part 3: Use utility function to convert IPCDataTransferItem into nsIVariant; r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D145947
2022-05-17 08:12:04 +00:00
Edgar Chen
150934d5ab 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