Last Comment Bug 743574 - Deprecate DOMException.code
: Deprecate DOMException.code
: dev-doc-complete
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla14
Assigned To: Masatoshi Kimura [:emk]
Depends on: 730161
  Show dependency treegraph
Reported: 2012-04-08 10:51 PDT by Masatoshi Kimura [:emk]
Modified: 2012-04-27 10:52 PDT (History)
7 users (show)
ryanvm: in‑testsuite-
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (3.70 KB, patch)
2012-04-08 10:52 PDT, Masatoshi Kimura [:emk]
no flags Details | Diff | Splinter Review
Warn use of DOMException.code only when the code was changed (IndexedDB or File API) or is useless (zero) (3.98 KB, patch)
2012-04-09 16:20 PDT, Masatoshi Kimura [:emk]
jonas: review+
Details | Diff | Splinter Review

Description Masatoshi Kimura [:emk] 2012-04-08 10:51:23 PDT
DOMException.code is deprecated per DOM4 spec.
Comment 1 Masatoshi Kimura [:emk] 2012-04-08 10:52:17 PDT
Created attachment 613190 [details] [diff] [review]

Adding a deprecation warning.
Comment 2 :Ms2ger (⌚ UTC+1/+2) 2012-04-08 12:01:46 PDT
Are we planning to remove support? It seems not too useful to warn for things that aren't broken, and won't be.
Comment 3 Masatoshi Kimura [:emk] 2012-04-08 16:35:29 PDT
If an existing IndexedDB/File API code uses .code to identify the error, it will be surely broken.
Also, we used to removed many non-broken things (taintEnabled, xmlVersion, isSameNode, etc.)
That said, I have no plan to remove .code at the moment (then what the DOM4 deprecation means?).
Comment 4 Jonas Sicking (:sicking) PTO Until July 5th 2012-04-09 14:55:53 PDT
I'm a little bit worried about warning here.

I agree that for code that uses IndexedDB or FileAPI exceptions, we are going to break people that are using DOMException.code.

However I'd expect it to be much much more common to use DOMException.code in code that uses older DOM APIs, such as normal Node manipulation etc. For those people, warning them doesn't do a lot of good. They likely need their code to work on older browsers where .name isn't available or doesn't have the new standardized names, and writing different code paths for Gecko is likely just a pain with no real gain.

So basically I'm worried that we're going to stick a warning in people's developer console, with no good alternative for what they should used instead. So I'm worried people are just going to ignore this warning which lessens the value of warnings in general.

So basically I think we should wait with checking this patch in until in a year or two when it would make more sense for developers to use .name for all exceptions.
Comment 5 Masatoshi Kimura [:emk] 2012-04-09 16:20:59 PDT
Created attachment 613428 [details] [diff] [review]
Warn use of DOMException.code only when the code was changed (IndexedDB or File API) or is useless (zero)

Then what about this? This patch relies on patches of bug 730161.
Comment 6 Jonas Sicking (:sicking) PTO Until July 5th 2012-04-09 16:34:14 PDT
Comment on attachment 613428 [details] [diff] [review]
Warn use of DOMException.code only when the code was changed (IndexedDB or File API) or is useless (zero)

SOLD to the awesome Kimura-san!
Comment 7 Ryan VanderMeulen [:RyanVM] 2012-04-11 15:04:16 PDT
Comment 8 Richard Newman [:rnewman] 2012-04-11 15:36:41 PDT
(In reply to Ryan VanderMeulen from comment #7)

Backed out whole merge for bustage per Yoric (Bug 743574):
Comment 9 Richard Newman [:rnewman] 2012-04-11 17:53:15 PDT
Disregard that; PEBKAC. Did not get backed out. I misread TBPL.
Comment 10 :Ehsan Akhgari (away Aug 1-5) 2012-04-12 10:31:06 PDT
Comment 11 :Ehsan Akhgari (away Aug 1-5) 2012-04-12 10:34:41 PDT
Backed out:
Comment 12 Richard Newman [:rnewman] 2012-04-12 10:37:15 PDT
(In reply to Ehsan Akhgari [:ehsan] from comment #11)
> Backed out:

This bug is cursed.
Comment 13 Ryan VanderMeulen [:RyanVM] 2012-04-12 14:40:36 PDT
(In reply to Ehsan Akhgari [:ehsan] from comment #11)
> Backed out:

Ehsan, that changeset doesn't appear to have anything to do with this bug. Furthermore, per comment 9, this was never actually backed out AFAIK.
Comment 14 Masatoshi Kimura [:emk] 2012-04-12 20:20:37 PDT
Closing again because this is not really backed out.

Note You need to log in before you can comment on or make changes to this bug.