Merge pull request #4982 from atom/fix-windows

Fix various problems on Windows build
This commit is contained in:
Cheng Zhao 2016-04-01 16:57:27 +09:00
commit 4b9b630e80
5 changed files with 16 additions and 8 deletions

View file

@ -242,7 +242,7 @@ void App::OnCreateWindow(const GURL& target_url,
content::WebContents::FromRenderFrameHost(rfh); content::WebContents::FromRenderFrameHost(rfh);
if (web_contents) { if (web_contents) {
auto api_web_contents = WebContents::CreateFrom(isolate(), web_contents); auto api_web_contents = WebContents::CreateFrom(isolate(), web_contents);
api_web_contents->CreateWindow(target_url, frame_name, disposition); api_web_contents->OnCreateWindow(target_url, frame_name, disposition);
} }
} }

View file

@ -316,9 +316,9 @@ bool WebContents::AddMessageToConsole(content::WebContents* source,
} }
} }
void WebContents::CreateWindow(const GURL& target_url, void WebContents::OnCreateWindow(const GURL& target_url,
const std::string& frame_name, const std::string& frame_name,
WindowOpenDisposition disposition) { WindowOpenDisposition disposition) {
if (type_ == BROWSER_WINDOW) if (type_ == BROWSER_WINDOW)
Emit("-new-window", target_url, frame_name, disposition); Emit("-new-window", target_url, frame_name, disposition);
else else

View file

@ -139,9 +139,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
bool allowed); bool allowed);
// Create window with the given disposition. // Create window with the given disposition.
void CreateWindow(const GURL& target_url, void OnCreateWindow(const GURL& target_url,
const std::string& frame_name, const std::string& frame_name,
WindowOpenDisposition disposition); WindowOpenDisposition disposition);
// Returns the web preferences of current WebContents. // Returns the web preferences of current WebContents.
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate); v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);

View file

@ -199,7 +199,10 @@ describe('chromium feature', function () {
it('defines a window.location getter', function (done) { it('defines a window.location getter', function (done) {
var b, targetURL var b, targetURL
targetURL = 'file://' + fixtures + '/pages/base-page.html' if (process.platform == 'win32')
targetURL = 'file:///' + fixtures.replace(/\\/g, '/') + '/pages/base-page.html'
else
targetURL = 'file://' + fixtures + '/pages/base-page.html'
b = window.open(targetURL) b = window.open(targetURL)
BrowserWindow.fromId(b.guestId).webContents.once('did-finish-load', function () { BrowserWindow.fromId(b.guestId).webContents.once('did-finish-load', function () {
assert.equal(b.location, targetURL) assert.equal(b.location, targetURL)

View file

@ -3,6 +3,11 @@
<meta name="referrer" content="always"> <meta name="referrer" content="always">
<link href="../node_modules/mocha/mocha.css" rel="stylesheet"> <link href="../node_modules/mocha/mocha.css" rel="stylesheet">
<script src="jquery-2.0.3.min.js"></script> <script src="jquery-2.0.3.min.js"></script>
<style type="text/css">
body {
background-color: white;
}
</style>
</head> </head>
<body> <body>