Closed Bug 695055 Opened 13 years ago Closed 6 years ago

float4 component access using out of range indice should produce a RangeError

Categories

(Tamarin Graveyard :: Virtual Machine, defect, P3)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED WONTFIX
Q2 12 - Cyril

People

(Reporter: brbaker, Unassigned)

References

Details

Float4 spec draft 12, section 4.6.3.2.b states that if the index is not of the numeric value 0, 1, 2 or 3 then a RangeError should be thrown:

2. If i is of a numeric type:
(a) If the value of i is 0, 1, 2 or 3, return v:x, v:y, v:z or v:w, respectively.
(b) Throw a RangeError error.

var flt4:float4 = new float4(1f);
flt4[-1];
flt4[4];

Actual output:
ReferenceError: Error #1069: Property -1 not found on float4 and there is no default value.
	at global$init()

Expected Output:
RangeError, valid values are 0-3

Testcase: as3/Types/Float4/flt4_4_6_3.as
Flags: in-testsuite+
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
Flags: flashplayer-bug-
Flags: flashplayer-qrb? → flashplayer-qrb+
Testmedia rename to as3/Types/Float4/component_access.as
Assignee: virgilp → lhansen
The facts on the ground have changed a little bit.

We now throw RangeError for non-integer indices in the range [4,2^32-2] and ReferenceError outside that range.  We treat numbers and strings that look like numbers the same.

That is consistent with a view that an index that is a string looks like an integer in the allowable range is converted to integer, and may then trigger a RangeError.

But it is inconsistent with how Vector works - Vector will absorb anything that looks like a number and throw RangeError for it.

It may be that what the spec is aiming for is just "too much goodness", ie, it may be a better definition of indexing but it is too complicated to grok for most programmers.

Some more thought is needed.  This bug can remain open for now, the problem does not need a fix urgently.
Testmedia updated to reflect:

float4[-1] -> ReferenceError
float4[4] -> RangeError

as3/Types/Float4/component_access.as
Priority: -- → P3
Target Milestone: --- → Q2 12 - Cyril
changeset: 6976:8645d19bbbea
user:      Brent Baker <brbaker@adobe.com>
summary:   Bug 695055: update media to reflect float4[-1] is a reference error and float4[4] is a range error

http://hg.mozilla.org/tamarin-redux/rev/8645d19bbbea
Assignee: lhansen → nobody
No assignee, updating the status.
Status: ASSIGNED → NEW
No assignee, updating the status.
No assignee, updating the status.
Tamarin is a dead project now. Mass WONTFIX.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
You need to log in before you can comment on or make changes to this bug.