Allow host objects to be notified of properties not found in prototypes chain

UNCONFIRMED
Unassigned

Status

UNCONFIRMED
11 years ago
11 years ago

People

(Reporter: mguillemot, Unassigned)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071204 Ubuntu/7.10 (gutsy) Firefox/2.0.0.11
Build Identifier: 

It is quite uneasy for an host object to have "low priority" properties, that should be returned only if no property with the given name is defined in the prototype chain.

In htmlunit we place for this purpose a custom object as prototype of Object. This custom object then calls getWithFallback() on our start object (when it makes sense). This allows us to simply handle this low priority properties but this implementation isn't totally hidden for the scripts as we've modified what should be the root prototype.

Provided patch adds a getWithFallback(String) method on ScriptableObject that returns NOT_FOUND per default. This method gets called if no property has been found in the prototype chain.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
(Reporter)

Comment 1

11 years ago
Created attachment 300637 [details] [diff] [review]
patch adding the described feature
You need to log in before you can comment on or make changes to this bug.