Bug 138091 - Allow to define a plugin in javascript
Summary: Allow to define a plugin in javascript
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-27 04:19 PDT by Julien Isorce
Modified: 2016-08-30 13:12 PDT (History)
13 users (show)

See Also:


Attachments
Patch that allow to set from javascript the internal object of an object element (8.28 KB, patch)
2014-10-27 04:19 PDT, Julien Isorce
no flags Details | Formatted Diff | Diff
Minimal test to illustrate the patch (944 bytes, text/html)
2014-10-27 04:22 PDT, Julien Isorce
no flags Details
Patch that allow to set from javascript the internal object of an object element (8.28 KB, patch)
2014-10-27 09:54 PDT, Julien Isorce
no flags Details | Formatted Diff | Diff
Patch that allow to set from javascript the internal object of an object element (9.85 KB, patch)
2014-11-04 05:20 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
Patch that allow to set from javascript the internal object of an object element (9.84 KB, patch)
2014-11-06 01:01 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
Patch that allow to set from javascript the internal object of an object element (12.88 KB, patch)
2014-11-13 10:10 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
Minimal test to illustrate the patch (1.54 KB, text/plain)
2014-11-13 10:11 PST, Julien Isorce
no flags Details
Patch that allow to set from javascript the internal object of an object element (12.84 KB, patch)
2014-11-14 02:26 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
Patch that allow to set from javascript the internal object of an object element (12.85 KB, patch)
2014-11-14 04:08 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
Patch that allow to set from javascript the internal object of an object element (12.24 KB, patch)
2014-11-14 06:42 PST, Julien Isorce
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 (576.01 KB, application/zip)
2014-11-14 07:57 PST, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion (602.20 KB, application/zip)
2014-11-14 08:20 PST, Build Bot
no flags Details
Patch that allow to set from javascript the internal object of an object element (14.96 KB, patch)
2014-11-14 10:01 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
Patch that allow to set from javascript the internal object of an object element (17.59 KB, patch)
2014-11-17 07:37 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
Patch (20.14 KB, patch)
2014-11-17 08:01 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
HTMLObjectElement: can set the underlying object from javascript (21.89 KB, patch)
2014-11-17 08:11 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
HTMLObjectElement: can set the underlying object from javascript (21.83 KB, patch)
2014-11-17 08:19 PST, Julien Isorce
no flags Details | Formatted Diff | Diff
HTMLObjectElement: can set the underlying object from javascript (19.04 KB, patch)
2015-02-05 03:20 PST, Julien Isorce
andersca: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Isorce 2014-10-27 04:19:15 PDT
Created attachment 240475 [details]
Patch that allow to set from javascript the internal object of an object element

Hi,

We know this is probably only useful for our usecase but we wanted to have your point of view if this enhancement may have more general interest.

So the attach patch allow to define a plugin in pure javascript. Then the page can still use a common interface (so not using a custom element).
We know we introduced a new object function which is not specified anywhere but we found this enhancement interesting and we wanted to share it with you.

See minimal attached example.

Cheers,
Julien
Comment 1 Julien Isorce 2014-10-27 04:22:08 PDT
Created attachment 240476 [details]
Minimal test to illustrate the patch
Comment 2 Julien Isorce 2014-10-27 09:54:58 PDT
Created attachment 240484 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 3 Julien Isorce 2014-11-04 05:20:58 PST
Created attachment 240921 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 4 Julien Isorce 2014-11-06 01:01:59 PST
Created attachment 241094 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 5 Julien Isorce 2014-11-13 10:10:08 PST
Created attachment 241489 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 6 Julien Isorce 2014-11-13 10:11:15 PST
Created attachment 241490 [details]
Minimal test to illustrate the patch
Comment 7 Julien Isorce 2014-11-14 02:26:50 PST
Created attachment 241569 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 8 Julien Isorce 2014-11-14 04:08:26 PST
Created attachment 241576 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 9 Julien Isorce 2014-11-14 06:42:02 PST
Created attachment 241585 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 10 Build Bot 2014-11-14 07:57:24 PST
Comment on attachment 241585 [details]
Patch that allow to set from javascript the internal object of an object element

Attachment 241585 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/6035540264615936

New failing tests:
sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.4/S15.3.4_A2_T3.html
sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.4/S15.3.4_A2_T1.html
sputnik/Conformance/15_Native_Objects/15.2_Object/15.2.4/S15.2.4_A3.html
plugins/script-object-invoke.html
sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.3/15.3.3.1_Function.prototype/S15.3.3.1_A1.html
sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.4/S15.3.4_A2_T2.html
plugins/npruntime/throw-exception.html
Comment 11 Build Bot 2014-11-14 07:57:26 PST
Created attachment 241588 [details]
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-16  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 12 Build Bot 2014-11-14 08:19:58 PST
Comment on attachment 241585 [details]
Patch that allow to set from javascript the internal object of an object element

Attachment 241585 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/4629795321151488

Number of test failures exceeded the failure limit.
Comment 13 Build Bot 2014-11-14 08:20:01 PST
Created attachment 241589 [details]
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-03  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 14 Julien Isorce 2014-11-14 10:01:32 PST
Created attachment 241595 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 15 Julien Isorce 2014-11-17 07:37:55 PST
Created attachment 241711 [details]
Patch that allow to set from javascript the internal object of an object element
Comment 16 Philippe Normand 2014-11-17 07:44:56 PST
I don't think I can review this but you'll need to provide changelog entries, see http://www.webkit.org/coding/contributing.html
Comment 17 Julien Isorce 2014-11-17 08:01:57 PST
Created attachment 241713 [details]
Patch
Comment 18 Julien Isorce 2014-11-17 08:11:23 PST
Created attachment 241715 [details]
HTMLObjectElement: can set the underlying object from javascript
Comment 19 Julien Isorce 2014-11-17 08:19:25 PST
Created attachment 241717 [details]
HTMLObjectElement: can set the underlying object from javascript
Comment 20 Philippe Normand 2014-11-17 23:10:55 PST
Comment on attachment 241717 [details]
HTMLObjectElement: can set the underlying object from javascript

No Julien, only reviewers should set the r+ flag.
Comment 21 Julien Isorce 2014-11-18 01:49:34 PST
Add reviewers that Tools/Scripts/webkit-patch suggest-reviewers printed.
Comment 22 Chang Shu 2014-12-01 09:46:25 PST
Hi, Julien,
Can you explain your usecase of using this interface and any other general usecases you might think of?
Comment 23 Julien Isorce 2014-12-02 05:32:01 PST
Our concrete usecase is to wrap custom js objects. These objects can be registered for example from the injectedBundle.

Some of these object are registered through JSClassDefinition. (So it will look like to the second layout test attached to the patch)

One of the consequences is that we do not depend on netscape and pepper plugin APIs.

In HTMLPluginElement there is already a "::getInstance()" method. This patch basically implements "::setInstance" and being a call triggered from javascript.
Comment 24 Julien Isorce 2015-02-05 03:20:35 PST
Created attachment 246095 [details]
HTMLObjectElement: can set the underlying object from javascript

Also handle DFG and FTL cases through JITOperations.cpp
Comment 25 Alexey Proskuryakov 2015-02-06 22:53:37 PST
Julien, is this the same use case that Web Components and Shadow DOM serve?
Comment 26 Anders Carlsson 2016-06-26 07:48:40 PDT
Comment on attachment 246095 [details]
HTMLObjectElement: can set the underlying object from javascript

Looking at the patch, this is not a direction we'd like to take for plug-ins.
Comment 27 Julien Isorce 2016-08-30 13:12:30 PDT
(In reply to comment #25)
> Julien, is this the same use case that Web Components and Shadow DOM serve?

Hi, nop. Unfortunately there is no way in current upstream or in any spec to override existing properties of a tag object. Custom element would have been a good candidate but because if the "is" attribute, this is not workable.