summaryrefslogtreecommitdiff
path: root/CyteKit/WebView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'CyteKit/WebView.mm')
-rw-r--r--CyteKit/WebView.mm23
1 files changed, 2 insertions, 21 deletions
diff --git a/CyteKit/WebView.mm b/CyteKit/WebView.mm
index 3ec751a..dbd9129 100644
--- a/CyteKit/WebView.mm
+++ b/CyteKit/WebView.mm
@@ -37,8 +37,8 @@
*/
/* }}} */
+#include "CyteKit/dispatchEvent.h"
#include "CyteKit/WebView.h"
-#include "CyteKit/WebThreadLocked.hpp"
#include <CydiaSubstrate/CydiaSubstrate.h>
@@ -329,26 +329,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
}
- (void) dispatchEvent:(NSString *)event {
- WebThreadLocked lock;
-
- NSString *script([NSString stringWithFormat:@
- "(function() {"
- "var event = this.document.createEvent('Events');"
- "event.initEvent('%@', false, false);"
- "this.document.dispatchEvent(event);"
- "})();"
- , event]);
-
- NSMutableArray *frames([NSMutableArray arrayWithObjects:
- [[[self _documentView] webView] mainFrame]
- , nil]);
-
- while (WebFrame *frame = [frames lastObject]) {
- WebScriptObject *object([frame windowObject]);
- [object evaluateWebScript:script];
- [frames removeLastObject];
- [frames addObjectsFromArray:[frame childFrames]];
- }
+ [[self _documentView] dispatchEvent:event];
}
- (void) reloadFromOrigin {