Skip to content
Permalink
Browse files
Implement some NPRuntime related NPN_ functions
https://bugs.webkit.org/show_bug.cgi?id=42518

Reviewed by Dan Bernstein.

WebCore:

* WebCore.exp.in:
Export IdentifierRep functions.

WebKit2:

* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetStringIdentifier):
(WebKit::NPN_GetStringIdentifiers):
(WebKit::NPN_GetIntIdentifier):
(WebKit::NPN_IdentifierIsString):
(WebKit::NPN_UTF8FromIdentifier):
(WebKit::NPN_IntFromIdentifier):
(WebKit::NPN_CreateObject):

Canonical link: https://commits.webkit.org/54468@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Jul 18, 2010
1 parent bdbd85d commit 1f7c4d72a124b0ec2dd59e83514899d30b55daf9
Showing with 64 additions and 14 deletions.
  1. +10 −0 WebCore/ChangeLog
  2. +2 −0 WebCore/WebCore.exp.in
  3. +16 −0 WebKit2/ChangeLog
  4. +36 −14 WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -1,3 +1,13 @@
2010-07-18 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

Implement some NPRuntime related NPN_ functions
https://bugs.webkit.org/show_bug.cgi?id=42518

* WebCore.exp.in:
Export IdentifierRep functions.

2010-07-17 TJ Lee <tjlee0909@gmail.com>

Reviewed by Timothy Hatcher.
@@ -282,6 +282,8 @@ __ZN7WebCore13AXObjectCache21gAccessibilityEnabledE
__ZN7WebCore13AXObjectCache42gAccessibilityEnhancedUserInterfaceEnabledE
__ZN7WebCore13HitTestResultC1ERKS0_
__ZN7WebCore13HitTestResultD1Ev
__ZN7WebCore13IdentifierRep3getEi
__ZN7WebCore13IdentifierRep3getEPKc
__ZN7WebCore13KeyboardEventC1ERKNS_12AtomicStringEbbPNS_9DOMWindowERKNS_6StringEjbbbbb
__ZN7WebCore13TypingCommand39insertParagraphSeparatorInQuotedContentEPNS_8DocumentE
__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow
@@ -1,3 +1,19 @@
2010-07-18 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

Implement some NPRuntime related NPN_ functions
https://bugs.webkit.org/show_bug.cgi?id=42518

* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetStringIdentifier):
(WebKit::NPN_GetStringIdentifiers):
(WebKit::NPN_GetIntIdentifier):
(WebKit::NPN_IdentifierIsString):
(WebKit::NPN_UTF8FromIdentifier):
(WebKit::NPN_IntFromIdentifier):
(WebKit::NPN_CreateObject):

2010-07-18 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.
@@ -27,6 +27,7 @@

#include "NetscapePlugin.h"
#include "NotImplemented.h"
#include <WebCore/IdentifierRep.h>

using namespace WebCore;

@@ -216,43 +217,64 @@ static void NPN_ForceRedraw(NPP instance)

static NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
{
notImplemented();
return 0;
return static_cast<NPIdentifier>(IdentifierRep::get(name));
}

static void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers)
{
notImplemented();
ASSERT(names);
ASSERT(identifiers);

if (!names || !identifiers)
return;

for (int32_t i = 0; i < nameCount; ++i)
identifiers[i] = NPN_GetStringIdentifier(names[i]);
}

static NPIdentifier NPN_GetIntIdentifier(int32_t intid)
{
notImplemented();
return 0;
return static_cast<NPIdentifier>(IdentifierRep::get(intid));
}

static bool NPN_IdentifierIsString(NPIdentifier identifier)
{
notImplemented();
return false;
return static_cast<IdentifierRep*>(identifier)->isString();
}

static NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
{
notImplemented();
return 0;
const char* string = static_cast<IdentifierRep*>(identifier)->string();
if (!string)
return 0;

uint32_t stringLength = strlen(string);
char* utf8String = static_cast<char*>(NPN_MemAlloc(stringLength + 1));
memcpy(utf8String, string, stringLength);
utf8String[stringLength] = '\0';

return utf8String;
}

static int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
{
notImplemented();
return 0;
return static_cast<IdentifierRep*>(identifier)->number();
}

static NPObject *NPN_CreateObject(NPP npp, NPClass *aClass)
static NPObject* NPN_CreateObject(NPP npp, NPClass *npClass)
{
notImplemented();
return 0;
ASSERT(npClass);

NPObject* object;
if (npClass->allocate)
object = npClass->allocate(npp, npClass);
else
object = static_cast<NPObject*>(NPN_MemAlloc(sizeof(NPObject)));

object->_class = npClass;
object->referenceCount = 1;

return object;
}

static NPObject *NPN_RetainObject(NPObject *npobj)

0 comments on commit 1f7c4d7

Please sign in to comment.