My favorites | Sign in
Project Home Issues Source
Repository:
Checkout   Browse   Changes   Clones    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
/**********************************************************\
Original Author: Richard Bateman (taxilian)

Created: Sept 24, 2009
License: Dual license model; choose one of two:
New BSD License
http://www.opensource.org/licenses/bsd-license.php
- or -
GNU Lesser General Public License, version 2.1
http://www.gnu.org/licenses/lgpl-2.1.html

Copyright 2009 Richard Bateman, Firebreath development team
\**********************************************************/

#pragma once
#ifndef H_FB_JSAPI
#define H_FB_JSAPI

#include "APITypes.h"
#include <list>
#include <deque>
#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp>
#include "JSExceptions.h"
#include "boost/thread/recursive_mutex.hpp"
#include "boost/thread/mutex.hpp"

namespace FB
{
class JSObject;
class BrowserHost;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @class JSAPI
///
/// @brief JavaScript API class -- provides a javascript interface that can be exposed to the
/// browser.
///
/// JSAPI is the core class for all interaction with javascript. All PluginCore-derived Plugin
/// objects must provide a JSAPI object to provide the javascript interface for their &lt;object&gt;
/// tag, and methods or properties of that object can return other JSAPI objects.
///
/// Important things to know about JSAPI objects:
/// - Unless you have unusual needs, you will most likely want to extend FB::JSAPIAuto instead
/// of extending JSAPI directly.
/// - Any time you work with a JSAPI object you should use it with a boost::shared_ptr.
/// FB::JSAPIPtr is a typedef for a boost::shared_ptr<JSAPI> which may be useful.
/// - From inside the object you can use the shared_from_this() method to get a shared_ptr for
/// "this"
/// - Objects passed in from javascript, including functions, will be passed in as FB::JSObject
/// objects which extend JSAPI.
///
/// @author Richard Bateman
/// @see FB::JSAPIAuto
////////////////////////////////////////////////////////////////////////////////////////////////////
class JSAPI : public boost::enable_shared_from_this<JSAPI>, boost::noncopyable
{
public:

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn JSAPI(void)
///
/// @brief Default constructor.
////////////////////////////////////////////////////////////////////////////////////////////////////
JSAPI(void) {}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual ~JSAPI(void)
///
/// @brief Finaliser.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual ~JSAPI(void) {}

public:

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn void invalidate()
///
/// @brief Invalidates this object.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void invalidate() = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn void shutdown()
///
/// @brief Called to notify the object that the plugin is shutting down
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void shutdown() {}

public:
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public void FB::JSAPI::pushZone(const SecurityZone& securityLevel)
///
/// @brief Pushes a new security level and locks a mutex (for every Push there *must* be a Pop!)
///
/// This should be used to temporarily set the security zone of the API object. Note that this
/// also locks a mutex to ensure that access to members under a non-default security level is
/// serialized. Do not *ever* leave an unmatched push (a push with no pop after it). For safety,
/// use the helper FB::scoped_zonelock:
/// @code
/// // In the constructor
/// // Register protected members
/// {
/// FB::scoped_zonelock _l(this, SecurityScope_Protected);
/// registerMethod("start", make_method(this, &MyPluginAPI::start));
/// } // Zone automatically popped off
/// // Register private members
/// {
/// FB::scoped_zonelock _l(this, SecurityScope_Protected);
/// registerMethod("getDirectoryListing", make_method(this, &MyPluginAPI::getDirectoryListing));
/// } // Zone automatically popped off
/// @endcode
///
/// @param securityLevel const SecurityZone & Zone id to push on the stack
/// @since 1.4a3
/// @see FB::scoped_zonelock
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void pushZone(const SecurityZone& securityLevel) { }

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public void FB::JSAPI::popZone()
///
/// @brief Pops off a security level and unlocks the mutex (for every Push there *must* be a Pop!)
///
/// Seriously, it's far better to use FB::scoped_zonelock instead of using popZone and pushZone
///
/// @returns void
/// @since 1.4a3
/// @see FB::scoped_zonelock
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void popZone() { }

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public void setDefaultZone(const SecurityZone& securityLevel)
///
/// @brief Sets the default zone (the zone the class operates on before a push)
///
/// @returns void
/// @since 1.4a3
/// @see FB::scoped_zonelock
/// @see pushZone
/// @see popZone
/// @see getDefaultZone
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void setDefaultZone(const SecurityZone& securityLevel) { }

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public virtual SecurityZone getDefaultZone() const
///
/// @brief Gets the default zone (the zone the class operates on before a push)
///
/// @returns SecurityZone the default zone
/// @since 1.4a3
/// @see FB::scoped_zonelock
/// @see pushZone
/// @see popZone
/// @see getDefaultZone
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual SecurityZone getDefaultZone() const { return SecurityScope_Public; }

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public SecurityZone getZone() const
///
/// @brief Gets the currently active zone
///
/// @returns SecurityZone the current zone
/// @since 1.4a3
/// @see FB::scoped_zonelock
/// @see pushZone
/// @see popZone
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual SecurityZone getZone() const { return SecurityScope_Public; }

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void registerEventMethod(const std::string& name, JSObjectPtr& event)
///
/// @brief Called by the browser to register an event handler method
///
/// @param name The name.
/// @param event The event handler method.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void registerEventMethod(const std::string& name, JSObjectPtr& event)
{
// TODO: add support for this in IDispatchAPI and NPObjectAPI
throw FB::script_error("Not implemented");
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual void registerEventMethod(const std::wstring& name, JSObjectPtr& event)
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void registerEventMethod(const std::wstring& name, JSObjectPtr& event)
{
registerEventMethod(wstring_to_utf8(name), event);
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void unregisterEventMethod(const std::string& name, JSObjectPtr& event)
///
/// @brief Called by the browser to unregister an event handler method
///
/// @param name The name.
/// @param event The event handler method to unregister.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void unregisterEventMethod(const std::string& name, JSObjectPtr& event)
{
// TODO: add support for this in IDispatchAPI and NPObjectAPI
throw FB::script_error("Not implemented");
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual void unregisterEventMethod(const std::wstring& name, JSObjectPtr& event)
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void unregisterEventMethod(const std::wstring& name, JSObjectPtr& event)
{
unregisterEventMethod(wstring_to_utf8(name), event);
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void registerEventInterface(const JSObjectPtr& event)
///
/// @brief Called by the browser to register a JSObject interface that handles events. This is
/// primarily used by IE. Objects provided to this method are called when events are fired
/// by calling a method of the event name on the event interface
///
/// @param event The JSAPI interface
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void registerEventInterface(const JSObjectPtr& event)
{
// TODO: add support for this in IDispatchAPI and NPObjectAPI
throw FB::script_error("Not implemented");
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void unregisterEventInterface(const JSObjectPtr& event)
///
/// @brief Called by the browser to unregister a JSObject interface that handles events.
///
/// @param event The JSAPI interface
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void unregisterEventInterface(const JSObjectPtr& event)
{
// TODO: add support for this in IDispatchAPI and NPObjectAPI
throw FB::script_error("Not implemented");
}

virtual void getMemberNames(std::vector<std::wstring> &nameVector) const
{
nameVector.clear();
std::vector<std::string> utf8Vector;
getMemberNames(utf8Vector);
for (std::vector<std::string>::const_iterator it = utf8Vector.begin();
it != utf8Vector.end(); ++it) {
std::wstring wStrVal(utf8_to_wstring(*it));
nameVector.push_back(wStrVal);
}
}

virtual void getMemberNames(std::vector<std::wstring> *nameVector) const
{
getMemberNames(*nameVector);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void getMemberNames(std::vector<std::string> &nameVector) const = 0
///
/// @brief Called by the browser to enumerate the members of this JSAPI object
///
/// This must be implemented by anything extending JSAPI directly. JSAPIAuto implements this
/// for you.
///
/// @param [out] nameVector The name vector.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void getMemberNames(std::vector<std::string> &nameVector) const = 0;
virtual void getMemberNames(std::vector<std::string> *nameVector) const
{
getMemberNames(*nameVector);
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual size_t getMemberCount() const = 0
///
/// @brief Gets the member count.
///
/// @return The member count.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual size_t getMemberCount() const = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual bool HasMethod(const std::wstring& methodName) const
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual bool HasMethod(const std::wstring& methodName) const
{
return HasMethod(wstring_to_utf8(methodName));
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual bool HasMethod(const std::string& methodName) const = 0
///
/// @brief Query if the JSAPI object has the 'methodName' method.
///
/// @param methodName Name of the method.
///
/// @return true if method exists, false if not.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual bool HasMethod(const std::string& methodName) const = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual bool HasMethodObject(const std::wstring& methodObjName) const
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual bool HasMethodObject(const std::wstring& methodObjName) const
{
return HasMethodObject(wstring_to_utf8(methodObjName));
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual bool HasMethodObject(const std::string& methodObjName) const
///
/// @brief Query if 'methodObjName' is a valid methodObj.
///
/// @param methodObjName Name of the method to fetch an object for.
///
/// If this feature is supported
///
/// @return true if methodObj exists, false if not.
/// @since 1.4
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual bool HasMethodObject(const std::string& methodObjName) const { return false; }

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual bool HasProperty(const std::wstring& propertyName) const
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual bool HasProperty(const std::wstring& propertyName) const
{
return HasProperty(wstring_to_utf8(propertyName));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual bool HasProperty(const std::string& propertyName) const
///
/// @brief Query if 'propertyName' is a valid property.
///
/// @param propertyName Name of the property.
///
/// @return true if property exists, false if not.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual bool HasProperty(const std::string& propertyName) const = 0;
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual bool HasProperty(int idx) const = 0
///
/// @brief Query if the property at "idx" exists.
///
/// This can be used for providing array-style access on your object. For example, the following
/// will result in a call to HasProperty with idx = 12:
/// @code
/// document.getElementById("plugin")[12];
/// @endcode
///
/// @param idx Zero-based index of the property to check for
///
/// @return true if property exists, false if not.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual bool HasProperty(int idx) const = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual JSAPIPtr GetMethodObject(const std::wstring& methodObjName)
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual JSAPIPtr GetMethodObject(const std::wstring& methodObjName)
{
return GetMethodObject(FB::wstring_to_utf8(methodObjName));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual variant GetMethodObject(const std::string& methodObjName) = 0
///
/// @brief Gets a method object (JSAPI object that has a default method)
///
/// Often it is preferable with the plugins to have the API return a JSAPI object as a
/// property and then call the default method on that object. This looks the same in
/// javascript, except that you can save the function object if you want to. See
/// FB::JSFunction for an example of how to make a function object
///
/// @param methodObjName Name of the methodObj.
/// @return The methodObj value
/// @since 1.4
/// @see FB::JSFunction
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual JSAPIPtr GetMethodObject(const std::string& methodObjName) { return FB::JSAPIPtr(); }

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual variant GetProperty(const std::wstring& propertyName)
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual variant GetProperty(const std::wstring& propertyName)
{
return GetProperty(wstring_to_utf8(propertyName));
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual variant GetProperty(const std::string& propertyName) = 0
///
/// @brief Gets a property value
///
/// @param propertyName Name of the property.
///
/// @return The property value
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual variant GetProperty(const std::string& propertyName) = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual void SetProperty(const std::wstring& propertyName, const variant& value)
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void SetProperty(const std::wstring& propertyName, const variant& value)
{
SetProperty(wstring_to_utf8(propertyName), value);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void SetProperty(const std::string& propertyName, const variant& value) = 0
///
/// @brief Sets the value of a property.
///
/// @param propertyName Name of the property.
/// @param value The value.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void SetProperty(const std::string& propertyName, const variant& value) = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual variant GetProperty(int idx) = 0
///
/// @brief Gets the value of an indexed property.
///
/// This can be used for providing array-style access on your object. For example, the following
/// will result in a call to GetProperty with idx = 12:
/// @code
/// var i = document.getElementById("plugin")[12];
/// @endcode
///
/// @param idx Zero-based index of the property to get the value of.
///
/// @return The property value.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual variant GetProperty(int idx) = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void SetProperty(int idx, const variant& value) = 0
///
/// @brief Sets the value of an indexed property.
///
/// This can be used for providing array-style access on your object. For example, the following
/// will result in a call to SetProperty with idx = 12:
/// @code
/// document.getElementById("plugin")[12] = "property value";
/// @endcode
///
/// @param idx Zero-based index of the property to set the value of.
/// @param value The new property value.
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void SetProperty(int idx, const variant& value) = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual variant RemoveProperty(const std::wstring& propertyName)
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void RemoveProperty(const std::wstring& propertyName)
{
return RemoveProperty(wstring_to_utf8(propertyName));
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual variant RemoveProperty(const std::string& propertyName) = 0
///
/// @brief Removes a property
///
/// @param propertyName Name of the property.
/// @since 1.5
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void RemoveProperty(const std::string& propertyName) = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual variant RemoveProperty(int idx) = 0
///
/// @brief Removes an indexed property.
///
/// This can be used for providing array-style access on your object. For example, the following
/// will result in a call to RemoveProperty with idx = 12:
/// @code
/// delete document.getElementById("plugin")[12];
/// @endcode
///
/// @param idx Zero-based index of the property to remove
/// @since 1.5
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void RemoveProperty(int idx) = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @overload virtual variant Invoke(const std::wstring& methodName, const std::vector<variant>& args)
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual variant Invoke(const std::wstring& methodName, const std::vector<variant>& args)
{
return Invoke(wstring_to_utf8(methodName), args);
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual variant Invoke(const std::string& methodName,
/// const std::vector<variant>& args) = 0
///
/// @brief Called by the browser to invoke a method on the JSAPI object.
///
/// @param methodName Name of the method.
/// @param args The arguments.
///
/// @return result of method call
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual variant Invoke(const std::string& methodName, const std::vector<variant>& args) = 0;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual variant Construct(const std::vector<variant>& args) = 0
///
/// @brief Called by the browser to construct the JSAPI object.
/// @code
/// var x = new MyJSAPIObject();
/// @endcode
///
/// @param args The arguments.
///
/// @return result of constructor call, the new object
/// @since 1.5
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual variant Construct(const std::vector<variant>& args) = 0;
};

////////////////////////////////////////////////////////////////////////////////////////////////////
/// @class scoped_zonelock
///
/// @brief Provides a helper class for locking
///
/// This class will call pushZone on the provided JSAPI object when instantiated and popZone
/// when it goes out of scope.
/// @code
/// // In the constructor
/// // Register protected members
/// {
/// FB::scoped_zonelock _l(this, SecurityScope_Protected);
/// registerMethod("start", make_method(this, &MyPluginAPI::start));
/// } // Zone automatically popped off
/// // Register private members
/// {
/// FB::scoped_zonelock _l(this, SecurityScope_Protected);
/// registerMethod("getDirectoryListing", make_method(this, &MyPluginAPI::getDirectoryListing));
/// } // Zone automatically popped off
/// @endcode
///
/// @since 1.4a3
/// @see FB::JSAPI::pushZone
/// @see FB::JSAPI::popZone
////////////////////////////////////////////////////////////////////////////////////////////////////
class scoped_zonelock : boost::noncopyable
{
public:
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public FB::scoped_zonelock::scoped_zonelock(const JSAPIPtr &api, const SecurityZone& zone)
///
/// @brief Accepts a FB::JSAPIPtr and pushes the specified security zone to be used
/// until this object goes out of scope
///
/// @param api const JSAPIPtr& JSAPI object to lock the zone for
/// @param zone const SecurityZone& Zone to push
/// @since 1.4a3
////////////////////////////////////////////////////////////////////////////////////////////////////
scoped_zonelock(const JSAPIPtr &api, const SecurityZone& zone)
: m_api(api.get()), ref(api) {
lock(zone);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public FB::scoped_zonelock::scoped_zonelock(JSAPI* api, const SecurityZone& zone)
///
/// @brief
///
/// @param api JSAPI* JSAPI object to lock the zone for
/// @param zone const SecurityZone& Zone to push
/// @since 1.4a3
////////////////////////////////////////////////////////////////////////////////////////////////////
scoped_zonelock(JSAPI* api, const SecurityZone& zone) : m_api(api) {
lock(zone);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public FB::scoped_zonelock::~scoped_zonelock()
///
/// @brief Unlocks/pops the zone
/// @since 1.4a3
////////////////////////////////////////////////////////////////////////////////////////////////////
~scoped_zonelock() {
if (m_api)
m_api->popZone();
}
private:
void lock(const SecurityZone& zone) const {
if (m_api)
m_api->pushZone(zone);
}
JSAPI* m_api;
const FB::JSAPIPtr ref;
};
};

// There are important conversion routines that require JSObject and JSAPI to both be loaded
#include "JSObject.h"
#endif

Change log

295ae35636a4 by Richard Bateman <taxilian> on Jul 30, 2011   Diff
FIREBREATH-92: add shutdown method to
JSAPI class to notify of browser shutdown
Go to: 

Older revisions

e7166653a48d by Richard Bateman <taxil...@fb.com> on Apr 8, 2011   Diff
FIREBREATH-18 Refactored JSAPI events,
added easy function macro

A side-effect of this change
completely changed how handler-as-
...
1ff71a4ede76 by Richard Bateman <taxilian> on Apr 8, 2011   Diff
FIREBREATH-32 Refactored JSAPI to
create JSAPIImpl
8a387d1cb674 by Richard Bateman <taxilian> on Apr 8, 2011   Diff
FIREBREATH-31 changed shared_ptr()
calls to shared_from_this()
All revisions of this file

File info

Size: 30556 bytes, 600 lines
Powered by Google Project Hosting