Kill obsolete nsIDOMFile properties/methods

VERIFIED FIXED in mozilla7

Status

()

Core
DOM
VERIFIED FIXED
6 years ago
4 years ago

People

(Reporter: khuey, Assigned: khuey)

Tracking

({dev-doc-complete, relnote})

unspecified
mozilla7
dev-doc-complete, relnote
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(firefox7+)

Details

(Whiteboard: [warning landed on aurora])

Attachments

(4 attachments, 2 obsolete attachments)

Created attachment 537181 [details] [diff] [review]
Patch
Attachment #537181 - Flags: review?(jonas)
Comment on attachment 537181 [details] [diff] [review]
Patch

Please also add a patch here which adds warnings to all these methods which we could check in to aurora.

I suspect none of these methods are used in inner loops or anything like that, so no need to add complexity by making sure that we only warn once per document or some such. Just add a warning to the console every time they are called.
Attachment #537181 - Flags: review?(jonas) → review+
Created attachment 537246 [details] [diff] [review]
Warn on aurora
Attachment #537246 - Flags: review?(jonas)
Comment on attachment 537246 [details] [diff] [review]
Warn on aurora

Don't add strings to the dom.properties file as it's too late to take string changes on aurora. Even just adding it to the file, even if we don't expect people to translate it, will set off all sorts of warnings in various systems which we don't want.

Also, the properties are to developers called "fileName", "getAsDataURL" etc, no uppercase first character.
Attachment #537246 - Flags: review?(jonas) → review-
What do you want me to do then, hardcode it into the binary?
Yes
Created attachment 537266 [details] [diff] [review]
Now with hardcoded strings

Comments addressed.

Did I mention that nsPrintfCString is a horrible thing?
Attachment #537246 - Attachment is obsolete: true
Attachment #537266 - Flags: review?(jonas)
Comment on attachment 537266 [details] [diff] [review]
Now with hardcoded strings

Review of attachment 537266 [details] [diff] [review]:
-----------------------------------------------------------------

I assume you tested that this works: r=me

::: content/base/src/nsDOMFile.cpp
@@ +706,5 @@
> +  // This is hardcoded here in English since we're past string freeze.
> +  
> +  nsPrintfCString warningText
> +  (500,
> +   "Use of File.%s is deprecated. To upgrade your code, use standard properties or use the DOM FileReader object. For more help https://developer.mozilla.org/en/DOM/FileReader",

"For more help, see https://..."
Attachment #537266 - Flags: review?(jonas) → review+
Yes, I tested this for all of the properties from the error console.
Comment on attachment 537266 [details] [diff] [review]
Now with hardcoded strings

We would like to take this patch on Aurora to warn web developers that these deprecated APIs are going away (in Firefox 7).
Attachment #537266 - Flags: approval-mozilla-aurora?
Created attachment 537455 [details] [diff] [review]
Test fixes
http://hg.mozilla.org/mozilla-central/rev/64dd0ffff3f2
http://hg.mozilla.org/mozilla-central/rev/1dec937dfbb6
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Comment on attachment 537455 [details] [diff] [review]
Test fixes

Review of attachment 537455 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/canvas/test/test_mozGetAsFile.html
@@ +15,5 @@
> +  reader.onload = 
> +    function(e) {
> +      is(e.target.result, canvas.toDataURL(type),
> + "<canvas>.mozGetAsFile().getAsDataURL() should equal <canvas>.toDataURL()");
> +      SimpleTest.finish();

This doesn't look correct. Won't you call finish multiple times? Is that allowed?
Depends on: 662403
This broke some of our tools; see bug 662403.

Updated

6 years ago
Depends on: 662838
We might want to emphasize this change to web devs.
Keywords: dev-doc-needed

Updated

6 years ago
Attachment #537266 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+

Updated

6 years ago
Keywords: relnote

Comment 15

6 years ago
To recap: no string changes on central, and hard-coded English deprecation notices to the error console for aurora?

If so, sounds good.
(In reply to comment #15)
> To recap: no string changes on central, and hard-coded English deprecation
> notices to the error console for aurora?
> 
> If so, sounds good.

Correct.
Keywords: dev-doc-needed → dev-doc-complete
http://hg.mozilla.org/releases/mozilla-aurora/rev/fed3cae237b1

Not marking fixed on Aurora or anything since these are just warnings.
Depends on: 664780

Updated

6 years ago
Whiteboard: [warning added in aurora, "fixed in aurora"]

Updated

6 years ago
Whiteboard: [warning added in aurora, "fixed in aurora"] → [warning landed on aurora]
Depends on: 669438

Updated

6 years ago
Depends on: 670086

Comment 18

6 years ago
going to track this for potential fallout similar to what we saw at bug 670086
tracking-firefox7: --- → +

Updated

6 years ago
Depends on: 682679

Comment 19

6 years ago
Can anyone please help me with a test case, STR or some guidelines that I can use to verify this fix?

Thank you
If you get hold of a File object, using for example <input type=file> and getting .files[0], then the File object should *not* have any of the following properties or functions:

.fileName
.fileSize
.getAsText()
.getAsDataURL()
.getAsBinary()

Comment 21

6 years ago
Created attachment 556771 [details]
test case

test case used to verify the bug/fix

Comment 22

6 years ago
Verified fixed on:
Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (Windows NT 5.1; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0) Gecko/20100101 Firefox/7.0

Steps used to verify the fix:
 1. Open the test case from comment #21.
 2. Upload a file.
 3. Tap on the Display Properties button.
The Name and Size properties are displayed as "undefined". The .getAsText(), .getAsDataURL() and .getAsBinary() functions don't return anything.
 
(I verified the test case on FF6 and all the properties were displayed).
Status: RESOLVED → VERIFIED

Updated

6 years ago
Attachment #556771 - Attachment is obsolete: true

Comment 23

6 years ago
Created attachment 557462 [details]
test case used to verify the bug/fix
You need to log in before you can comment on or make changes to this bug.