New issue
Advanced search Search tips

Issue 616662 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

The mimeTypes and plugins objects on navigator return new objects when indexed by the same ordinal

Reported by just...@gmail.com, Jun 2 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36

Steps to reproduce the problem:
1. navigator.mimeTypes[0] === navigator.mimeTypes[0]
2. navigator.plugins[0] === navigator.plugins[0]

What is the expected behavior?
Both of these statements should return true. But instead each time a new object is returned and so they both return false. They return true in IE, Edge and FireFox so far as I can tell.

What went wrong?
New objects were created.

Did this work before? N/A 

Chrome version: 50.0.2661.94  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 21.0 r0

Prevents usage of assert_array_equals when writing web-platform-tests for these objects.
 
Cc: domenic@chromium.org
Components: Blink>Bindings
Labels: -OS-Windows Hotlist-Interop OS-All
Status: Untriaged (was: Unconfirmed)
Can confirm that Chrome's behavior is wrong per spec:

- https://html.spec.whatwg.org/#dom-mimetypearray-item
- https://html.spec.whatwg.org/#dom-pluginarray-item
Components: Blink>DOM
Labels: -Arch-x86_64
Status: Available (was: Untriaged)
DOM{Mime,Plugin}Array::item(unsigned) returns a new object every time.

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/plugins/DOMMimeTypeArray.cpp?l=56
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp?l=56

This is the cause.
I can have a look.

To fix this issue does it mean we have to maintain vector<DOMPlugin> in DOMPluginArray and vector<DOMMimeType> in DOMMimeTypeArray to cache returned items? Will it affect garbage collection?




Owner: lfg@chromium.org
Status: Assigned (was: Available)
Doesn't look like a.obzhirov@ is looking at this anymore.

It's not a critical issue, but it would be nice to do this correctly. lfg@, might you have a chance to have a look at this?

Comment 6 by lfg@chromium.org, May 24 2017

Status: Started (was: Assigned)
Project Member

Comment 7 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/417f8212676dd6c0e0542e89cfef82e67b03dedf

commit 417f8212676dd6c0e0542e89cfef82e67b03dedf
Author: lfg <lfg@chromium.org>
Date: Fri May 26 16:09:42 2017

Move blink::PluginData, blink::PluginInfo, blink::MimeTypeInfo to oilpan heap.

A future patch will fix the spec compliance of navigator.plugins.

BUG= 616662 

Review-Url: https://codereview.chromium.org/2901353002
Cr-Commit-Position: refs/heads/master@{#475022}

[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/core/page/Page.cpp
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/core/page/Page.h
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/modules/plugins/DOMMimeType.cpp
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/modules/plugins/DOMMimeType.h
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/modules/plugins/DOMMimeTypeArray.cpp
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/modules/plugins/DOMPlugin.cpp
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/modules/plugins/DOMPlugin.h
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/platform/plugins/PluginData.cpp
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/platform/plugins/PluginData.h
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/platform/plugins/PluginListBuilder.cpp
[modify] https://crrev.com/417f8212676dd6c0e0542e89cfef82e67b03dedf/third_party/WebKit/Source/platform/plugins/PluginListBuilder.h

Project Member

Comment 8 by bugdroid1@chromium.org, Jun 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/819697cf41f496d914415cc88a39e39afe4dfe29

commit 819697cf41f496d914415cc88a39e39afe4dfe29
Author: Lucas Furukawa Gadani <lfg@chromium.org>
Date: Fri Jun 02 22:55:41 2017

Make navigator arrays return the same object when indexed at the same position.

Before this change, every time the navigator.plugins or navigator.mimeTypes
arrays were indexed, blink would create a new object and return it.

This patch changes this so that it can now return the same object when
indexed at the same position.

This patch also makes the arrays sorted alphabetically by name and type
respectively, as required by the spec.

BUG= 616662 

Change-Id: I3d522d6c8efc220c71a1711b3eec43c0bbd5f8ef
Reviewed-on: https://chromium-review.googlesource.com/517886
Commit-Queue: Lucas Furukawa Gadani <lfg@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#476826}
[add] https://crrev.com/819697cf41f496d914415cc88a39e39afe4dfe29/third_party/WebKit/LayoutTests/plugins/navigator-pluginarray.html
[modify] https://crrev.com/819697cf41f496d914415cc88a39e39afe4dfe29/third_party/WebKit/Source/core/page/Page.cpp
[modify] https://crrev.com/819697cf41f496d914415cc88a39e39afe4dfe29/third_party/WebKit/Source/modules/plugins/DOMMimeType.cpp
[modify] https://crrev.com/819697cf41f496d914415cc88a39e39afe4dfe29/third_party/WebKit/Source/modules/plugins/DOMMimeTypeArray.cpp
[modify] https://crrev.com/819697cf41f496d914415cc88a39e39afe4dfe29/third_party/WebKit/Source/modules/plugins/DOMMimeTypeArray.h
[modify] https://crrev.com/819697cf41f496d914415cc88a39e39afe4dfe29/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp
[modify] https://crrev.com/819697cf41f496d914415cc88a39e39afe4dfe29/third_party/WebKit/Source/modules/plugins/DOMPluginArray.h
[modify] https://crrev.com/819697cf41f496d914415cc88a39e39afe4dfe29/third_party/WebKit/Source/platform/plugins/PluginData.cpp

Awesome to see this fixed, lfg@!

Did you know that if you add the tests to LayoutTests/external/wpt, they'll automatically get synced into a cross-browser test suite used by all the different engines? This test looks like a great one to add there, perhaps without the "there must be at least one plugin" assertions.
Project Member

Comment 10 by bugdroid1@chromium.org, Jun 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9a9c75da9b47eed047553d66d032dd397aee45a5

commit 9a9c75da9b47eed047553d66d032dd397aee45a5
Author: Lucas Furukawa Gadani <lfg@chromium.org>
Date: Mon Jun 05 21:01:41 2017

Adds wpt tests that verify compliance of navigator.plugins and
navigator.mimeTypes.

The new tests verify that:
  * Arrays returns the same object when indexed by the same ordinal.
  * Arrays do not return the same object on different frames.
  * The arrays are sorted in alphabetical order.

Bug:  616662 
Change-Id: I2b9e87b68c70167124d143790cff04889d08e97f
Reviewed-on: https://chromium-review.googlesource.com/524412
Reviewed-by: Quinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Lucas Furukawa Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#477081}
[add] https://crrev.com/9a9c75da9b47eed047553d66d032dd397aee45a5/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html

Comment 11 by lfg@chromium.org, Jun 6 2017

Labels: Merge-Request-60
Status: Fixed (was: Started)
Project Member

Comment 12 by sheriffbot@chromium.org, Jun 6 2017

Labels: -Merge-Request-60 Hotlist-Merge-Approved Merge-Approved-60
Your change meets the bar and is auto-approved for M60. Please go ahead and merge the CL to branch 3112 manually. Please contact milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), josafat@(ChromeOS), bustamante@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Please merge the patch to M60 branch(3112),Beta RC cut is scheduled @ 4.00 PM PST today(06/07).

Comment 14 by lfg@chromium.org, Jun 7 2017

Labels: -Hotlist-Merge-Approved -Merge-Approved-60
I initially thought that the first part had landed before the branch but not the second part, and that's why I requested the merge.

I just checked and this wasn't the case, so we'll just wait until M61 for this change to go through.

Project Member

Comment 15 by bugdroid1@chromium.org, Jun 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e67d603af3065d26e557eb00f964badd71f7d1a3

commit e67d603af3065d26e557eb00f964badd71f7d1a3
Author: Lucas Furukawa Gadani <lfg@chromium.org>
Date: Fri Jun 09 19:28:54 2017

Rename internal pdf plugin so it doesn't clash with the pdf extension.

BUG= 616662 

Change-Id: I34534dd8138329eef4d5c78170ec954c6c59d92b
Reviewed-on: https://chromium-review.googlesource.com/518224
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lucas Furukawa Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#478371}
[modify] https://crrev.com/e67d603af3065d26e557eb00f964badd71f7d1a3/chrome/browser/pdf/pdf_extension_util.cc
[modify] https://crrev.com/e67d603af3065d26e557eb00f964badd71f7d1a3/chrome/browser/plugins/plugin_policy_handler.cc
[modify] https://crrev.com/e67d603af3065d26e557eb00f964badd71f7d1a3/chrome/browser/plugins/plugin_prefs.cc
[modify] https://crrev.com/e67d603af3065d26e557eb00f964badd71f7d1a3/chrome/browser/plugins/plugin_prefs_unittest.cc
[modify] https://crrev.com/e67d603af3065d26e557eb00f964badd71f7d1a3/chrome/common/chrome_content_client.cc
[modify] https://crrev.com/e67d603af3065d26e557eb00f964badd71f7d1a3/chrome/common/chrome_content_client.h
[modify] https://crrev.com/e67d603af3065d26e557eb00f964badd71f7d1a3/chrome/common/chrome_content_client_constants.cc
[modify] https://crrev.com/e67d603af3065d26e557eb00f964badd71f7d1a3/chrome/renderer/chrome_content_renderer_client.cc

Sign in to add a comment