Closed Bug 973905 Opened 6 years ago Closed 6 years ago

window.setTimeout/setInterval string as parameter 1 no longer works if caller also tries to pass function arguments to the nonexistent function

Categories

(Core :: DOM: Core & HTML, defect)

27 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla30
Tracking Status
firefox27 --- wontfix
firefox28 --- fixed
firefox29 --- fixed
firefox30 --- fixed
firefox-esr24 --- unaffected
b2g-v1.3 --- fixed
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed

People

(Reporter: tomhartland, Assigned: bzbarsky)

References

Details

(Keywords: regression, site-compat, Whiteboard: [qa-])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 (Beta/Release)
Build ID: 20140212131424

Steps to reproduce:

<html>
<head>
  <script type="text/javascript">
    window.setTimeout("alert('hello world');", 100, "javascript");
  </script>
</head>
</html>


Actual results:

Error occurs: "Argument 1 of Window.setTimeout is not an object."


Expected results:

The script should be evaluated and executed as normal.

At some point in the distant past, I must have been told that the 3rd parameter had to be "javascript"... I have absolutely no idea why, or for what reason, but obviously this is not the case.

Unfortunately I have a LOT of legacy code that uses this format, and now it breaks as of v27.  I am not in a position to update to update all the systems.
Regression window:
Good:
http://hg.mozilla.org/integration/mozilla-inbound/rev/5717dfc80960
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 ID:20131026184508
Bad:
http://hg.mozilla.org/integration/mozilla-inbound/rev/508288a2b62c
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 ID:20131027021707
Pushlog:
http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=5717dfc80960&tochange=508288a2b62c
Regressed by:
508288a2b62c	Peter Van der Beken — Bug 918345 - Turn on WebIDL binding generation for Window and hook it up to quickstubs. r=bz.
Blocks: 918345
Status: UNCONFIRMED → NEW
Component: Untriaged → DOM
Ever confirmed: true
Keywords: regression
Product: Firefox → Core
Hm, looks like the WebIDL only allows additional arguments in the Function case:

http://dxr.mozilla.org/mozilla-central/source/dom/webidl/Window.webidl?from=Window.webidl#90

Boris, is there a reason for that? It doesn't match the spec, at least.
Flags: needinfo?(bzbarsky)
That looks like a bug in our IDL, yes.
Assignee: nobody → bzbarsky
Flags: needinfo?(bzbarsky)
Summary: window.setTimeout/setInterval string as parameter 1 no longer works → window.setTimeout/setInterval string as parameter 1 no longer works if caller also tries to pass function arguments to the nonexistent function
Whiteboard: [need review]
Attachment #8378099 - Flags: review?(bugs) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/b54f72ef2d35
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla30
Comment on attachment 8378099 [details] [diff] [review]
setTimeout/setInterval with a string first arg but more than two arguments should still work (and ignore the extra arguments).

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Bug 918345 
User impact if declined: Some web pages may not work right.
Testing completed (on m-c, etc.): Passes tests.
Risk to taking this patch (and alternatives if risky): I believe this is very low
   risk.
String or IDL/UUID changes made by this patch:  None.
Attachment #8378099 - Flags: approval-mozilla-beta?
Attachment #8378099 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/b54f72ef2d35
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Attachment #8378099 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #8378099 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Whiteboard: [qa-]
Keywords: site-compat
OS: Windows 7 → All
Hardware: x86_64 → All
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.