Commit 9668eaea authored by Kyle Spiers's avatar Kyle Spiers Committed by Commit Bot

[Extension Docs]Print Sample Extension: replace tabs.update with tabs.executeScript

Attempting to use the print this page extension results in Unchecked runtime.lastError: JavaScript URLs are not allowed in chrome.tabs.update. Use chrome.tabs.executeScript instead.

https://developer.chrome.com/extensions/samples needs to be updated as well.

Change-Id: Iea56f32cae87dc4286fe5e1cd61cb5e4ada1e478
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1554794Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Kyle Spiers <ksspiers@google.com>
Cr-Commit-Position: refs/heads/master@{#657382}
parent 80b0e6ee
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// Called when the user clicks on the browser action. // Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) { chrome.browserAction.onClicked.addListener(function(tab) {
var action_url = "javascript:window.print();"; chrome.tabs.executeScript(
chrome.tabs.update(tab.id, {url: action_url}); tab.id,
{code: 'window.print();'});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment