From fbb8e61958c8950455883e2a4ae12088ba030a12 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 13 Nov 2015 16:03:40 +0800 Subject: [PATCH] Replace "Url" in API names with "URL" --- atom/browser/api/atom_api_auto_updater.cc | 2 +- atom/browser/api/atom_api_cookies.cc | 6 +- atom/browser/api/atom_api_download_item.cc | 6 +- atom/browser/api/atom_api_download_item.h | 2 +- atom/browser/api/atom_api_protocol.cc | 4 +- atom/browser/api/atom_api_web_contents.cc | 4 +- atom/browser/api/lib/app.coffee | 3 +- atom/browser/api/lib/auto-updater.coffee | 9 +- .../lib/auto-updater/auto-updater-win.coffee | 12 +-- .../auto-updater/squirrel-update-win.coffee | 8 +- atom/browser/api/lib/browser-window.coffee | 8 +- .../api/lib/navigation-controller.coffee | 20 ++-- atom/browser/api/lib/web-contents.coffee | 8 +- atom/browser/atom_access_token_store.cc | 6 +- atom/browser/default_app/default_app.js | 2 +- atom/browser/lib/guest-view-manager.coffee | 4 +- atom/browser/lib/guest-window-manager.coffee | 8 +- .../browser/net/url_request_async_asar_job.cc | 4 +- atom/browser/net/url_request_async_asar_job.h | 6 +- atom/browser/web_contents_preferences.cc | 2 +- atom/common/api/atom_api_native_image.cc | 5 +- atom/common/api/lib/crash-reporter.coffee | 19 ++-- atom/common/api/lib/native-image.coffee | 8 +- atom/common/options_switches.cc | 4 +- atom/common/options_switches.h | 4 +- atom/common/platform_util_win.cc | 4 +- atom/renderer/api/atom_api_web_frame.cc | 10 +- atom/renderer/api/atom_api_web_frame.h | 2 +- atom/renderer/api/lib/web-frame.coffee | 10 +- atom/renderer/lib/override.coffee | 4 +- .../lib/web-view/guest-view-internal.coffee | 6 +- .../lib/web-view/web-view-attributes.coffee | 8 +- atom/renderer/lib/web-view/web-view.coffee | 91 ++++++++++--------- docs/api/auto-updater.md | 6 +- docs/api/browser-window.md | 6 +- docs/api/crash-reporter.md | 6 +- docs/api/download-item.md | 2 +- docs/api/native-image.md | 8 +- docs/api/remote.md | 2 +- docs/api/session.md | 6 +- docs/api/synopsis.md | 2 +- docs/api/web-contents.md | 30 +++--- docs/api/web-frame.md | 6 +- docs/api/web-view-tag.md | 14 +-- docs/tutorial/application-packaging.md | 2 +- docs/tutorial/online-offline-events.md | 4 +- docs/tutorial/quick-start.md | 2 +- docs/tutorial/using-pepper-flash-plugin.md | 2 +- spec/api-browser-window-spec.coffee | 34 +++---- spec/api-clipboard-spec.coffee | 4 +- spec/api-crash-reporter-spec.coffee | 4 +- spec/api-ipc-spec.coffee | 2 +- spec/api-session-spec.coffee | 8 +- spec/asar-spec.coffee | 4 +- spec/chromium-spec.coffee | 4 +- spec/fixtures/api/crash.html | 2 +- spec/static/main.js | 4 +- 57 files changed, 251 insertions(+), 212 deletions(-) diff --git a/atom/browser/api/atom_api_auto_updater.cc b/atom/browser/api/atom_api_auto_updater.cc index 1c80f73f..1a02a54d 100644 --- a/atom/browser/api/atom_api_auto_updater.cc +++ b/atom/browser/api/atom_api_auto_updater.cc @@ -81,7 +81,7 @@ void AutoUpdater::OnWindowAllClosed() { mate::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder( v8::Isolate* isolate) { return mate::ObjectTemplateBuilder(isolate) - .SetMethod("setFeedUrl", &auto_updater::AutoUpdater::SetFeedURL) + .SetMethod("setFeedURL", &auto_updater::AutoUpdater::SetFeedURL) .SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates) .SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall); } diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index 4f989eff..a3b2c37c 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -204,7 +204,7 @@ void Cookies::GetCookiesOnIOThread(scoped_ptr filter, Passed(&filter), callback))) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 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."; } if (error_message.empty() && !url.is_valid()) { - error_message = "Url is not valid."; + error_message = "URL is not valid."; } if (!error_message.empty()) { RunRemoveCookiesCallbackOnUIThread(isolate(), error_message, callback); @@ -261,7 +261,7 @@ void Cookies::Set(const base::DictionaryValue& options, GURL gurl(url); if (error_message.empty() && !gurl.is_valid()) { - error_message = "Url is not valid."; + error_message = "URL is not valid."; } if (!error_message.empty()) { diff --git a/atom/browser/api/atom_api_download_item.cc b/atom/browser/api/atom_api_download_item.cc index 691cfbfe..7dd27130 100644 --- a/atom/browser/api/atom_api_download_item.cc +++ b/atom/browser/api/atom_api_download_item.cc @@ -103,7 +103,7 @@ int64 DownloadItem::GetTotalBytes() { return download_item_->GetTotalBytes(); } -const GURL& DownloadItem::GetUrl() { +const GURL& DownloadItem::GetURL() { return download_item_->GetURL(); } @@ -116,7 +116,7 @@ bool DownloadItem::HasUserGesture() { } std::string DownloadItem::GetFilename() { - return base::UTF16ToUTF8(net::GenerateFileName(GetUrl(), + return base::UTF16ToUTF8(net::GenerateFileName(GetURL(), GetContentDisposition(), std::string(), download_item_->GetSuggestedFilename(), @@ -152,7 +152,7 @@ mate::ObjectTemplateBuilder DownloadItem::GetObjectTemplateBuilder( .SetMethod("cancel", &DownloadItem::Cancel) .SetMethod("getReceivedBytes", &DownloadItem::GetReceivedBytes) .SetMethod("getTotalBytes", &DownloadItem::GetTotalBytes) - .SetMethod("getUrl", &DownloadItem::GetUrl) + .SetMethod("getURL", &DownloadItem::GetURL) .SetMethod("getMimeType", &DownloadItem::GetMimeType) .SetMethod("hasUserGesture", &DownloadItem::HasUserGesture) .SetMethod("getFilename", &DownloadItem::GetFilename) diff --git a/atom/browser/api/atom_api_download_item.h b/atom/browser/api/atom_api_download_item.h index 14074a4b..955801cd 100644 --- a/atom/browser/api/atom_api_download_item.h +++ b/atom/browser/api/atom_api_download_item.h @@ -49,7 +49,7 @@ class DownloadItem : public mate::EventEmitter, bool HasUserGesture(); std::string GetFilename(); std::string GetContentDisposition(); - const GURL& GetUrl(); + const GURL& GetURL(); void SetSavePath(const base::FilePath& path); private: diff --git a/atom/browser/api/atom_api_protocol.cc b/atom/browser/api/atom_api_protocol.cc index e76f26f0..b1ad7981 100644 --- a/atom/browser/api/atom_api_protocol.cc +++ b/atom/browser/api/atom_api_protocol.cc @@ -37,7 +37,7 @@ mate::ObjectTemplateBuilder Protocol::GetObjectTemplateBuilder( .SetMethod("registerBufferProtocol", &Protocol::RegisterProtocol) .SetMethod("registerFileProtocol", - &Protocol::RegisterProtocol) + &Protocol::RegisterProtocol) .SetMethod("registerHttpProtocol", &Protocol::RegisterProtocol) .SetMethod("unregisterProtocol", &Protocol::UnregisterProtocol) @@ -47,7 +47,7 @@ mate::ObjectTemplateBuilder Protocol::GetObjectTemplateBuilder( .SetMethod("interceptBufferProtocol", &Protocol::InterceptProtocol) .SetMethod("interceptFileProtocol", - &Protocol::InterceptProtocol) + &Protocol::InterceptProtocol) .SetMethod("interceptHttpProtocol", &Protocol::InterceptProtocol) .SetMethod("uninterceptProtocol", &Protocol::UninterceptProtocol); diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index d67794a9..601a4ba6 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1003,8 +1003,8 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( .SetMethod("isAlive", &WebContents::IsAlive, true) .SetMethod("getId", &WebContents::GetID) .SetMethod("equal", &WebContents::Equal) - .SetMethod("_loadUrl", &WebContents::LoadURL) - .SetMethod("_getUrl", &WebContents::GetURL) + .SetMethod("_loadURL", &WebContents::LoadURL) + .SetMethod("_getURL", &WebContents::GetURL) .SetMethod("getTitle", &WebContents::GetTitle) .SetMethod("isLoading", &WebContents::IsLoading) .SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse) diff --git a/atom/browser/api/lib/app.coffee b/atom/browser/api/lib/app.coffee index 3494a6e6..f8d3cedd 100644 --- a/atom/browser/api/lib/app.coffee +++ b/atom/browser/api/lib/app.coffee @@ -63,10 +63,11 @@ wrapDownloadItem = (downloadItem) -> # downloadItem is an EventEmitter. downloadItem.__proto__ = EventEmitter.prototype # Deprecated. - deprecate.property downloadItem, 'url', 'getUrl' + deprecate.property downloadItem, 'url', 'getURL' deprecate.property downloadItem, 'filename', 'getFilename' deprecate.property downloadItem, 'mimeType', 'getMimeType' deprecate.property downloadItem, 'hasUserGesture', 'hasUserGesture' + deprecate.rename downloadItem, 'getUrl', 'getURL' downloadItemBindings._setWrapDownloadItem wrapDownloadItem # Only one App object pemitted. diff --git a/atom/browser/api/lib/auto-updater.coffee b/atom/browser/api/lib/auto-updater.coffee index d5e69e2a..28df59fb 100644 --- a/atom/browser/api/lib/auto-updater.coffee +++ b/atom/browser/api/lib/auto-updater.coffee @@ -1,5 +1,12 @@ -module.exports = +{deprecate} = require 'electron' + +autoUpdater = if process.platform is 'win32' require './auto-updater/auto-updater-win' else require './auto-updater/auto-updater-native' + +# Deprecated. +deprecate.rename autoUpdater, 'setFeedUrl', 'setFeedURL' + +module.exports = autoUpdater diff --git a/atom/browser/api/lib/auto-updater/auto-updater-win.coffee b/atom/browser/api/lib/auto-updater/auto-updater-win.coffee index 12ebedaa..e7cb194f 100644 --- a/atom/browser/api/lib/auto-updater/auto-updater-win.coffee +++ b/atom/browser/api/lib/auto-updater/auto-updater-win.coffee @@ -9,28 +9,28 @@ class AutoUpdater extends EventEmitter squirrelUpdate.processStart() app.quit() - setFeedUrl: (updateUrl) -> - @updateUrl = updateUrl + setFeedURL: (updateURL) -> + @updateURL = updateURL 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() @emit 'checking-for-update' - squirrelUpdate.download @updateUrl, (error, update) => + squirrelUpdate.download @updateURL, (error, update) => return @emitError error if error? return @emit 'update-not-available' unless update? @emit 'update-available' - squirrelUpdate.update @updateUrl, (error) => + squirrelUpdate.update @updateURL, (error) => return @emitError error if error? {releaseNotes, version} = update # Following information is not available on Windows, so fake them. date = new Date - url = @updateUrl + url = @updateURL @emit 'update-downloaded', {}, releaseNotes, version, date, url, => @quitAndInstall() diff --git a/atom/browser/api/lib/auto-updater/squirrel-update-win.coffee b/atom/browser/api/lib/auto-updater/squirrel-update-win.coffee index ed302124..ee914c4f 100644 --- a/atom/browser/api/lib/auto-updater/squirrel-update-win.coffee +++ b/atom/browser/api/lib/auto-updater/squirrel-update-win.coffee @@ -41,8 +41,8 @@ exports.processStart = (callback) -> spawnUpdate ['--processStart', exeName], true, -> # Download the releases specified by the URL and write new results to stdout. -exports.download = (updateUrl, callback) -> - spawnUpdate ['--download', updateUrl], false, (error, stdout) -> +exports.download = (updateURL, callback) -> + spawnUpdate ['--download', updateURL], false, (error, stdout) -> return callback(error) if error? try @@ -55,8 +55,8 @@ exports.download = (updateUrl, callback) -> callback null, update # Update the application to the latest remote version specified by URL. -exports.update = (updateUrl, callback) -> - spawnUpdate ['--update', updateUrl], false, callback +exports.update = (updateURL, callback) -> + spawnUpdate ['--update', updateURL], false, callback # Is the Update.exe installed with the current application? exports.supported = -> diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index 3cefa1bf..9947bc1a 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -69,7 +69,8 @@ BrowserWindow.fromDevToolsWebContents = (webContents) -> return window for window in windows when window.devToolsWebContents?.equal webContents # 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::send = -> @webContents.send.apply @webContents, arguments BrowserWindow::openDevTools = -> @webContents.openDevTools.apply @webContents, arguments @@ -80,14 +81,12 @@ BrowserWindow::inspectElement = -> @webContents.inspectElement.apply @webContent BrowserWindow::inspectServiceWorker = -> @webContents.inspectServiceWorker() # Deprecated. -deprecate.rename BrowserWindow, 'restart', 'reload' deprecate.member BrowserWindow, 'undo', 'webContents' deprecate.member BrowserWindow, 'redo', 'webContents' deprecate.member BrowserWindow, 'cut', 'webContents' deprecate.member BrowserWindow, 'copy', 'webContents' deprecate.member BrowserWindow, 'paste', 'webContents' deprecate.member BrowserWindow, 'selectAll', 'webContents' -deprecate.member BrowserWindow, 'getUrl', 'webContents' deprecate.member BrowserWindow, 'reloadIgnoringCache', 'webContents' deprecate.member BrowserWindow, 'getPageTitle', 'webContents' deprecate.member BrowserWindow, 'isLoading', 'webContents' @@ -97,5 +96,8 @@ deprecate.member BrowserWindow, 'isCrashed', 'webContents' deprecate.member BrowserWindow, 'executeJavaScriptInDevTools', 'webContents' deprecate.member BrowserWindow, 'print', 'webContents' deprecate.member BrowserWindow, 'printToPDF', 'webContents' +deprecate.rename BrowserWindow, 'restart', 'reload' +deprecate.rename BrowserWindow, 'loadUrl', 'loadURL' +deprecate.rename BrowserWindow, 'getUrl', 'getURL' module.exports = BrowserWindow diff --git a/atom/browser/api/lib/navigation-controller.coffee b/atom/browser/api/lib/navigation-controller.coffee index 88b1ed30..7d276e57 100644 --- a/atom/browser/api/lib/navigation-controller.coffee +++ b/atom/browser/api/lib/navigation-controller.coffee @@ -9,7 +9,7 @@ ipcMain.on 'ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER', (event, method, args...) -> # JavaScript implementation of Chromium's NavigationController. # 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 # process is restarted everytime. class NavigationController @@ -17,9 +17,9 @@ class NavigationController @clearHistory() # webContents may have already navigated to a page. - if @webContents._getUrl() + if @webContents._getURL() @currentIndex++ - @history.push @webContents._getUrl() + @history.push @webContents._getURL() @webContents.on 'navigation-entry-commited', (event, url, inPage, replaceEntry) => if @inPageIndex > -1 and not inPage @@ -42,12 +42,12 @@ class NavigationController @currentIndex++ @history.push url - loadUrl: (url, options={}) -> + loadURL: (url, options={}) -> @pendingIndex = -1 - @webContents._loadUrl url, options + @webContents._loadURL url, options @webContents.emit 'load-url', url, options - getUrl: -> + getURL: -> if @currentIndex is -1 '' else @@ -59,7 +59,7 @@ class NavigationController reload: -> @pendingIndex = @currentIndex - @webContents._loadUrl @getUrl(), {} + @webContents._loadURL @getURL(), {} reloadIgnoringCache: -> @webContents._reloadIgnoringCache() # Rely on WebContents to clear cache. @@ -89,7 +89,7 @@ class NavigationController if @inPageIndex > -1 and @pendingIndex >= @inPageIndex @webContents._goBack() else - @webContents._loadUrl @history[@pendingIndex], {} + @webContents._loadURL @history[@pendingIndex], {} goForward: -> return unless @canGoForward() @@ -97,12 +97,12 @@ class NavigationController if @inPageIndex > -1 and @pendingIndex >= @inPageIndex @webContents._goForward() else - @webContents._loadUrl @history[@pendingIndex], {} + @webContents._loadURL @history[@pendingIndex], {} goToIndex: (index) -> return unless @canGoToIndex index @pendingIndex = index - @webContents._loadUrl @history[@pendingIndex], {} + @webContents._loadURL @history[@pendingIndex], {} goToOffset: (offset) -> return unless @canGoToOffset offset diff --git a/atom/browser/api/lib/web-contents.coffee b/atom/browser/api/lib/web-contents.coffee index b3b1e7ed..1a224c74 100644 --- a/atom/browser/api/lib/web-contents.coffee +++ b/atom/browser/api/lib/web-contents.coffee @@ -1,5 +1,5 @@ {EventEmitter} = require 'events' -{ipcMain, NavigationController, Menu} = require 'electron' +{deprecate, ipcMain, NavigationController, Menu} = require 'electron' binding = process.atomBinding 'web_contents' @@ -45,7 +45,7 @@ wrapWebContents = (webContents) -> # Make sure webContents.executeJavaScript would run the code only when the # web contents has been loaded. webContents.executeJavaScript = (code, hasUserGesture=false) -> - if @getUrl() and not @isLoading() + if @getURL() and not @isLoading() @_executeJavaScript code, hasUserGesture else webContents.once 'did-finish-load', @_executeJavaScript.bind(this, code, hasUserGesture) @@ -70,6 +70,10 @@ wrapWebContents = (webContents) -> menu = Menu.buildFromTemplate params.menu menu.popup params.x, params.y + # Deprecated. + deprecate.rename webContents, 'loadUrl', 'loadURL' + deprecate.rename webContents, 'getUrl', 'getURL' + webContents.printToPDF = (options, callback) -> printingSetting = pageRage: [] diff --git a/atom/browser/atom_access_token_store.cc b/atom/browser/atom_access_token_store.cc index 3d254f06..adf2f506 100644 --- a/atom/browser/atom_access_token_store.cc +++ b/atom/browser/atom_access_token_store.cc @@ -18,7 +18,7 @@ namespace { // 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 // 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=" GOOGLEAPIS_API_KEY; @@ -35,11 +35,11 @@ void AtomAccessTokenStore::LoadAccessTokens( const LoadAccessTokensCallbackType& callback) { 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 // of std::map on Linux, this can work around it. std::pair token_pair; - token_pair.first = GURL(kGeolocationProviderUrl); + token_pair.first = GURL(kGeolocationProviderURL); access_token_set.insert(token_pair); auto browser_context = AtomBrowserMainParts::Get()->browser_context(); diff --git a/atom/browser/default_app/default_app.js b/atom/browser/default_app/default_app.js index 6a94db48..2ec765d0 100644 --- a/atom/browser/default_app/default_app.js +++ b/atom/browser/default_app/default_app.js @@ -16,6 +16,6 @@ app.on('ready', function() { autoHideMenuBar: true, useContentSize: true, }); - mainWindow.loadUrl('file://' + __dirname + '/index.html'); + mainWindow.loadURL('file://' + __dirname + '/index.html'); mainWindow.focus(); }); diff --git a/atom/browser/lib/guest-view-manager.coffee b/atom/browser/lib/guest-view-manager.coffee index 4a33b281..e6be05a9 100644 --- a/atom/browser/lib/guest-view-manager.coffee +++ b/atom/browser/lib/guest-view-manager.coffee @@ -79,7 +79,7 @@ createGuest = (embedder, params) -> opts = {} opts.httpReferrer = params.httpreferrer if params.httpreferrer opts.userAgent = params.useragent if params.useragent - @loadUrl params.src, opts + @loadURL params.src, opts if params.allowtransparency? @setAllowTransparency params.allowtransparency @@ -122,7 +122,7 @@ attachGuest = (embedder, elementInstanceId, guestInstanceId, params) -> nodeIntegration: params.nodeintegration ? false plugins: params.plugins webSecurity: !params.disablewebsecurity - webPreferences.preloadUrl = params.preload if params.preload + webPreferences.preloadURL = params.preload if params.preload webViewManager.addGuest guestInstanceId, elementInstanceId, embedder, guest, webPreferences guest.attachParams = params diff --git a/atom/browser/lib/guest-window-manager.coffee b/atom/browser/lib/guest-window-manager.coffee index c602d370..c311e01c 100644 --- a/atom/browser/lib/guest-window-manager.coffee +++ b/atom/browser/lib/guest-window-manager.coffee @@ -27,11 +27,11 @@ mergeBrowserWindowOptions = (embedder, options) -> createGuest = (embedder, url, frameName, options) -> guest = frameToGuest[frameName] if frameName and guest? - guest.loadUrl url + guest.loadURL url return guest.id guest = new BrowserWindow(options) - guest.loadUrl url + guest.loadURL url # Remember the embedder, will be used by window.opener methods. 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) -> 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 ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', (event, guestId, message, targetOrigin, sourceOrigin) -> 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 ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', (event, guestId, method, args...) -> diff --git a/atom/browser/net/url_request_async_asar_job.cc b/atom/browser/net/url_request_async_asar_job.cc index ba0189e5..303bfc01 100644 --- a/atom/browser/net/url_request_async_asar_job.cc +++ b/atom/browser/net/url_request_async_asar_job.cc @@ -6,13 +6,13 @@ namespace atom { -UrlRequestAsyncAsarJob::UrlRequestAsyncAsarJob( +URLRequestAsyncAsarJob::URLRequestAsyncAsarJob( net::URLRequest* request, net::NetworkDelegate* network_delegate) : JsAsker(request, network_delegate) { } -void UrlRequestAsyncAsarJob::StartAsync(scoped_ptr options) { +void URLRequestAsyncAsarJob::StartAsync(scoped_ptr options) { base::FilePath::StringType file_path; if (options->IsType(base::Value::TYPE_DICTIONARY)) { static_cast(options.get())->GetString( diff --git a/atom/browser/net/url_request_async_asar_job.h b/atom/browser/net/url_request_async_asar_job.h index 748b96d8..df1aed35 100644 --- a/atom/browser/net/url_request_async_asar_job.h +++ b/atom/browser/net/url_request_async_asar_job.h @@ -11,15 +11,15 @@ namespace atom { // Like URLRequestAsarJob, but asks the JavaScript handler for file path. -class UrlRequestAsyncAsarJob : public JsAsker { +class URLRequestAsyncAsarJob : public JsAsker { public: - UrlRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*); + URLRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*); // JsAsker: void StartAsync(scoped_ptr options) override; private: - DISALLOW_COPY_AND_ASSIGN(UrlRequestAsyncAsarJob); + DISALLOW_COPY_AND_ASSIGN(URLRequestAsyncAsarJob); }; } // namespace atom diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 188de4d1..83145368 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -113,7 +113,7 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches( command_line->AppendSwitchNative(switches::kPreloadScript, preload); else 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. base::FilePath preload_path; if (net::FileURLToFilePath(GURL(preload), &preload_path)) diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index df6c14da..e0f0940a 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -168,7 +168,8 @@ mate::ObjectTemplateBuilder NativeImage::GetObjectTemplateBuilder( template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate) .SetMethod("toPng", &NativeImage::ToPNG) .SetMethod("toJpeg", &NativeImage::ToJPEG) - .SetMethod("toDataUrl", &NativeImage::ToDataURL) + .SetMethod("toDataURL", &NativeImage::ToDataURL) + .SetMethod("toDataUrl", &NativeImage::ToDataURL) // deprecated. .SetMethod("isEmpty", &NativeImage::IsEmpty) .SetMethod("getSize", &NativeImage::GetSize) .SetMethod("setTemplateImage", &NativeImage::SetTemplateImage) @@ -309,7 +310,7 @@ void Initialize(v8::Local exports, v8::Local unused, dict.SetMethod("createEmpty", &atom::api::NativeImage::CreateEmpty); dict.SetMethod("createFromPath", &atom::api::NativeImage::CreateFromPath); dict.SetMethod("createFromBuffer", &atom::api::NativeImage::CreateFromBuffer); - dict.SetMethod("createFromDataUrl", + dict.SetMethod("createFromDataURL", &atom::api::NativeImage::CreateFromDataURL); } diff --git a/atom/common/api/lib/crash-reporter.coffee b/atom/common/api/lib/crash-reporter.coffee index 873fc184..0713da99 100644 --- a/atom/common/api/lib/crash-reporter.coffee +++ b/atom/common/api/lib/crash-reporter.coffee @@ -1,14 +1,21 @@ -binding = process.atomBinding 'crash_reporter' fs = require 'fs' os = require 'os' path = require 'path' {spawn} = require 'child_process' +electron = require 'electron' +binding = process.atomBinding 'crash_reporter' + class CrashReporter 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} = if process.type is 'browser' electron @@ -17,7 +24,7 @@ class CrashReporter @productName ?= app.getName() companyName ?= 'GitHub, Inc' - submitUrl ?= 'http://54.249.141.255:1127/post' + submitURL ?= 'http://54.249.141.255:1127/post' autoSubmit ?= true ignoreSystemCrashHandler ?= false extra ?= {} @@ -26,11 +33,11 @@ class CrashReporter extra._companyName ?= companyName 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' args = [ - "--reporter-url=#{submitUrl}" + "--reporter-url=#{submitURL}" "--application-name=#{@productName}" "--v=1" ] diff --git a/atom/common/api/lib/native-image.coffee b/atom/common/api/lib/native-image.coffee index c3cbb60e..2bdfd494 100644 --- a/atom/common/api/lib/native-image.coffee +++ b/atom/common/api/lib/native-image.coffee @@ -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 diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index 1d375ba0..1124cfba 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -77,7 +77,7 @@ const char kZoomFactor[] = "zoomFactor"; const char kPreloadScript[] = "preload"; // Like --preload, but the passed argument is an URL. -const char kPreloadUrl[] = "preloadUrl"; +const char kPreloadURL[] = "preloadURL"; // Enable the node integration. const char kNodeIntegration[] = "nodeIntegration"; @@ -133,7 +133,7 @@ const char kAppUserModelId[] = "app-user-model-id"; // The command line switch versions of the options. const char kZoomFactor[] = "zoom-factor"; const char kPreloadScript[] = "preload"; -const char kPreloadUrl[] = "preload-url"; +const char kPreloadURL[] = "preload-url"; const char kNodeIntegration[] = "node-integration"; const char kGuestInstanceID[] = "guest-instance-id"; const char kExperimentalFeatures[] = "experimental-features"; diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index 7f262fb0..cd52c975 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -44,7 +44,7 @@ extern const char kWebPreferences[]; extern const char kDirectWrite[]; extern const char kZoomFactor[]; extern const char kPreloadScript[]; -extern const char kPreloadUrl[]; +extern const char kPreloadURL[]; extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; @@ -73,7 +73,7 @@ extern const char kAppUserModelId[]; extern const char kZoomFactor[]; extern const char kPreloadScript[]; -extern const char kPreloadUrl[]; +extern const char kPreloadURL[]; extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; diff --git a/atom/common/platform_util_win.cc b/atom/common/platform_util_win.cc index 87f45e5c..cca39295 100644 --- a/atom/common/platform_util_win.cc +++ b/atom/common/platform_util_win.cc @@ -307,8 +307,8 @@ bool OpenExternal(const GURL& url) { // "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 // support URLS of 2083 chars in length, 2K is safe." - const size_t kMaxUrlLength = 2048; - if (escaped_url.length() > kMaxUrlLength) { + const size_t kMaxURLLength = 2048; + if (escaped_url.length() > kMaxURLLength) { NOTREACHED(); return false; } diff --git a/atom/renderer/api/atom_api_web_frame.cc b/atom/renderer/api/atom_api_web_frame.cc index 69613043..e9b2b030 100644 --- a/atom/renderer/api/atom_api_web_frame.cc +++ b/atom/renderer/api/atom_api_web_frame.cc @@ -98,7 +98,7 @@ void WebFrame::RegisterURLSchemeAsSecure(const std::string& 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. blink::WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( blink::WebString::fromUTF8(scheme)); @@ -129,11 +129,11 @@ mate::ObjectTemplateBuilder WebFrame::GetObjectTemplateBuilder( &WebFrame::RegisterElementResizeCallback) .SetMethod("attachGuest", &WebFrame::AttachGuest) .SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider) - .SetMethod("registerUrlSchemeAsSecure", + .SetMethod("registerURLSchemeAsSecure", &WebFrame::RegisterURLSchemeAsSecure) - .SetMethod("registerUrlSchemeAsBypassingCsp", - &WebFrame::RegisterURLSchemeAsBypassingCsp) - .SetMethod("registerUrlSchemeAsPrivileged", + .SetMethod("registerURLSchemeAsBypassingCSP", + &WebFrame::RegisterURLSchemeAsBypassingCSP) + .SetMethod("registerURLSchemeAsPrivileged", &WebFrame::RegisterURLSchemeAsPrivileged); } diff --git a/atom/renderer/api/atom_api_web_frame.h b/atom/renderer/api/atom_api_web_frame.h index a3dec6cb..95a5a82a 100644 --- a/atom/renderer/api/atom_api_web_frame.h +++ b/atom/renderer/api/atom_api_web_frame.h @@ -57,7 +57,7 @@ class WebFrame : public mate::Wrappable { v8::Local provider); void RegisterURLSchemeAsSecure(const std::string& scheme); - void RegisterURLSchemeAsBypassingCsp(const std::string& scheme); + void RegisterURLSchemeAsBypassingCSP(const std::string& scheme); void RegisterURLSchemeAsPrivileged(const std::string& scheme); // mate::Wrappable: diff --git a/atom/renderer/api/lib/web-frame.coffee b/atom/renderer/api/lib/web-frame.coffee index 6525730e..53564c61 100644 --- a/atom/renderer/api/lib/web-frame.coffee +++ b/atom/renderer/api/lib/web-frame.coffee @@ -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 diff --git a/atom/renderer/lib/override.coffee b/atom/renderer/lib/override.coffee index d12952a1..a3a2f9ac 100644 --- a/atom/renderer/lib/override.coffee +++ b/atom/renderer/lib/override.coffee @@ -2,7 +2,7 @@ # Helper function to resolve relative url. a = window.top.document.createElement 'a' -resolveUrl = (url) -> +resolveURL = (url) -> a.href = url a.href @@ -55,7 +55,7 @@ window.open = (url, frameName='', features='') -> options.height ?= 600 # Resolve relative urls. - url = resolveUrl url + url = resolveURL url (options[name] = parseInt(options[name], 10) if options[name]?) for name in ints diff --git a/atom/renderer/lib/web-view/guest-view-internal.coffee b/atom/renderer/lib/web-view/guest-view-internal.coffee index a01a994b..61a93d8c 100644 --- a/atom/renderer/lib/web-view/guest-view-internal.coffee +++ b/atom/renderer/lib/web-view/guest-view-internal.coffee @@ -5,14 +5,14 @@ requestId = 0 WEB_VIEW_EVENTS = 'load-commit': ['url', 'isMainFrame'] 'did-finish-load': [] - 'did-fail-load': ['errorCode', 'errorDescription', 'validatedUrl'] + 'did-fail-load': ['errorCode', 'errorDescription', 'validatedURL'] 'did-frame-finish-load': ['isMainFrame'] 'did-start-loading': [] 'did-stop-loading': [] - 'did-get-response-details': ['status', 'newUrl', 'originalUrl', + 'did-get-response-details': ['status', 'newURL', 'originalURL', 'httpResponseCode', 'requestMethod', 'referrer', 'headers'] - 'did-get-redirect-request': ['oldUrl', 'newUrl', 'isMainFrame'] + 'did-get-redirect-request': ['oldURL', 'newURL', 'isMainFrame'] 'dom-ready': [] 'console-message': ['level', 'message', 'line', 'sourceId'] 'new-window': ['url', 'frameName', 'disposition', 'options'] diff --git a/atom/renderer/lib/web-view/web-view-attributes.coffee b/atom/renderer/lib/web-view/web-view-attributes.coffee index 48e57ea9..7760b400 100644 --- a/atom/renderer/lib/web-view/web-view-attributes.coffee +++ b/atom/renderer/lib/web-view/web-view-attributes.coffee @@ -6,7 +6,7 @@ webViewConstants = require './web-view-constants' # Helper function to resolve url set in attribute. a = document.createElement 'a' -resolveUrl = (url) -> +resolveURL = (url) -> a.href = url a.href @@ -116,7 +116,7 @@ class SrcAttribute extends WebViewAttribute getValue: -> if @webViewImpl.webviewNode.hasAttribute @name - resolveUrl @webViewImpl.webviewNode.getAttribute(@name) + resolveURL @webViewImpl.webviewNode.getAttribute(@name) else '' @@ -178,7 +178,7 @@ class SrcAttribute extends WebViewAttribute if useragent then opts.userAgent = useragent guestContents = remote.getGuestWebContents(@webViewImpl.guestInstanceId) - guestContents.loadUrl @getValue(), opts + guestContents.loadURL @getValue(), opts # Attribute specifies HTTP referrer. class HttpReferrerAttribute extends WebViewAttribute @@ -197,7 +197,7 @@ class PreloadAttribute extends WebViewAttribute getValue: -> return '' unless @webViewImpl.webviewNode.hasAttribute @name - preload = resolveUrl @webViewImpl.webviewNode.getAttribute(@name) + preload = resolveURL @webViewImpl.webviewNode.getAttribute(@name) protocol = preload.substr 0, 5 unless protocol is 'file:' console.error webViewConstants.ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE diff --git a/atom/renderer/lib/web-view/web-view.coffee b/atom/renderer/lib/web-view/web-view.coffee index 204889de..5e3f7d6b 100644 --- a/atom/renderer/lib/web-view/web-view.coffee +++ b/atom/renderer/lib/web-view/web-view.coffee @@ -1,4 +1,4 @@ -{webFrame, remote} = require 'electron' +{deprecate, webFrame, remote} = require 'electron' v8Util = process.atomBinding 'v8_util' guestViewInternal = require './guest-view-internal' @@ -252,49 +252,49 @@ registerWebViewElement = -> # Public-facing API methods. methods = [ - "getUrl" - "getTitle" - "isLoading" - "isWaitingForResponse" - "stop" - "reload" - "reloadIgnoringCache" - "canGoBack" - "canGoForward" - "canGoToOffset" - "clearHistory" - "goBack" - "goForward" - "goToIndex" - "goToOffset" - "isCrashed" - "setUserAgent" - "getUserAgent" - "executeJavaScript" - "insertCSS" - "openDevTools" - "closeDevTools" - "isDevToolsOpened" - "inspectElement" - "setAudioMuted" - "isAudioMuted" - "undo" - "redo" - "cut" - "copy" - "paste" - "pasteAndMatchStyle" - "delete" - "selectAll" - "unselect" - "replace" - "replaceMisspelling" - "send" - "getId" - "inspectServiceWorker" - "print" - "printToPDF" - "sendInputEvent" + 'getURL' + 'getTitle' + 'isLoading' + 'isWaitingForResponse' + 'stop' + 'reload' + 'reloadIgnoringCache' + 'canGoBack' + 'canGoForward' + 'canGoToOffset' + 'clearHistory' + 'goBack' + 'goForward' + 'goToIndex' + 'goToOffset' + 'isCrashed' + 'setUserAgent' + 'getUserAgent' + 'executeJavaScript' + 'insertCSS' + 'openDevTools' + 'closeDevTools' + 'isDevToolsOpened' + 'inspectElement' + 'setAudioMuted' + 'isAudioMuted' + 'undo' + 'redo' + 'cut' + 'copy' + 'paste' + 'pasteAndMatchStyle' + 'delete' + 'selectAll' + 'unselect' + 'replace' + 'replaceMisspelling' + 'send' + 'getId' + 'inspectServiceWorker' + 'print' + 'printToPDF' + 'sendInputEvent' ] # Forward proto.foo* method calls to WebViewImpl.foo*. @@ -304,6 +304,9 @@ registerWebViewElement = -> internal.webContents[m] args... proto[m] = createHandler m for m in methods + # Deprecated. + deprecate.rename proto, 'getUrl', 'getURL' + window.WebView = webFrame.registerEmbedderCustomElement 'webview', prototype: proto diff --git a/docs/api/auto-updater.md b/docs/api/auto-updater.md index eb0ea375..fa4f92cb 100644 --- a/docs/api/auto-updater.md +++ b/docs/api/auto-updater.md @@ -67,7 +67,7 @@ Returns: * `releaseNotes` String * `releaseName` String * `releaseDate` Date -* `updateUrl` String +* `updateURL` String Emitted when an update has been downloaded. @@ -77,7 +77,7 @@ On Windows only `releaseName` is available. The `autoUpdater` object has the following methods: -### `autoUpdater.setFeedUrl(url)` +### `autoUpdater.setFeedURL(url)` * `url` String @@ -86,7 +86,7 @@ once it is set. ### `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. ### `autoUpdater.quitAndInstall()` diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 670c814c..3b293e99 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -11,7 +11,7 @@ win.on('closed', function() { win = null; }); -win.loadUrl('https://github.com'); +win.loadURL('https://github.com'); win.show(); ``` @@ -613,9 +613,9 @@ Same as `webContents.print([options])` 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()` diff --git a/docs/api/crash-reporter.md b/docs/api/crash-reporter.md index 8127c9bc..6c66a855 100644 --- a/docs/api/crash-reporter.md +++ b/docs/api/crash-reporter.md @@ -11,7 +11,7 @@ const crashReporter = require('electron').crashReporter; crashReporter.start({ productName: 'YourName', companyName: 'YourCompany', - submitUrl: 'https://your-domain.com/url-to-submit', + submitURL: 'https://your-domain.com/url-to-submit', autoSubmit: true }); ``` @@ -26,7 +26,7 @@ The `crash-reporter` module has the following methods: * `productName` String, default: Electron. * `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. * `autoSubmit` Boolean, default: `true`. * Send the crash report without user interaction. @@ -57,7 +57,7 @@ ID. ## 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. * `platform` String - e.g. 'win32'. diff --git a/docs/api/download-item.md b/docs/api/download-item.md index 53cd56cc..756353b8 100644 --- a/docs/api/download-item.md +++ b/docs/api/download-item.md @@ -66,7 +66,7 @@ Resumes the download that has been paused. Cancels the download operation. -### `downloadItem.getUrl()` +### `downloadItem.getURL()` Returns a `String` represents the origin url where the item is downloaded from. diff --git a/docs/api/native-image.md b/docs/api/native-image.md index 74dc7a68..c0878896 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -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 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 @@ -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. -### `image.toDataUrl()` +### `image.toDataURL()` Returns the data URL of the image. diff --git a/docs/api/remote.md b/docs/api/remote.md index 6eaa2064..d6aca3ec 100644 --- a/docs/api/remote.md +++ b/docs/api/remote.md @@ -16,7 +16,7 @@ const remote = require('electron').remote; const BrowserWindow = remote.require('electron').BrowserWindow; 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), diff --git a/docs/api/session.md b/docs/api/session.md index 0fa72585..c3a3c91e 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -8,7 +8,7 @@ instance of `BrowserWindow`. For example: const BrowserWindow = require('electron').BrowserWindow; var win = new BrowserWindow({ width: 800, height: 600 }); -win.loadUrl("http://github.com"); +win.loadURL("http://github.com"); var session = win.webContents.session ``` @@ -28,7 +28,7 @@ Calling `event.preventDefault()` will cancel the download. ```javascript session.on('will-download', function(event, item, webContents) { event.preventDefault(); - require('request')(item.getUrl(), function(data) { + require('request')(item.getURL(), function(data) { require('fs').writeFileSync('/somewhere', data); }); }); @@ -47,7 +47,7 @@ const BrowserWindow = require('electron').BrowserWindow; 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() { // Query all cookies. diff --git a/docs/api/synopsis.md b/docs/api/synopsis.md index f6c161b6..4cacf52c 100644 --- a/docs/api/synopsis.md +++ b/docs/api/synopsis.md @@ -25,7 +25,7 @@ var window = null; app.on('ready', function() { window = new BrowserWindow({width: 800, height: 600}); - window.loadUrl('https://github.com'); + window.loadURL('https://github.com'); }); ``` diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index aff5752a..917e0670 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -11,7 +11,7 @@ the [`BrowserWindow`](browser-window.md) object. An example of accessing the const BrowserWindow = require('electron').BrowserWindow; var win = new BrowserWindow({width: 800, height: 1500}); -win.loadUrl("http://github.com"); +win.loadURL("http://github.com"); var webContents = win.webContents; ``` @@ -32,7 +32,7 @@ Returns: * `event` Event * `errorCode` Integer * `errorDescription` String -* `validatedUrl` String +* `validatedURL` String This event is like `did-finish-load` but emitted when the load failed or was cancelled, e.g. `window.stop()` is invoked. @@ -61,8 +61,8 @@ Returns: * `event` Event * `status` Boolean -* `newUrl` String -* `originalUrl` String +* `newURL` String +* `originalURL` String * `httpResponseCode` Integer * `requestMethod` String * `referrer` String @@ -76,8 +76,8 @@ Emitted when details regarding a requested resource are available. Returns: * `event` Event -* `oldUrl` String -* `newUrl` String +* `oldURL` String +* `newURL` String * `isMainFrame` Boolean * `httpResponseCode` Integer * `requestMethod` String @@ -99,7 +99,7 @@ Emitted when the document in the given frame is loaded. Returns: * `event` Event -* `favicons` Array - Array of Urls +* `favicons` Array - Array of 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. 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. @@ -198,7 +198,7 @@ Returns the `session` object used by this webContents. See [session documentation](session.md) for this object's methods. -### `webContents.loadUrl(url[, options])` +### `webContents.loadURL(url[, options])` * `url` URL * `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, e.g. the `http://` or `file://`. -### `webContents.getUrl()` +### `webContents.getURL()` Returns URL of the current web page. ```javascript 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()` @@ -447,7 +447,7 @@ const BrowserWindow = require('electron').BrowserWindow; const fs = require('fs'); 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() { // Use default printing options @@ -524,7 +524,7 @@ An example of sending messages from the main process to the renderer process: var window = null; app.on('ready', function() { 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.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. ```javascript -win.loadUrl('https://github.com'); +win.loadURL('https://github.com'); win.webContents.on('did-finish-load', function() { win.webContents.savePage('/tmp/test.html', 'HTMLComplete', function(error) { diff --git a/docs/api/web-frame.md b/docs/api/web-frame.md index c9cfb48f..38c5e30d 100644 --- a/docs/api/web-frame.md +++ b/docs/api/web-frame.md @@ -66,7 +66,7 @@ webFrame.setSpellCheckProvider("en-US", true, { }); ``` -### `webFrame.registerUrlSchemeAsSecure(scheme)` +### `webFrame.registerURLSchemeAsSecure(scheme)` * `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 attackers. -### `webFrame.registerUrlSchemeAsBypassingCsp(scheme)` +### `webFrame.registerURLSchemeAsBypassingCSP(scheme)` * `scheme` String Resources will be loaded from this `scheme` regardless of the current page's Content Security Policy. -### `webFrame.registerUrlSchemeAsPrivileged(scheme)` +### `webFrame.registerURLSchemeAsPrivileged(scheme)` * `scheme` String diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index a12ec447..25b0e399 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -170,7 +170,7 @@ webview.addEventListener("dom-ready", function() { }); ``` -### `.getUrl()` +### `.getURL()` Returns URL of guest page. @@ -402,7 +402,7 @@ Returns: * `errorCode` Integer * `errorDescription` String -* `validatedUrl` String +* `validatedURL` String This event is like `did-finish-load`, but fired when the load failed or was 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: * `status` Boolean -* `newUrl` String -* `originalUrl` String +* `newURL` String +* `originalURL` String * `httpResponseCode` Integer * `requestMethod` String * `referrer` String @@ -442,8 +442,8 @@ Fired when details regarding a requested resource is available. Returns: -* `oldUrl` String -* `newUrl` String +* `oldURL` String +* `newURL` String * `isMainFrame` Boolean Fired when a redirect was received while requesting a resource. @@ -466,7 +466,7 @@ url. Returns: -* `favicons` Array - Array of Urls. +* `favicons` Array - Array of URLs. Fired when page receives favicon urls. diff --git a/docs/tutorial/application-packaging.md b/docs/tutorial/application-packaging.md index 7c1ea773..45973e49 100644 --- a/docs/tutorial/application-packaging.md +++ b/docs/tutorial/application-packaging.md @@ -73,7 +73,7 @@ You can also display a web page in an `asar` archive with `BrowserWindow`: ```javascript const BrowserWindow = require('electron').BrowserWindow; 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 diff --git a/docs/tutorial/online-offline-events.md b/docs/tutorial/online-offline-events.md index 6e031282..d143118e 100644 --- a/docs/tutorial/online-offline-events.md +++ b/docs/tutorial/online-offline-events.md @@ -13,7 +13,7 @@ const BrowserWindow = electron.BrowserWindow; var onlineStatusWindow; app.on('ready', function() { 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; app.on('ready', function() { 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) { diff --git a/docs/tutorial/quick-start.md b/docs/tutorial/quick-start.md index 7c55340f..4c614134 100644 --- a/docs/tutorial/quick-start.md +++ b/docs/tutorial/quick-start.md @@ -105,7 +105,7 @@ app.on('ready', function() { mainWindow = new BrowserWindow({width: 800, height: 600}); // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); + mainWindow.loadURL('file://' + __dirname + '/index.html'); // Open the DevTools. mainWindow.webContents.openDevTools(); diff --git a/docs/tutorial/using-pepper-flash-plugin.md b/docs/tutorial/using-pepper-flash-plugin.md index 4cbbb519..a9918b22 100644 --- a/docs/tutorial/using-pepper-flash-plugin.md +++ b/docs/tutorial/using-pepper-flash-plugin.md @@ -36,7 +36,7 @@ app.on('ready', function() { 'plugins': true } }); - mainWindow.loadUrl('file://' + __dirname + '/index.html'); + mainWindow.loadURL('file://' + __dirname + '/index.html'); // Something else }); ``` diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index 055cd8ed..00437ae4 100644 --- a/spec/api-browser-window-spec.coffee +++ b/spec/api-browser-window-spec.coffee @@ -31,14 +31,14 @@ describe 'browser-window module', -> fs.unlinkSync(test) assert.equal String(content), 'unload' 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) -> w.on 'onbeforeunload', -> done() w.webContents.on 'did-finish-load', -> 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()', -> it 'should emit unload handler', (done) -> @@ -48,23 +48,23 @@ describe 'browser-window module', -> fs.unlinkSync(test) assert.equal String(content), 'close' 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) -> w.on 'onbeforeunload', -> 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) -> w.webContents.on 'did-start-loading', -> done() - w.loadUrl 'about:blank' + w.loadURL 'about:blank' it 'should emit did-fail-load event', (done) -> w.webContents.on 'did-fail-load', -> done() - w.loadUrl 'file://a.txt' + w.loadURL 'file://a.txt' describe 'BrowserWindow.show()', -> it 'should focus on window', -> @@ -214,7 +214,7 @@ describe 'browser-window module', -> show: false webPreferences: preload: preload - w.loadUrl 'file://' + path.join(fixtures, 'api', 'preload.html') + w.loadURL 'file://' + path.join(fixtures, 'api', 'preload.html') describe '"node-integration" option', -> it 'disables node integration when specified to false', (done) -> @@ -228,28 +228,28 @@ describe 'browser-window module', -> webPreferences: preload: preload nodeIntegration: false - w.loadUrl 'file://' + path.join(fixtures, 'api', 'blank.html') + w.loadURL 'file://' + path.join(fixtures, 'api', 'blank.html') describe 'beforeunload handler', -> it 'returning true would not prevent close', (done) -> w.on 'closed', -> 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) -> w.on 'closed', -> 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) -> w.on 'onbeforeunload', -> 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) -> w.on 'onbeforeunload', -> 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', -> return if isCI and process.platform is 'darwin' @@ -259,7 +259,7 @@ describe 'browser-window module', -> assert.equal url, 'http://host/' assert.equal frameName, 'host' 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) -> w.webContents.once 'new-window', (e, url, frameName) -> @@ -267,7 +267,7 @@ describe 'browser-window module', -> assert.equal url, 'http://host/' assert.equal frameName, 'target' done() - w.loadUrl "file://#{fixtures}/pages/target-name.html" + w.loadURL "file://#{fixtures}/pages/target-name.html" describe 'maximize event', -> return if isCI @@ -296,7 +296,7 @@ describe 'browser-window module', -> xdescribe 'beginFrameSubscription method', -> it 'subscribes frame updates', (done) -> - w.loadUrl "file://#{fixtures}/api/blank.html" + w.loadURL "file://#{fixtures}/api/blank.html" w.webContents.beginFrameSubscription (data) -> assert.notEqual data.length, 0 w.webContents.endFrameSubscription() @@ -321,4 +321,4 @@ describe 'browser-window module', -> fs.rmdirSync savePageDir done() - w.loadUrl "file://#{fixtures}/pages/save_page/index.html" + w.loadURL "file://#{fixtures}/pages/save_page/index.html" diff --git a/spec/api-clipboard-spec.coffee b/spec/api-clipboard-spec.coffee index b02eb855..19da3fc7 100644 --- a/spec/api-clipboard-spec.coffee +++ b/spec/api-clipboard-spec.coffee @@ -11,7 +11,7 @@ describe 'clipboard module', -> p = path.join fixtures, 'assets', 'logo.png' i = nativeImage.createFromPath p clipboard.writeImage p - assert.equal clipboard.readImage().toDataUrl(), i.toDataUrl() + assert.equal clipboard.readImage().toDataURL(), i.toDataURL() describe 'clipboard.readText()', -> it 'returns unicode string correctly', -> @@ -49,4 +49,4 @@ describe 'clipboard module', -> clipboard.write {text: "test", html: 'Hi', image: p} assert.equal clipboard.readText(), text assert.equal clipboard.readHtml(), markup - assert.equal clipboard.readImage().toDataUrl(), i.toDataUrl() + assert.equal clipboard.readImage().toDataURL(), i.toDataURL() diff --git a/spec/api-crash-reporter-spec.coffee b/spec/api-crash-reporter-spec.coffee index 281a1a77..676dbf9d 100644 --- a/spec/api-crash-reporter-spec.coffee +++ b/spec/api-crash-reporter-spec.coffee @@ -55,5 +55,5 @@ describe 'crash-reporter module', -> pathname: path.join fixtures, 'api', 'crash.html' search: "?port=#{port}" if process.platform is 'darwin' - crashReporter.start {'submitUrl': 'http://127.0.0.1:' + port} - w.loadUrl url + crashReporter.start {'submitURL': 'http://127.0.0.1:' + port} + w.loadURL url diff --git a/spec/api-ipc-spec.coffee b/spec/api-ipc-spec.coffee index 1e6ee8f8..a8d2a65c 100644 --- a/spec/api-ipc-spec.coffee +++ b/spec/api-ipc-spec.coffee @@ -86,7 +86,7 @@ describe 'ipc module', -> event.returnValue = null w.destroy() 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', -> it 'can be added and removed correctly', -> diff --git a/spec/api-session-spec.coffee b/spec/api-session-spec.coffee index f544dff4..bf91bdd6 100644 --- a/spec/api-session-spec.coffee +++ b/spec/api-session-spec.coffee @@ -23,7 +23,7 @@ describe 'session module', -> server.listen 0, '127.0.0.1', -> {port} = server.address() - w.loadUrl "#{url}:#{port}" + w.loadURL "#{url}:#{port}" w.webContents.on 'did-finish-load', -> w.webContents.session.cookies.get {url: url}, (error, list) -> return done(error) if error @@ -64,7 +64,7 @@ describe 'session module', -> ipcMain.removeAllListeners 'count' assert not count 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', -> options = origin: "file://", @@ -91,7 +91,7 @@ describe 'session module', -> downloadServer.listen 0, '127.0.0.1', -> {port} = downloadServer.address() 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) -> assert.equal state, 'completed' assert.equal filename, 'mock.pdf' @@ -108,7 +108,7 @@ describe 'session module', -> downloadServer.listen 0, '127.0.0.1', -> {port} = downloadServer.address() 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) -> assert.equal state, 'cancelled' assert.equal filename, 'mock.pdf' diff --git a/spec/asar-spec.coffee b/spec/asar-spec.coffee index f84fb059..ad480a58 100644 --- a/spec/asar-spec.coffee +++ b/spec/asar-spec.coffee @@ -453,7 +453,7 @@ describe 'asar package', -> ipcMain.once 'dirname', (event, dirname) -> assert.equal dirname, path.dirname(p) done() - w.loadUrl u + w.loadURL u it 'loads script tag in html', (done) -> after -> @@ -463,7 +463,7 @@ describe 'asar package', -> w = new BrowserWindow(show: false, width: 400, height: 400) p = path.resolve fixtures, 'asar', 'script.asar', 'index.html' u = url.format protocol: 'file', slashed: true, pathname: p - w.loadUrl u + w.loadURL u ipcMain.once 'ping', (event, message) -> assert.equal message, 'pong' done() diff --git a/spec/chromium-spec.coffee b/spec/chromium-spec.coffee index ebd7b36d..435f7bbb 100644 --- a/spec/chromium-spec.coffee +++ b/spec/chromium-spec.coffee @@ -43,7 +43,7 @@ describe 'chromium feature', -> w.webContents.on 'ipc-message', (event, args) -> assert.deepEqual args, ['hidden', true] done() - w.loadUrl url + w.loadURL url describe 'navigator.webkitGetUserMedia', -> it 'calls its callbacks', (done) -> @@ -96,7 +96,7 @@ describe 'chromium feature', -> w.webContents.on 'ipc-message', (event, args) -> assert.deepEqual args, ['opener', null] done() - w.loadUrl url + w.loadURL url it 'is not null for window opened by window.open', (done) -> listener = (event) -> diff --git a/spec/fixtures/api/crash.html b/spec/fixtures/api/crash.html index 30494849..c1fb6214 100644 --- a/spec/fixtures/api/crash.html +++ b/spec/fixtures/api/crash.html @@ -6,7 +6,7 @@ var crashReporter = require('electron').crashReporter; crashReporter.start({ productName: 'Zombies', companyName: 'Umbrella Corporation', - submitUrl: 'http://127.0.0.1:' + port, + submitURL: 'http://127.0.0.1:' + port, autoSubmit: true, ignoreSystemCrashHandler: true, extra: { diff --git a/spec/static/main.js b/spec/static/main.js index e071474f..be3690cd 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -67,7 +67,7 @@ app.on('ready', function() { javascript: true // Test whether web-preferences crashes. }, }); - window.loadUrl('file://' + __dirname + '/index.html'); + window.loadURL('file://' + __dirname + '/index.html'); window.on('unresponsive', function() { var chosen = dialog.showMessageBox(window, { type: 'warning', @@ -88,7 +88,7 @@ app.on('ready', function() { item.on('done', function(e, state) { window.webContents.send('download-done', state, - item.getUrl(), + item.getURL(), item.getMimeType(), item.getReceivedBytes(), item.getTotalBytes(), -- 2.43.0