From 41de0b420ab55a3ea5da1994088570cf7ad773bb Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 14 Oct 2013 11:57:53 +0800 Subject: [PATCH] Unescape the script path before passing it to cefode.js, fixed #108. --- common/node_bindings.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/node_bindings.cc b/common/node_bindings.cc index 5d2ebf9..963f8fe 100644 --- a/common/node_bindings.cc +++ b/common/node_bindings.cc @@ -7,7 +7,9 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/message_loop.h" +#include "common/v8_conversions.h" #include "content/public/browser/browser_thread.h" +#include "net/base/escape.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "vendor/node/src/node.h" @@ -116,9 +118,12 @@ void NodeBindings::BindTo(WebKit::WebFrame* frame) { // Run the script of cefode.js. std::string script_path(GURL(frame->document().url()).path()); + script_path = net::UnescapeURLComponent( + script_path, + net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS); v8::Handle args[2] = { v8::Local::New(node::process), - v8::String::New(script_path.c_str(), script_path.size()) + ToV8Value(script_path), }; v8::Local::Cast(result)->Call(context->Global(), 2, args); } -- 2.7.4