Index: components/dom_distiller/ios/javascript/domdistiller.js |
diff --git a/components/dom_distiller/ios/javascript/domdistiller.js b/components/dom_distiller/ios/javascript/domdistiller.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..874b97799e3d224eadbf221c60bfb4e37813d1b4 |
--- /dev/null |
+++ b/components/dom_distiller/ios/javascript/domdistiller.js |
@@ -0,0 +1,24 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
nyquist
2015/02/20 18:55:48
Not: 2015
sdefresne
2015/02/23 11:08:58
Code was written in 2014, only upstreaming happene
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Applies DomDistillerJs to the content of the page and returns a |
+// DomDistillerResults (as a javascript object/dict). |
+(function() { |
nyquist
2015/02/20 18:55:48
For core I believe the folder name is just 'js'. A
sdefresne
2015/02/23 11:08:58
The code file is located at "components/dom_distil
|
+ try { |
+ // UIWebView's JavaScript engine has a bug that causes crashes when creating |
+ // a separate window object (as in the non-iOS version of this file), so |
+ // allow the script to run directly in the window until a better solution |
+ // is created. |
+ // TODO(kkhorimoto): investigate whether this is necessary for WKWebView. |
+ <include |
+ src="../../../../third_party/dom_distiller_js/package/js/domdistiller.js"/> |
+ // UIWebView requires javascript to return a single string value. |
+ return JSON.stringify( |
+ window.com.dom_distiller.DomDistiller.applyWithOptions($$OPTIONS)); |
+ } catch (e) { |
+ window.console.error("Error during distillation: " + e); |
+ if (e.stack != undefined) window.console.error(e.stack); |
+ } |
+ return undefined; |
+})(); |