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
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
|
// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2000 Harri Porten ([email protected])
* Copyright (c) 2000 Daniel Molkentin ([email protected])
* Copyright (c) 2000 Stefan Schimanski ([email protected])
* Copyright (C) 2003 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <klocale.h>
#include <kstandarddirs.h>
#include <tdeconfig.h>
#include <kdebug.h>
#include <tdeio/kprotocolmanager.h>
#include <tdeio/kmimetype.h>
#include <tdeio/kservice.h>
#include <tdeio/ktrader.h>
#include "kjs_navigator.h"
#include "kjs/lookup.h"
#include "kjs_binding.h"
#include "tdehtml_part.h"
#include <sys/utsname.h>
#include "kjs_navigator.lut.h"
using namespace KJS;
namespace KJS {
// All objects that need plugin info must inherit from PluginBase
// Its ctor and dtor take care of the refcounting on the static lists.
class PluginBase : public ObjectImp {
public:
PluginBase(ExecState *exec, bool loadPluginInfo);
virtual ~PluginBase();
struct MimeClassInfo;
struct PluginInfo;
struct MimeClassInfo {
TQString type;
TQString desc;
TQString suffixes;
PluginInfo *plugin;
};
struct PluginInfo {
TQString name;
TQString file;
TQString desc;
TQPtrList<MimeClassInfo> mimes;
};
static TQPtrList<PluginInfo> *plugins;
static TQPtrList<MimeClassInfo> *mimes;
private:
static int m_refCount;
};
class Plugins : public PluginBase {
public:
Plugins(ExecState *exec, bool pluginsEnabled)
: PluginBase(exec, pluginsEnabled),
m_pluginsEnabled(pluginsEnabled) {};
virtual Value get(ExecState *exec, const Identifier &propertyName) const;
Value getValueProperty(ExecState *exec, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
Value pluginByName( ExecState* exec, const TQString& name ) const;
bool pluginsEnabled() const { return m_pluginsEnabled; };
private:
bool m_pluginsEnabled;
};
class MimeTypes : public PluginBase {
public:
MimeTypes(ExecState *exec, bool pluginsEnabled)
: PluginBase(exec, pluginsEnabled),
m_pluginsEnabled(pluginsEnabled) {};
virtual Value get(ExecState *exec, const Identifier &propertyName) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
Value getValueProperty(ExecState *exec, int token) const;
Value mimeTypeByName( ExecState* exec, const TQString& name ) const;
bool pluginsEnabled() const { return m_pluginsEnabled; };
private:
bool m_pluginsEnabled;
};
class Plugin : public PluginBase {
public:
Plugin( ExecState *exec, PluginBase::PluginInfo *info )
: PluginBase( exec, true )
{ m_info = info; };
virtual Value get(ExecState *exec, const Identifier &propertyName) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
Value mimeByName(ExecState* exec, const TQString& name ) const;
Value getValueProperty(ExecState *exec, int token) const;
PluginBase::PluginInfo *pluginInfo() const { return m_info; }
private:
PluginBase::PluginInfo *m_info;
};
class MimeType : public PluginBase {
public:
MimeType( ExecState *exec, PluginBase::MimeClassInfo *info )
: PluginBase( exec, true )
{ m_info = info; };
virtual Value get(ExecState *exec, const Identifier &propertyName) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
Value getValueProperty(ExecState *exec, int token) const;
private:
PluginBase::MimeClassInfo *m_info;
};
}
TQPtrList<PluginBase::PluginInfo> *KJS::PluginBase::plugins = 0;
TQPtrList<PluginBase::MimeClassInfo> *KJS::PluginBase::mimes = 0;
int KJS::PluginBase::m_refCount = 0;
const ClassInfo Navigator::info = { "Navigator", 0, &NavigatorTable, 0 };
/*
@begin NavigatorTable 12
appCodeName Navigator::AppCodeName DontDelete|ReadOnly
appName Navigator::AppName DontDelete|ReadOnly
appVersion Navigator::AppVersion DontDelete|ReadOnly
language Navigator::Language DontDelete|ReadOnly
userAgent Navigator::UserAgent DontDelete|ReadOnly
userLanguage Navigator::UserLanguage DontDelete|ReadOnly
browserLanguage Navigator::BrowserLanguage DontDelete|ReadOnly
platform Navigator::Platform DontDelete|ReadOnly
cpuClass Navigator::CpuClass DontDelete|ReadOnly
plugins Navigator::_Plugins DontDelete|ReadOnly
mimeTypes Navigator::_MimeTypes DontDelete|ReadOnly
product Navigator::Product DontDelete|ReadOnly
vendor Navigator::Vendor DontDelete|ReadOnly
productSub Navigator::ProductSub DontDelete|ReadOnly
cookieEnabled Navigator::CookieEnabled DontDelete|ReadOnly
javaEnabled Navigator::JavaEnabled DontDelete|Function 0
@end
*/
IMPLEMENT_PROTOFUNC_DOM(NavigatorFunc)
Navigator::Navigator(ExecState *exec, KHTMLPart *p)
: ObjectImp(exec->interpreter()->builtinObjectPrototype()), m_part(p) { }
Value Navigator::get(ExecState *exec, const Identifier &propertyName) const
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "Navigator::get " << propertyName.ascii() << endl;
#endif
return lookupGet<NavigatorFunc,Navigator,ObjectImp>(exec,propertyName,&NavigatorTable,this);
}
Value Navigator::getValueProperty(ExecState *exec, int token) const
{
KURL url = m_part->url();
TQString userAgent = url.host();
if (userAgent.isEmpty())
userAgent = "localhost";
userAgent = KProtocolManager::userAgentForHost(userAgent);
switch (token) {
case AppCodeName:
return String("Mozilla");
case AppName:
// If we find "Mozilla" but not "(compatible, ...)" we are a real Netscape
if (userAgent.find(TQString::fromLatin1("Mozilla")) >= 0 &&
userAgent.find(TQString::fromLatin1("compatible")) == -1)
{
//kdDebug() << "appName -> Mozilla" << endl;
return String("Netscape");
}
if (userAgent.find(TQString::fromLatin1("Microsoft")) >= 0 ||
userAgent.find(TQString::fromLatin1("MSIE")) >= 0)
{
//kdDebug() << "appName -> IE" << endl;
return String("Microsoft Internet Explorer");
}
//kdDebug() << "appName -> Konqueror" << endl;
return String("Konqueror");
case AppVersion:
// We assume the string is something like Mozilla/version (properties)
return String(userAgent.mid(userAgent.find('/') + 1));
case Product:
// We are pretending to be Mozilla or Safari
if (userAgent.find(TQString::fromLatin1("Mozilla")) >= 0 &&
userAgent.find(TQString::fromLatin1("compatible")) == -1)
{
return String("Gecko");
}
// When spoofing as IE, we use Undefined().
if (userAgent.find(TQString::fromLatin1("Microsoft")) >= 0 ||
userAgent.find(TQString::fromLatin1("MSIE")) >= 0)
{
return Undefined();
}
// We are acting straight
return String("Konqueror/tdehtml");
case ProductSub:
{
int ix = userAgent.find("Gecko");
if (ix >= 0 && userAgent.length() >= (uint)ix+14 && userAgent.unicode()[ix+5] == TQChar('/') &&
userAgent.find(TQRegExp("\\d{8}"), ix+6) == ix+6)
{
// We have Gecko/<productSub> in the UA string
return String(userAgent.mid(ix+6, 8));
}
else if (ix >= 0)
{
return String("20040107");
}
}
return Undefined();
case Vendor:
return String("KDE");
case BrowserLanguage:
case Language:
case UserLanguage:
return String(TDEGlobal::locale()->language());
case UserAgent:
return String(userAgent);
case Platform:
// yet another evil hack, but necessary to spoof some sites...
if ( (userAgent.find(TQString::fromLatin1("Win"),0,false)>=0) )
return String(TQString::fromLatin1("Win32"));
else if ( (userAgent.find(TQString::fromLatin1("Macintosh"),0,false)>=0) ||
(userAgent.find(TQString::fromLatin1("Mac_PowerPC"),0,false)>=0) )
return String(TQString::fromLatin1("MacPPC"));
else
{
struct utsname name;
int ret = uname(&name);
if ( ret >= 0 )
return String(TQString(TQString::fromLatin1("%1 %1 X11").arg(name.sysname).arg(name.machine)));
else // can't happen
return String(TQString(TQString::fromLatin1("Unix X11")));
}
case CpuClass:
{
struct utsname name;
int ret = uname(&name);
if ( ret >= 0 )
return String(name.machine);
else // can't happen
return String("x86");
}
case _Plugins:
return Value(new Plugins(exec, m_part->pluginsEnabled()));
case _MimeTypes:
return Value(new MimeTypes(exec, m_part->pluginsEnabled()));
case CookieEnabled:
return Boolean(true); /// ##### FIXME
default:
kdDebug(6070) << "WARNING: Unhandled token in DOMEvent::getValueProperty : " << token << endl;
return Value();
}
}
/*******************************************************************/
PluginBase::PluginBase(ExecState *exec, bool loadPluginInfo)
: ObjectImp(exec->interpreter()->builtinObjectPrototype() )
{
if ( loadPluginInfo && !plugins ) {
plugins = new TQPtrList<PluginInfo>;
mimes = new TQPtrList<MimeClassInfo>;
plugins->setAutoDelete( true );
mimes->setAutoDelete( true );
// read in using KTrader
KTrader::OfferList offers = KTrader::self()->query("Browser/View");
KTrader::OfferList::iterator it;
for ( it = offers.begin(); it != offers.end(); ++it ) {
TQVariant pluginsinfo = (**it).property( "X-TDE-BrowserView-PluginsInfo" );
if ( !pluginsinfo.isValid() ) {
// <backwards compatible>
if ((**it).library() == TQString("libnsplugin"))
pluginsinfo = TQVariant("nsplugins/pluginsinfo");
else
// </backwards compatible>
continue;
}
// read configuration
TDEConfig kc( locate ("data", pluginsinfo.toString()) );
unsigned num = (unsigned int) kc.readNumEntry("number");
for ( unsigned n = 0; n < num; n++ ) {
kc.setGroup( TQString::number(n) );
PluginInfo *plugin = new PluginInfo;
plugin->name = kc.readEntry("name");
plugin->file = kc.readPathEntry("file");
plugin->desc = kc.readEntry("description");
plugins->append( plugin );
// get mime types from string
TQStringList types = TQStringList::split( ';', kc.readEntry("mime") );
TQStringList::Iterator type;
for ( type=types.begin(); type!=types.end(); ++type ) {
// get mime information
TQStringList tokens = TQStringList::split(':', *type, true);
if ( tokens.count() < 3 ) // we need 3 items
continue;
MimeClassInfo *mime = new MimeClassInfo;
TQStringList::Iterator token = tokens.begin();
mime->type = (*token).lower();
//kdDebug(6070) << "mime->type=" << mime->type << endl;
++token;
mime->suffixes = *token;
++token;
mime->desc = *token;
++token;
mime->plugin = plugin;
mimes->append( mime );
plugin->mimes.append( mime );
}
}
}
}
m_refCount++;
}
PluginBase::~PluginBase()
{
m_refCount--;
if ( m_refCount==0 ) {
delete plugins;
delete mimes;
plugins = 0;
mimes = 0;
}
}
/*******************************************************************/
const ClassInfo Plugins::info = { "PluginArray", 0, &PluginsTable, 0 };
/*
@begin PluginsTable 4
length Plugins_Length DontDelete|ReadOnly
refresh Plugins_Refresh DontDelete|Function 0
item Plugins_Item DontDelete|Function 1
namedItem Plugins_NamedItem DontDelete|Function 1
@end
*/
IMPLEMENT_PROTOFUNC_DOM(PluginsFunc)
Value Plugins::get(ExecState *exec, const Identifier &propertyName) const
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "Plugins::get " << propertyName.qstring() << endl;
#endif
if (!pluginsEnabled()) {
if (propertyName == lengthPropertyName )
return Number(0);
} else {
if ( propertyName == lengthPropertyName )
return Number(plugins->count());
// plugins[#]
bool ok;
unsigned int i = propertyName.toULong(&ok);
if( ok && i<plugins->count() )
return Value( new Plugin( exec, plugins->at(i) ) );
// plugin[name]
Value val = pluginByName( exec, propertyName.qstring() );
if (!val.isA(UndefinedType))
return val;
}
return lookupGet<PluginsFunc,Plugins,ObjectImp>(exec,propertyName,&PluginsTable,this);
}
Value Plugins::pluginByName( ExecState* exec, const TQString& name ) const
{
Q_ASSERT(plugins);
for ( PluginInfo *pl = plugins->first(); pl!=0; pl = plugins->next() ) {
if ( pl->name == name )
return Value( new Plugin( exec, pl ) );
}
return Undefined();
}
Value Plugins::getValueProperty(ExecState* /*exec*/, int token) const
{
kdDebug(6070) << "WARNING: Unhandled token in Plugins::getValueProperty : " << token << endl;
return Undefined();
}
Value PluginsFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
{
KJS_CHECK_THIS( KJS::Plugins, thisObj );
KJS::Plugins* base = static_cast<KJS::Plugins *>(thisObj.imp());
if (!base->pluginsEnabled()) {
if (id == Plugins_Refresh || //## TODO
id == Plugins_Item ||
id == Plugins_NamedItem)
return Undefined();
} else {
switch( id ) {
case Plugins_Refresh:
return Undefined(); //## TODO
case Plugins_Item:
{
bool ok;
unsigned int i = args[0].toString(exec).toArrayIndex(&ok);
if( ok && i<base->plugins->count() )
return Value( new Plugin( exec, base->plugins->at(i) ) );
return Undefined();
}
case Plugins_NamedItem:
UString s = args[0].toString(exec);
return base->pluginByName( exec, s.qstring() );
}
}
kdDebug(6070) << "WARNING: Unhandled token in PluginsFunc::tryCall : " << id << endl;
return Undefined();
}
/*******************************************************************/
const ClassInfo MimeTypes::info = { "MimeTypeArray", 0, &MimeTypesTable, 0 };
/*
@begin MimeTypesTable 3
length MimeTypes_Length DontDelete|ReadOnly
item MimeTypes_Item DontDelete|Function 1
namedItem MimeTypes_NamedItem DontDelete|Function 1
@end
*/
IMPLEMENT_PROTOFUNC_DOM(MimeTypesFunc)
Value MimeTypes::get(ExecState *exec, const Identifier &propertyName) const
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "MimeTypes::get " << propertyName.qstring() << endl;
#endif
if (!pluginsEnabled()) {
if (propertyName == lengthPropertyName )
return Number(0);
} else {
if( propertyName==lengthPropertyName )
return Number( mimes->count() );
// mimeTypes[#]
bool ok;
unsigned int i = propertyName.toULong(&ok);
if( ok && i<mimes->count() )
return Value( new MimeType( exec, mimes->at(i) ) );
// mimeTypes[name]
Value val = mimeTypeByName( exec, propertyName.qstring() );
if (!val.isA(UndefinedType))
return val;
}
return lookupGet<MimeTypesFunc,MimeTypes,ObjectImp>(exec,propertyName,&MimeTypesTable,this);
}
Value MimeTypes::mimeTypeByName( ExecState* exec, const TQString& name ) const
{
//kdDebug(6070) << "MimeTypes[" << name << "]" << endl;
Q_ASSERT(mimes);
for ( MimeClassInfo *m = mimes->first(); m!=0; m = mimes->next() ) {
if ( m->type == name )
return Value( new MimeType( exec, m ) );
}
return Undefined();
}
Value MimeTypes::getValueProperty(ExecState* /*exec*/, int token) const
{
kdDebug(6070) << "WARNING: Unhandled token in MimeTypes::getValueProperty : " << token << endl;
return Undefined();
}
Value MimeTypesFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
{
KJS_CHECK_THIS( KJS::MimeTypes, thisObj );
KJS::MimeTypes* base = static_cast<KJS::MimeTypes *>(thisObj.imp());
if (!base->pluginsEnabled()) {
if (id == MimeTypes_Item ||
id == MimeTypes_NamedItem)
return Undefined();
} else {
switch( id ) {
case MimeTypes_Item:
{
bool ok;
unsigned int i = args[0].toString(exec).toArrayIndex(&ok);
if( ok && i<base->mimes->count() )
return Value( new MimeType( exec, base->mimes->at(i) ) );
return Undefined();
}
case MimeTypes_NamedItem:
UString s = args[0].toString(exec);
return base->mimeTypeByName( exec, s.qstring() );
}
}
kdDebug(6070) << "WARNING: Unhandled token in MimeTypesFunc::tryCall : " << id << endl;
return Undefined();
}
/************************************************************************/
const ClassInfo Plugin::info = { "Plugin", 0, &PluginTable, 0 };
/*
@begin PluginTable 7
name Plugin_Name DontDelete|ReadOnly
filename Plugin_FileName DontDelete|ReadOnly
description Plugin_Description DontDelete|ReadOnly
length Plugin_Length DontDelete|ReadOnly
item Plugin_Item DontDelete|Function 1
namedItem Plugin_NamedItem DontDelete|Function 1
@end
*/
IMPLEMENT_PROTOFUNC_DOM(PluginFunc)
Value Plugin::get(ExecState *exec, const Identifier &propertyName) const
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "Plugin::get " << propertyName.qstring() << endl;
#endif
if ( propertyName == lengthPropertyName )
return Number( m_info->mimes.count() );
// plugin[#]
bool ok;
unsigned int i = propertyName.toULong(&ok);
//kdDebug(6070) << "Plugin::get plugin[" << i << "]" << endl;
if( ok && i<m_info->mimes.count() )
{
//kdDebug(6070) << "returning mimetype " << m_info->mimes.at(i)->type << endl;
return Value(new MimeType(exec, m_info->mimes.at(i)));
}
// plugin["name"]
Value val = mimeByName( exec, propertyName.qstring() );
if (!val.isA(UndefinedType))
return val;
return lookupGet<PluginFunc,Plugin,ObjectImp>(exec, propertyName, &PluginTable, this );
}
Value Plugin::mimeByName(ExecState* exec, const TQString& name) const
{
for ( PluginBase::MimeClassInfo *m = m_info->mimes.first();
m != 0; m = m_info->mimes.next() ) {
if ( m->type == name )
return Value(new MimeType(exec, m));
}
return Undefined();
}
Value Plugin::getValueProperty(ExecState* /*exec*/, int token) const
{
switch( token ) {
case Plugin_Name:
return String( m_info->name );
case Plugin_FileName:
return String( m_info->file );
case Plugin_Description:
return String( m_info->desc );
default:
kdDebug(6070) << "WARNING: Unhandled token in Plugin::getValueProperty : " << token << endl;
return Undefined();
}
}
Value PluginFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
{
KJS_CHECK_THIS( KJS::Plugin, thisObj );
KJS::Plugin* plugin = static_cast<KJS::Plugin *>(thisObj.imp());
switch( id ) {
case Plugin_Item:
{
bool ok;
unsigned int i = args[0].toString(exec).toArrayIndex(&ok);
if( ok && i< plugin->pluginInfo()->mimes.count() )
return Value( new MimeType( exec, plugin->pluginInfo()->mimes.at(i) ) );
return Undefined();
}
case Plugin_NamedItem:
{
UString s = args[0].toString(exec);
return plugin->mimeByName( exec, s.qstring() );
}
default:
kdDebug(6070) << "WARNING: Unhandled token in PluginFunc::tryCall : " << id << endl;
return Undefined();
}
}
/*****************************************************************************/
const ClassInfo MimeType::info = { "MimeType", 0, &MimeTypeTable, 0 };
/*
@begin MimeTypeTable 4
description MimeType_Description DontDelete|ReadOnly
enabledPlugin MimeType_EnabledPlugin DontDelete|ReadOnly
suffixes MimeType_Suffixes DontDelete|ReadOnly
type MimeType_Type DontDelete|ReadOnly
@end
*/
Value MimeType::get(ExecState *exec, const Identifier &propertyName) const
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "MimeType::get " << propertyName.qstring() << endl;
#endif
return lookupGetValue<MimeType,ObjectImp>(exec, propertyName, &MimeTypeTable, this );
}
Value MimeType::getValueProperty(ExecState* exec, int token) const
{
switch( token ) {
case MimeType_Type:
return String( m_info->type );
case MimeType_Suffixes:
return String( m_info->suffixes );
case MimeType_Description:
return String( m_info->desc );
case MimeType_EnabledPlugin:
return Value(new Plugin(exec, m_info->plugin));
default:
kdDebug(6070) << "WARNING: Unhandled token in MimeType::getValueProperty : " << token << endl;
return Undefined();
}
}
Value NavigatorFunc::tryCall(ExecState *exec, Object &thisObj, const List &)
{
KJS_CHECK_THIS( KJS::Navigator, thisObj );
Navigator *nav = static_cast<Navigator *>(thisObj.imp());
// javaEnabled()
return Boolean(nav->part()->javaEnabled());
}
|