Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
872cb22
Prevent crash on `nw.showDevTools` on non-sdk build
ayushmanchhabra Mar 3, 2023
e760ba4
build: fix python not found error
ayushmanchhabra Mar 6, 2023
bc4e111
build(node): `copy_node` should not refer to Debug on Release
ayushmanchhabra Mar 7, 2023
71fa5de
test: start test case
ayushmanchhabra Mar 7, 2023
ea9db44
test: remove tmp file
ayushmanchhabra Mar 7, 2023
d76cdc9
test: only run test if flavor is not sdk
ayushmanchhabra Mar 7, 2023
a97c0be
EoL
TheJaredWilcurt Mar 8, 2023
4cfc2dc
Add doctype
TheJaredWilcurt Mar 8, 2023
df4d9a3
test: move test from sanity to manual
ayushmanchhabra Mar 8, 2023
5eb3e40
test: resolve merge conflicts
ayushmanchhabra Mar 8, 2023
e800cf0
build: run using Python3
ayushmanchhabra Mar 8, 2023
3038d82
test: uncomment manual test code
ayushmanchhabra Mar 10, 2023
7185cdb
Merge branch 'nw74' of github.com:tharatau/nw-core into nw74
ayushmanchhabra Mar 10, 2023
f099d8d
build: revert incorrect config change
ayushmanchhabra Mar 15, 2023
adcac6d
build: revert unnecessary change
ayushmanchhabra Mar 15, 2023
176206e
fix(test): prevent crash
ayushmanchhabra Mar 15, 2023
065413e
Merge branch 'nwjs:nw74' into dev-8012
ayushmanchhabra Mar 28, 2023
344b401
chore: revert git ignore log file
ayushmanchhabra Apr 4, 2023
8d75ac4
chore: revert icu patch
ayushmanchhabra Apr 4, 2023
2d62074
[Resources/Window] Throw error if build flavor not `sdk`
ayushmanchhabra Apr 18, 2023
cd89214
[Resources/Window] Throw error if build flavor not `sdk`
ayushmanchhabra Apr 18, 2023
51c9a63
test: catch error to prevent crash
ayushmanchhabra Apr 20, 2023
079d890
Merge branch 'nwjs:nw75' into dev-8012
ayushmanchhabra Apr 20, 2023
f46075c
docs: change of behaviour note in docs
ayushmanchhabra Apr 20, 2023
c908e4f
Update docs/References/Window.md
ayushmanchhabra Apr 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ tests/tmp-nw
tags
Thumbs.db
/tmp
log
2 changes: 1 addition & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ if (is_mac) {
}

copy("copy_node") {
if (is_debug) {
if (is_debug && !is_linux) {
node_dir = "$root_out_dir/../Debug/lib/"
} else {
node_dir = "$root_out_dir/../Release/lib/"
Expand Down
15 changes: 12 additions & 3 deletions patch/patches/icu.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/icu.gyp b/icu.gyp
index b3c12030..799dce2a 100644
--- icu.gyp
+++ icu.gyp
index 7deb43c..b0bc0a3 100644
--- a/icu.gyp
+++ b/icu.gyp
@@ -25,6 +25,7 @@
'defines': [
'U_USING_ICU_NAMESPACE=0',
Expand Down Expand Up @@ -29,3 +29,12 @@ index b3c12030..799dce2a 100644
['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
(target_arch=="arm" or target_arch=="ia32" or \
@@ -173,7 +184,7 @@
'_toolset == "host" and host_os == "mac")', {
'action': ['python', '<@(_inputs)', '<@(_outputs)', '--mac'],
} , {
- 'action': ['python', '<@(_inputs)', '<@(_outputs)'],
+ 'action': ['python3', '<@(_inputs)', '<@(_outputs)'],
}],
],
},
2 changes: 2 additions & 0 deletions src/resources/api_nw_newwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ NWWindow.prototype.toggleKioskMode = function() {
};

NWWindow.prototype.showDevTools = function(frm, callback) {
if (process.versions['nw-flavor'] !== 'sdk')
return new Error('showDevTools does not exist on normal build flavor.');
var id = '';
if (typeof frm === 'string')
id = frm;
Expand Down
2 changes: 2 additions & 0 deletions src/resources/api_nw_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ apiBridge.registerCustomHook(function(bindingsAPI) {
};

NWWindow.prototype.showDevTools = function(frm, callback) {
if (process.versions['nw-flavor'] !== 'sdk')
return new Error('showDevTools does not exist on normal build flavor.');
var id = '';
if (typeof frm === 'string')
id = frm;
Expand Down
22 changes: 22 additions & 0 deletions test/sanity/window-showdevtools/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<html>
Comment thread
TheJaredWilcurt marked this conversation as resolved.
Outdated

<head>
<script>
document.addEventListener("DOMContentLoaded", () => {
const process = require(process);
const w = nw.Window.get();
const e = nw.showDevTools();

document.getElementById("flavor").innerText = process.versions["nw-flavor"];
document.getElementById("result").innerText = e.message;

});
</script>
</head>

<body>
<span id="flavor"></span>
<span id="result"></span>
</body>

</html>
4 changes: 4 additions & 0 deletions test/sanity/window-showdevtools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "window-showdevtools",
"main": "index.html"
}
24 changes: 24 additions & 0 deletions test/sanity/window-showdevtools/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))

driver = webdriver.Chrome(
service=Service(
executable_path=os.environ["CHROMEDRIVER"]
),
options=chrome_options
)
driver.implicitly_wait(5)
try:
flavor = driver.find_element(By.ID, 'flavor').get_attribute('innerHTML')
if (flavor == "normal"):
result = driver.find_element(By.ID, 'result').get_attribute('innerHTML')
assert(result == 'showDevTools does not exist on normal build flavor.')
finally:
driver.quit()