summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2011-11-23 12:51:58 +0200
committerAlexander Bokovoy <abokovoy@redhat.com>2011-11-23 12:51:58 +0200
commit870695c758a213a54aa2b2db9ba8bb9de83724ba (patch)
tree6eabe40e9e17c7fb8a6594c944a968d789631ad4
downloaddisableplugins-870695c758a213a54aa2b2db9ba8bb9de83724ba.tar.gz
disableplugins-870695c758a213a54aa2b2db9ba8bb9de83724ba.tar.xz
disableplugins-870695c758a213a54aa2b2db9ba8bb9de83724ba.zip
Initial commitHEADmaster
-rw-r--r--disableplugins.cpp22
-rw-r--r--disableplugins.pro8
2 files changed, 30 insertions, 0 deletions
diff --git a/disableplugins.cpp b/disableplugins.cpp
new file mode 100644
index 0000000..04976de
--- /dev/null
+++ b/disableplugins.cpp
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <dlfcn.h>
+#include <QWebSettings>
+
+typedef QWebSettings*(*func_t)();
+QWebSettings *QWebSettings::globalSettings(){
+ void *handle = NULL;
+ const char library[] = "/usr/lib64/libQtWebKit.so.4.9.0";
+ static func_t real_func = NULL;
+ handle = dlopen(library, RTLD_LAZY);
+
+ if (handle == NULL) {
+ fprintf(stderr, "Failed to dlopen %s\n", library);
+ fprintf(stderr, "dlerror says: %s\n", dlerror());
+ return NULL;
+ }
+ real_func = (func_t)dlsym(handle, "_ZN12QWebSettings14globalSettingsEv");
+ QWebSettings *s = real_func();
+ s->setAttribute(QWebSettings::PluginsEnabled, false);
+ return s;
+}
+
diff --git a/disableplugins.pro b/disableplugins.pro
new file mode 100644
index 0000000..d884283
--- /dev/null
+++ b/disableplugins.pro
@@ -0,0 +1,8 @@
+QT += webkit
+TEMPLATE = lib
+TARGET = disableplugins
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += disableplugins.cpp