Closed Bug 703195 Opened 13 years ago Closed 13 years ago

Don't throw warnings about octals in httpd module.

Categories

(Add-on SDK Graveyard :: General, defect, P2)

x86_64
Windows NT
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: KWierso, Assigned: KWierso)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch s/0444/PR_RDONLY/ (obsolete) — Splinter Review
Starting sometime today, I started seeing warnings like this being logged when I was using the httpd module:

console: [JavaScript Warning: "octal literals and octal escape sequences are deprecated" {file: "res
ource://0bc0a5b2-5d3b-49dc-876b-fb296081070a-at-jetpack-api-utils-lib/cuddlefish.js -> resource://0b
c0a5b2-5d3b-49dc-876b-fb296081070a-at-jetpack-api-utils-lib/httpd.js" line: 2566 column: 53 source:
"      var fis = new FileInputStream(file, PR_RDONLY, 0444,
"}]

I wasn't seeing this before some today, but I'm not really sure why I'm seeing them now.

This patch makes the warnings go away, but I'm not sure if it's the right thing to do.

Attaching it now and requesting review on it, but I'd like some confirmation that other people are seeing the warnings too on a recent pull from github master. My steps to reproduce are to run "cfx test --filter test-request" from the addon-kit folder.
Attachment #575097 - Flags: review?(myk)
(Also, PR_RDONLY is the same as 0444 permissions, right?)
Comment on attachment 575097 [details] [diff] [review]
s/0444/PR_RDONLY/

(In reply to Wes Kocher (:KWierso) (Jetpack Bugmaster) from comment #1)
> (Also, PR_RDONLY is the same as 0444 permissions, right?)

No, PR_RDONLY is 0x01 <http://mxr.mozilla.org/mozilla-central/source/nsprpub/pr/include/prio.h#616>.

FileInputStream creates an nsIFileInputStream and calls its `init` method <http://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIFileStreams.idl>, whose `perm` argument takes file mode bits as described in prio.h <http://mxr.mozilla.org/mozilla-central/source/nsprpub/pr/include/prio.h#626>.

We could convert these numbers to decimal (292) or hexadecimal (0x124), but they're most readable as octals, so let's use `parseInt` to represent them as such while avoiding the warning:

    parseInt("444", 8)
Attachment #575097 - Flags: review?(myk) → review-
So, like this?
Attachment #575097 - Attachment is obsolete: true
Attachment #576357 - Flags: review?(myk)
Comment on attachment 576357 [details] [diff] [review]
parseInt("444", 8)

Exactly.
Attachment #576357 - Flags: review?(myk) → review+
Commit pushed to https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/ad778b71bfd62ce2219d5d419d727aaa59ed2f0d
fix bug 703195 - httpd module tests throw warnings about octals - replace deprecated octal literals with parseInt(octal, 8) calls; r=myk
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Assignee: nobody → kwierso
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: