OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Applies DomDistillerJs to the content of the page and returns a |
| 6 // DomDistillerResults (as a javascript object/dict). |
| 7 (function() { |
| 8 try { |
| 9 // UIWebView's JavaScript engine has a bug that causes crashes when creating |
| 10 // a separate window object (as in the non-iOS version of this file), so |
| 11 // allow the script to run directly in the window until a better solution |
| 12 // is created. |
| 13 // TODO(kkhorimoto): investigate whether this is necessary for WKWebView. |
| 14 <include |
| 15 src="../../../../third_party/dom_distiller_js/package/js/domdistiller.js"/> |
| 16 // UIWebView requires javascript to return a single string value. |
| 17 return JSON.stringify( |
| 18 window.com.dom_distiller.DomDistiller.applyWithOptions($$OPTIONS)); |
| 19 } catch (e) { |
| 20 window.console.error("Error during distillation: " + e); |
| 21 if (e.stack != undefined) window.console.error(e.stack); |
| 22 } |
| 23 return undefined; |
| 24 })(); |
OLD | NEW |