summaryrefslogtreecommitdiff
path: root/CyteKit/WebView.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-13 14:07:59 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-14 05:09:09 -0700
commit31f9c8f728e31d0614b9c0aa9fe3ddb60545a366 (patch)
tree4a6e65b67a90b1aceac8812ae2fbf7846cee55f6 /CyteKit/WebView.mm
parentbaa2fba301cb1561e2c0bbc528027074ce73d692 (diff)
Separate out CyteKit/dispatchEvent.*.
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 {