Closed Bug 499921 Opened 13 years ago Closed 13 years ago

add support for NPAPI NPN_ScheduleTimer/NPN_UnscheduleTimer

Categories

(Core :: Plug-ins, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jaas, Assigned: jaas)

References

Details

Attachments

(1 file, 2 obsolete files)

We should add support for NPAPI NPN_ScheduleTimer/NPN_UnscheduleTimer. This was originally specified as part of the Cocoa NPAPI event model but it not specific to the Cocoa event model.
Attached patch fix v1.0 (obsolete) — Splinter Review
Fully functional implementation with tests, but I think it leaks. More on that soon.
Attached patch fix v1.1 (obsolete) — Splinter Review
Fixes memory leaks.
Attachment #384818 - Attachment is obsolete: true
Attachment #384947 - Flags: review?(bent.mozilla)
Attachment #384947 - Flags: review?(jst) → superreview?(jst)
Comment on attachment 384947 [details] [diff] [review]
fix v1.1

- In timerTest():

+  id->timerID1 = NPN_ScheduleTimer(npp, 50, false, timerCallback);
+  id->timerID2 = NPN_ScheduleTimer(npp, 150, true, timerCallback);
+
+  NPObject* windowObject;
+  NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
+  if (!windowObject) {
+    NPN_UnscheduleTimer(npp, id->timerID1);
+    NPN_UnscheduleTimer(npp, id->timerID2);
+    return false;
+  }

If you call NPN_GetValue() before you schedule the timers here you don't need to worry about unscheduling if getting the window fails here.

r+sr=jst. But was this discussed on plugin-futures yet? I know apple shipped this w/o any discussion, but I really don't think we should put this in the tree before we at least announce these API changes.
Attachment #384947 - Flags: superreview?(jst)
Attachment #384947 - Flags: superreview+
Attachment #384947 - Flags: review?(bent.mozilla)
Attachment #384947 - Flags: review+
Attached patch fix v1.2Splinter Review
Updated to current trunk, addresses jst's comment, includes some header file cleanup.
Attachment #384947 - Attachment is obsolete: true
We should file a bug about pausing NPAPI timers when a window minimizes. I think WebKit does that.
pushed to mozilla-central

http://hg.mozilla.org/mozilla-central/rev/6135c784b458
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Filed bug 501702 about possibly pausing timers when windows minimize.
Depends on: 501889
You need to log in before you can comment on or make changes to this bug.