Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
fix windows paths for content scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Feb 7, 2016
1 parent 2fef55c commit 4675933
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion atom/renderer/atom_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "native_mate/dictionary.h"
#include "net/base/filename_util.h"
#include "third_party/WebKit/public/web/WebCustomElement.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
Expand Down Expand Up @@ -396,7 +397,9 @@ void AtomRendererClient::DidCreateScriptContext(
GetSwitchValueASCII(switches::kContentScripts));
std::string name;
while (std::getline(ss, name, ',')) {
ExecuteScriptFile(context, base::FilePath::FromUTF8Unsafe(name));
base::FilePath file_path;
net::FileURLToFilePath(GURL(name), &file_path);
ExecuteScriptFile(context, file_path);
}
}
// remove process object from the global scope
Expand Down
2 changes: 1 addition & 1 deletion atom/renderer/lib/web-view/web-view-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class ContentScriptsAttribute extends WebViewAttribute {
console.error(webViewConstants.ERROR_MSG_INVALID_CONTENT_SCRIPT_JS_ATTRIBUTE);
return null;
} else {
return fileUrl.slice(7); // strip off the file:// prefix
return fileUrl;
}
}).filter(file => file).join(',');
}
Expand Down

0 comments on commit 4675933

Please sign in to comment.