Closed
Bug 128420
Opened 23 years ago
Closed 23 years ago
[FIX]getComputedStyle should raise NOT_SUPPORTED_ERR
Categories
(Core :: DOM: CSS Object Model, defect, P3)
Core
DOM: CSS Object Model
Tracking
()
RESOLVED
FIXED
mozilla1.2alpha
People
(Reporter: netdragon, Assigned: caillon)
Details
Attachments
(3 files)
12.11 KB,
text/html
|
Details | |
12.20 KB,
text/html
|
Details | |
871 bytes,
patch
|
glazou
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
Error: uncaught exception: [Exception... "Component returned failure code:
0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMViewCSS.getComputedStyle]"
nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame ::
file:///F:/netscape/projects/patchandtest/Bug/kitchensinkerror.html ::
<TOP_LEVEL> :: line 65" data: no]
Reporter | ||
Comment 1•23 years ago
|
||
The error appeared in the javascript console.
Assignee | ||
Comment 2•23 years ago
|
||
Well, that's because you pass an undefined value for the element value of
getComputedStyle(). Try adding an |alert (typeof elt);| right after you assign
it. When you call document.getElementById("sink") there is no element with that
ID. It doesn't get defined until after you run your JS.
Define your element before trying to access it and you'll see that it does
indeed work fine. Note though that the value will be practically useless to you
though as it will be "auto". the top property only applies to positioned
elements and thus returns the default value per the spec.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Component: JavaScript Engine → DOM Style
Resolution: --- → INVALID
Reporter | ||
Comment 3•23 years ago
|
||
You're right.
Reporter | ||
Comment 4•23 years ago
|
||
I still don't like the exception it returned. It should give something a little
more informative (object not initialized) or something.
![]() |
||
Comment 5•23 years ago
|
||
Um... there is no object to not be initialized. There is a reference to an
element and the reference is "null". It's a null pointer.
That said, getComputedStyle is defined as returning no exceptions (even for
stupid cases like this). I hate the DOM Style spec. So we should just be
silently failing, with an assert in debug builds.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
![]() |
||
Comment 6•23 years ago
|
||
to caillon, but feel free to punt to me if you don't want to deal. :)
Assignee: rogerl → caillon
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Summary: Error on GetComputedStyle → getComputedStyle should not raise exceptions
Target Milestone: --- → Future
Assignee | ||
Comment 8•23 years ago
|
||
Daniel, should this be fixed? Or will the new CSS OM allow this (or another?)
exception? Let me know and I'll whip out a patch.
raising issue to CSS WG
resolution is "should throw NOT_SUPPORTED_ERR DOMException"
Assignee | ||
Comment 11•23 years ago
|
||
Thanks Daniel. I'll have a patch tomorrow, about to go to bed.
Priority: -- → P3
Target Milestone: Future → mozilla1.2alpha
Assignee | ||
Comment 12•23 years ago
|
||
Daniel, could you r=? Boris, sr=?
Assignee | ||
Updated•23 years ago
|
Summary: getComputedStyle should not raise exceptions → [FIX]getComputedStyle should raise NOT_SUPPORTED_ERR
![]() |
||
Comment 13•23 years ago
|
||
Comment on attachment 97210 [details] [diff] [review]
Raise the right exception.
sr=bzbarsky
Attachment #97210 -
Flags: superreview+
Comment on attachment 97210 [details] [diff] [review]
Raise the right exception.
r=glazman
check that in ! let's make the specs on thursday and be compliant on saturday
:-)
Attachment #97210 -
Flags: review+
Assignee | ||
Comment 15•23 years ago
|
||
So let it be written. So let it be done.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago → 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•