Closed Bug 203248 Opened 22 years ago Closed 7 years ago

redeclaration of variables and functions not warned against in separate <SCRIPT> elements

Categories

(Core :: JavaScript Engine, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: coscatmu, Unassigned)

Details

Attachments

(2 files, 2 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030424 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030424 When you have scripts in separate <SCRIPTS> elements, the JavaScript console does not pick up on redeclared functions or variables. This can cause problems if you are gluing scripts together (e.g., navbar and calendar) and the vendors have duplicated functions or global variables. Strange behavior is to be expected on the page. The following code, when run against strict javascript warnings will not generate warnings in the console and I feel that they should because expected behavior may not occur: <html> <head> <title>Testing JavaScript conflicts <script type="text/javascript"> var ns4="1st"; function func() { document.write("func1"); } </script> <script type="text/javascript"> var ns4="2nd"; function func() { document.write("func2"); } </script> <script type="text/javascript"> document.write(ns4); //ambiguous variable func(); // Ambiguous function call </script> </head> </html> Reproducible: Always Steps to Reproduce: 1. Create a file of sample page in description. 2. Enable JavaScript strict in a debug build via Edit | Preferences | Debug 3. Load the page in the browser. Actual Results: No warnings are generated. Expected Results: Warnings about the namespace conflict for the variables and functions should be sent to the JavaScript console.
Reassigning to JavaScript Engine for consideration. This is an interesting question!!! If we put all the code inside a single <script> block, we get the requisite JS warnings. But as Steve points out, no warnings from separate <script> blocks -
Assignee: nboyd → khanson
Component: Core → JavaScript Engine
OS: Windows 2000 → All
Product: Rhino → Browser
Version: other → Trunk
Is this bug still valid? I think the redeclaration warning was removed not too long ago.
Assignee: khanson → general
QA Contact: pschwartau → general
Attached file single <script> block
Still valid for redeclarations of functions. New test-cases attached because the old ones didn't run because of the missing </title>.
Attachment #121591 - Attachment is obsolete: true
Attachment #121592 - Attachment is obsolete: true
Assignee: general → nobody
Redeclaration warnings were removed in bug 291868, therefore resolving as WONTFIX.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: