/** * Load a url from the network or the filesystem into the main frame. Following the same behaviour * as Safari, javascript: URLs are not passed to the main frame, instead they are evaluated * immediately. * * @param url The url to load. */ public void loadUrl(String url) { mLoadInitFromJava = true; if (URLUtil.isJavaScriptUrl(url)) { // strip off the scheme and evaluate the string stringByEvaluatingJavaScriptFromString(url.substring("javascript:".length())); } else { nativeLoadUrl(url); } mLoadInitFromJava = false; }
/* * This method is called by WebCore to inform the frame that * the Javascript window object has been cleared. * We should re-attach any attached js interfaces. */ private void windowObjectCleared(int nativeFramePointer) { Iterator<String> iter = mJavaScriptObjects.keySet().iterator(); while (iter.hasNext()) { String interfaceName = iter.next(); Object object = mJavaScriptObjects.get(interfaceName); if (object != null) { nativeAddJavascriptInterface( nativeFramePointer, mJavaScriptObjects.get(interfaceName), interfaceName); } } mRemovedJavaScriptObjects.clear(); stringByEvaluatingJavaScriptFromString(SearchBoxImpl.JS_BRIDGE); }