Closed Bug 88550 Opened 23 years ago Closed 23 years ago

javascript strict warnings in password.js

Categories

(Core Graveyard :: Security: UI, defect, P2)

1.0 Branch
defect

Tracking

(Not tracked)

VERIFIED FIXED
psm2.1

People

(Reporter: bugzilla, Assigned: inactive-mailbox)

Details

Attachments

(1 file)

Warning: reference to undefined property window.arguments
Source File: chrome://pippki/content/password.js
Line: 38

Please add the following line to your prefs.js file, so we could avoid all the 
strict warning fixup...:
user_pref("javascript.options.strict", true);
p2
t->2.1
v->2.0
Priority: -- → P2
Target Milestone: --- → 2.1
Version: 1.01 → 2.0
I assume the the author wanted to check whether object "window" has a property
named "arguments". I'm not a JavaScript expert, and couldn't find a
documentation on how to do it, but in many places spread all over the Mozilla
JavaScript sources, the
    if ("property" in object)
notation is used, and changing the code this way makes the warning message go
away. Therefore I'm suggesting the attached patch to fix the problem.
Keywords: patch, review
David, please review.
r=ddrinan.
I'm not sure that one is correct.  Isn't that just supposed to be an empty array?
My understanding is, it is not guaranteed that "window" will have a property
"arguments". It could have one, but only if previous code during runtime added
this property to the current window instance.

I searched the existing sources and found some other occurences of similar code:

./xpfe/browser/resources/content/fastnav.js:  if ("arguments" in window &&
window.arguments.length > 1 && window.arguments[1]) {
./xpfe/browser/resources/content/fastnav.js:      if ("arguments" in window &&
window.arguments.length >= 1 && window.arguments[0])
./xpfe/browser/resources/content/fastnav.js:    if ("arguments" in window &&
window.arguments.length >= 3 && window.arguments[2] ==
true)./xpfe/browser/resources/content/navigator.js:  if ("arguments" in window
&& window.arguments.length > 1 && window.arguments[1]) {
./xpfe/browser/resources/content/navigator.js:    if ("arguments" in window &&
window.arguments.length >= 1 && window.arguments[0])
./xpfe/browser/resources/content/navigator.js:    if ("arguments" in window &&
window.arguments.length >= 3 && window.arguments[2] == true)
./xpfe/browser/resources/content/pageInfo.js:  if ("arguments" in window) {
./xpfe/browser/resources/content/viewsource.js:    if ("arguments" in window &&
window.arguments.length >= 2) {
./xpfe/components/bookmarks/resources/addBookmark.js:  if ("arguments" in
window) {
./xpfe/components/bookmarks/resources/bookmarks.js:  if ("arguments" in window
&& window.arguments[0]) {
./xpfe/components/history/resources/history.js:    if ("arguments" in window &&
window.arguments[0] && window.arguments.length >= 1) {
./xpfe/components/prefwindow/resources/content/pref-applications-new.js:  if (
"arguments" in window && window.arguments[0] ) {
./xpfe/components/prefwindow/resources/content/pref-applications-new.js:  if (
"arguments" in window && window.arguments[0] ) {
./xpfe/components/prefwindow/resources/content/pref-charset.js:  if ("arguments"
in window && window.arguments[0])
./xpfe/components/prefwindow/resources/content/pref-languages.js:  if
(!("arguments" in window)) {
./mailnews/addrbook/resources/content/abAddressBookNameDialog.js:	if
("arguments" in window && window.arguments[0])
./mailnews/addrbook/resources/content/abCardOverlay.js:  if ("arguments" in
window && window.arguments[0])
./mailnews/base/resources/content/msgMail3PaneWindow.js:  if ("arguments" in
window && window.arguments[0])
./mailnews/base/search/resources/content/FilterEditor.js:    if ("arguments" in
window && window.arguments[0]) {
./mailnews/news/resources/content/downloadheaders.js:    if ("arguments" in
window && window.arguments[0]) {

This looks like we could deduce this code is correct. It is used to execute code
accesing the property "arguments" only if the above code succeeds.

Do you agree, or do you suggest we should find a JavaScript expert who could
tell whether the code is correct? Do you know someone we could ask?
No, that's fine.  sr=blizzard
who's up for a checkin?
-> Kai
Assignee: ssaux → kai.engert
Status: NEW → ASSIGNED
adding nsenterprise to all P1, P2 PSM bugs with target milestone of 2.1
Keywords: nsenterprise
I'll say again: just needs checkin...
Keywords: nsenterprise, review
Mass assigning QA to ckritzer.
QA Contact: junruh → ckritzer
Checked in patch for Kai.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
keywords->verifyme
Keywords: patchverifyme
Verified.
Status: RESOLVED → VERIFIED
Product: PSM → Core
Version: psm2.0 → 1.0 Branch
Keywords: verifyme
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: