summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 09:33:24 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 09:33:24 +0000
commitf4d962edbcf53999f8854e7a15e41d9d0e2c5241 (patch)
tree9be8e707055e100cea9bdbaa0e1ebfad7a2887b5 /chrome
parent9b4b2995aee8c5db19ae4ad4ea2c14307a82015c (diff)
downloadchromium_src-f4d962edbcf53999f8854e7a15e41d9d0e2c5241.zip
chromium_src-f4d962edbcf53999f8854e7a15e41d9d0e2c5241.tar.gz
chromium_src-f4d962edbcf53999f8854e7a15e41d9d0e2c5241.tar.bz2
Merge 34482 - Update the EmailThisPage to fix a problem with subject containing & causing a mostly empty email to appear.
BUG=None TEST=EmailThisPage should work for both native and web mail clients and ampersand in page title/user selection should not cause truncation. Review URL: http://codereview.chromium.org/482011 TBR=finnur@chromium.org Review URL: http://codereview.chromium.org/504025 git-svn-id: svn://svn.chromium.org/chrome/branches/249/src@34713 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/common/extensions/docs/examples/extensions/email_this_page/background.html25
-rw-r--r--chrome/common/extensions/docs/examples/extensions/email_this_page/manifest.json6
2 files changed, 17 insertions, 14 deletions
diff --git a/chrome/common/extensions/docs/examples/extensions/email_this_page/background.html b/chrome/common/extensions/docs/examples/extensions/email_this_page/background.html
index 6893cc5..d8eb9ed 100644
--- a/chrome/common/extensions/docs/examples/extensions/email_this_page/background.html
+++ b/chrome/common/extensions/docs/examples/extensions/email_this_page/background.html
@@ -15,23 +15,27 @@
}
function executeMailto(tab_id, subject, body, selection) {
+ var default_handler = customMailtoUrl().length == 0;
+
var action_url = "mailto:?"
if (subject.length > 0)
- action_url += "subject=" + subject + "%26"; // 26 is ampersand.
+ action_url += "subject=" + encodeURIComponent(subject) + "&";
+
if (body.length > 0) {
- action_url += "body=" + body;
+ action_url += "body=" + encodeURIComponent(body);
// Append the current selection to the end of the text message.
- var new_line = "%0D%0A";
- if (selection.length > 0)
- action_url += new_line + new_line + selection;
+ if (selection.length > 0) {
+ action_url += encodeURIComponent("\n\n") +
+ encodeURIComponent(selection);
+ }
}
- var custom_url = customMailtoUrl();
- if (custom_url.length > 0) {
+ if (!default_handler) {
// Custom URL's (such as opening mailto in Gmail tab) should have a
// separate tab to avoid clobbering the page you are on.
- action_url = custom_url.replace("%s", action_url);
+ var custom_url = customMailtoUrl();
+ action_url = custom_url.replace("%s", encodeURIComponent(action_url));
console.log('Custom url: ' + action_url);
chrome.tabs.create({ url: action_url });
} else {
@@ -51,8 +55,7 @@
var max_length = 1024;
if (info.selection.length > max_length)
info.selection = info.selection.substring(0, max_length);
- executeMailto(tab.id, encodeURI(info.title),
- encodeURI(tab.url), encodeURI(info.selection));
+ executeMailto(tab.id, info.title, tab.url, info.selection);
});
});
@@ -62,7 +65,7 @@
// and https so for all other pages, we don't ask for the title.
if (tab.url.indexOf("http:") != 0 &&
tab.url.indexOf("https:") != 0) {
- executeMailto(tab.id, "", encodeURI(tab.url), "");
+ executeMailto(tab.id, "", tab.url, "");
} else {
chrome.tabs.executeScript(null, {file: "content_script.js"});
}
diff --git a/chrome/common/extensions/docs/examples/extensions/email_this_page/manifest.json b/chrome/common/extensions/docs/examples/extensions/email_this_page/manifest.json
index d22ef4e..6a50060 100644
--- a/chrome/common/extensions/docs/examples/extensions/email_this_page/manifest.json
+++ b/chrome/common/extensions/docs/examples/extensions/email_this_page/manifest.json
@@ -1,7 +1,7 @@
{
- "name": "Email this page",
- "description": "This extension adds an email button to the toolbar which allows you to email the page link using your default mail client or Gmail",
- "version": "1.2.2",
+ "name": "Email this page (by Google)",
+ "description": "This extension adds an email button to the toolbar which allows you to email the page link using your default mail client or Gmail.",
+ "version": "1.2.5",
"background_page": "background.html",
"icons": { "128": "mail_128x128.png" },
"options_page": "options.html",