more code to check in before moving in a different direction; ignoring more editor...
authorMark Donnelly <mark@painless-security.com>
Sun, 22 Dec 2013 18:05:45 +0000 (13:05 -0500)
committerMark Donnelly <mark@painless-security.com>
Sun, 22 Dec 2013 18:05:45 +0000 (13:05 -0500)
.gitignore
npapi/npapiplugin.cpp [new file with mode: 0644]
npapi/npapiplugin.h [new file with mode: 0644]
npapi/test.html [new file with mode: 0644]

index 787bf94..d368523 100644 (file)
@@ -54,3 +54,22 @@ install_manifest.txt
 *.out
 *.app
 *.hex
+
+##
+## KDevelop 4 files
+#################################
+apidocs
+.kdev4
+*.kdev4
+*~
+*.orig
+*.rej
+doxygen.log
+Doxyfile
+*.kdevelop
+*.kdevelop.filelist
+*.kdevelop.pcs
+*.kdevses
+.*kate-swp
+#build
+#build/
diff --git a/npapi/npapiplugin.cpp b/npapi/npapiplugin.cpp
new file mode 100644 (file)
index 0000000..90030a8
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2013 <copyright holder> <email>
+ * 
+ * For license details, see the LICENSE file in the root of this project.
+ * 
+ */
+
+#include "npapiplugin.h"
+
+
+NPAPIPlugin::NPAPIPlugin(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *pFuncs)
+{
+  /*
+   * Setup - Ensure a sane environment
+   */  
+  if( pFuncs == NULL || 
+      pFuncs->size < sizeof(NPNetscapeFuncs) )
+    return NPERR_INVALID_FUNCTABLE_ERROR;
+
+  if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
+    return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+  /*
+   * Main body:
+   *   Tell the browser about the API functions we implement
+   */
+  pFuncs->newp = NPP_New;
+  pFuncs->destroy = NPP_Destroy;
+  pFuncs->getvalue = NPP_GetValue;
+
+  return NPERR_NO_ERROR;
+
+}
+
+NPAPIPlugin::~NPAPIPlugin(NPP instance, NPSavedData **save)
+{
+
+}
+
+
+/*
+ * Create and destroy an instance of the plugin
+ */
+NPError NPAPIPlugin::NPP_New(NPMIMEType    pluginType,
+                NPP instance, uint16_t mode,
+                int16_t argc, char *argn[],
+                char *argv[], NPSavedData *saved)
+{
+  return(NPERR_NO_ERROR);
+}
+
+NPError NPAPIPlugin::NPP_Destroy(NPP instance, NPSavedData **save)
+{
+  return(NPERR_NO_ERROR);
+}
+
+NPError NPAPIPlugin::NPP_GetValue(NPP instance,
+                     NPPVariable variable,
+                     void *value)
+{
+  switch(variable)
+  {
+    case NPPVpluginScriptableNPObject:
+      cerr << "Received the scriptable object call!\n";
+      //value = NPN_CreateObject(instance, )
+      break;
+  }
+  cerr << "Called NPP_GetValue with " << variable << ".\n";
+  return NPERR_NO_ERROR;
+}
diff --git a/npapi/npapiplugin.h b/npapi/npapiplugin.h
new file mode 100644 (file)
index 0000000..2f28e24
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2013 <copyright holder> <email>
+ * 
+ * For license details, see the LICENSE file in the root of this project.
+ * 
+ */
+
+#ifndef NPAPIPLUGIN_H
+#define NPAPIPLUGIN_H
+
+#include <firefox/npapi.h>
+
+class NPAPIPlugin
+{
+public:
+NPAPIPlugin(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *pFuncs);
+~NPAPIPlugin(NPP instance, NPSavedData **save);
+
+
+NPError NPP_New(NPMIMEType    pluginType,
+                NPP instance, uint16_t mode,
+                int16_t argc, char *argn[],
+                char *argv[], NPSavedData *saved);
+
+NPError NPP_Destroy(NPP instance, NPSavedData **save);
+
+NPError NPP_GetValue(NPP instance,
+                     NPPVariable variable,
+                     void *value);
+
+
+};
+
+#endif // NPAPIPLUGIN_H
diff --git a/npapi/test.html b/npapi/test.html
new file mode 100644 (file)
index 0000000..679b05c
--- /dev/null
@@ -0,0 +1,11 @@
+<html>
+  <body>
+    <embed type="application/gss-web">
+    <script>
+      var embed = document.embeds[0];
+      embed.nativeMethod();
+      alert(embed.nativeProperty);
+      embed.nativeProperty.anotherNativeMethod();
+    </script>
+  </body>
+</html>
\ No newline at end of file