Replace "Url" in API names with "URL"
This commit is contained in:
parent
8f56387bd9
commit
fbb8e61958
57 changed files with 251 additions and 212 deletions
|
@ -81,7 +81,7 @@ void AutoUpdater::OnWindowAllClosed() {
|
||||||
mate::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder(
|
mate::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder(
|
||||||
v8::Isolate* isolate) {
|
v8::Isolate* isolate) {
|
||||||
return mate::ObjectTemplateBuilder(isolate)
|
return mate::ObjectTemplateBuilder(isolate)
|
||||||
.SetMethod("setFeedUrl", &auto_updater::AutoUpdater::SetFeedURL)
|
.SetMethod("setFeedURL", &auto_updater::AutoUpdater::SetFeedURL)
|
||||||
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
|
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
|
||||||
.SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
|
.SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ void Cookies::GetCookiesOnIOThread(scoped_ptr<base::DictionaryValue> filter,
|
||||||
Passed(&filter), callback))) {
|
Passed(&filter), callback))) {
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
||||||
base::Bind(&RunGetCookiesCallbackOnUIThread, isolate(),
|
base::Bind(&RunGetCookiesCallbackOnUIThread, isolate(),
|
||||||
"Url is not valid", net::CookieList(), callback));
|
"URL is not valid", net::CookieList(), callback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ void Cookies::Remove(const mate::Dictionary& details,
|
||||||
error_message = "Details(url, name) of removing cookie are required.";
|
error_message = "Details(url, name) of removing cookie are required.";
|
||||||
}
|
}
|
||||||
if (error_message.empty() && !url.is_valid()) {
|
if (error_message.empty() && !url.is_valid()) {
|
||||||
error_message = "Url is not valid.";
|
error_message = "URL is not valid.";
|
||||||
}
|
}
|
||||||
if (!error_message.empty()) {
|
if (!error_message.empty()) {
|
||||||
RunRemoveCookiesCallbackOnUIThread(isolate(), error_message, callback);
|
RunRemoveCookiesCallbackOnUIThread(isolate(), error_message, callback);
|
||||||
|
@ -261,7 +261,7 @@ void Cookies::Set(const base::DictionaryValue& options,
|
||||||
|
|
||||||
GURL gurl(url);
|
GURL gurl(url);
|
||||||
if (error_message.empty() && !gurl.is_valid()) {
|
if (error_message.empty() && !gurl.is_valid()) {
|
||||||
error_message = "Url is not valid.";
|
error_message = "URL is not valid.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!error_message.empty()) {
|
if (!error_message.empty()) {
|
||||||
|
|
|
@ -103,7 +103,7 @@ int64 DownloadItem::GetTotalBytes() {
|
||||||
return download_item_->GetTotalBytes();
|
return download_item_->GetTotalBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
const GURL& DownloadItem::GetUrl() {
|
const GURL& DownloadItem::GetURL() {
|
||||||
return download_item_->GetURL();
|
return download_item_->GetURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ bool DownloadItem::HasUserGesture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DownloadItem::GetFilename() {
|
std::string DownloadItem::GetFilename() {
|
||||||
return base::UTF16ToUTF8(net::GenerateFileName(GetUrl(),
|
return base::UTF16ToUTF8(net::GenerateFileName(GetURL(),
|
||||||
GetContentDisposition(),
|
GetContentDisposition(),
|
||||||
std::string(),
|
std::string(),
|
||||||
download_item_->GetSuggestedFilename(),
|
download_item_->GetSuggestedFilename(),
|
||||||
|
@ -152,7 +152,7 @@ mate::ObjectTemplateBuilder DownloadItem::GetObjectTemplateBuilder(
|
||||||
.SetMethod("cancel", &DownloadItem::Cancel)
|
.SetMethod("cancel", &DownloadItem::Cancel)
|
||||||
.SetMethod("getReceivedBytes", &DownloadItem::GetReceivedBytes)
|
.SetMethod("getReceivedBytes", &DownloadItem::GetReceivedBytes)
|
||||||
.SetMethod("getTotalBytes", &DownloadItem::GetTotalBytes)
|
.SetMethod("getTotalBytes", &DownloadItem::GetTotalBytes)
|
||||||
.SetMethod("getUrl", &DownloadItem::GetUrl)
|
.SetMethod("getURL", &DownloadItem::GetURL)
|
||||||
.SetMethod("getMimeType", &DownloadItem::GetMimeType)
|
.SetMethod("getMimeType", &DownloadItem::GetMimeType)
|
||||||
.SetMethod("hasUserGesture", &DownloadItem::HasUserGesture)
|
.SetMethod("hasUserGesture", &DownloadItem::HasUserGesture)
|
||||||
.SetMethod("getFilename", &DownloadItem::GetFilename)
|
.SetMethod("getFilename", &DownloadItem::GetFilename)
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DownloadItem : public mate::EventEmitter,
|
||||||
bool HasUserGesture();
|
bool HasUserGesture();
|
||||||
std::string GetFilename();
|
std::string GetFilename();
|
||||||
std::string GetContentDisposition();
|
std::string GetContentDisposition();
|
||||||
const GURL& GetUrl();
|
const GURL& GetURL();
|
||||||
void SetSavePath(const base::FilePath& path);
|
void SetSavePath(const base::FilePath& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -37,7 +37,7 @@ mate::ObjectTemplateBuilder Protocol::GetObjectTemplateBuilder(
|
||||||
.SetMethod("registerBufferProtocol",
|
.SetMethod("registerBufferProtocol",
|
||||||
&Protocol::RegisterProtocol<URLRequestBufferJob>)
|
&Protocol::RegisterProtocol<URLRequestBufferJob>)
|
||||||
.SetMethod("registerFileProtocol",
|
.SetMethod("registerFileProtocol",
|
||||||
&Protocol::RegisterProtocol<UrlRequestAsyncAsarJob>)
|
&Protocol::RegisterProtocol<URLRequestAsyncAsarJob>)
|
||||||
.SetMethod("registerHttpProtocol",
|
.SetMethod("registerHttpProtocol",
|
||||||
&Protocol::RegisterProtocol<URLRequestFetchJob>)
|
&Protocol::RegisterProtocol<URLRequestFetchJob>)
|
||||||
.SetMethod("unregisterProtocol", &Protocol::UnregisterProtocol)
|
.SetMethod("unregisterProtocol", &Protocol::UnregisterProtocol)
|
||||||
|
@ -47,7 +47,7 @@ mate::ObjectTemplateBuilder Protocol::GetObjectTemplateBuilder(
|
||||||
.SetMethod("interceptBufferProtocol",
|
.SetMethod("interceptBufferProtocol",
|
||||||
&Protocol::InterceptProtocol<URLRequestBufferJob>)
|
&Protocol::InterceptProtocol<URLRequestBufferJob>)
|
||||||
.SetMethod("interceptFileProtocol",
|
.SetMethod("interceptFileProtocol",
|
||||||
&Protocol::InterceptProtocol<UrlRequestAsyncAsarJob>)
|
&Protocol::InterceptProtocol<URLRequestAsyncAsarJob>)
|
||||||
.SetMethod("interceptHttpProtocol",
|
.SetMethod("interceptHttpProtocol",
|
||||||
&Protocol::InterceptProtocol<URLRequestFetchJob>)
|
&Protocol::InterceptProtocol<URLRequestFetchJob>)
|
||||||
.SetMethod("uninterceptProtocol", &Protocol::UninterceptProtocol);
|
.SetMethod("uninterceptProtocol", &Protocol::UninterceptProtocol);
|
||||||
|
|
|
@ -1003,8 +1003,8 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
|
||||||
.SetMethod("isAlive", &WebContents::IsAlive, true)
|
.SetMethod("isAlive", &WebContents::IsAlive, true)
|
||||||
.SetMethod("getId", &WebContents::GetID)
|
.SetMethod("getId", &WebContents::GetID)
|
||||||
.SetMethod("equal", &WebContents::Equal)
|
.SetMethod("equal", &WebContents::Equal)
|
||||||
.SetMethod("_loadUrl", &WebContents::LoadURL)
|
.SetMethod("_loadURL", &WebContents::LoadURL)
|
||||||
.SetMethod("_getUrl", &WebContents::GetURL)
|
.SetMethod("_getURL", &WebContents::GetURL)
|
||||||
.SetMethod("getTitle", &WebContents::GetTitle)
|
.SetMethod("getTitle", &WebContents::GetTitle)
|
||||||
.SetMethod("isLoading", &WebContents::IsLoading)
|
.SetMethod("isLoading", &WebContents::IsLoading)
|
||||||
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
|
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
|
||||||
|
|
|
@ -63,10 +63,11 @@ wrapDownloadItem = (downloadItem) ->
|
||||||
# downloadItem is an EventEmitter.
|
# downloadItem is an EventEmitter.
|
||||||
downloadItem.__proto__ = EventEmitter.prototype
|
downloadItem.__proto__ = EventEmitter.prototype
|
||||||
# Deprecated.
|
# Deprecated.
|
||||||
deprecate.property downloadItem, 'url', 'getUrl'
|
deprecate.property downloadItem, 'url', 'getURL'
|
||||||
deprecate.property downloadItem, 'filename', 'getFilename'
|
deprecate.property downloadItem, 'filename', 'getFilename'
|
||||||
deprecate.property downloadItem, 'mimeType', 'getMimeType'
|
deprecate.property downloadItem, 'mimeType', 'getMimeType'
|
||||||
deprecate.property downloadItem, 'hasUserGesture', 'hasUserGesture'
|
deprecate.property downloadItem, 'hasUserGesture', 'hasUserGesture'
|
||||||
|
deprecate.rename downloadItem, 'getUrl', 'getURL'
|
||||||
downloadItemBindings._setWrapDownloadItem wrapDownloadItem
|
downloadItemBindings._setWrapDownloadItem wrapDownloadItem
|
||||||
|
|
||||||
# Only one App object pemitted.
|
# Only one App object pemitted.
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
module.exports =
|
{deprecate} = require 'electron'
|
||||||
|
|
||||||
|
autoUpdater =
|
||||||
if process.platform is 'win32'
|
if process.platform is 'win32'
|
||||||
require './auto-updater/auto-updater-win'
|
require './auto-updater/auto-updater-win'
|
||||||
else
|
else
|
||||||
require './auto-updater/auto-updater-native'
|
require './auto-updater/auto-updater-native'
|
||||||
|
|
||||||
|
# Deprecated.
|
||||||
|
deprecate.rename autoUpdater, 'setFeedUrl', 'setFeedURL'
|
||||||
|
|
||||||
|
module.exports = autoUpdater
|
||||||
|
|
|
@ -9,28 +9,28 @@ class AutoUpdater extends EventEmitter
|
||||||
squirrelUpdate.processStart()
|
squirrelUpdate.processStart()
|
||||||
app.quit()
|
app.quit()
|
||||||
|
|
||||||
setFeedUrl: (updateUrl) ->
|
setFeedURL: (updateURL) ->
|
||||||
@updateUrl = updateUrl
|
@updateURL = updateURL
|
||||||
|
|
||||||
checkForUpdates: ->
|
checkForUpdates: ->
|
||||||
return @emitError 'Update URL is not set' unless @updateUrl
|
return @emitError 'Update URL is not set' unless @updateURL
|
||||||
return @emitError 'Can not find Squirrel' unless squirrelUpdate.supported()
|
return @emitError 'Can not find Squirrel' unless squirrelUpdate.supported()
|
||||||
|
|
||||||
@emit 'checking-for-update'
|
@emit 'checking-for-update'
|
||||||
|
|
||||||
squirrelUpdate.download @updateUrl, (error, update) =>
|
squirrelUpdate.download @updateURL, (error, update) =>
|
||||||
return @emitError error if error?
|
return @emitError error if error?
|
||||||
return @emit 'update-not-available' unless update?
|
return @emit 'update-not-available' unless update?
|
||||||
|
|
||||||
@emit 'update-available'
|
@emit 'update-available'
|
||||||
|
|
||||||
squirrelUpdate.update @updateUrl, (error) =>
|
squirrelUpdate.update @updateURL, (error) =>
|
||||||
return @emitError error if error?
|
return @emitError error if error?
|
||||||
|
|
||||||
{releaseNotes, version} = update
|
{releaseNotes, version} = update
|
||||||
# Following information is not available on Windows, so fake them.
|
# Following information is not available on Windows, so fake them.
|
||||||
date = new Date
|
date = new Date
|
||||||
url = @updateUrl
|
url = @updateURL
|
||||||
|
|
||||||
@emit 'update-downloaded', {}, releaseNotes, version, date, url, => @quitAndInstall()
|
@emit 'update-downloaded', {}, releaseNotes, version, date, url, => @quitAndInstall()
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ exports.processStart = (callback) ->
|
||||||
spawnUpdate ['--processStart', exeName], true, ->
|
spawnUpdate ['--processStart', exeName], true, ->
|
||||||
|
|
||||||
# Download the releases specified by the URL and write new results to stdout.
|
# Download the releases specified by the URL and write new results to stdout.
|
||||||
exports.download = (updateUrl, callback) ->
|
exports.download = (updateURL, callback) ->
|
||||||
spawnUpdate ['--download', updateUrl], false, (error, stdout) ->
|
spawnUpdate ['--download', updateURL], false, (error, stdout) ->
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -55,8 +55,8 @@ exports.download = (updateUrl, callback) ->
|
||||||
callback null, update
|
callback null, update
|
||||||
|
|
||||||
# Update the application to the latest remote version specified by URL.
|
# Update the application to the latest remote version specified by URL.
|
||||||
exports.update = (updateUrl, callback) ->
|
exports.update = (updateURL, callback) ->
|
||||||
spawnUpdate ['--update', updateUrl], false, callback
|
spawnUpdate ['--update', updateURL], false, callback
|
||||||
|
|
||||||
# Is the Update.exe installed with the current application?
|
# Is the Update.exe installed with the current application?
|
||||||
exports.supported = ->
|
exports.supported = ->
|
||||||
|
|
|
@ -69,7 +69,8 @@ BrowserWindow.fromDevToolsWebContents = (webContents) ->
|
||||||
return window for window in windows when window.devToolsWebContents?.equal webContents
|
return window for window in windows when window.devToolsWebContents?.equal webContents
|
||||||
|
|
||||||
# Helpers.
|
# Helpers.
|
||||||
BrowserWindow::loadUrl = -> @webContents.loadUrl.apply @webContents, arguments
|
BrowserWindow::loadURL = -> @webContents.loadURL.apply @webContents, arguments
|
||||||
|
BrowserWindow::getURL = -> @webContents.getURL()
|
||||||
BrowserWindow::reload = -> @webContents.reload.apply @webContents, arguments
|
BrowserWindow::reload = -> @webContents.reload.apply @webContents, arguments
|
||||||
BrowserWindow::send = -> @webContents.send.apply @webContents, arguments
|
BrowserWindow::send = -> @webContents.send.apply @webContents, arguments
|
||||||
BrowserWindow::openDevTools = -> @webContents.openDevTools.apply @webContents, arguments
|
BrowserWindow::openDevTools = -> @webContents.openDevTools.apply @webContents, arguments
|
||||||
|
@ -80,14 +81,12 @@ BrowserWindow::inspectElement = -> @webContents.inspectElement.apply @webContent
|
||||||
BrowserWindow::inspectServiceWorker = -> @webContents.inspectServiceWorker()
|
BrowserWindow::inspectServiceWorker = -> @webContents.inspectServiceWorker()
|
||||||
|
|
||||||
# Deprecated.
|
# Deprecated.
|
||||||
deprecate.rename BrowserWindow, 'restart', 'reload'
|
|
||||||
deprecate.member BrowserWindow, 'undo', 'webContents'
|
deprecate.member BrowserWindow, 'undo', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'redo', 'webContents'
|
deprecate.member BrowserWindow, 'redo', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'cut', 'webContents'
|
deprecate.member BrowserWindow, 'cut', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'copy', 'webContents'
|
deprecate.member BrowserWindow, 'copy', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'paste', 'webContents'
|
deprecate.member BrowserWindow, 'paste', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'selectAll', 'webContents'
|
deprecate.member BrowserWindow, 'selectAll', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'getUrl', 'webContents'
|
|
||||||
deprecate.member BrowserWindow, 'reloadIgnoringCache', 'webContents'
|
deprecate.member BrowserWindow, 'reloadIgnoringCache', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'getPageTitle', 'webContents'
|
deprecate.member BrowserWindow, 'getPageTitle', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'isLoading', 'webContents'
|
deprecate.member BrowserWindow, 'isLoading', 'webContents'
|
||||||
|
@ -97,5 +96,8 @@ deprecate.member BrowserWindow, 'isCrashed', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'executeJavaScriptInDevTools', 'webContents'
|
deprecate.member BrowserWindow, 'executeJavaScriptInDevTools', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'print', 'webContents'
|
deprecate.member BrowserWindow, 'print', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'printToPDF', 'webContents'
|
deprecate.member BrowserWindow, 'printToPDF', 'webContents'
|
||||||
|
deprecate.rename BrowserWindow, 'restart', 'reload'
|
||||||
|
deprecate.rename BrowserWindow, 'loadUrl', 'loadURL'
|
||||||
|
deprecate.rename BrowserWindow, 'getUrl', 'getURL'
|
||||||
|
|
||||||
module.exports = BrowserWindow
|
module.exports = BrowserWindow
|
||||||
|
|
|
@ -9,7 +9,7 @@ ipcMain.on 'ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER', (event, method, args...) ->
|
||||||
|
|
||||||
# JavaScript implementation of Chromium's NavigationController.
|
# JavaScript implementation of Chromium's NavigationController.
|
||||||
# Instead of relying on Chromium for history control, we compeletely do history
|
# Instead of relying on Chromium for history control, we compeletely do history
|
||||||
# control on user land, and only rely on WebContents.loadUrl for navigation.
|
# control on user land, and only rely on WebContents.loadURL for navigation.
|
||||||
# This helps us avoid Chromium's various optimizations so we can ensure renderer
|
# This helps us avoid Chromium's various optimizations so we can ensure renderer
|
||||||
# process is restarted everytime.
|
# process is restarted everytime.
|
||||||
class NavigationController
|
class NavigationController
|
||||||
|
@ -17,9 +17,9 @@ class NavigationController
|
||||||
@clearHistory()
|
@clearHistory()
|
||||||
|
|
||||||
# webContents may have already navigated to a page.
|
# webContents may have already navigated to a page.
|
||||||
if @webContents._getUrl()
|
if @webContents._getURL()
|
||||||
@currentIndex++
|
@currentIndex++
|
||||||
@history.push @webContents._getUrl()
|
@history.push @webContents._getURL()
|
||||||
|
|
||||||
@webContents.on 'navigation-entry-commited', (event, url, inPage, replaceEntry) =>
|
@webContents.on 'navigation-entry-commited', (event, url, inPage, replaceEntry) =>
|
||||||
if @inPageIndex > -1 and not inPage
|
if @inPageIndex > -1 and not inPage
|
||||||
|
@ -42,12 +42,12 @@ class NavigationController
|
||||||
@currentIndex++
|
@currentIndex++
|
||||||
@history.push url
|
@history.push url
|
||||||
|
|
||||||
loadUrl: (url, options={}) ->
|
loadURL: (url, options={}) ->
|
||||||
@pendingIndex = -1
|
@pendingIndex = -1
|
||||||
@webContents._loadUrl url, options
|
@webContents._loadURL url, options
|
||||||
@webContents.emit 'load-url', url, options
|
@webContents.emit 'load-url', url, options
|
||||||
|
|
||||||
getUrl: ->
|
getURL: ->
|
||||||
if @currentIndex is -1
|
if @currentIndex is -1
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
|
@ -59,7 +59,7 @@ class NavigationController
|
||||||
|
|
||||||
reload: ->
|
reload: ->
|
||||||
@pendingIndex = @currentIndex
|
@pendingIndex = @currentIndex
|
||||||
@webContents._loadUrl @getUrl(), {}
|
@webContents._loadURL @getURL(), {}
|
||||||
|
|
||||||
reloadIgnoringCache: ->
|
reloadIgnoringCache: ->
|
||||||
@webContents._reloadIgnoringCache() # Rely on WebContents to clear cache.
|
@webContents._reloadIgnoringCache() # Rely on WebContents to clear cache.
|
||||||
|
@ -89,7 +89,7 @@ class NavigationController
|
||||||
if @inPageIndex > -1 and @pendingIndex >= @inPageIndex
|
if @inPageIndex > -1 and @pendingIndex >= @inPageIndex
|
||||||
@webContents._goBack()
|
@webContents._goBack()
|
||||||
else
|
else
|
||||||
@webContents._loadUrl @history[@pendingIndex], {}
|
@webContents._loadURL @history[@pendingIndex], {}
|
||||||
|
|
||||||
goForward: ->
|
goForward: ->
|
||||||
return unless @canGoForward()
|
return unless @canGoForward()
|
||||||
|
@ -97,12 +97,12 @@ class NavigationController
|
||||||
if @inPageIndex > -1 and @pendingIndex >= @inPageIndex
|
if @inPageIndex > -1 and @pendingIndex >= @inPageIndex
|
||||||
@webContents._goForward()
|
@webContents._goForward()
|
||||||
else
|
else
|
||||||
@webContents._loadUrl @history[@pendingIndex], {}
|
@webContents._loadURL @history[@pendingIndex], {}
|
||||||
|
|
||||||
goToIndex: (index) ->
|
goToIndex: (index) ->
|
||||||
return unless @canGoToIndex index
|
return unless @canGoToIndex index
|
||||||
@pendingIndex = index
|
@pendingIndex = index
|
||||||
@webContents._loadUrl @history[@pendingIndex], {}
|
@webContents._loadURL @history[@pendingIndex], {}
|
||||||
|
|
||||||
goToOffset: (offset) ->
|
goToOffset: (offset) ->
|
||||||
return unless @canGoToOffset offset
|
return unless @canGoToOffset offset
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{EventEmitter} = require 'events'
|
{EventEmitter} = require 'events'
|
||||||
{ipcMain, NavigationController, Menu} = require 'electron'
|
{deprecate, ipcMain, NavigationController, Menu} = require 'electron'
|
||||||
|
|
||||||
binding = process.atomBinding 'web_contents'
|
binding = process.atomBinding 'web_contents'
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ wrapWebContents = (webContents) ->
|
||||||
# Make sure webContents.executeJavaScript would run the code only when the
|
# Make sure webContents.executeJavaScript would run the code only when the
|
||||||
# web contents has been loaded.
|
# web contents has been loaded.
|
||||||
webContents.executeJavaScript = (code, hasUserGesture=false) ->
|
webContents.executeJavaScript = (code, hasUserGesture=false) ->
|
||||||
if @getUrl() and not @isLoading()
|
if @getURL() and not @isLoading()
|
||||||
@_executeJavaScript code, hasUserGesture
|
@_executeJavaScript code, hasUserGesture
|
||||||
else
|
else
|
||||||
webContents.once 'did-finish-load', @_executeJavaScript.bind(this, code, hasUserGesture)
|
webContents.once 'did-finish-load', @_executeJavaScript.bind(this, code, hasUserGesture)
|
||||||
|
@ -70,6 +70,10 @@ wrapWebContents = (webContents) ->
|
||||||
menu = Menu.buildFromTemplate params.menu
|
menu = Menu.buildFromTemplate params.menu
|
||||||
menu.popup params.x, params.y
|
menu.popup params.x, params.y
|
||||||
|
|
||||||
|
# Deprecated.
|
||||||
|
deprecate.rename webContents, 'loadUrl', 'loadURL'
|
||||||
|
deprecate.rename webContents, 'getUrl', 'getURL'
|
||||||
|
|
||||||
webContents.printToPDF = (options, callback) ->
|
webContents.printToPDF = (options, callback) ->
|
||||||
printingSetting =
|
printingSetting =
|
||||||
pageRage: []
|
pageRage: []
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace {
|
||||||
// Notice that we just combined the api key with the url together here, because
|
// Notice that we just combined the api key with the url together here, because
|
||||||
// if we use the standard {url: key} format Chromium would override our key with
|
// if we use the standard {url: key} format Chromium would override our key with
|
||||||
// the predefined one in common.gypi of libchromiumcontent, which is empty.
|
// the predefined one in common.gypi of libchromiumcontent, which is empty.
|
||||||
const char* kGeolocationProviderUrl =
|
const char* kGeolocationProviderURL =
|
||||||
"https://www.googleapis.com/geolocation/v1/geolocate?key="
|
"https://www.googleapis.com/geolocation/v1/geolocate?key="
|
||||||
GOOGLEAPIS_API_KEY;
|
GOOGLEAPIS_API_KEY;
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ void AtomAccessTokenStore::LoadAccessTokens(
|
||||||
const LoadAccessTokensCallbackType& callback) {
|
const LoadAccessTokensCallbackType& callback) {
|
||||||
AccessTokenSet access_token_set;
|
AccessTokenSet access_token_set;
|
||||||
|
|
||||||
// Equivelent to access_token_set[kGeolocationProviderUrl].
|
// Equivelent to access_token_set[kGeolocationProviderURL].
|
||||||
// Somehow base::string16 is causing compilation errors when used in a pair
|
// Somehow base::string16 is causing compilation errors when used in a pair
|
||||||
// of std::map on Linux, this can work around it.
|
// of std::map on Linux, this can work around it.
|
||||||
std::pair<GURL, base::string16> token_pair;
|
std::pair<GURL, base::string16> token_pair;
|
||||||
token_pair.first = GURL(kGeolocationProviderUrl);
|
token_pair.first = GURL(kGeolocationProviderURL);
|
||||||
access_token_set.insert(token_pair);
|
access_token_set.insert(token_pair);
|
||||||
|
|
||||||
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
|
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
|
||||||
|
|
|
@ -16,6 +16,6 @@ app.on('ready', function() {
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
useContentSize: true,
|
useContentSize: true,
|
||||||
});
|
});
|
||||||
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||||
mainWindow.focus();
|
mainWindow.focus();
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,7 +79,7 @@ createGuest = (embedder, params) ->
|
||||||
opts = {}
|
opts = {}
|
||||||
opts.httpReferrer = params.httpreferrer if params.httpreferrer
|
opts.httpReferrer = params.httpreferrer if params.httpreferrer
|
||||||
opts.userAgent = params.useragent if params.useragent
|
opts.userAgent = params.useragent if params.useragent
|
||||||
@loadUrl params.src, opts
|
@loadURL params.src, opts
|
||||||
|
|
||||||
if params.allowtransparency?
|
if params.allowtransparency?
|
||||||
@setAllowTransparency params.allowtransparency
|
@setAllowTransparency params.allowtransparency
|
||||||
|
@ -122,7 +122,7 @@ attachGuest = (embedder, elementInstanceId, guestInstanceId, params) ->
|
||||||
nodeIntegration: params.nodeintegration ? false
|
nodeIntegration: params.nodeintegration ? false
|
||||||
plugins: params.plugins
|
plugins: params.plugins
|
||||||
webSecurity: !params.disablewebsecurity
|
webSecurity: !params.disablewebsecurity
|
||||||
webPreferences.preloadUrl = params.preload if params.preload
|
webPreferences.preloadURL = params.preload if params.preload
|
||||||
webViewManager.addGuest guestInstanceId, elementInstanceId, embedder, guest, webPreferences
|
webViewManager.addGuest guestInstanceId, elementInstanceId, embedder, guest, webPreferences
|
||||||
|
|
||||||
guest.attachParams = params
|
guest.attachParams = params
|
||||||
|
|
|
@ -27,11 +27,11 @@ mergeBrowserWindowOptions = (embedder, options) ->
|
||||||
createGuest = (embedder, url, frameName, options) ->
|
createGuest = (embedder, url, frameName, options) ->
|
||||||
guest = frameToGuest[frameName]
|
guest = frameToGuest[frameName]
|
||||||
if frameName and guest?
|
if frameName and guest?
|
||||||
guest.loadUrl url
|
guest.loadURL url
|
||||||
return guest.id
|
return guest.id
|
||||||
|
|
||||||
guest = new BrowserWindow(options)
|
guest = new BrowserWindow(options)
|
||||||
guest.loadUrl url
|
guest.loadURL url
|
||||||
|
|
||||||
# Remember the embedder, will be used by window.opener methods.
|
# Remember the embedder, will be used by window.opener methods.
|
||||||
v8Util.setHiddenValue guest.webContents, 'embedder', embedder
|
v8Util.setHiddenValue guest.webContents, 'embedder', embedder
|
||||||
|
@ -74,12 +74,12 @@ ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD', (event, guestId, met
|
||||||
|
|
||||||
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', (event, guestId, message, targetOrigin) ->
|
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', (event, guestId, message, targetOrigin) ->
|
||||||
guestContents = BrowserWindow.fromId(guestId)?.webContents
|
guestContents = BrowserWindow.fromId(guestId)?.webContents
|
||||||
if guestContents?.getUrl().indexOf(targetOrigin) is 0 or targetOrigin is '*'
|
if guestContents?.getURL().indexOf(targetOrigin) is 0 or targetOrigin is '*'
|
||||||
guestContents.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', guestId, message, targetOrigin
|
guestContents.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', guestId, message, targetOrigin
|
||||||
|
|
||||||
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', (event, guestId, message, targetOrigin, sourceOrigin) ->
|
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', (event, guestId, message, targetOrigin, sourceOrigin) ->
|
||||||
embedder = v8Util.getHiddenValue event.sender, 'embedder'
|
embedder = v8Util.getHiddenValue event.sender, 'embedder'
|
||||||
if embedder?.getUrl().indexOf(targetOrigin) is 0 or targetOrigin is '*'
|
if embedder?.getURL().indexOf(targetOrigin) is 0 or targetOrigin is '*'
|
||||||
embedder.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', guestId, message, sourceOrigin
|
embedder.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', guestId, message, sourceOrigin
|
||||||
|
|
||||||
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', (event, guestId, method, args...) ->
|
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', (event, guestId, method, args...) ->
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
UrlRequestAsyncAsarJob::UrlRequestAsyncAsarJob(
|
URLRequestAsyncAsarJob::URLRequestAsyncAsarJob(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
net::NetworkDelegate* network_delegate)
|
net::NetworkDelegate* network_delegate)
|
||||||
: JsAsker<asar::URLRequestAsarJob>(request, network_delegate) {
|
: JsAsker<asar::URLRequestAsarJob>(request, network_delegate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UrlRequestAsyncAsarJob::StartAsync(scoped_ptr<base::Value> options) {
|
void URLRequestAsyncAsarJob::StartAsync(scoped_ptr<base::Value> options) {
|
||||||
base::FilePath::StringType file_path;
|
base::FilePath::StringType file_path;
|
||||||
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
|
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
|
||||||
static_cast<base::DictionaryValue*>(options.get())->GetString(
|
static_cast<base::DictionaryValue*>(options.get())->GetString(
|
||||||
|
|
|
@ -11,15 +11,15 @@
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
// Like URLRequestAsarJob, but asks the JavaScript handler for file path.
|
// Like URLRequestAsarJob, but asks the JavaScript handler for file path.
|
||||||
class UrlRequestAsyncAsarJob : public JsAsker<asar::URLRequestAsarJob> {
|
class URLRequestAsyncAsarJob : public JsAsker<asar::URLRequestAsarJob> {
|
||||||
public:
|
public:
|
||||||
UrlRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*);
|
URLRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*);
|
||||||
|
|
||||||
// JsAsker:
|
// JsAsker:
|
||||||
void StartAsync(scoped_ptr<base::Value> options) override;
|
void StartAsync(scoped_ptr<base::Value> options) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(UrlRequestAsyncAsarJob);
|
DISALLOW_COPY_AND_ASSIGN(URLRequestAsyncAsarJob);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -113,7 +113,7 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
|
||||||
command_line->AppendSwitchNative(switches::kPreloadScript, preload);
|
command_line->AppendSwitchNative(switches::kPreloadScript, preload);
|
||||||
else
|
else
|
||||||
LOG(ERROR) << "preload script must have absolute path.";
|
LOG(ERROR) << "preload script must have absolute path.";
|
||||||
} else if (web_preferences.GetString(options::kPreloadUrl, &preload)) {
|
} else if (web_preferences.GetString(options::kPreloadURL, &preload)) {
|
||||||
// Translate to file path if there is "preload-url" option.
|
// Translate to file path if there is "preload-url" option.
|
||||||
base::FilePath preload_path;
|
base::FilePath preload_path;
|
||||||
if (net::FileURLToFilePath(GURL(preload), &preload_path))
|
if (net::FileURLToFilePath(GURL(preload), &preload_path))
|
||||||
|
|
|
@ -168,7 +168,8 @@ mate::ObjectTemplateBuilder NativeImage::GetObjectTemplateBuilder(
|
||||||
template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate)
|
template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate)
|
||||||
.SetMethod("toPng", &NativeImage::ToPNG)
|
.SetMethod("toPng", &NativeImage::ToPNG)
|
||||||
.SetMethod("toJpeg", &NativeImage::ToJPEG)
|
.SetMethod("toJpeg", &NativeImage::ToJPEG)
|
||||||
.SetMethod("toDataUrl", &NativeImage::ToDataURL)
|
.SetMethod("toDataURL", &NativeImage::ToDataURL)
|
||||||
|
.SetMethod("toDataUrl", &NativeImage::ToDataURL) // deprecated.
|
||||||
.SetMethod("isEmpty", &NativeImage::IsEmpty)
|
.SetMethod("isEmpty", &NativeImage::IsEmpty)
|
||||||
.SetMethod("getSize", &NativeImage::GetSize)
|
.SetMethod("getSize", &NativeImage::GetSize)
|
||||||
.SetMethod("setTemplateImage", &NativeImage::SetTemplateImage)
|
.SetMethod("setTemplateImage", &NativeImage::SetTemplateImage)
|
||||||
|
@ -309,7 +310,7 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
||||||
dict.SetMethod("createEmpty", &atom::api::NativeImage::CreateEmpty);
|
dict.SetMethod("createEmpty", &atom::api::NativeImage::CreateEmpty);
|
||||||
dict.SetMethod("createFromPath", &atom::api::NativeImage::CreateFromPath);
|
dict.SetMethod("createFromPath", &atom::api::NativeImage::CreateFromPath);
|
||||||
dict.SetMethod("createFromBuffer", &atom::api::NativeImage::CreateFromBuffer);
|
dict.SetMethod("createFromBuffer", &atom::api::NativeImage::CreateFromBuffer);
|
||||||
dict.SetMethod("createFromDataUrl",
|
dict.SetMethod("createFromDataURL",
|
||||||
&atom::api::NativeImage::CreateFromDataURL);
|
&atom::api::NativeImage::CreateFromDataURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
binding = process.atomBinding 'crash_reporter'
|
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
os = require 'os'
|
os = require 'os'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
{spawn} = require 'child_process'
|
{spawn} = require 'child_process'
|
||||||
|
|
||||||
|
electron = require 'electron'
|
||||||
|
binding = process.atomBinding 'crash_reporter'
|
||||||
|
|
||||||
class CrashReporter
|
class CrashReporter
|
||||||
start: (options={}) ->
|
start: (options={}) ->
|
||||||
{@productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler, extra} = options
|
{@productName, companyName, submitURL, autoSubmit, ignoreSystemCrashHandler, extra} = options
|
||||||
|
|
||||||
|
# Deprecated.
|
||||||
|
{deprecate} = electron
|
||||||
|
if options.submitUrl
|
||||||
|
submitURL ?= options.submitUrl
|
||||||
|
deprecate.warn 'submitUrl', 'submitURL'
|
||||||
|
|
||||||
electron = require 'electron'
|
|
||||||
{app} =
|
{app} =
|
||||||
if process.type is 'browser'
|
if process.type is 'browser'
|
||||||
electron
|
electron
|
||||||
|
@ -17,7 +24,7 @@ class CrashReporter
|
||||||
|
|
||||||
@productName ?= app.getName()
|
@productName ?= app.getName()
|
||||||
companyName ?= 'GitHub, Inc'
|
companyName ?= 'GitHub, Inc'
|
||||||
submitUrl ?= 'http://54.249.141.255:1127/post'
|
submitURL ?= 'http://54.249.141.255:1127/post'
|
||||||
autoSubmit ?= true
|
autoSubmit ?= true
|
||||||
ignoreSystemCrashHandler ?= false
|
ignoreSystemCrashHandler ?= false
|
||||||
extra ?= {}
|
extra ?= {}
|
||||||
|
@ -26,11 +33,11 @@ class CrashReporter
|
||||||
extra._companyName ?= companyName
|
extra._companyName ?= companyName
|
||||||
extra._version ?= app.getVersion()
|
extra._version ?= app.getVersion()
|
||||||
|
|
||||||
start = => binding.start @productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler, extra
|
start = => binding.start @productName, companyName, submitURL, autoSubmit, ignoreSystemCrashHandler, extra
|
||||||
|
|
||||||
if process.platform is 'win32'
|
if process.platform is 'win32'
|
||||||
args = [
|
args = [
|
||||||
"--reporter-url=#{submitUrl}"
|
"--reporter-url=#{submitURL}"
|
||||||
"--application-name=#{@productName}"
|
"--application-name=#{@productName}"
|
||||||
"--v=1"
|
"--v=1"
|
||||||
]
|
]
|
||||||
|
|
|
@ -1 +1,7 @@
|
||||||
module.exports = process.atomBinding 'native_image'
|
{deprecate} = require 'electron'
|
||||||
|
nativeImage = process.atomBinding 'native_image'
|
||||||
|
|
||||||
|
# Deprecated.
|
||||||
|
deprecate.rename nativeImage, 'createFromDataUrl', 'createFromDataURL'
|
||||||
|
|
||||||
|
module.exports = nativeImage
|
||||||
|
|
|
@ -77,7 +77,7 @@ const char kZoomFactor[] = "zoomFactor";
|
||||||
const char kPreloadScript[] = "preload";
|
const char kPreloadScript[] = "preload";
|
||||||
|
|
||||||
// Like --preload, but the passed argument is an URL.
|
// Like --preload, but the passed argument is an URL.
|
||||||
const char kPreloadUrl[] = "preloadUrl";
|
const char kPreloadURL[] = "preloadURL";
|
||||||
|
|
||||||
// Enable the node integration.
|
// Enable the node integration.
|
||||||
const char kNodeIntegration[] = "nodeIntegration";
|
const char kNodeIntegration[] = "nodeIntegration";
|
||||||
|
@ -133,7 +133,7 @@ const char kAppUserModelId[] = "app-user-model-id";
|
||||||
// The command line switch versions of the options.
|
// The command line switch versions of the options.
|
||||||
const char kZoomFactor[] = "zoom-factor";
|
const char kZoomFactor[] = "zoom-factor";
|
||||||
const char kPreloadScript[] = "preload";
|
const char kPreloadScript[] = "preload";
|
||||||
const char kPreloadUrl[] = "preload-url";
|
const char kPreloadURL[] = "preload-url";
|
||||||
const char kNodeIntegration[] = "node-integration";
|
const char kNodeIntegration[] = "node-integration";
|
||||||
const char kGuestInstanceID[] = "guest-instance-id";
|
const char kGuestInstanceID[] = "guest-instance-id";
|
||||||
const char kExperimentalFeatures[] = "experimental-features";
|
const char kExperimentalFeatures[] = "experimental-features";
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern const char kWebPreferences[];
|
||||||
extern const char kDirectWrite[];
|
extern const char kDirectWrite[];
|
||||||
extern const char kZoomFactor[];
|
extern const char kZoomFactor[];
|
||||||
extern const char kPreloadScript[];
|
extern const char kPreloadScript[];
|
||||||
extern const char kPreloadUrl[];
|
extern const char kPreloadURL[];
|
||||||
extern const char kNodeIntegration[];
|
extern const char kNodeIntegration[];
|
||||||
extern const char kGuestInstanceID[];
|
extern const char kGuestInstanceID[];
|
||||||
extern const char kExperimentalFeatures[];
|
extern const char kExperimentalFeatures[];
|
||||||
|
@ -73,7 +73,7 @@ extern const char kAppUserModelId[];
|
||||||
|
|
||||||
extern const char kZoomFactor[];
|
extern const char kZoomFactor[];
|
||||||
extern const char kPreloadScript[];
|
extern const char kPreloadScript[];
|
||||||
extern const char kPreloadUrl[];
|
extern const char kPreloadURL[];
|
||||||
extern const char kNodeIntegration[];
|
extern const char kNodeIntegration[];
|
||||||
extern const char kGuestInstanceID[];
|
extern const char kGuestInstanceID[];
|
||||||
extern const char kExperimentalFeatures[];
|
extern const char kExperimentalFeatures[];
|
||||||
|
|
|
@ -307,8 +307,8 @@ bool OpenExternal(const GURL& url) {
|
||||||
// "Some versions of windows (Win2k before SP3, Win XP before SP1) crash in
|
// "Some versions of windows (Win2k before SP3, Win XP before SP1) crash in
|
||||||
// ShellExecute on long URLs (bug 161357 on bugzilla.mozilla.org). IE 5 and 6
|
// ShellExecute on long URLs (bug 161357 on bugzilla.mozilla.org). IE 5 and 6
|
||||||
// support URLS of 2083 chars in length, 2K is safe."
|
// support URLS of 2083 chars in length, 2K is safe."
|
||||||
const size_t kMaxUrlLength = 2048;
|
const size_t kMaxURLLength = 2048;
|
||||||
if (escaped_url.length() > kMaxUrlLength) {
|
if (escaped_url.length() > kMaxURLLength) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ void WebFrame::RegisterURLSchemeAsSecure(const std::string& scheme) {
|
||||||
blink::WebString::fromUTF8(scheme));
|
blink::WebString::fromUTF8(scheme));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebFrame::RegisterURLSchemeAsBypassingCsp(const std::string& scheme) {
|
void WebFrame::RegisterURLSchemeAsBypassingCSP(const std::string& scheme) {
|
||||||
// Register scheme to bypass pages's Content Security Policy.
|
// Register scheme to bypass pages's Content Security Policy.
|
||||||
blink::WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(
|
blink::WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(
|
||||||
blink::WebString::fromUTF8(scheme));
|
blink::WebString::fromUTF8(scheme));
|
||||||
|
@ -129,11 +129,11 @@ mate::ObjectTemplateBuilder WebFrame::GetObjectTemplateBuilder(
|
||||||
&WebFrame::RegisterElementResizeCallback)
|
&WebFrame::RegisterElementResizeCallback)
|
||||||
.SetMethod("attachGuest", &WebFrame::AttachGuest)
|
.SetMethod("attachGuest", &WebFrame::AttachGuest)
|
||||||
.SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider)
|
.SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider)
|
||||||
.SetMethod("registerUrlSchemeAsSecure",
|
.SetMethod("registerURLSchemeAsSecure",
|
||||||
&WebFrame::RegisterURLSchemeAsSecure)
|
&WebFrame::RegisterURLSchemeAsSecure)
|
||||||
.SetMethod("registerUrlSchemeAsBypassingCsp",
|
.SetMethod("registerURLSchemeAsBypassingCSP",
|
||||||
&WebFrame::RegisterURLSchemeAsBypassingCsp)
|
&WebFrame::RegisterURLSchemeAsBypassingCSP)
|
||||||
.SetMethod("registerUrlSchemeAsPrivileged",
|
.SetMethod("registerURLSchemeAsPrivileged",
|
||||||
&WebFrame::RegisterURLSchemeAsPrivileged);
|
&WebFrame::RegisterURLSchemeAsPrivileged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class WebFrame : public mate::Wrappable {
|
||||||
v8::Local<v8::Object> provider);
|
v8::Local<v8::Object> provider);
|
||||||
|
|
||||||
void RegisterURLSchemeAsSecure(const std::string& scheme);
|
void RegisterURLSchemeAsSecure(const std::string& scheme);
|
||||||
void RegisterURLSchemeAsBypassingCsp(const std::string& scheme);
|
void RegisterURLSchemeAsBypassingCSP(const std::string& scheme);
|
||||||
void RegisterURLSchemeAsPrivileged(const std::string& scheme);
|
void RegisterURLSchemeAsPrivileged(const std::string& scheme);
|
||||||
|
|
||||||
// mate::Wrappable:
|
// mate::Wrappable:
|
||||||
|
|
|
@ -1 +1,9 @@
|
||||||
module.exports = process.atomBinding('web_frame').webFrame
|
{deprecate} = require 'electron'
|
||||||
|
{webFrame} = process.atomBinding 'web_frame'
|
||||||
|
|
||||||
|
# Deprecated.
|
||||||
|
deprecate.rename webFrame, 'registerUrlSchemeAsSecure', 'registerURLSchemeAsSecure'
|
||||||
|
deprecate.rename webFrame, 'registerUrlSchemeAsBypassingCSP', 'registerURLSchemeAsBypassingCSP'
|
||||||
|
deprecate.rename webFrame, 'registerUrlSchemeAsPrivileged', 'registerURLSchemeAsPrivileged'
|
||||||
|
|
||||||
|
module.exports = webFrame
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Helper function to resolve relative url.
|
# Helper function to resolve relative url.
|
||||||
a = window.top.document.createElement 'a'
|
a = window.top.document.createElement 'a'
|
||||||
resolveUrl = (url) ->
|
resolveURL = (url) ->
|
||||||
a.href = url
|
a.href = url
|
||||||
a.href
|
a.href
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ window.open = (url, frameName='', features='') ->
|
||||||
options.height ?= 600
|
options.height ?= 600
|
||||||
|
|
||||||
# Resolve relative urls.
|
# Resolve relative urls.
|
||||||
url = resolveUrl url
|
url = resolveURL url
|
||||||
|
|
||||||
(options[name] = parseInt(options[name], 10) if options[name]?) for name in ints
|
(options[name] = parseInt(options[name], 10) if options[name]?) for name in ints
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,14 @@ requestId = 0
|
||||||
WEB_VIEW_EVENTS =
|
WEB_VIEW_EVENTS =
|
||||||
'load-commit': ['url', 'isMainFrame']
|
'load-commit': ['url', 'isMainFrame']
|
||||||
'did-finish-load': []
|
'did-finish-load': []
|
||||||
'did-fail-load': ['errorCode', 'errorDescription', 'validatedUrl']
|
'did-fail-load': ['errorCode', 'errorDescription', 'validatedURL']
|
||||||
'did-frame-finish-load': ['isMainFrame']
|
'did-frame-finish-load': ['isMainFrame']
|
||||||
'did-start-loading': []
|
'did-start-loading': []
|
||||||
'did-stop-loading': []
|
'did-stop-loading': []
|
||||||
'did-get-response-details': ['status', 'newUrl', 'originalUrl',
|
'did-get-response-details': ['status', 'newURL', 'originalURL',
|
||||||
'httpResponseCode', 'requestMethod', 'referrer',
|
'httpResponseCode', 'requestMethod', 'referrer',
|
||||||
'headers']
|
'headers']
|
||||||
'did-get-redirect-request': ['oldUrl', 'newUrl', 'isMainFrame']
|
'did-get-redirect-request': ['oldURL', 'newURL', 'isMainFrame']
|
||||||
'dom-ready': []
|
'dom-ready': []
|
||||||
'console-message': ['level', 'message', 'line', 'sourceId']
|
'console-message': ['level', 'message', 'line', 'sourceId']
|
||||||
'new-window': ['url', 'frameName', 'disposition', 'options']
|
'new-window': ['url', 'frameName', 'disposition', 'options']
|
||||||
|
|
|
@ -6,7 +6,7 @@ webViewConstants = require './web-view-constants'
|
||||||
|
|
||||||
# Helper function to resolve url set in attribute.
|
# Helper function to resolve url set in attribute.
|
||||||
a = document.createElement 'a'
|
a = document.createElement 'a'
|
||||||
resolveUrl = (url) ->
|
resolveURL = (url) ->
|
||||||
a.href = url
|
a.href = url
|
||||||
a.href
|
a.href
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class SrcAttribute extends WebViewAttribute
|
||||||
|
|
||||||
getValue: ->
|
getValue: ->
|
||||||
if @webViewImpl.webviewNode.hasAttribute @name
|
if @webViewImpl.webviewNode.hasAttribute @name
|
||||||
resolveUrl @webViewImpl.webviewNode.getAttribute(@name)
|
resolveURL @webViewImpl.webviewNode.getAttribute(@name)
|
||||||
else
|
else
|
||||||
''
|
''
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class SrcAttribute extends WebViewAttribute
|
||||||
if useragent then opts.userAgent = useragent
|
if useragent then opts.userAgent = useragent
|
||||||
|
|
||||||
guestContents = remote.getGuestWebContents(@webViewImpl.guestInstanceId)
|
guestContents = remote.getGuestWebContents(@webViewImpl.guestInstanceId)
|
||||||
guestContents.loadUrl @getValue(), opts
|
guestContents.loadURL @getValue(), opts
|
||||||
|
|
||||||
# Attribute specifies HTTP referrer.
|
# Attribute specifies HTTP referrer.
|
||||||
class HttpReferrerAttribute extends WebViewAttribute
|
class HttpReferrerAttribute extends WebViewAttribute
|
||||||
|
@ -197,7 +197,7 @@ class PreloadAttribute extends WebViewAttribute
|
||||||
|
|
||||||
getValue: ->
|
getValue: ->
|
||||||
return '' unless @webViewImpl.webviewNode.hasAttribute @name
|
return '' unless @webViewImpl.webviewNode.hasAttribute @name
|
||||||
preload = resolveUrl @webViewImpl.webviewNode.getAttribute(@name)
|
preload = resolveURL @webViewImpl.webviewNode.getAttribute(@name)
|
||||||
protocol = preload.substr 0, 5
|
protocol = preload.substr 0, 5
|
||||||
unless protocol is 'file:'
|
unless protocol is 'file:'
|
||||||
console.error webViewConstants.ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE
|
console.error webViewConstants.ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{webFrame, remote} = require 'electron'
|
{deprecate, webFrame, remote} = require 'electron'
|
||||||
v8Util = process.atomBinding 'v8_util'
|
v8Util = process.atomBinding 'v8_util'
|
||||||
|
|
||||||
guestViewInternal = require './guest-view-internal'
|
guestViewInternal = require './guest-view-internal'
|
||||||
|
@ -252,49 +252,49 @@ registerWebViewElement = ->
|
||||||
|
|
||||||
# Public-facing API methods.
|
# Public-facing API methods.
|
||||||
methods = [
|
methods = [
|
||||||
"getUrl"
|
'getURL'
|
||||||
"getTitle"
|
'getTitle'
|
||||||
"isLoading"
|
'isLoading'
|
||||||
"isWaitingForResponse"
|
'isWaitingForResponse'
|
||||||
"stop"
|
'stop'
|
||||||
"reload"
|
'reload'
|
||||||
"reloadIgnoringCache"
|
'reloadIgnoringCache'
|
||||||
"canGoBack"
|
'canGoBack'
|
||||||
"canGoForward"
|
'canGoForward'
|
||||||
"canGoToOffset"
|
'canGoToOffset'
|
||||||
"clearHistory"
|
'clearHistory'
|
||||||
"goBack"
|
'goBack'
|
||||||
"goForward"
|
'goForward'
|
||||||
"goToIndex"
|
'goToIndex'
|
||||||
"goToOffset"
|
'goToOffset'
|
||||||
"isCrashed"
|
'isCrashed'
|
||||||
"setUserAgent"
|
'setUserAgent'
|
||||||
"getUserAgent"
|
'getUserAgent'
|
||||||
"executeJavaScript"
|
'executeJavaScript'
|
||||||
"insertCSS"
|
'insertCSS'
|
||||||
"openDevTools"
|
'openDevTools'
|
||||||
"closeDevTools"
|
'closeDevTools'
|
||||||
"isDevToolsOpened"
|
'isDevToolsOpened'
|
||||||
"inspectElement"
|
'inspectElement'
|
||||||
"setAudioMuted"
|
'setAudioMuted'
|
||||||
"isAudioMuted"
|
'isAudioMuted'
|
||||||
"undo"
|
'undo'
|
||||||
"redo"
|
'redo'
|
||||||
"cut"
|
'cut'
|
||||||
"copy"
|
'copy'
|
||||||
"paste"
|
'paste'
|
||||||
"pasteAndMatchStyle"
|
'pasteAndMatchStyle'
|
||||||
"delete"
|
'delete'
|
||||||
"selectAll"
|
'selectAll'
|
||||||
"unselect"
|
'unselect'
|
||||||
"replace"
|
'replace'
|
||||||
"replaceMisspelling"
|
'replaceMisspelling'
|
||||||
"send"
|
'send'
|
||||||
"getId"
|
'getId'
|
||||||
"inspectServiceWorker"
|
'inspectServiceWorker'
|
||||||
"print"
|
'print'
|
||||||
"printToPDF"
|
'printToPDF'
|
||||||
"sendInputEvent"
|
'sendInputEvent'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Forward proto.foo* method calls to WebViewImpl.foo*.
|
# Forward proto.foo* method calls to WebViewImpl.foo*.
|
||||||
|
@ -304,6 +304,9 @@ registerWebViewElement = ->
|
||||||
internal.webContents[m] args...
|
internal.webContents[m] args...
|
||||||
proto[m] = createHandler m for m in methods
|
proto[m] = createHandler m for m in methods
|
||||||
|
|
||||||
|
# Deprecated.
|
||||||
|
deprecate.rename proto, 'getUrl', 'getURL'
|
||||||
|
|
||||||
window.WebView = webFrame.registerEmbedderCustomElement 'webview',
|
window.WebView = webFrame.registerEmbedderCustomElement 'webview',
|
||||||
prototype: proto
|
prototype: proto
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ Returns:
|
||||||
* `releaseNotes` String
|
* `releaseNotes` String
|
||||||
* `releaseName` String
|
* `releaseName` String
|
||||||
* `releaseDate` Date
|
* `releaseDate` Date
|
||||||
* `updateUrl` String
|
* `updateURL` String
|
||||||
|
|
||||||
Emitted when an update has been downloaded.
|
Emitted when an update has been downloaded.
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ On Windows only `releaseName` is available.
|
||||||
|
|
||||||
The `autoUpdater` object has the following methods:
|
The `autoUpdater` object has the following methods:
|
||||||
|
|
||||||
### `autoUpdater.setFeedUrl(url)`
|
### `autoUpdater.setFeedURL(url)`
|
||||||
|
|
||||||
* `url` String
|
* `url` String
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ once it is set.
|
||||||
|
|
||||||
### `autoUpdater.checkForUpdates()`
|
### `autoUpdater.checkForUpdates()`
|
||||||
|
|
||||||
Asks the server whether there is an update. You must call `setFeedUrl` before
|
Asks the server whether there is an update. You must call `setFeedURL` before
|
||||||
using this API.
|
using this API.
|
||||||
|
|
||||||
### `autoUpdater.quitAndInstall()`
|
### `autoUpdater.quitAndInstall()`
|
||||||
|
|
|
@ -11,7 +11,7 @@ win.on('closed', function() {
|
||||||
win = null;
|
win = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
win.loadUrl('https://github.com');
|
win.loadURL('https://github.com');
|
||||||
win.show();
|
win.show();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -613,9 +613,9 @@ Same as `webContents.print([options])`
|
||||||
|
|
||||||
Same as `webContents.printToPDF(options, callback)`
|
Same as `webContents.printToPDF(options, callback)`
|
||||||
|
|
||||||
### `win.loadUrl(url[, options])`
|
### `win.loadURL(url[, options])`
|
||||||
|
|
||||||
Same as `webContents.loadUrl(url[, options])`.
|
Same as `webContents.loadURL(url[, options])`.
|
||||||
|
|
||||||
### `win.reload()`
|
### `win.reload()`
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ const crashReporter = require('electron').crashReporter;
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
productName: 'YourName',
|
productName: 'YourName',
|
||||||
companyName: 'YourCompany',
|
companyName: 'YourCompany',
|
||||||
submitUrl: 'https://your-domain.com/url-to-submit',
|
submitURL: 'https://your-domain.com/url-to-submit',
|
||||||
autoSubmit: true
|
autoSubmit: true
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
@ -26,7 +26,7 @@ The `crash-reporter` module has the following methods:
|
||||||
|
|
||||||
* `productName` String, default: Electron.
|
* `productName` String, default: Electron.
|
||||||
* `companyName` String, default: GitHub, Inc.
|
* `companyName` String, default: GitHub, Inc.
|
||||||
* `submitUrl` String, default: http://54.249.141.255:1127/post.
|
* `submitURL` String, default: http://54.249.141.255:1127/post.
|
||||||
* URL that crash reports will be sent to as POST.
|
* URL that crash reports will be sent to as POST.
|
||||||
* `autoSubmit` Boolean, default: `true`.
|
* `autoSubmit` Boolean, default: `true`.
|
||||||
* Send the crash report without user interaction.
|
* Send the crash report without user interaction.
|
||||||
|
@ -57,7 +57,7 @@ ID.
|
||||||
|
|
||||||
## crash-reporter Payload
|
## crash-reporter Payload
|
||||||
|
|
||||||
The crash reporter will send the following data to the `submitUrl` as `POST`:
|
The crash reporter will send the following data to the `submitURL` as `POST`:
|
||||||
|
|
||||||
* `ver` String - The version of Electron.
|
* `ver` String - The version of Electron.
|
||||||
* `platform` String - e.g. 'win32'.
|
* `platform` String - e.g. 'win32'.
|
||||||
|
|
|
@ -66,7 +66,7 @@ Resumes the download that has been paused.
|
||||||
|
|
||||||
Cancels the download operation.
|
Cancels the download operation.
|
||||||
|
|
||||||
### `downloadItem.getUrl()`
|
### `downloadItem.getURL()`
|
||||||
|
|
||||||
Returns a `String` represents the origin url where the item is downloaded from.
|
Returns a `String` represents the origin url where the item is downloaded from.
|
||||||
|
|
||||||
|
|
|
@ -103,11 +103,11 @@ Creates a new `nativeImage` instance from a file located at `path`.
|
||||||
Creates a new `nativeImage` instance from `buffer`. The default `scaleFactor` is
|
Creates a new `nativeImage` instance from `buffer`. The default `scaleFactor` is
|
||||||
1.0.
|
1.0.
|
||||||
|
|
||||||
### `nativeImage.createFromDataUrl(dataUrl)`
|
### `nativeImage.createFromDataURL(dataURL)`
|
||||||
|
|
||||||
* `dataUrl` String
|
* `dataURL` String
|
||||||
|
|
||||||
Creates a new `nativeImage` instance from `dataUrl`.
|
Creates a new `nativeImage` instance from `dataURL`.
|
||||||
|
|
||||||
## Instance Methods
|
## Instance Methods
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ Returns a [Buffer][buffer] that contains the image's `PNG` encoded data.
|
||||||
|
|
||||||
Returns a [Buffer][buffer] that contains the image's `JPEG` encoded data.
|
Returns a [Buffer][buffer] that contains the image's `JPEG` encoded data.
|
||||||
|
|
||||||
### `image.toDataUrl()`
|
### `image.toDataURL()`
|
||||||
|
|
||||||
Returns the data URL of the image.
|
Returns the data URL of the image.
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ const remote = require('electron').remote;
|
||||||
const BrowserWindow = remote.require('electron').BrowserWindow;
|
const BrowserWindow = remote.require('electron').BrowserWindow;
|
||||||
|
|
||||||
var win = new BrowserWindow({ width: 800, height: 600 });
|
var win = new BrowserWindow({ width: 800, height: 600 });
|
||||||
win.loadUrl('https://github.com');
|
win.loadURL('https://github.com');
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** for the reverse (access the renderer process from the main process),
|
**Note:** for the reverse (access the renderer process from the main process),
|
||||||
|
|
|
@ -8,7 +8,7 @@ instance of `BrowserWindow`. For example:
|
||||||
const BrowserWindow = require('electron').BrowserWindow;
|
const BrowserWindow = require('electron').BrowserWindow;
|
||||||
|
|
||||||
var win = new BrowserWindow({ width: 800, height: 600 });
|
var win = new BrowserWindow({ width: 800, height: 600 });
|
||||||
win.loadUrl("http://github.com");
|
win.loadURL("http://github.com");
|
||||||
|
|
||||||
var session = win.webContents.session
|
var session = win.webContents.session
|
||||||
```
|
```
|
||||||
|
@ -28,7 +28,7 @@ Calling `event.preventDefault()` will cancel the download.
|
||||||
```javascript
|
```javascript
|
||||||
session.on('will-download', function(event, item, webContents) {
|
session.on('will-download', function(event, item, webContents) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
require('request')(item.getUrl(), function(data) {
|
require('request')(item.getURL(), function(data) {
|
||||||
require('fs').writeFileSync('/somewhere', data);
|
require('fs').writeFileSync('/somewhere', data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -47,7 +47,7 @@ const BrowserWindow = require('electron').BrowserWindow;
|
||||||
|
|
||||||
var win = new BrowserWindow({ width: 800, height: 600 });
|
var win = new BrowserWindow({ width: 800, height: 600 });
|
||||||
|
|
||||||
win.loadUrl('https://github.com');
|
win.loadURL('https://github.com');
|
||||||
|
|
||||||
win.webContents.on('did-finish-load', function() {
|
win.webContents.on('did-finish-load', function() {
|
||||||
// Query all cookies.
|
// Query all cookies.
|
||||||
|
|
|
@ -25,7 +25,7 @@ var window = null;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
window = new BrowserWindow({width: 800, height: 600});
|
window = new BrowserWindow({width: 800, height: 600});
|
||||||
window.loadUrl('https://github.com');
|
window.loadURL('https://github.com');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ the [`BrowserWindow`](browser-window.md) object. An example of accessing the
|
||||||
const BrowserWindow = require('electron').BrowserWindow;
|
const BrowserWindow = require('electron').BrowserWindow;
|
||||||
|
|
||||||
var win = new BrowserWindow({width: 800, height: 1500});
|
var win = new BrowserWindow({width: 800, height: 1500});
|
||||||
win.loadUrl("http://github.com");
|
win.loadURL("http://github.com");
|
||||||
|
|
||||||
var webContents = win.webContents;
|
var webContents = win.webContents;
|
||||||
```
|
```
|
||||||
|
@ -32,7 +32,7 @@ Returns:
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `errorCode` Integer
|
* `errorCode` Integer
|
||||||
* `errorDescription` String
|
* `errorDescription` String
|
||||||
* `validatedUrl` String
|
* `validatedURL` String
|
||||||
|
|
||||||
This event is like `did-finish-load` but emitted when the load failed or was
|
This event is like `did-finish-load` but emitted when the load failed or was
|
||||||
cancelled, e.g. `window.stop()` is invoked.
|
cancelled, e.g. `window.stop()` is invoked.
|
||||||
|
@ -61,8 +61,8 @@ Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `status` Boolean
|
* `status` Boolean
|
||||||
* `newUrl` String
|
* `newURL` String
|
||||||
* `originalUrl` String
|
* `originalURL` String
|
||||||
* `httpResponseCode` Integer
|
* `httpResponseCode` Integer
|
||||||
* `requestMethod` String
|
* `requestMethod` String
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
|
@ -76,8 +76,8 @@ Emitted when details regarding a requested resource are available.
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `oldUrl` String
|
* `oldURL` String
|
||||||
* `newUrl` String
|
* `newURL` String
|
||||||
* `isMainFrame` Boolean
|
* `isMainFrame` Boolean
|
||||||
* `httpResponseCode` Integer
|
* `httpResponseCode` Integer
|
||||||
* `requestMethod` String
|
* `requestMethod` String
|
||||||
|
@ -99,7 +99,7 @@ Emitted when the document in the given frame is loaded.
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `favicons` Array - Array of Urls
|
* `favicons` Array - Array of URLs
|
||||||
|
|
||||||
Emitted when page receives favicon urls.
|
Emitted when page receives favicon urls.
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ Emitted when a user or the page wants to start navigation. It can happen when th
|
||||||
`window.location` object is changed or a user clicks a link in the page.
|
`window.location` object is changed or a user clicks a link in the page.
|
||||||
|
|
||||||
This event will not emit when the navigation is started programmatically with
|
This event will not emit when the navigation is started programmatically with
|
||||||
APIs like `webContents.loadUrl` and `webContents.back`.
|
APIs like `webContents.loadURL` and `webContents.back`.
|
||||||
|
|
||||||
Calling `event.preventDefault()` will prevent the navigation.
|
Calling `event.preventDefault()` will prevent the navigation.
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ Returns the `session` object used by this webContents.
|
||||||
|
|
||||||
See [session documentation](session.md) for this object's methods.
|
See [session documentation](session.md) for this object's methods.
|
||||||
|
|
||||||
### `webContents.loadUrl(url[, options])`
|
### `webContents.loadURL(url[, options])`
|
||||||
|
|
||||||
* `url` URL
|
* `url` URL
|
||||||
* `options` Object (optional), properties:
|
* `options` Object (optional), properties:
|
||||||
|
@ -209,15 +209,15 @@ See [session documentation](session.md) for this object's methods.
|
||||||
Loads the `url` in the window, the `url` must contain the protocol prefix,
|
Loads the `url` in the window, the `url` must contain the protocol prefix,
|
||||||
e.g. the `http://` or `file://`.
|
e.g. the `http://` or `file://`.
|
||||||
|
|
||||||
### `webContents.getUrl()`
|
### `webContents.getURL()`
|
||||||
|
|
||||||
Returns URL of the current web page.
|
Returns URL of the current web page.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var win = new BrowserWindow({width: 800, height: 600});
|
var win = new BrowserWindow({width: 800, height: 600});
|
||||||
win.loadUrl("http://github.com");
|
win.loadURL("http://github.com");
|
||||||
|
|
||||||
var currentUrl = win.webContents.getUrl();
|
var currentURL = win.webContents.getURL();
|
||||||
```
|
```
|
||||||
|
|
||||||
### `webContents.getTitle()`
|
### `webContents.getTitle()`
|
||||||
|
@ -447,7 +447,7 @@ const BrowserWindow = require('electron').BrowserWindow;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
var win = new BrowserWindow({width: 800, height: 600});
|
var win = new BrowserWindow({width: 800, height: 600});
|
||||||
win.loadUrl("http://github.com");
|
win.loadURL("http://github.com");
|
||||||
|
|
||||||
win.webContents.on("did-finish-load", function() {
|
win.webContents.on("did-finish-load", function() {
|
||||||
// Use default printing options
|
// Use default printing options
|
||||||
|
@ -524,7 +524,7 @@ An example of sending messages from the main process to the renderer process:
|
||||||
var window = null;
|
var window = null;
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
window = new BrowserWindow({width: 800, height: 600});
|
window = new BrowserWindow({width: 800, height: 600});
|
||||||
window.loadUrl('file://' + __dirname + '/index.html');
|
window.loadURL('file://' + __dirname + '/index.html');
|
||||||
window.webContents.on('did-finish-load', function() {
|
window.webContents.on('did-finish-load', function() {
|
||||||
window.webContents.send('ping', 'whoooooooh!');
|
window.webContents.send('ping', 'whoooooooh!');
|
||||||
});
|
});
|
||||||
|
@ -660,7 +660,7 @@ when the DevTools has been closed.
|
||||||
Returns true if the process of saving page has been initiated successfully.
|
Returns true if the process of saving page has been initiated successfully.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
win.loadUrl('https://github.com');
|
win.loadURL('https://github.com');
|
||||||
|
|
||||||
win.webContents.on('did-finish-load', function() {
|
win.webContents.on('did-finish-load', function() {
|
||||||
win.webContents.savePage('/tmp/test.html', 'HTMLComplete', function(error) {
|
win.webContents.savePage('/tmp/test.html', 'HTMLComplete', function(error) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ webFrame.setSpellCheckProvider("en-US", true, {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
### `webFrame.registerUrlSchemeAsSecure(scheme)`
|
### `webFrame.registerURLSchemeAsSecure(scheme)`
|
||||||
|
|
||||||
* `scheme` String
|
* `scheme` String
|
||||||
|
|
||||||
|
@ -76,14 +76,14 @@ Secure schemes do not trigger mixed content warnings. For example, `https` and
|
||||||
`data` are secure schemes because they cannot be corrupted by active network
|
`data` are secure schemes because they cannot be corrupted by active network
|
||||||
attackers.
|
attackers.
|
||||||
|
|
||||||
### `webFrame.registerUrlSchemeAsBypassingCsp(scheme)`
|
### `webFrame.registerURLSchemeAsBypassingCSP(scheme)`
|
||||||
|
|
||||||
* `scheme` String
|
* `scheme` String
|
||||||
|
|
||||||
Resources will be loaded from this `scheme` regardless of the current page's
|
Resources will be loaded from this `scheme` regardless of the current page's
|
||||||
Content Security Policy.
|
Content Security Policy.
|
||||||
|
|
||||||
### `webFrame.registerUrlSchemeAsPrivileged(scheme)`
|
### `webFrame.registerURLSchemeAsPrivileged(scheme)`
|
||||||
|
|
||||||
* `scheme` String
|
* `scheme` String
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ webview.addEventListener("dom-ready", function() {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
### `<webview>.getUrl()`
|
### `<webview>.getURL()`
|
||||||
|
|
||||||
Returns URL of guest page.
|
Returns URL of guest page.
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ Returns:
|
||||||
|
|
||||||
* `errorCode` Integer
|
* `errorCode` Integer
|
||||||
* `errorDescription` String
|
* `errorDescription` String
|
||||||
* `validatedUrl` String
|
* `validatedURL` String
|
||||||
|
|
||||||
This event is like `did-finish-load`, but fired when the load failed or was
|
This event is like `did-finish-load`, but fired when the load failed or was
|
||||||
cancelled, e.g. `window.stop()` is invoked.
|
cancelled, e.g. `window.stop()` is invoked.
|
||||||
|
@ -428,8 +428,8 @@ Corresponds to the points in time when the spinner of the tab stops spinning.
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `status` Boolean
|
* `status` Boolean
|
||||||
* `newUrl` String
|
* `newURL` String
|
||||||
* `originalUrl` String
|
* `originalURL` String
|
||||||
* `httpResponseCode` Integer
|
* `httpResponseCode` Integer
|
||||||
* `requestMethod` String
|
* `requestMethod` String
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
|
@ -442,8 +442,8 @@ Fired when details regarding a requested resource is available.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `oldUrl` String
|
* `oldURL` String
|
||||||
* `newUrl` String
|
* `newURL` String
|
||||||
* `isMainFrame` Boolean
|
* `isMainFrame` Boolean
|
||||||
|
|
||||||
Fired when a redirect was received while requesting a resource.
|
Fired when a redirect was received while requesting a resource.
|
||||||
|
@ -466,7 +466,7 @@ url.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `favicons` Array - Array of Urls.
|
* `favicons` Array - Array of URLs.
|
||||||
|
|
||||||
Fired when page receives favicon urls.
|
Fired when page receives favicon urls.
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ You can also display a web page in an `asar` archive with `BrowserWindow`:
|
||||||
```javascript
|
```javascript
|
||||||
const BrowserWindow = require('electron').BrowserWindow;
|
const BrowserWindow = require('electron').BrowserWindow;
|
||||||
var win = new BrowserWindow({width: 800, height: 600});
|
var win = new BrowserWindow({width: 800, height: 600});
|
||||||
win.loadUrl('file:///path/to/example.asar/static/index.html');
|
win.loadURL('file:///path/to/example.asar/static/index.html');
|
||||||
```
|
```
|
||||||
|
|
||||||
### Web API
|
### Web API
|
||||||
|
|
|
@ -13,7 +13,7 @@ const BrowserWindow = electron.BrowserWindow;
|
||||||
var onlineStatusWindow;
|
var onlineStatusWindow;
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ const BrowserWindow = electron.BrowserWindow;
|
||||||
var onlineStatusWindow;
|
var onlineStatusWindow;
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('online-status-changed', function(event, status) {
|
ipcMain.on('online-status-changed', function(event, status) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ app.on('ready', function() {
|
||||||
mainWindow = new BrowserWindow({width: 800, height: 600});
|
mainWindow = new BrowserWindow({width: 800, height: 600});
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||||
|
|
||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
mainWindow.webContents.openDevTools();
|
mainWindow.webContents.openDevTools();
|
||||||
|
|
|
@ -36,7 +36,7 @@ app.on('ready', function() {
|
||||||
'plugins': true
|
'plugins': true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||||
// Something else
|
// Something else
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
|
@ -31,14 +31,14 @@ describe 'browser-window module', ->
|
||||||
fs.unlinkSync(test)
|
fs.unlinkSync(test)
|
||||||
assert.equal String(content), 'unload'
|
assert.equal String(content), 'unload'
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'unload.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'unload.html')
|
||||||
|
|
||||||
it 'should emit beforeunload handler', (done) ->
|
it 'should emit beforeunload handler', (done) ->
|
||||||
w.on 'onbeforeunload', ->
|
w.on 'onbeforeunload', ->
|
||||||
done()
|
done()
|
||||||
w.webContents.on 'did-finish-load', ->
|
w.webContents.on 'did-finish-load', ->
|
||||||
w.close()
|
w.close()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'beforeunload-false.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'beforeunload-false.html')
|
||||||
|
|
||||||
describe 'window.close()', ->
|
describe 'window.close()', ->
|
||||||
it 'should emit unload handler', (done) ->
|
it 'should emit unload handler', (done) ->
|
||||||
|
@ -48,23 +48,23 @@ describe 'browser-window module', ->
|
||||||
fs.unlinkSync(test)
|
fs.unlinkSync(test)
|
||||||
assert.equal String(content), 'close'
|
assert.equal String(content), 'close'
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'close.html')
|
||||||
|
|
||||||
it 'should emit beforeunload handler', (done) ->
|
it 'should emit beforeunload handler', (done) ->
|
||||||
w.on 'onbeforeunload', ->
|
w.on 'onbeforeunload', ->
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
|
||||||
|
|
||||||
describe 'BrowserWindow.loadUrl(url)', ->
|
describe 'BrowserWindow.loadURL(url)', ->
|
||||||
it 'should emit did-start-loading event', (done) ->
|
it 'should emit did-start-loading event', (done) ->
|
||||||
w.webContents.on 'did-start-loading', ->
|
w.webContents.on 'did-start-loading', ->
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'about:blank'
|
w.loadURL 'about:blank'
|
||||||
|
|
||||||
it 'should emit did-fail-load event', (done) ->
|
it 'should emit did-fail-load event', (done) ->
|
||||||
w.webContents.on 'did-fail-load', ->
|
w.webContents.on 'did-fail-load', ->
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://a.txt'
|
w.loadURL 'file://a.txt'
|
||||||
|
|
||||||
describe 'BrowserWindow.show()', ->
|
describe 'BrowserWindow.show()', ->
|
||||||
it 'should focus on window', ->
|
it 'should focus on window', ->
|
||||||
|
@ -214,7 +214,7 @@ describe 'browser-window module', ->
|
||||||
show: false
|
show: false
|
||||||
webPreferences:
|
webPreferences:
|
||||||
preload: preload
|
preload: preload
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'preload.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'preload.html')
|
||||||
|
|
||||||
describe '"node-integration" option', ->
|
describe '"node-integration" option', ->
|
||||||
it 'disables node integration when specified to false', (done) ->
|
it 'disables node integration when specified to false', (done) ->
|
||||||
|
@ -228,28 +228,28 @@ describe 'browser-window module', ->
|
||||||
webPreferences:
|
webPreferences:
|
||||||
preload: preload
|
preload: preload
|
||||||
nodeIntegration: false
|
nodeIntegration: false
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'blank.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'blank.html')
|
||||||
|
|
||||||
describe 'beforeunload handler', ->
|
describe 'beforeunload handler', ->
|
||||||
it 'returning true would not prevent close', (done) ->
|
it 'returning true would not prevent close', (done) ->
|
||||||
w.on 'closed', ->
|
w.on 'closed', ->
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-true.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-true.html')
|
||||||
|
|
||||||
it 'returning non-empty string would not prevent close', (done) ->
|
it 'returning non-empty string would not prevent close', (done) ->
|
||||||
w.on 'closed', ->
|
w.on 'closed', ->
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-string.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-string.html')
|
||||||
|
|
||||||
it 'returning false would prevent close', (done) ->
|
it 'returning false would prevent close', (done) ->
|
||||||
w.on 'onbeforeunload', ->
|
w.on 'onbeforeunload', ->
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
|
||||||
|
|
||||||
it 'returning empty string would prevent close', (done) ->
|
it 'returning empty string would prevent close', (done) ->
|
||||||
w.on 'onbeforeunload', ->
|
w.on 'onbeforeunload', ->
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-empty-string.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-empty-string.html')
|
||||||
|
|
||||||
describe 'new-window event', ->
|
describe 'new-window event', ->
|
||||||
return if isCI and process.platform is 'darwin'
|
return if isCI and process.platform is 'darwin'
|
||||||
|
@ -259,7 +259,7 @@ describe 'browser-window module', ->
|
||||||
assert.equal url, 'http://host/'
|
assert.equal url, 'http://host/'
|
||||||
assert.equal frameName, 'host'
|
assert.equal frameName, 'host'
|
||||||
done()
|
done()
|
||||||
w.loadUrl "file://#{fixtures}/pages/window-open.html"
|
w.loadURL "file://#{fixtures}/pages/window-open.html"
|
||||||
|
|
||||||
it 'emits when link with target is called', (done) ->
|
it 'emits when link with target is called', (done) ->
|
||||||
w.webContents.once 'new-window', (e, url, frameName) ->
|
w.webContents.once 'new-window', (e, url, frameName) ->
|
||||||
|
@ -267,7 +267,7 @@ describe 'browser-window module', ->
|
||||||
assert.equal url, 'http://host/'
|
assert.equal url, 'http://host/'
|
||||||
assert.equal frameName, 'target'
|
assert.equal frameName, 'target'
|
||||||
done()
|
done()
|
||||||
w.loadUrl "file://#{fixtures}/pages/target-name.html"
|
w.loadURL "file://#{fixtures}/pages/target-name.html"
|
||||||
|
|
||||||
describe 'maximize event', ->
|
describe 'maximize event', ->
|
||||||
return if isCI
|
return if isCI
|
||||||
|
@ -296,7 +296,7 @@ describe 'browser-window module', ->
|
||||||
|
|
||||||
xdescribe 'beginFrameSubscription method', ->
|
xdescribe 'beginFrameSubscription method', ->
|
||||||
it 'subscribes frame updates', (done) ->
|
it 'subscribes frame updates', (done) ->
|
||||||
w.loadUrl "file://#{fixtures}/api/blank.html"
|
w.loadURL "file://#{fixtures}/api/blank.html"
|
||||||
w.webContents.beginFrameSubscription (data) ->
|
w.webContents.beginFrameSubscription (data) ->
|
||||||
assert.notEqual data.length, 0
|
assert.notEqual data.length, 0
|
||||||
w.webContents.endFrameSubscription()
|
w.webContents.endFrameSubscription()
|
||||||
|
@ -321,4 +321,4 @@ describe 'browser-window module', ->
|
||||||
fs.rmdirSync savePageDir
|
fs.rmdirSync savePageDir
|
||||||
done()
|
done()
|
||||||
|
|
||||||
w.loadUrl "file://#{fixtures}/pages/save_page/index.html"
|
w.loadURL "file://#{fixtures}/pages/save_page/index.html"
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe 'clipboard module', ->
|
||||||
p = path.join fixtures, 'assets', 'logo.png'
|
p = path.join fixtures, 'assets', 'logo.png'
|
||||||
i = nativeImage.createFromPath p
|
i = nativeImage.createFromPath p
|
||||||
clipboard.writeImage p
|
clipboard.writeImage p
|
||||||
assert.equal clipboard.readImage().toDataUrl(), i.toDataUrl()
|
assert.equal clipboard.readImage().toDataURL(), i.toDataURL()
|
||||||
|
|
||||||
describe 'clipboard.readText()', ->
|
describe 'clipboard.readText()', ->
|
||||||
it 'returns unicode string correctly', ->
|
it 'returns unicode string correctly', ->
|
||||||
|
@ -49,4 +49,4 @@ describe 'clipboard module', ->
|
||||||
clipboard.write {text: "test", html: '<b>Hi</b>', image: p}
|
clipboard.write {text: "test", html: '<b>Hi</b>', image: p}
|
||||||
assert.equal clipboard.readText(), text
|
assert.equal clipboard.readText(), text
|
||||||
assert.equal clipboard.readHtml(), markup
|
assert.equal clipboard.readHtml(), markup
|
||||||
assert.equal clipboard.readImage().toDataUrl(), i.toDataUrl()
|
assert.equal clipboard.readImage().toDataURL(), i.toDataURL()
|
||||||
|
|
|
@ -55,5 +55,5 @@ describe 'crash-reporter module', ->
|
||||||
pathname: path.join fixtures, 'api', 'crash.html'
|
pathname: path.join fixtures, 'api', 'crash.html'
|
||||||
search: "?port=#{port}"
|
search: "?port=#{port}"
|
||||||
if process.platform is 'darwin'
|
if process.platform is 'darwin'
|
||||||
crashReporter.start {'submitUrl': 'http://127.0.0.1:' + port}
|
crashReporter.start {'submitURL': 'http://127.0.0.1:' + port}
|
||||||
w.loadUrl url
|
w.loadURL url
|
||||||
|
|
|
@ -86,7 +86,7 @@ describe 'ipc module', ->
|
||||||
event.returnValue = null
|
event.returnValue = null
|
||||||
w.destroy()
|
w.destroy()
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'send-sync-message.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'send-sync-message.html')
|
||||||
|
|
||||||
describe 'remote listeners', ->
|
describe 'remote listeners', ->
|
||||||
it 'can be added and removed correctly', ->
|
it 'can be added and removed correctly', ->
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe 'session module', ->
|
||||||
|
|
||||||
server.listen 0, '127.0.0.1', ->
|
server.listen 0, '127.0.0.1', ->
|
||||||
{port} = server.address()
|
{port} = server.address()
|
||||||
w.loadUrl "#{url}:#{port}"
|
w.loadURL "#{url}:#{port}"
|
||||||
w.webContents.on 'did-finish-load', ->
|
w.webContents.on 'did-finish-load', ->
|
||||||
w.webContents.session.cookies.get {url: url}, (error, list) ->
|
w.webContents.session.cookies.get {url: url}, (error, list) ->
|
||||||
return done(error) if error
|
return done(error) if error
|
||||||
|
@ -64,7 +64,7 @@ describe 'session module', ->
|
||||||
ipcMain.removeAllListeners 'count'
|
ipcMain.removeAllListeners 'count'
|
||||||
assert not count
|
assert not count
|
||||||
done()
|
done()
|
||||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'localstorage.html')
|
w.loadURL 'file://' + path.join(fixtures, 'api', 'localstorage.html')
|
||||||
w.webContents.on 'did-finish-load', ->
|
w.webContents.on 'did-finish-load', ->
|
||||||
options =
|
options =
|
||||||
origin: "file://",
|
origin: "file://",
|
||||||
|
@ -91,7 +91,7 @@ describe 'session module', ->
|
||||||
downloadServer.listen 0, '127.0.0.1', ->
|
downloadServer.listen 0, '127.0.0.1', ->
|
||||||
{port} = downloadServer.address()
|
{port} = downloadServer.address()
|
||||||
ipcRenderer.sendSync 'set-download-option', false
|
ipcRenderer.sendSync 'set-download-option', false
|
||||||
w.loadUrl "#{url}:#{port}"
|
w.loadURL "#{url}:#{port}"
|
||||||
ipcRenderer.once 'download-done', (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) ->
|
ipcRenderer.once 'download-done', (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) ->
|
||||||
assert.equal state, 'completed'
|
assert.equal state, 'completed'
|
||||||
assert.equal filename, 'mock.pdf'
|
assert.equal filename, 'mock.pdf'
|
||||||
|
@ -108,7 +108,7 @@ describe 'session module', ->
|
||||||
downloadServer.listen 0, '127.0.0.1', ->
|
downloadServer.listen 0, '127.0.0.1', ->
|
||||||
{port} = downloadServer.address()
|
{port} = downloadServer.address()
|
||||||
ipcRenderer.sendSync 'set-download-option', true
|
ipcRenderer.sendSync 'set-download-option', true
|
||||||
w.loadUrl "#{url}:#{port}/"
|
w.loadURL "#{url}:#{port}/"
|
||||||
ipcRenderer.once 'download-done', (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) ->
|
ipcRenderer.once 'download-done', (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) ->
|
||||||
assert.equal state, 'cancelled'
|
assert.equal state, 'cancelled'
|
||||||
assert.equal filename, 'mock.pdf'
|
assert.equal filename, 'mock.pdf'
|
||||||
|
|
|
@ -453,7 +453,7 @@ describe 'asar package', ->
|
||||||
ipcMain.once 'dirname', (event, dirname) ->
|
ipcMain.once 'dirname', (event, dirname) ->
|
||||||
assert.equal dirname, path.dirname(p)
|
assert.equal dirname, path.dirname(p)
|
||||||
done()
|
done()
|
||||||
w.loadUrl u
|
w.loadURL u
|
||||||
|
|
||||||
it 'loads script tag in html', (done) ->
|
it 'loads script tag in html', (done) ->
|
||||||
after ->
|
after ->
|
||||||
|
@ -463,7 +463,7 @@ describe 'asar package', ->
|
||||||
w = new BrowserWindow(show: false, width: 400, height: 400)
|
w = new BrowserWindow(show: false, width: 400, height: 400)
|
||||||
p = path.resolve fixtures, 'asar', 'script.asar', 'index.html'
|
p = path.resolve fixtures, 'asar', 'script.asar', 'index.html'
|
||||||
u = url.format protocol: 'file', slashed: true, pathname: p
|
u = url.format protocol: 'file', slashed: true, pathname: p
|
||||||
w.loadUrl u
|
w.loadURL u
|
||||||
ipcMain.once 'ping', (event, message) ->
|
ipcMain.once 'ping', (event, message) ->
|
||||||
assert.equal message, 'pong'
|
assert.equal message, 'pong'
|
||||||
done()
|
done()
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe 'chromium feature', ->
|
||||||
w.webContents.on 'ipc-message', (event, args) ->
|
w.webContents.on 'ipc-message', (event, args) ->
|
||||||
assert.deepEqual args, ['hidden', true]
|
assert.deepEqual args, ['hidden', true]
|
||||||
done()
|
done()
|
||||||
w.loadUrl url
|
w.loadURL url
|
||||||
|
|
||||||
describe 'navigator.webkitGetUserMedia', ->
|
describe 'navigator.webkitGetUserMedia', ->
|
||||||
it 'calls its callbacks', (done) ->
|
it 'calls its callbacks', (done) ->
|
||||||
|
@ -96,7 +96,7 @@ describe 'chromium feature', ->
|
||||||
w.webContents.on 'ipc-message', (event, args) ->
|
w.webContents.on 'ipc-message', (event, args) ->
|
||||||
assert.deepEqual args, ['opener', null]
|
assert.deepEqual args, ['opener', null]
|
||||||
done()
|
done()
|
||||||
w.loadUrl url
|
w.loadURL url
|
||||||
|
|
||||||
it 'is not null for window opened by window.open', (done) ->
|
it 'is not null for window opened by window.open', (done) ->
|
||||||
listener = (event) ->
|
listener = (event) ->
|
||||||
|
|
2
spec/fixtures/api/crash.html
vendored
2
spec/fixtures/api/crash.html
vendored
|
@ -6,7 +6,7 @@ var crashReporter = require('electron').crashReporter;
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
productName: 'Zombies',
|
productName: 'Zombies',
|
||||||
companyName: 'Umbrella Corporation',
|
companyName: 'Umbrella Corporation',
|
||||||
submitUrl: 'http://127.0.0.1:' + port,
|
submitURL: 'http://127.0.0.1:' + port,
|
||||||
autoSubmit: true,
|
autoSubmit: true,
|
||||||
ignoreSystemCrashHandler: true,
|
ignoreSystemCrashHandler: true,
|
||||||
extra: {
|
extra: {
|
||||||
|
|
|
@ -67,7 +67,7 @@ app.on('ready', function() {
|
||||||
javascript: true // Test whether web-preferences crashes.
|
javascript: true // Test whether web-preferences crashes.
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
window.loadUrl('file://' + __dirname + '/index.html');
|
window.loadURL('file://' + __dirname + '/index.html');
|
||||||
window.on('unresponsive', function() {
|
window.on('unresponsive', function() {
|
||||||
var chosen = dialog.showMessageBox(window, {
|
var chosen = dialog.showMessageBox(window, {
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
|
@ -88,7 +88,7 @@ app.on('ready', function() {
|
||||||
item.on('done', function(e, state) {
|
item.on('done', function(e, state) {
|
||||||
window.webContents.send('download-done',
|
window.webContents.send('download-done',
|
||||||
state,
|
state,
|
||||||
item.getUrl(),
|
item.getURL(),
|
||||||
item.getMimeType(),
|
item.getMimeType(),
|
||||||
item.getReceivedBytes(),
|
item.getReceivedBytes(),
|
||||||
item.getTotalBytes(),
|
item.getTotalBytes(),
|
||||||
|
|
Loading…
Reference in a new issue