diff --git a/aports/main/qt5-qtwebchannel/APKBUILD b/aports/main/qt5-qtwebchannel/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..55d0707d63d569a10fce74271b43f2b5b86efaba
--- /dev/null
+++ b/aports/main/qt5-qtwebchannel/APKBUILD
@@ -0,0 +1,43 @@
+pkgname=qt5-qtwebchannel
+_pkgname=${pkgname/qt5-//}-opensource-src
+pkgver=9999
+_pkgver=5.9.3
+_ver=${_pkgver/_/-}
+_ver=${_ver/beta0/beta}
+_ver=${_ver/rc0/rc}
+_V=${_ver/rc/RC}
+pkgrel=0
+pkgdesc="library for seamless integration of C++ +and QML applications with HTML/JavaScript clients."
+url="http://qt-project.org/"
+arch="all"
+license="LGPLv2 with exceptions or GPLv3 with exceptions"
+options="!check" #upstream does not provide check
+depends="qt5-qtdeclarative qt5-qtquickcontrols2-dev"
+makedepends="qt5-qtbase-dev qt5-websockets-dev qt5-qtdeclarative-dev qt5-qtquickcontrols2-dev"
+subpackages="$pkgname-dev"
+
+case $_pkgver in
+*_beta*|*_rc*) _rel=development_releases;;
+*) _rel=official_releases;;
+esac
+source="http://download.qt-project.org/$_rel/qt/${_pkgver%.*}/$_ver/submodules/$_pkgname-$_V.tar.xz"
+
+builddir="$srcdir"/$_pkgname-${_V%-*}
+
+prepare() {
+	default_prepare
+	cd "$builddir"
+	mkdir -p build
+}
+
+build() {
+	cd "$builddir"/build
+	qmake-qt5 ..
+	make
+}
+
+package() {
+	cd "$builddir"/build
+	make INSTALL_ROOT="$pkgdir" install
+}
+sha512sums="d03a091121256532aac1ab4492b83ba29c847729f2628a2bc7a76b064d197e72cfdab50f0ec2314eac01cc47e2255bfef17f2e010d7b2c3d408b9af74c9ea136  qtwebchannel-opensource-src-5.9.3.tar.xz"
diff --git a/aports/main/qt5-qtwebengine/APKBUILD b/aports/main/qt5-qtwebengine/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..846b184ff5d2843a05344a9f3d557c33f491d2de
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/APKBUILD
@@ -0,0 +1,147 @@
+pkgname=qt5-qtwebengine
+pkgver=5.9.3
+pkgrel=0
+arch="all"
+url='http://qt-project.org/'
+license="GPL3 LGPL3 FDL custom"
+pkgdesc='Provides communication between JS/HTML and Qt apps'
+depends="qt5-qtbase qt5-qtquickcontrols2 python2 fontconfig dbus-x11 libcap libdrm libxcomposite libxcursor libxi libxrandr libxscrnsaver libxtst alsa-lib ffmpeg libwebp opus icu-libs libevent libexecinfo qt5-qtwebchannel libjpeg-turbo libintl gettext dbus libpbnjson luna-service2"
+makedepends="qt5-qtbase-dev qt5-qtquickcontrols2-dev python2-dev bison flex gperf fontconfig-dev mesa-dev libcap-dev libdrm-dev libxcomposite-dev libxcursor-dev libxi-dev libxrandr-dev libxscrnsaver-dev libxtst-dev alsa-lib-dev ffmpeg-dev ffmpeg-libs jsoncpp-dev ninja libwebp-dev opus-dev icu-dev libevent-dev bsd-compat-headers libexecinfo-dev git qt5-qtwebchannel-dev libjpeg-turbo-dev gzip libintl gettext-dev yasm dbus-dev libpbnjson-dev luna-service2-dev"
+builddir="$srcdir/${pkgname/qt5-/}-opensource-src-$pkgver"
+source="http://download.qt.io/official_releases/qt/${pkgver%.*}/${pkgver}/submodules/${pkgname/qt5-/}-opensource-src-$pkgver.tar.xz
+patches-musl/0001-chromium-Change-false-to-FALSE-and-1-to-TRUE-FIX-qtw.patch
+patches-musl/0001-functions.prf-allow-build-for-linux-oe-g-platform.patch
+patches-musl/0002-chromium-Force-host-toolchain-configuration.patch
+patches-musl/0002-WebEngine-qquickwebengineview_p_p.h-add-include-QCol.patch
+patches-musl/0003-chromium-workaround-for-too-long-.rps-file-name.patch
+patches-musl/0003-Include-dependency-to-QCoreApplication-translate.patch
+patches-musl/0004-chromium-musl-sandbox-Define-TEMP_FAILURE_RETRY-if-n.patch
+patches-musl/0005-chromium-musl-Avoid-mallinfo-APIs-on-non-glibc-linux.patch
+patches-musl/0006-chromium-musl-include-fcntl.h-for-loff_t.patch
+patches-musl/0007-chromium-musl-use-off64_t-instead-of-the-internal-__.patch
+patches-musl/0008-chromium-musl-linux-glibc-make-the-distinction.patch
+patches-musl/0009-chromium-musl-allocator-Do-not-include-glibc_weak_sy.patch
+patches-musl/0010-chromium-musl-Use-correct-member-name-__si_fields-fr.patch
+patches-musl/0011-chromium-musl-Match-syscalls-to-match-musl.patch
+patches-musl/0012-chromium-musl-Define-res_ninit-and-res_nclose-for-no.patch
+patches-musl/0013-chromium-musl-Do-not-define-__sbrk-on-musl.patch
+patches-musl/0014-chromium-musl-Adjust-default-pthread-stack-size.patch
+patches-musl/0015-chromium-musl-include-asm-generic-ioctl.h-for-TCGETS.patch
+patches-musl/0016-chromium-musl-tcmalloc-Use-off64_t-insread-of-__off6.patch
+patches-musl/gn_bootstrap.patch
+patches-musl/no_execinfo.patch
+patches-musl/yasm_intl.patch
+patches-musl/renderthread-mallinfo.patch
+patches-musl/no-pvalloc.patch
+use-ozone.patch
+patches-luna/0001-Add-PalmServiceBridge-to-WebEngine.patch
+patches-luna/0002-PalmServiceBridge-adapt-to-Chromium-53-code-base.patch
+patches-luna/0003-WebContents-provide-additional-features-from-window..patch
+patches-luna/0004-Store-the-additional-window-features-related-to-Lune.patch
+patches-luna/0005-WindowFeatures-Chrome-lower-the-minimum-height-to-5.patch
+patches-luna/0006-Enable-password-echo.patch
+patches-luna/0007-storage-browser-quota-workaround-for-crash-on-cache-.patch
+patches-luna/0008-html.css-themeWin.css-Add-Prelude-as-default-font-in.patch
+patches-luna/0010-Update-additional-params-from-Chromium-53-56.patch
+patches-luna/0011-Fix-WebGL2-Textures.patch
+patches-luna/0002-WebEngineView-provide-additionnal-features-from-wind.patch
+patches-luna/0003-WebEngineNewViewRequest-provide-the-requested-URL-as.patch
+patches-luna/0004-Implement-Sync-IPC-messaging-through-qt.webChannelTr.patch
+patches-luna/0005-Make-properties-for-some-settings-for-PalmBridgeServ.patch
+patches-luna/0006-WebEngineSettings-Add-a-standardFontFamily-property-.patch
+patches-luna/0007-WebEngineSettings-add-also-Serif-Fixed-and-Cursive-f.patch
+patches-luna/0008-Store-the-additional-window-features-required-by-the.patch
+patches-luna/0009-QQuickWebEngineNewViewRequest-use-initialTargetUrl-f.patch
+patches-luna/0010-WebEngineNewViewRequest-add-possibility-to-get-reque.patch
+patches-luna/0011-GetScreenInfo-use-default-screen-when-no-window-is-a.patch
+patches-luna/0012-Enable-password-echo.patch
+patches-luna/0013-Implement-RequestQuotePermission.patch
+patches-luna/0014-WebEngineView-re-introduce-devicePixelRatio-property.patch
+patches-luna/0015-WebEngineView-add-extraContextMenuEntriesComponent-p.patch
+patches-luna/0016-Fix-build-for-Qt5.9.patch
+patches-luna/0017-gn_generator-fix-debug-build.patch
+patches-luna/0018-Add-LuneOS-specific-switches.patch
+"
+subpackages="$pkgname-dev $pkgname-doc"
+
+prepare() {
+	for i in "$startdir"/patches*; do
+		ln -sv "$i" "$srcdir/$(basename "$i")"
+	done
+	default_prepare
+	mkdir -p "$srcdir"/build
+}
+
+build() {
+	cd $srcdir/build
+
+	export QT_CONFIG=system-ffmpeg
+	qmake-qt5 WEBENGINE_CONFIG+=use_system_ffmpeg "$srcdir"/${pkgname/qt5-/}-opensource-src-$pkgver 
+	make
+}
+
+package() {
+	cd $srcdir/build
+
+	make INSTALL_ROOT="$pkgdir" install
+
+	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
+	find "$pkgdir/usr/lib" -type f -name '*.prl' \
+		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
+
+	install -d "$pkgdir"/usr/share/licenses
+	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/${pkgname}
+}
+sha512sums="0db532b4d54540da1ca63de1cc4d561d72f052211535f75f60b99c1858ec0819ab0f831a3326d58da6350066748634000fe7ad0719ca545e12f3ed249a6eb90a  qtwebengine-opensource-src-5.9.3.tar.xz
+32648dcd9e389b52cf65f5085e72c35afe48a97285b549096cd6f561fdf39bb37372b464e9ebcba95611244b29fc76b63c76d805152edd2f2678d1a812429a50  0001-chromium-Change-false-to-FALSE-and-1-to-TRUE-FIX-qtw.patch
+18a1a30e9a5d7e67b1e94cfde1930685cbf80fb1e54c3c0fb5255ddf19cba6d9b8d5f1b681b1c755aa41111b2f1c05c8557caa11715b0506f6b3cdb9d7474423  0001-functions.prf-allow-build-for-linux-oe-g-platform.patch
+351000898b7e5495dea555bd728d88be4c01e473892f001bf9cfe248fae443333be70778a309b20be3eb83b7bcd952d7fb62acfe0d61b01cf7e7dadfb8cc78ff  0002-chromium-Force-host-toolchain-configuration.patch
+f1ef72db8c1b8a84f8e62a2999d15e61cb648e1f973fd17a9b84e4aed4e46f296ce796e52b5938d7ea43bdd3b03318c3aab109f1570927dc7e649f41d7981479  0002-WebEngine-qquickwebengineview_p_p.h-add-include-QCol.patch
+4bcda52bec2e39911425af03b16826d37fec73f412aeb0ce828221bb3b0e3e703f711a88d1612f30aabd570b1055c58e202d14b49a5d805842a23a4981b6def1  0003-chromium-workaround-for-too-long-.rps-file-name.patch
+d924461cdeaea9a44c431f07f1703070e006e42b67bb12aa1bc99908c529f0d979e212bfbc99f4747f875cd3056bcdf7133d003e8775407e648f9ff37132b2cd  0003-Include-dependency-to-QCoreApplication-translate.patch
+5ef75ac7b5e576bea362a0d94d495df6698d7b4544f8bef87cd2e7e57cfaab74b8698ae46f6d3544f5f2efdc416936407052eee79fb51c1b0a106ea3a2196dac  0004-chromium-musl-sandbox-Define-TEMP_FAILURE_RETRY-if-n.patch
+bd2696ab829376e3f77e74abad3b12e26e109961bf630ee1a1dac5435d3f0d20d638a38401f605ccb5b0b6cf039406590778d894ada322c3f01232e362695ba2  0005-chromium-musl-Avoid-mallinfo-APIs-on-non-glibc-linux.patch
+62dd7ed3803299a56f007da3f7dfaf655afd41c54427d6457a8aa5d34cd339a906280c199d1246099291973ea27376123d2a7f57f9cae1c6efccb085120bd2c4  0006-chromium-musl-include-fcntl.h-for-loff_t.patch
+f1b7c634a8f955bda4e6f98dd758444a482b9d3d638dc7afb1d182159a4fd1a281f845a2ab3f378737e78a44033d537e270e8e5bd425705d2cb98829f6eab237  0007-chromium-musl-use-off64_t-instead-of-the-internal-__.patch
+30016e498a2c30acb53695093b9d5607ef500d10c63501c632a18fe6424d99f84c2bbae8e87d9774cc2000ddecf951c4bf20c6f1ff4716ed80f5c624a91445d3  0008-chromium-musl-linux-glibc-make-the-distinction.patch
+0d0778fa41507167d583f270c4b40a9331b900b13dce21aa76af31f43b11bff6fdaaaa91cdd33d4e8d093ea9c0826ecdd39658e1e86acadba2caa2ded83c6b87  0009-chromium-musl-allocator-Do-not-include-glibc_weak_sy.patch
+f0d7ba14c32e09cd6a7a44e641f28d800ed66ca87c8126ff77065332c1965848ce2390adbd60a2b56b597ede21afc06b288877c09ea82edec29ffef5c54dc4bf  0010-chromium-musl-Use-correct-member-name-__si_fields-fr.patch
+3f9c6ef70a1e16d7c22d71c228bcce62594e54262a969bf9b12648e01c1c27fdae0631ae386c77bf692143996e00ade849effa2808179ef4ebb988dc8179ad8f  0011-chromium-musl-Match-syscalls-to-match-musl.patch
+f69fae2cbe9869560e90888b2cb5727c8fa9b460665a9148a46653c288bf782f791ffde008aadb04fa9ae92445fe7c307c371ca7004753812ff1f848d5cd25f9  0012-chromium-musl-Define-res_ninit-and-res_nclose-for-no.patch
+e0a4d0acc501bbdd2dc6eb37b1824c3d0833e53708f4a6e6fcfaeb27b181bde0cd726b03ec33de1b8dcb8fc5f650706842acbb6ef70381fc8dbb9a1fbb751b60  0013-chromium-musl-Do-not-define-__sbrk-on-musl.patch
+bd27b1f0ab41b6edc2579e00d2155335d6b662424f682bf3183d1abb27b1266b75a79e63f3708317b90e29f22b0a2f2c660d5587b08512fc981d32b78be07ac9  0014-chromium-musl-Adjust-default-pthread-stack-size.patch
+2a8c70dbffab9f2c15cc862e795a762578ba363db6ac7d43d97ce2d8a0f43c8ce0a7c77b8fe9b0010a924d99a304e97f6b29cb969009cd2bcdc5dbe0caceed43  0015-chromium-musl-include-asm-generic-ioctl.h-for-TCGETS.patch
+ebff27bc19476fad4cbbb619d74bb0cc9d63cf82245dc5c53352df423aa7096844e1b0ee8156d77796b001496ea850bfa0faf4f1278a369a394a3501f62c49f2  0016-chromium-musl-tcmalloc-Use-off64_t-insread-of-__off6.patch
+07ef6db227cf80683960a4e00e307980bd7b911ca4614d477a77b318a2e2d649cb39563b1f9feb3abea78d6d603d88762160c52f83f4204f90512bf6efb685d9  gn_bootstrap.patch
+45919a5e90db8e32d5a5c121a49927652f726cc4206e1e7af830376e634769012162cb8915b9acde7971d111b095496c50b9c69ca32a41bf09ca0cab66bef88a  no_execinfo.patch
+f6c17aa2c8136ca13b51d0b3819435819bcaaf65ea42b6d66460ae08e14a0d75560d938480dfe07ea07f146384476cfa86674921eabd6ab8a3d691d2b93ed0fc  yasm_intl.patch
+ca12618013458ebabc4f84b7458fb0a58629aebca8745ffe96122131fadfa72b17c9351a4b35a4542cd2132b5dbba4fb3b60b52e3c47a853f87eec7c22e9aea2  renderthread-mallinfo.patch
+bfa7c934c8c300d706cf36e9584a3411f814d1764af928603f55c0e14c9bfef95dd7c357ac686d72d29d46224b782a9e86870acdb140f4eeeb79a4a60f976656  no-pvalloc.patch
+9ff66a603807aec4ebc5df7d94155b2c8085039c69a79bd90553b5bedc6799dd7898fd856998a02f6deb15772a657cc06aa4d97b55f6a3665061027f624881ea  use-ozone.patch
+9efad8cc7be70f0687ffee585b3e943c76e576d8121a14c79a16e96586301cfd464056bea1bfc58298f7eaa89839af5af5c5f5d629843ad2182d27820d496043  0001-Add-PalmServiceBridge-to-WebEngine.patch
+64443e6e078744803ebf34adbb3cbe8cf0ad1becbbfafefc1f882cb12ee71ff401ced826a509f91b151cb739ef9947b6cc6f39c278bb8f6418a8396fe7d8968c  0002-PalmServiceBridge-adapt-to-Chromium-53-code-base.patch
+8eca1df605f5ef69883b03135058306f877615a7d64802be016a747e784984a27121d88e38583d0ff22d514c2e655bafc1fdefc24ff4829741fab9d3b632ee4f  0003-WebContents-provide-additional-features-from-window..patch
+addc34766f68eb058c3d67ab23daf58345238ed12dc47ce69e3ef1337a582538d1c5bb2f718aef8f76967f6b3d9cc3967a30c278af52a33bc0fac3dd3daeb091  0004-Store-the-additional-window-features-related-to-Lune.patch
+fa6ef473a91acc0e2e492943d7e3b29d06ac3ad8c016eca8205972dc6193455bade5b6af7ffc13e8d96184dc01d320dcab579c9ded2966592e4db0cf8b067448  0005-WindowFeatures-Chrome-lower-the-minimum-height-to-5.patch
+4fc58fa6f3ccb37fdbc7205cfade90c86da739e5dfad24b59c17e0db233d1ddede70d41e8314e222e432684e7d766c00ff984a4d41aea176c08d3e9f50750a12  0006-Enable-password-echo.patch
+cfc24127f132cd3fa67f45372e93d9d7c0497ab08d7c99bf7fdfc65078216d8c3fd31bcaf32b19e9835fd1c0d635ff28140c8bba170c6ca636c56e31656c30a0  0007-storage-browser-quota-workaround-for-crash-on-cache-.patch
+1df2db6b4259c211005984cf13dcdadd848ae14c15f20fcdfba4c1e07abac5478817f00023bbec81569f82229ef0c3e0237b9d0adee8ba20e1b74275a68c67bf  0008-html.css-themeWin.css-Add-Prelude-as-default-font-in.patch
+db11d1f5316c15d1f49a33f2576587fd7cc274594fd52a1e33713678f5fdcd57954380d74ff1048cd9136bc39c8809c0d06eb0f3bc7d53ce6b0f70631b16e8ec  0010-Update-additional-params-from-Chromium-53-56.patch
+b57de7c7f05ddd5c3f7ad9c3cc864cc88022f53cf92e9a558a00215c536b48bece104520575f8fef303c48d3718d5831a0806b6a094e9cc93c65112c9b7963cf  0011-Fix-WebGL2-Textures.patch
+6fd1c34d8eef5e8b4d9f7800ac2d00599e6d2afa63df602a7b9ad11a809ef827ef0c2c3f00ee81eee8cea1f5e2e8bb3fcb773902e5ad7ae60b70dc486bc6d6fc  0002-WebEngineView-provide-additionnal-features-from-wind.patch
+cd105f87db6f802ba2503471df295d80441845e3f21c60b72d098b21dd13b502373bab5e89a1d7730ada00cda573c69d824ca82314e199f12fc1d0e3fea737f0  0003-WebEngineNewViewRequest-provide-the-requested-URL-as.patch
+6c66c8d52dfb02f5eeb5f63f4287e21ae8e2ae82d4384ad5db4b5e5f7da1b812d2bd6c37c2cba53ac4bbbde5f98f5062c9fce56922af0d5032366b4f23ed0e88  0004-Implement-Sync-IPC-messaging-through-qt.webChannelTr.patch
+cdb7fb29857c166c428bbf912dacc22d4f83d9719fb5079931b92ad891c9d23574dd0d0c0c205c8e2ced918e21b0dae5e7ded983323285f542b09495645e72ae  0005-Make-properties-for-some-settings-for-PalmBridgeServ.patch
+af6586db207b5cf25737c043b410f7a4081a393662425b91c58f69ac618920188d26886a32c60b7d57ca48a55975b8ee4cbe2483adad409f56e7f85453683fc2  0006-WebEngineSettings-Add-a-standardFontFamily-property-.patch
+42b1c524b1f0dec96f1d280d754314a6ced21ab3790e438b4e65dfd1cdabb64fd7e8e0eb9bfdafb955acf8f1c71d4c300a66ff1733591489288d56805a14c749  0007-WebEngineSettings-add-also-Serif-Fixed-and-Cursive-f.patch
+61fc952d385520494c61d6df8f72ae2f5331fda9f760dc0da2e069495c767b04dc381fc93b08bb4795c1cf817dc92809930ce83cf4f248d65fa596499028a624  0008-Store-the-additional-window-features-required-by-the.patch
+88e6394a02065ce14b472791d53897b0792c7f69959b316575f509ae3f7ba02d9feffb6fd17e63bca7f748631b19ac968351b51db4015b91e68840fafbab9861  0009-QQuickWebEngineNewViewRequest-use-initialTargetUrl-f.patch
+c202c74d12565bca7099e06c114ae81f57d1e99c9b7bfa3d0e645c8b870bbdadbc6e346bb2ee63aad172d7c50b76905e0de2b6ef0f4452dabf2cd0c7d4043d0e  0010-WebEngineNewViewRequest-add-possibility-to-get-reque.patch
+dcfc529c44d84db9f794bb3876e13c60c03f51997537541029e499837a07d1e3c162201337305ce5a7b92fff4a0f610b2460156e0510ab64a5e4e61ea95afa73  0011-GetScreenInfo-use-default-screen-when-no-window-is-a.patch
+baf4f2c86c94d2c4531b621999b02840e27f542e431296555cba33fbc7a8762bcb346cd629e4883731d25d425072198de626d1c6d1010ad0e40929b17a5f9022  0012-Enable-password-echo.patch
+5a4dca4d5289b8d1fc5a2108721a5be8a8d3997a92055cfac9e9f6466c913f00ef2388d2b11d593bd77ddcb4eb0432268ccc1ba89a3bbaff71e4a8a0cde5614b  0013-Implement-RequestQuotePermission.patch
+0921c6a20124bdbace7003551772adf4155792a7cb4ba49af80963345d2470320066c279e79e46d22bedbb34eaec9c66b6c5f03ea22e3ae230779ebd5c7f1c58  0014-WebEngineView-re-introduce-devicePixelRatio-property.patch
+c29e6b5c455fb77b06a8c368300115b3f458d860c2d9d42fc4c0e6940fa6433afa27b40742d5e416464ca55ca90ce3f6f21c89e2c238d7facd6381ef3e9bcc1b  0015-WebEngineView-add-extraContextMenuEntriesComponent-p.patch
+314686a8938bc56c04e74f0b2ef3e8acaa9899bae4c58107ddd14eaa2698f29976a102dfb43519e4a050a9410559564fa454bd1226f12d758ae3b7401c53b92b  0016-Fix-build-for-Qt5.9.patch
+5c4d944e37205e6b5c462055ad398eed2a1b71d263051a580c68c6c76c826b1dee7dbf383dcdb9334b7634292d6ae1a5f323a6a307be65db6426de554744f78d  0017-gn_generator-fix-debug-build.patch
+f6a3747af295361b2542a258026b510fbd65196fd9108bb5b596a01e24366a3384fa0bf6f7bd44146ac0db3e58250510641c5be0ae1502c571761ff81f60d2c8  0018-Add-LuneOS-specific-switches.patch"
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0001-Add-PalmServiceBridge-to-WebEngine.patch b/aports/main/qt5-qtwebengine/patches-luna/0001-Add-PalmServiceBridge-to-WebEngine.patch
new file mode 100644
index 0000000000000000000000000000000000000000..02750f623aa8de4992e323a3deac8bf55962edda
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0001-Add-PalmServiceBridge-to-WebEngine.patch
@@ -0,0 +1,1054 @@
+From 4c6b93dc7515ebd193ec60d5cd2085f901351969 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sat, 26 Sep 2015 22:26:24 +0200
+Subject: [PATCH 01/10] Add PalmServiceBridge to WebEngine
+
+* Adapt PalmServiceBridge IDL for Chromium
+* Propagate PalmBridgeService related settings from host
+* Attempt to have a correct implementation for onserviceresponse attribute
+* test returned identifier before using it
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ .../public/common/common_param_traits_macros.h     |   3 +
+ chromium/content/public/common/web_preferences.cc  |   5 +-
+ chromium/content/public/common/web_preferences.h   |   5 +
+ chromium/content/renderer/render_view_impl.cc      |   3 +
+ .../WebKit/Source/core/frame/Settings.in           |  11 +
+ .../third_party/WebKit/Source/modules/BUILD.gn     |   1 +
+ .../WebKit/Source/modules/modules_idl_files.gni    |   1 +
+ .../WebKit/Source/modules/webos/BUILD.gn           |  13 +
+ .../WebKit/Source/modules/webos/Logging.h          |  11 +
+ .../WebKit/Source/modules/webos/LunaServiceMgr.cpp | 316 +++++++++++++++++++++
+ .../WebKit/Source/modules/webos/LunaServiceMgr.h   |  53 ++++
+ .../Source/modules/webos/PalmServiceBridge.cpp     | 300 +++++++++++++++++++
+ .../Source/modules/webos/PalmServiceBridge.h       |  90 ++++++
+ .../Source/modules/webos/PalmServiceBridge.idl     |  14 +
+ .../WebKit/Source/web/WebSettingsImpl.cpp          |  16 ++
+ .../WebKit/Source/web/WebSettingsImpl.h            |   3 +
+ .../third_party/WebKit/public/web/WebSettings.h    |   3 +
+ 17 files changed, 847 insertions(+), 1 deletion(-)
+ create mode 100644 chromium/third_party/WebKit/Source/modules/webos/BUILD.gn
+ create mode 100644 chromium/third_party/WebKit/Source/modules/webos/Logging.h
+ create mode 100644 chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.cpp
+ create mode 100644 chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.h
+ create mode 100644 chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.cpp
+ create mode 100644 chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.h
+ create mode 100644 chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.idl
+
+diff --git a/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h b/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
+index 9b2e0ff..c4568af 100644
+--- a/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
++++ b/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
+@@ -245,6 +245,9 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
+   IPC_STRUCT_TRAITS_MEMBER(default_minimum_page_scale_factor)
+   IPC_STRUCT_TRAITS_MEMBER(default_maximum_page_scale_factor)
+   IPC_STRUCT_TRAITS_MEMBER(hide_download_ui)
++  IPC_STRUCT_TRAITS_MEMBER(luneosPriviledged)
++  IPC_STRUCT_TRAITS_MEMBER(palmServiceBridgeEnabled)
++  IPC_STRUCT_TRAITS_MEMBER(luneosAppIdentifier)
+ IPC_STRUCT_TRAITS_END()
+ 
+ IPC_STRUCT_TRAITS_BEGIN(blink::WebWindowFeatures)
+diff --git a/src/3rdparty/chromium/content/public/common/web_preferences.cc b/src/3rdparty/chromium/content/public/common/web_preferences.cc
+index 2e9e036..45b6d9f 100644
+--- a/src/3rdparty/chromium/content/public/common/web_preferences.cc
++++ b/src/3rdparty/chromium/content/public/common/web_preferences.cc
+@@ -222,7 +222,10 @@ WebPreferences::WebPreferences()
+       default_minimum_page_scale_factor(1.f),
+       default_maximum_page_scale_factor(4.f),
+ #endif
+-      hide_download_ui(false) {
++      hide_download_ui(false),
++      luneosPriviledged(false),
++      palmServiceBridgeEnabled(false),
++      luneosAppIdentifier("") {
+   standard_font_family_map[kCommonScript] =
+       base::ASCIIToUTF16("Times New Roman");
+   fixed_font_family_map[kCommonScript] = base::ASCIIToUTF16("Courier New");
+diff --git a/src/3rdparty/chromium/content/public/common/web_preferences.h b/src/3rdparty/chromium/content/public/common/web_preferences.h
+index 44ff927..fbdeae8 100644
+--- a/src/3rdparty/chromium/content/public/common/web_preferences.h
++++ b/src/3rdparty/chromium/content/public/common/web_preferences.h
+@@ -264,6 +264,11 @@ struct CONTENT_EXPORT WebPreferences {
+   // Whether download UI should be hidden on this page.
+   bool hide_download_ui;
+ 
++  // Follwing settings are for LuneOS usage
++  bool luneosPriviledged;
++  bool palmServiceBridgeEnabled;
++  std::string luneosAppIdentifier;
++  
+   // We try to keep the default values the same as the default values in
+   // chrome, except for the cases where it would require lots of extra work for
+   // the embedder to use the same default value.
+diff --git a/src/3rdparty/chromium/content/renderer/render_view_impl.cc b/src/3rdparty/chromium/content/renderer/render_view_impl.cc
+index a32fe58..512f621 100644
+--- a/src/3rdparty/chromium/content/renderer/render_view_impl.cc
++++ b/src/3rdparty/chromium/content/renderer/render_view_impl.cc
+@@ -1031,6 +1031,9 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
+ #elif defined(TOOLKIT_QT)
+   settings->setFullscreenSupported(prefs.fullscreen_supported);
+ #endif
++  settings->setLuneosPriviledged(prefs.luneosPriviledged);
++  settings->setPalmServiceBridgeEnabled(prefs.palmServiceBridgeEnabled);
++  settings->setLuneosAppIdentifier(base::ASCIIToUTF16(prefs.luneosAppIdentifier));
+ 
+   settings->setAutoplayExperimentMode(
+       blink::WebString::fromUTF8(prefs.autoplay_experiment_mode));
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/Settings.in b/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/Settings.in
+index b66cff7..5a50982 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/Settings.in
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/Settings.in
+@@ -405,6 +405,17 @@ useDefaultImageInterpolationQuality initial=false
+ # tokenizes input bytes. The default is to tokenize with a post task.
+ parseHTMLOnMainThreadSyncTokenize initial=false
+ 
++# #### LuneOS specific #####
++
++# Whether PalmBridge is enabled or not
++palmServiceBridgeEnabled initial=false
++
++# Whether the LuneOS app has priviledge access
++luneosPriviledged initial=false
++
++# LuneOS app identifier
++luneosAppIdentifier type=String, initial=""
++
+ # Variant of the ParseHTMLOnMainThread experiment. This is designed to coalesce
+ # TokenizedChunks when the experiment is running in threaded mode.
+ parseHTMLOnMainThreadCoalesceChunks initial=false
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/BUILD.gn b/src/3rdparty/chromium/third_party/WebKit/Source/modules/BUILD.gn
+index ab332ef..4e8e58d 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/modules/BUILD.gn
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/BUILD.gn
+@@ -150,6 +150,7 @@ target(modules_target_type, "modules") {
+     "//third_party/WebKit/Source/modules/vr",
+     "//third_party/WebKit/Source/modules/wake_lock",
+     "//third_party/WebKit/Source/modules/webaudio",
++    "//third_party/WebKit/Source/modules/webos",
+     "//third_party/WebKit/Source/modules/webdatabase",
+     "//third_party/WebKit/Source/modules/webgl",
+     "//third_party/WebKit/Source/modules/webmidi",
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/modules_idl_files.gni b/src/3rdparty/chromium/third_party/WebKit/Source/modules/modules_idl_files.gni
+index e9dd62f..a7bae9b 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/modules/modules_idl_files.gni
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/modules_idl_files.gni
+@@ -368,6 +368,7 @@ modules_idl_files =
+                     "webmidi/MIDIOutput.idl",
+                     "webmidi/MIDIOutputMap.idl",
+                     "webmidi/MIDIPort.idl",
++                    "webos/PalmServiceBridge.idl",
+                     "websockets/CloseEvent.idl",
+                     "websockets/WebSocket.idl",
+                     "webusb/USB.idl",
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/BUILD.gn b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/BUILD.gn
+new file mode 100644
+index 0000000..effd211
+--- /dev/null
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/BUILD.gn
+@@ -0,0 +1,13 @@
++# Copyright 2017 Herman van Hazendonk. All rights reserved.
++
++import("//third_party/WebKit/Source/modules/modules.gni")
++
++blink_modules_sources("webos") {
++  sources = [
++    "Logging.h",
++    "LunaServiceMgr.cpp",
++    "LunaServiceMgr.h",
++    "PalmServiceBridge.cpp",
++    "PalmServiceBridge.h",
++  ]
++}
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/Logging.h b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/Logging.h
+new file mode 100644
+index 0000000..d472ae2
+--- /dev/null
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/Logging.h
+@@ -0,0 +1,11 @@
++#ifndef LOGGING_H_
++#define LOGGING_H_
++
++#include <PmLogLib.h>
++
++extern PmLogContext LogContext;
++
++#define DEBUG(...) \
++	PmLogDebug(LogContext, ##__VA_ARGS__)
++
++#endif
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.cpp
+new file mode 100644
+index 0000000..55feab8
+--- /dev/null
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.cpp
+@@ -0,0 +1,316 @@
++#include "config.h"
++
++#include "base/message_loop/message_loop.h"
++#include "base/bind.h"
++
++#include <glib.h>
++#include "LunaServiceMgr.h"
++#include "Logging.h"
++
++#include <unistd.h>
++#include <lunaservice.h>
++#include <stdio.h>
++#include <stdlib.h>
++
++#include <wtf/text/WTFString.h>
++#include <wtf/text/CString.h>
++
++namespace blink {
++
++/**
++* @brief Internal callback for service responses.
++*
++* @param  sh
++* @param  reply
++* @param  ctx
++*
++* @retval
++*/
++static bool
++message_filter(LSHandle *sh, LSMessage* reply, void* ctx)
++{
++    const char* payload = LSMessageGetPayload(reply);
++
++    LunaServiceManagerListener* listener = (LunaServiceManagerListener*)ctx;
++
++    if (listener) {
++        listener->serviceResponse(payload);
++        return true;
++    }
++
++    return false;
++}
++
++bool doIterateNext = true;
++void GMainContextIterate()
++{
++    g_main_context_iteration(g_main_context_default(), false);
++    // be called again in 100ms
++    base::MessageLoop *pCurrentMsgLoop = base::MessageLoop::current();
++    if( doIterateNext && pCurrentMsgLoop )
++    {
++        pCurrentMsgLoop->PostDelayedTask(FROM_HERE, base::Bind(&GMainContextIterate), base::TimeDelta::FromMilliseconds(100));
++    }
++}
++
++LunaServiceManager* s_instance = 0;
++
++/**
++* @brief Obtains the singleton LunaServiceManager.
++*
++* @retval the LunaServiceManager
++*/
++LunaServiceManager* LunaServiceManager::instance()
++{
++    bool retVal;
++    if (s_instance)
++        return s_instance;
++
++    s_instance = new LunaServiceManager();
++    retVal = s_instance->init();
++    if (!retVal)
++        goto error;
++
++    return s_instance;
++
++error:
++    fprintf(stderr, "*******************************************************************\n");
++    fprintf(stderr, "*  Could got get an instance of LunaServiceManager.               *\n");
++    fprintf(stderr, "*  Try running with luna-dbus start; luna-dbus run <executable>.  *\n");
++    fprintf(stderr, "*******************************************************************\n");
++    exit(-1);
++}
++
++/**
++* @brief Private constructor to enforce singleton.
++*/
++LunaServiceManager::LunaServiceManager() :
++      publicBus(0)
++    , privateBus(0)
++    , palmServiceHandle(0)
++    , publicBusHighPriority(0)
++    , privateBusHighPriority(0)
++    , palmServiceHandleHighPriority(0)
++{
++}
++
++LunaServiceManager::~LunaServiceManager()
++{
++    doIterateNext = false;
++    // ED : Close the single connection to DBUS.
++    if (palmServiceHandle) {
++        bool retVal;
++        LSError lserror;
++        LSErrorInit(&lserror);
++
++        retVal = LSUnregisterPalmService(palmServiceHandle, &lserror);
++        if (!retVal) {
++            g_warning("LSUnregisterPalmService ERROR %d: %s (%s @ %s:%d)",
++                lserror.error_code, lserror.message,
++                lserror.func, lserror.file, lserror.line);
++            LSErrorFree(&lserror);
++        }
++    }
++}
++
++bool LunaServiceManager::init()
++{
++    bool init;
++    LSError lserror;
++    LSErrorInit(&lserror);
++
++    DEBUG("LunaServiceManager: Starting iteration on GLib event loop ...");
++    GMainContextIterate();
++
++    DEBUG("LunaServiceManager: initializing ...");
++
++    String id("com.palm.luna-");
++    id.append(String::number(getpid()));
++    String active = (id + "-active");
++    String phone = (id + "-phone");
++    init = LSRegisterPalmService(id.utf8().data(), &palmServiceHandle, &lserror);
++    if (!init)
++        goto error;
++
++    init = LSGmainAttachPalmService(palmServiceHandle,
++            g_main_loop_new(g_main_context_default(), TRUE), &lserror);
++    if (!init)
++        goto error;
++
++    privateBus = LSPalmServiceGetPrivateConnection(palmServiceHandle);
++    publicBus = LSPalmServiceGetPublicConnection(palmServiceHandle);
++
++    if (privateBus) {
++        init = LSGmainSetPriority(privateBus, G_PRIORITY_DEFAULT, &lserror);
++        if (!init)
++            goto error;
++    }
++
++    if (publicBus) {
++        init = LSGmainSetPriority(publicBus, G_PRIORITY_DEFAULT, &lserror);
++        if (!init)
++            goto error;
++    }
++
++    init = LSRegisterPalmService(phone.utf8().data(), &palmServiceHandleHighPriority, &lserror);
++    if (!init)
++        goto error;
++
++    init = LSGmainAttachPalmService(palmServiceHandleHighPriority,
++            g_main_loop_new(g_main_context_default(), TRUE), &lserror);
++    if (!init)
++        goto error;
++
++    privateBusHighPriority = LSPalmServiceGetPrivateConnection(palmServiceHandleHighPriority);
++    publicBusHighPriority = LSPalmServiceGetPublicConnection(palmServiceHandleHighPriority);
++
++    if (privateBusHighPriority) {
++        init = LSGmainSetPriority(privateBusHighPriority, G_PRIORITY_HIGH, &lserror);
++        if (!init)
++            goto error;
++    }
++
++    if (publicBusHighPriority) {
++        init = LSGmainSetPriority(publicBusHighPriority, G_PRIORITY_HIGH, &lserror);
++        if (!init)
++            goto error;
++    }
++
++
++    init = LSRegisterPalmService(active.utf8().data(), &palmServiceHandleMediumPriority, &lserror);
++    if (!init)
++        goto error;
++
++    init = LSGmainAttachPalmService(palmServiceHandleMediumPriority,
++            g_main_loop_new(g_main_context_default(), TRUE), &lserror);
++    if (!init)
++        goto error;
++
++    privateBusMediumPriority = LSPalmServiceGetPrivateConnection(palmServiceHandleMediumPriority);
++    publicBusMediumPriority = LSPalmServiceGetPublicConnection(palmServiceHandleMediumPriority);
++
++    if (privateBusMediumPriority) {
++        init = LSGmainSetPriority(privateBusMediumPriority, G_PRIORITY_HIGH + 50, &lserror);
++        if (!init)
++            goto error;
++    }
++
++    if (publicBusMediumPriority) {
++        init = LSGmainSetPriority(publicBusMediumPriority, G_PRIORITY_HIGH + 50, &lserror);
++        if (!init)
++            goto error;
++    }
++
++error:
++    if (!init) {
++        g_warning("Cannot initialize LunaServiceManager ERROR %d: %s (%s @ %s:%d)",
++            lserror.error_code, lserror.message,
++            lserror.func, lserror.file, lserror.line);
++        LSErrorFree(&lserror);
++    }
++
++    return init;
++}
++
++/**
++* @brief This method will make the async call to DBUS.
++*
++* @param  uri
++* @param  payload
++* @param  inListener
++*
++* @retval 0 if message could not be sent.
++* @retval >0 serial number for the message.
++*/
++unsigned long LunaServiceManager::call(const char* uri, const char* payload, LunaServiceManagerListener* inListener,
++                                       const char* callerId, bool usePrivateBus)
++{
++    bool retVal;
++    LSError lserror;
++    LSErrorInit(&lserror);
++    LSMessageToken token = 0;
++    LSHandle* serviceHandle = 0;
++
++    DEBUG("LunaServiceManager: calling %s payload %s inListener %p callerId %s usePrivateBus %d",
++          uri, payload, inListener, callerId, usePrivateBus);
++
++    if (callerId && (!(*callerId)))
++        callerId = 0;
++
++    static int phoneAppIdLen = strlen("com.palm.app.phone");
++    if (callerId && !(strncmp(callerId, "com.palm.app.phone", phoneAppIdLen))) {
++
++        if (!usePrivateBus)
++            serviceHandle = publicBusHighPriority;
++        else
++            serviceHandle = privateBusHighPriority;
++
++    } else {
++/*  else if (callerId && activeAppId && strncmp(callerId, activeAppId, strlen(activeAppId)) == 0) {
++
++
++        if (!usePrivateBus)
++            serviceHandle = publicBusMediumPriority;
++        else
++            serviceHandle = privateBusMediumPriority;
++    }
++*/
++        if (!usePrivateBus)
++            serviceHandle = publicBus;
++        else
++            serviceHandle = privateBus;
++    }
++
++    if (!inListener)
++        retVal = LSCallFromApplication(serviceHandle, uri, payload, callerId, 0, 0, &token, &lserror);
++    else {
++        retVal = LSCallFromApplication(serviceHandle, uri, payload, callerId, message_filter, inListener, &token, &lserror);
++        if (retVal) {
++            inListener->listenerToken = token;
++            inListener->sh = serviceHandle;
++        }
++    }
++
++    if (!retVal) {
++        g_warning("LSCallFromApplication ERROR %d: %s (%s @ %s:%d)",
++            lserror.error_code, lserror.message,
++            lserror.func, lserror.file, lserror.line);
++        LSErrorFree(&lserror);
++        token = 0;
++        goto error;
++    }
++
++error:
++    return token;
++}
++
++/**
++ * @brief Terminates a call causing any subscription for responses to end.
++ *        This is also called by garbage collector's collect()
++ *        when no more references to inListener exist.
++ *
++ * @param  inListener
++ */
++void LunaServiceManager::cancel(LunaServiceManagerListener* inListener)
++{
++    bool retVal;
++    LSError lserror;
++
++    if (!inListener || !inListener->listenerToken)
++        return;
++
++    DEBUG("LunaServiceManager: canceling call inListener %p", inListener);
++
++    LSErrorInit(&lserror);
++
++    if (!LSCallCancel(inListener->sh, inListener->listenerToken, &lserror)) {
++        g_warning("LSCallCancel ERROR %d: %s (%s @ %s:%d)",
++            lserror.error_code, lserror.message,
++            lserror.func, lserror.file, lserror.line);
++        LSErrorFree(&lserror);
++    }
++
++    // set the token to zero to indicate we have been canceled
++    inListener->listenerToken = 0;
++}
++};
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.h b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.h
+new file mode 100644
+index 0000000..d167f70
+--- /dev/null
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.h
+@@ -0,0 +1,53 @@
++
++#ifndef LunaServiceMgr_h
++#define LunaServiceMgr_h
++
++#include <lunaservice.h>
++
++namespace blink {
++
++struct LunaServiceManagerListener {
++        LunaServiceManagerListener() : listenerToken(LSMESSAGE_TOKEN_INVALID), sh(0) { }
++        virtual ~LunaServiceManagerListener() { }
++        virtual void serviceResponse(const char* body) = 0;
++        LSMessageToken listenerToken;
++        LSHandle* sh;
++};
++
++
++//
++//  LunaServiceManager
++//
++// This class is a singleton which handles all the client requests
++// for a WebKit instance.
++
++class LunaServiceManager {
++    public:
++        ~LunaServiceManager();
++
++        static LunaServiceManager* instance();
++        unsigned long call(const char* uri, const char* payload, LunaServiceManagerListener*, const char* callerId, bool usePrivateBus = false);
++        void cancel(LunaServiceManagerListener*);
++
++    private:
++        bool init();
++        LunaServiceManager();
++
++        LSHandle* publicBus;
++        LSHandle* privateBus;
++        LSPalmService* palmServiceHandle;
++
++        // The Medium Priority bus is used for the active app
++        LSHandle* publicBusMediumPriority;
++        LSHandle* privateBusMediumPriority;
++        LSPalmService* palmServiceHandleMediumPriority;
++
++        // The High Priority bus is used only for the Phone app
++        LSHandle* publicBusHighPriority;
++        LSHandle* privateBusHighPriority;
++        LSPalmService* palmServiceHandleHighPriority;
++};
++
++}
++
++#endif
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.cpp
+new file mode 100644
+index 0000000..22c160e
+--- /dev/null
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.cpp
+@@ -0,0 +1,300 @@
++#include "config.h"
++#include "PalmServiceBridge.h"
++#include "Logging.h"
++
++#include "core/dom/Document.h"
++#include "core/events/Event.h"
++#include "core/dom/ExceptionCode.h"
++#include "core/frame/Frame.h"
++#include "platform/Logging.h"
++#include "core/page/Page.h"
++#include "core/frame/Settings.h"
++#include <wtf/text/WTFString.h>
++#include "bindings/core/v8/ScriptSourceCode.h"
++#include "bindings/core/v8/ScriptController.h"
++#include "bindings/core/v8/ScriptState.h"
++#include "bindings/core/v8/V8Binding.h"
++#include "bindings/core/v8/ExceptionState.h"
++#include <wtf/RefCountedLeakCounter.h>
++
++#include <map>
++#include <set>
++
++bool LoggingInitialized = false;
++PmLogContext LogContext;
++
++namespace blink {
++
++typedef std::set<PalmServiceBridge*> ServicesSet;
++typedef std::map<Document*, ServicesSet*> ServicesSetMap;
++
++#ifndef NDEBUG
++static WTF::RefCountedLeakCounter serviceBridgeCounter("PalmServiceBridge");
++#endif
++
++static ServicesSetMap* servicesByDocument()
++{
++    static ServicesSetMap map;
++    return &map;
++}
++
++int PalmServiceBridge::numHandlesForUrl(const char* appId)
++{
++    for (ServicesSetMap::iterator setIt = servicesByDocument()->begin(); setIt != servicesByDocument()->end(); ++setIt) {
++        if (!strcmp(appId, setIt->first->url().string().utf8().data()))
++            return setIt->second->size();
++    }
++
++    return 0;
++}
++
++void PalmServiceBridge::handlesForUrl(const char* appId, std::list<PalmServiceBridge*>& outHandles)
++{
++    outHandles.clear();
++    for (ServicesSetMap::iterator setIt = servicesByDocument()->begin(); setIt != servicesByDocument()->end(); ++setIt) {
++        if (!strcmp(appId, setIt->first->url().string().utf8().data())) {
++            ServicesSet* set = setIt->second;
++
++            for (ServicesSet::iterator s = set->begin(); s != set->end(); ++s)
++                outHandles.push_back(*s);
++
++            return;
++        }
++    }
++}
++
++static void addToServicesByDocument(Document* doc, PalmServiceBridge* svc)
++{
++    if (!doc || !svc)
++        return;
++
++    ServicesSet* set = 0;
++    ServicesSetMap::iterator it = servicesByDocument()->find(doc);
++    if (it == servicesByDocument()->end()) {
++        set = new ServicesSet();
++        (*servicesByDocument())[doc] = set;
++    } else
++        set = it->second;
++
++    set->insert(svc);
++}
++
++static void removeFromServicesByDocument(Document* doc, PalmServiceBridge* svc)
++{
++    if (!doc || !svc)
++        return;
++
++    ServicesSetMap::iterator it = servicesByDocument()->find(doc);
++    if (it == servicesByDocument()->end())
++        return;
++
++    ServicesSet* set = it->second;
++    if (!set)
++        return;
++
++    set->erase(svc);
++    if (!set->size()) {
++        // remove from the hash map
++        delete set;
++        servicesByDocument()->erase(it);
++    }
++}
++
++PalmServiceBridge::PalmServiceBridge(ExecutionContext* context, bool subscribe)
++    : ActiveDOMObject(context),
++      m_canceled(false),
++      m_subscribed(subscribe),
++      m_inServiceCallback(false),
++      m_identifier(0),
++      m_isPrivileged(false)
++{
++    if (!LoggingInitialized) {
++        PmLogGetContext("QtWebEngineProcess", &LogContext);
++        LoggingInitialized = true;
++    }
++
++    addToServicesByDocument(document(), this);
++
++#ifndef NDEBUG
++    serviceBridgeCounter.increment();
++#endif
++    Frame *frame = document()->frame();
++    Settings* settings = document()->settings();
++    if (settings != 0 && document()->page()->mainFrame() == frame) {
++        m_identifier = strdup(settings->luneosAppIdentifier().utf8().data());
++    }
++    else {
++        v8::Local<v8::Value> identifier;
++
++        identifier = document()->frame()->script().executeScriptInMainWorldAndReturnValue(ScriptSourceCode("PalmSystem && PalmSystem.getIdentifierForFrame(window.frameElement.id, window.frameElement.src)"));
++
++        // Failure is reported as a null string.
++        if (identifier.IsEmpty() || !identifier->IsString())
++            m_identifier = strdup("dummy_identifier 0");
++        else
++            m_identifier = strdup(toCoreString(v8::Handle<v8::String>::Cast(identifier)).utf8().data());
++    }
++
++    if (settings != 0)
++        m_isPrivileged = settings->luneosPriviledged();
++
++    DEBUG("PalmServiceBridge[%p]: created (subscribe %d identifier %s privileged %d)",
++          this, subscribe, m_identifier, m_isPrivileged);
++}
++
++bool PalmServiceBridge::init(Document* d, bool subscribe)
++{
++    m_subscribed = subscribe;
++
++    DEBUG("PalmServiceBridge[%p]: initialized (subscribe %d)", this, subscribe);
++
++    return true;
++}
++
++PalmServiceBridge::~PalmServiceBridge()
++{
++    DEBUG("PalmServiceBridge[%p]: destroying (identifier %s privileged %d subscribed %d)",
++          this, m_identifier, m_isPrivileged, m_subscribed);
++
++    cancel();
++
++    if (m_scriptState)
++        m_scriptState->clear();
++
++    if (executionContext() && document())
++        removeFromServicesByDocument(document(), this);
++
++    if (m_identifier)
++        free(m_identifier);
++
++#ifndef NDEBUG
++    serviceBridgeCounter.decrement();
++#endif
++}
++
++void PalmServiceBridge::detachServices(Document* doc)
++{
++    ServicesSetMap::iterator it = servicesByDocument()->find(doc);
++    if (it == servicesByDocument()->end())
++        return;
++
++    ServicesSet* services = it->second;
++    servicesByDocument()->erase(it);
++
++    if (services) {
++        while (services->size()) {
++            ServicesSet::iterator sit = services->begin();
++            (*sit)->cancel();
++            services->erase(sit);
++        }
++        delete services;
++    }
++
++}
++
++void PalmServiceBridge::cancelServices(Document* doc)
++{
++    ServicesSetMap::iterator it = servicesByDocument()->find(doc);
++    if (it == servicesByDocument()->end())
++        return;
++
++    ServicesSet* services = it->second;
++
++    if (services) {
++        for (ServicesSet::iterator sit = services->begin(); sit != services->end(); ++sit) {
++            PalmServiceBridge* br = *sit;
++            br->cancel();
++        }
++    }
++}
++
++String PalmServiceBridge::version()
++{
++    return String("1.1");
++}
++
++int PalmServiceBridge::token()
++{
++    return (int)listenerToken;
++}
++
++int PalmServiceBridge::call(const String& uri, const String& payload, ExceptionState& exceptionState)
++{
++    DEBUG("PalmServiceBridge[%p]: calling on uri %s payload %s (identifier %s privileged %d subscribed %d)",
++          this, uri.utf8().data(), payload.utf8().data(), m_identifier, m_isPrivileged, m_subscribed);
++
++    LunaServiceManager::instance()->call(uri.utf8().data(), payload.utf8().data(), this, m_identifier, m_isPrivileged);
++    if (LSMESSAGE_TOKEN_INVALID == listenerToken) {
++        exceptionState.throwDOMException(EncodingError, "The LS2 call returned an invalid token.");
++        cancel();
++    }
++
++    return (int)listenerToken;
++}
++
++void PalmServiceBridge::serviceResponse(const char* body)
++{
++    if (m_canceled || !document() || !m_scriptState)
++        return;
++
++    if (!body)
++        body = "";
++
++    DEBUG("PalmServiceBridge[%p]: got service response %s (identifier %s privileged %d subscribed %d)",
++          this, body, m_identifier, m_isPrivileged, m_subscribed);
++
++    /* here we need to get the v8::Function associated with our v8 object */
++    ScriptState *pScriptState = m_scriptState->get();
++    v8::Isolate *isolateCurrent = pScriptState->isolate();
++    v8::HandleScope handleScope(isolateCurrent);
++    v8::Handle<v8::Value> cbValue = m_callbackScriptValue.v8ValueUnsafe();
++    if (!cbValue.IsEmpty() && cbValue->IsFunction()) {
++        v8::Handle<v8::Function> cbFctV8 = cbValue.As<v8::Function>();
++        v8::Handle<v8::Value> argv[1];
++        argv[0] = v8::String::NewFromUtf8(isolateCurrent, body);
++
++        cbFctV8->Call(pScriptState->context()->Global(), 1, argv);
++    }
++
++   // document()->updateStyleIfNeeded();
++}
++
++void PalmServiceBridge::cancel()
++{
++    if (m_canceled)
++        return;
++
++    m_canceled = true;
++    if (listenerToken) {
++        DEBUG("PalmServiceBridge[%p]: canceling current call (identifier %s privileged %d subscribed %d)",
++            this, m_identifier, m_isPrivileged, m_subscribed);
++
++        LunaServiceManager::instance()->cancel(this);
++    }
++}
++
++void PalmServiceBridge::stop()
++{
++    DEBUG("PalmServiceBridge[%p]: stopping ... (identifier %s privileged %d subscribed %d)",
++        this, m_identifier, m_isPrivileged, m_subscribed);
++
++    cancel();
++}
++
++bool PalmServiceBridge::canSuspend() const
++{
++    return false;
++}
++
++void PalmServiceBridge::contextDestroyed()
++{
++    ActiveDOMObject::contextDestroyed();
++}
++
++Document* PalmServiceBridge::document() const
++{
++    ASSERT(executionContext()->isDocument());
++    return static_cast<Document*>(executionContext());
++}
++
++} // namespace blink
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.h b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.h
+new file mode 100644
+index 0000000..4984a09
+--- /dev/null
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.h
+@@ -0,0 +1,90 @@
++#ifndef PalmServiceBridge_h
++#define PalmServiceBridge_h
++
++#include "core/dom/ActiveDOMObject.h"
++#include "core/dom/StringCallback.h"
++#include "bindings/core/v8/ScriptWrappable.h"
++#include "bindings/core/v8/V8Binding.h"
++#include "bindings/core/v8/ScriptValue.h"
++#include "core/events/Event.h"
++#include "core/events/EventListener.h"
++#include "core/events/EventTarget.h"
++#include "LunaServiceMgr.h"
++#include <wtf/OwnPtr.h>
++#include "wtf/PassOwnPtr.h"
++
++// #include <heap/Strong.h>
++// #include <heap/StrongInlines.h>
++
++#include <glib.h>
++#include <list>
++
++
++namespace blink {
++
++class Document;
++
++
++class PalmServiceBridge : public RefCounted<PalmServiceBridge>,
++                          public LunaServiceManagerListener,
++                          public ActiveDOMObject, public ScriptWrappable {
++    DEFINE_WRAPPERTYPEINFO();
++    public:
++        static PassRefPtr<PalmServiceBridge> create(ExecutionContext* context, bool subscribe = false)
++        {
++            return adoptRef(new PalmServiceBridge(context, subscribe));
++        }
++
++        bool init(Document*, bool subscribed = false);
++        ~PalmServiceBridge();
++
++        static int numHandlesForUrl(const char* appId);
++        static void handlesForUrl(const char* appId, std::list<PalmServiceBridge*>& outHandles);
++
++        virtual PalmServiceBridge* toPalmServiceBridge() { return this; }
++
++        static void detachServices(Document*);
++        static void cancelServices(Document*);
++
++        String version();
++
++        int token();
++
++        int call(const String& uri, const String& payload, ExceptionState&);
++        void cancel();
++
++        void setOnservicecallback(ScriptValue& cbScriptValue) {
++            m_callbackScriptValue = cbScriptValue;
++            if (m_scriptState) {
++                m_scriptState->clear();
++            }
++            m_scriptState = adoptPtr(new ScriptStateProtectingContext(cbScriptValue.scriptState()));
++        }
++        ScriptValue onservicecallback() const { return m_callbackScriptValue; }
++
++        // callback from LunaServiceManagerListener
++        virtual void serviceResponse(const char* body);
++
++        Document* document() const;
++
++        // ActiveDOMObject:
++        virtual void contextDestroyed();
++        virtual bool canSuspend() const;
++        virtual void stop();
++
++    private:
++        ScriptValue m_callbackScriptValue;
++        OwnPtr<ScriptStateProtectingContext> m_scriptState;
++
++        bool m_canceled;
++        bool m_subscribed;
++        bool m_inServiceCallback;
++        char *m_identifier;
++        bool m_isPrivileged;
++
++        PalmServiceBridge(ExecutionContext*, bool);
++        PalmServiceBridge();
++};
++}
++
++#endif
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.idl b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.idl
+new file mode 100644
+index 0000000..43e1fdd
+--- /dev/null
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.idl
+@@ -0,0 +1,14 @@
++callback ServiceCallback = void (DOMString message);
++
++[
++    Exposed=(Window,Worker),
++    ActiveDOMObject,
++    Constructor,
++    ConstructorCallWith=ExecutionContext
++] interface PalmServiceBridge {
++
++    [RaisesException] unsigned long call(DOMString method, DOMString url);
++    void cancel();
++
++    attribute ServiceCallback onservicecallback;
++};
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/web/WebSettingsImpl.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/web/WebSettingsImpl.cpp
+index 65d5d91..c3afa5b 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/web/WebSettingsImpl.cpp
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/web/WebSettingsImpl.cpp
+@@ -714,4 +714,20 @@ void WebSettingsImpl::setExpensiveBackgroundThrottlingMaxDelay(float maxDelay) {
+   m_expensiveBackgroundThrottlingMaxDelay = maxDelay;
+ }
+ 
++// LuneOS specific settings
++void WebSettingsImpl::setLuneosAppIdentifier(const WebString& appId)
++{
++    m_settings->setLuneosAppIdentifier(appId);
++}
++
++void WebSettingsImpl::setLuneosPriviledged(bool enabled)
++{
++    m_settings->setLuneosPriviledged(enabled);
++}
++
++void WebSettingsImpl::setPalmServiceBridgeEnabled(bool enabled)
++{
++    m_settings->setPalmServiceBridgeEnabled(enabled);
++}
++
+ }  // namespace blink
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/web/WebSettingsImpl.h b/src/3rdparty/chromium/third_party/WebKit/Source/web/WebSettingsImpl.h
+index dab96e4..f493abe 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/web/WebSettingsImpl.h
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/web/WebSettingsImpl.h
+@@ -118,6 +118,8 @@ class WEB_EXPORT WebSettingsImpl final
+   void setShouldReuseGlobalForUnownedMainFrame(bool) override;
+   void setProgressBarCompletion(ProgressBarCompletion) override;
+   void setLocalStorageEnabled(bool) override;
++  void setLuneosAppIdentifier(const WebString&) override;
++  void setLuneosPriviledged(bool) override;
+   void setMainFrameClipsContent(bool) override;
+   void setMainFrameResizesAreOrientationChanges(bool) override;
+   void setMaxTouchPoints(int) override;
+@@ -130,6 +132,7 @@ class WEB_EXPORT WebSettingsImpl final
+   void setMockScrollbarsEnabled(bool) override;
+   void setHideScrollbars(bool) override;
+   void setOfflineWebApplicationCacheEnabled(bool) override;
++  void setPalmServiceBridgeEnabled(bool) override;
+   void setPassiveEventListenerDefault(PassiveEventListenerDefault) override;
+   void setPasswordEchoDurationInSeconds(double) override;
+   void setPasswordEchoEnabled(bool) override;
+diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/WebSettings.h b/src/3rdparty/chromium/third_party/WebKit/public/web/WebSettings.h
+index 124be31..769a64c 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/public/web/WebSettings.h
++++ b/src/3rdparty/chromium/third_party/WebKit/public/web/WebSettings.h
+@@ -197,6 +197,8 @@ class WebSettings {
+   virtual void setShouldReuseGlobalForUnownedMainFrame(bool) = 0;
+   virtual void setProgressBarCompletion(ProgressBarCompletion) = 0;
+   virtual void setLocalStorageEnabled(bool) = 0;
++  virtual void setLuneosAppIdentifier(const WebString&) = 0;
++  virtual void setLuneosPriviledged(bool) = 0;
+   virtual void setMainFrameClipsContent(bool) = 0;
+   virtual void setMainFrameResizesAreOrientationChanges(bool) = 0;
+   virtual void setMaxTouchPoints(int) = 0;
+@@ -209,6 +211,7 @@ class WebSettings {
+   virtual void setMockScrollbarsEnabled(bool) = 0;
+   virtual void setHideScrollbars(bool) = 0;
+   virtual void setOfflineWebApplicationCacheEnabled(bool) = 0;
++  virtual void setPalmServiceBridgeEnabled(bool) = 0;
+   virtual void setPassiveEventListenerDefault(PassiveEventListenerDefault) = 0;
+   virtual void setPasswordEchoDurationInSeconds(double) = 0;
+   virtual void setPasswordEchoEnabled(bool) = 0;
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0002-PalmServiceBridge-adapt-to-Chromium-53-code-base.patch b/aports/main/qt5-qtwebengine/patches-luna/0002-PalmServiceBridge-adapt-to-Chromium-53-code-base.patch
new file mode 100644
index 0000000000000000000000000000000000000000..2bdda4ca36b6ca47e14d481a435dc533af16a24b
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0002-PalmServiceBridge-adapt-to-Chromium-53-code-base.patch
@@ -0,0 +1,316 @@
+From 66b5e193f3fc4d1bdc579b1051dc76aa90d3b61e Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sun, 16 Jul 2017 11:09:09 +0000
+Subject: [PATCH 02/10] PalmServiceBridge: adapt to Chromium 53 code base
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ .../Source/bindings/modules/v8/generated.gni       |  2 +
+ .../WebKit/Source/modules/webos/BUILD.gn           | 14 +++++++
+ .../WebKit/Source/modules/webos/LunaServiceMgr.cpp |  4 +-
+ .../Source/modules/webos/PalmServiceBridge.cpp     | 43 +++++++---------------
+ .../Source/modules/webos/PalmServiceBridge.h       | 36 +++++++++---------
+ .../Source/modules/webos/PalmServiceBridge.idl     |  5 ++-
+ 6 files changed, 52 insertions(+), 52 deletions(-)
+
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/bindings/modules/v8/generated.gni b/src/3rdparty/chromium/third_party/WebKit/Source/bindings/modules/v8/generated.gni
+index 0d8f27d..db9b850 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/bindings/modules/v8/generated.gni
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/bindings/modules/v8/generated.gni
+@@ -46,6 +46,8 @@ bindings_modules_generated_union_type_files = [
+   "$bindings_modules_v8_output_dir/RenderingContext.h",
+   "$bindings_modules_v8_output_dir/RequestOrUSVString.cpp",
+   "$bindings_modules_v8_output_dir/RequestOrUSVString.h",
++  "$bindings_modules_v8_output_dir/ServiceCallback.cpp",
++  "$bindings_modules_v8_output_dir/ServiceCallback.h",
+   "$bindings_modules_v8_output_dir/ServiceWorkerOrMessagePort.cpp",
+   "$bindings_modules_v8_output_dir/ServiceWorkerOrMessagePort.h",
+   "$bindings_modules_v8_output_dir/StringOrArrayBufferOrNFCMessage.cpp",
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/BUILD.gn b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/BUILD.gn
+index effd211..2da4492 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/BUILD.gn
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/BUILD.gn
+@@ -1,6 +1,11 @@
+ # Copyright 2017 Herman van Hazendonk. All rights reserved.
+ 
+ import("//third_party/WebKit/Source/modules/modules.gni")
++import("//build/config/linux/pkg_config.gni")
++
++pkg_config("ls2") {
++  packages = [ "luna-service2", "glib-2.0" ]
++}  
+ 
+ blink_modules_sources("webos") {
+   sources = [
+@@ -10,4 +15,13 @@ blink_modules_sources("webos") {
+     "PalmServiceBridge.cpp",
+     "PalmServiceBridge.h",
+   ]
++   
++  public_configs = [
++    ":ls2",
++  ]
++  
++  libs = [
++    "PmLogLib",   
++  ]
++
+ }
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.cpp
+index 55feab8..f4b9f60 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.cpp
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/LunaServiceMgr.cpp
+@@ -1,5 +1,3 @@
+-#include "config.h"
+-
+ #include "base/message_loop/message_loop.h"
+ #include "base/bind.h"
+ 
+@@ -49,7 +47,7 @@ void GMainContextIterate()
+     base::MessageLoop *pCurrentMsgLoop = base::MessageLoop::current();
+     if( doIterateNext && pCurrentMsgLoop )
+     {
+-        pCurrentMsgLoop->PostDelayedTask(FROM_HERE, base::Bind(&GMainContextIterate), base::TimeDelta::FromMilliseconds(100));
++        pCurrentMsgLoop->task_runner()->PostDelayedTask(FROM_HERE, base::Bind(&GMainContextIterate), base::TimeDelta::FromMilliseconds(100));
+     }
+ }
+ 
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.cpp
+index 22c160e..b6ece79 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.cpp
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.cpp
+@@ -1,4 +1,3 @@
+-#include "config.h"
+ #include "PalmServiceBridge.h"
+ #include "Logging.h"
+ 
+@@ -6,7 +5,6 @@
+ #include "core/events/Event.h"
+ #include "core/dom/ExceptionCode.h"
+ #include "core/frame/Frame.h"
+-#include "platform/Logging.h"
+ #include "core/page/Page.h"
+ #include "core/frame/Settings.h"
+ #include <wtf/text/WTFString.h>
+@@ -15,7 +13,6 @@
+ #include "bindings/core/v8/ScriptState.h"
+ #include "bindings/core/v8/V8Binding.h"
+ #include "bindings/core/v8/ExceptionState.h"
+-#include <wtf/RefCountedLeakCounter.h>
+ 
+ #include <map>
+ #include <set>
+@@ -28,10 +25,6 @@ namespace blink {
+ typedef std::set<PalmServiceBridge*> ServicesSet;
+ typedef std::map<Document*, ServicesSet*> ServicesSetMap;
+ 
+-#ifndef NDEBUG
+-static WTF::RefCountedLeakCounter serviceBridgeCounter("PalmServiceBridge");
+-#endif
+-
+ static ServicesSetMap* servicesByDocument()
+ {
+     static ServicesSetMap map;
+@@ -41,7 +34,7 @@ static ServicesSetMap* servicesByDocument()
+ int PalmServiceBridge::numHandlesForUrl(const char* appId)
+ {
+     for (ServicesSetMap::iterator setIt = servicesByDocument()->begin(); setIt != servicesByDocument()->end(); ++setIt) {
+-        if (!strcmp(appId, setIt->first->url().string().utf8().data()))
++        if (!strcmp(appId, setIt->first->url().getString().utf8().data()))
+             return setIt->second->size();
+     }
+ 
+@@ -52,7 +45,7 @@ void PalmServiceBridge::handlesForUrl(const char* appId, std::list<PalmServiceBr
+ {
+     outHandles.clear();
+     for (ServicesSetMap::iterator setIt = servicesByDocument()->begin(); setIt != servicesByDocument()->end(); ++setIt) {
+-        if (!strcmp(appId, setIt->first->url().string().utf8().data())) {
++        if (!strcmp(appId, setIt->first->url().getString().utf8().data())) {
+             ServicesSet* set = setIt->second;
+ 
+             for (ServicesSet::iterator s = set->begin(); s != set->end(); ++s)
+@@ -102,6 +95,7 @@ static void removeFromServicesByDocument(Document* doc, PalmServiceBridge* svc)
+ 
+ PalmServiceBridge::PalmServiceBridge(ExecutionContext* context, bool subscribe)
+     : ActiveDOMObject(context),
++      ActiveScriptWrappable(this),
+       m_canceled(false),
+       m_subscribed(subscribe),
+       m_inServiceCallback(false),
+@@ -115,9 +109,6 @@ PalmServiceBridge::PalmServiceBridge(ExecutionContext* context, bool subscribe)
+ 
+     addToServicesByDocument(document(), this);
+ 
+-#ifndef NDEBUG
+-    serviceBridgeCounter.increment();
+-#endif
+     Frame *frame = document()->frame();
+     Settings* settings = document()->settings();
+     if (settings != 0 && document()->page()->mainFrame() == frame) {
+@@ -161,15 +152,11 @@ PalmServiceBridge::~PalmServiceBridge()
+     if (m_scriptState)
+         m_scriptState->clear();
+ 
+-    if (executionContext() && document())
++    if (getExecutionContext() && document())
+         removeFromServicesByDocument(document(), this);
+ 
+     if (m_identifier)
+         free(m_identifier);
+-
+-#ifndef NDEBUG
+-    serviceBridgeCounter.decrement();
+-#endif
+ }
+ 
+ void PalmServiceBridge::detachServices(Document* doc)
+@@ -247,7 +234,7 @@ void PalmServiceBridge::serviceResponse(const char* body)
+     ScriptState *pScriptState = m_scriptState->get();
+     v8::Isolate *isolateCurrent = pScriptState->isolate();
+     v8::HandleScope handleScope(isolateCurrent);
+-    v8::Handle<v8::Value> cbValue = m_callbackScriptValue.v8ValueUnsafe();
++    v8::Handle<v8::Value> cbValue = m_callbackScriptValue.v8ValueFor(pScriptState);
+     if (!cbValue.IsEmpty() && cbValue->IsFunction()) {
+         v8::Handle<v8::Function> cbFctV8 = cbValue.As<v8::Function>();
+         v8::Handle<v8::Value> argv[1];
+@@ -273,28 +260,24 @@ void PalmServiceBridge::cancel()
+     }
+ }
+ 
+-void PalmServiceBridge::stop()
++void PalmServiceBridge::contextDestroyed()
+ {
+-    DEBUG("PalmServiceBridge[%p]: stopping ... (identifier %s privileged %d subscribed %d)",
+-        this, m_identifier, m_isPrivileged, m_subscribed);
+-
+     cancel();
+ }
+ 
+-bool PalmServiceBridge::canSuspend() const
++bool PalmServiceBridge::hasPendingActivity() const
+ {
+-    return false;
++    return m_canceled == false && getExecutionContext() && !getExecutionContext()->activeDOMObjectsAreStopped();
+ }
+ 
+-void PalmServiceBridge::contextDestroyed()
++Document* PalmServiceBridge::document() const
+ {
+-    ActiveDOMObject::contextDestroyed();
++    ASSERT(getExecutionContext()->isDocument());
++    return static_cast<Document*>(getExecutionContext());
+ }
+ 
+-Document* PalmServiceBridge::document() const
++DEFINE_TRACE(PalmServiceBridge)
+ {
+-    ASSERT(executionContext()->isDocument());
+-    return static_cast<Document*>(executionContext());
++    ActiveDOMObject::trace(visitor);
+ }
+-
+ } // namespace blink
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.h b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.h
+index 4984a09..46b6440 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.h
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.h
+@@ -6,12 +6,11 @@
+ #include "bindings/core/v8/ScriptWrappable.h"
+ #include "bindings/core/v8/V8Binding.h"
+ #include "bindings/core/v8/ScriptValue.h"
++#include "bindings/modules/v8/ServiceCallback.h"
+ #include "core/events/Event.h"
+ #include "core/events/EventListener.h"
+ #include "core/events/EventTarget.h"
+ #include "LunaServiceMgr.h"
+-#include <wtf/OwnPtr.h>
+-#include "wtf/PassOwnPtr.h"
+ 
+ // #include <heap/Strong.h>
+ // #include <heap/StrongInlines.h>
+@@ -25,14 +24,17 @@ namespace blink {
+ class Document;
+ 
+ 
+-class PalmServiceBridge : public RefCounted<PalmServiceBridge>,
++class PalmServiceBridge : public GarbageCollectedFinalized<PalmServiceBridge>, 
+                           public LunaServiceManagerListener,
+-                          public ActiveDOMObject, public ScriptWrappable {
++                          public ActiveDOMObject,
++                          public ScriptWrappable, public ActiveScriptWrappable {
+     DEFINE_WRAPPERTYPEINFO();
++    USING_GARBAGE_COLLECTED_MIXIN(PalmServiceBridge)
++    WTF_MAKE_NONCOPYABLE(PalmServiceBridge);
+     public:
+-        static PassRefPtr<PalmServiceBridge> create(ExecutionContext* context, bool subscribe = false)
++        static PalmServiceBridge *create(ExecutionContext* context, bool subscribe = false)
+         {
+-            return adoptRef(new PalmServiceBridge(context, subscribe));
++            return new PalmServiceBridge(context, subscribe);
+         }
+ 
+         bool init(Document*, bool subscribed = false);
+@@ -53,28 +55,28 @@ class PalmServiceBridge : public RefCounted<PalmServiceBridge>,
+         int call(const String& uri, const String& payload, ExceptionState&);
+         void cancel();
+ 
+-        void setOnservicecallback(ScriptValue& cbScriptValue) {
+-            m_callbackScriptValue = cbScriptValue;
+-            if (m_scriptState) {
+-                m_scriptState->clear();
+-            }
+-            m_scriptState = adoptPtr(new ScriptStateProtectingContext(cbScriptValue.scriptState()));
++        void setOnservicecallback(ScriptState *&cbState, ServiceCallback *cbValue) {
++            m_callbackScriptValue = ScriptValue::from(cbState, cbValue->v8Value(cbState->isolate()));
++            m_scriptState.reset(new ScriptStateProtectingContext(cbState));
+         }
+-        ScriptValue onservicecallback() const { return m_callbackScriptValue; }
++        ScriptWrappable *onservicecallback(ScriptState *cbState) const { return nullptr; }
+ 
+         // callback from LunaServiceManagerListener
+         virtual void serviceResponse(const char* body);
+ 
+         Document* document() const;
+ 
+-        // ActiveDOMObject:
++        // ContextLifecycleObserver:
+         virtual void contextDestroyed();
+-        virtual bool canSuspend() const;
+-        virtual void stop();
++
++        // ActiveScriptWrappable.
++        bool hasPendingActivity() const final;
++
++    DECLARE_VIRTUAL_TRACE();
+ 
+     private:
+         ScriptValue m_callbackScriptValue;
+-        OwnPtr<ScriptStateProtectingContext> m_scriptState;
++        std::unique_ptr<ScriptStateProtectingContext> m_scriptState;
+ 
+         bool m_canceled;
+         bool m_subscribed;
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.idl b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.idl
+index 43e1fdd..fc808d0 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.idl
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/modules/webos/PalmServiceBridge.idl
+@@ -2,7 +2,8 @@ callback ServiceCallback = void (DOMString message);
+ 
+ [
+     Exposed=(Window,Worker),
+-    ActiveDOMObject,
++    ActiveScriptWrappable,
++    DependentLifetime,
+     Constructor,
+     ConstructorCallWith=ExecutionContext
+ ] interface PalmServiceBridge {
+@@ -10,5 +11,5 @@ callback ServiceCallback = void (DOMString message);
+     [RaisesException] unsigned long call(DOMString method, DOMString url);
+     void cancel();
+ 
+-    attribute ServiceCallback onservicecallback;
++    [CallWith=ScriptState] attribute ServiceCallback onservicecallback;
+ };
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0002-WebEngineView-provide-additionnal-features-from-wind.patch b/aports/main/qt5-qtwebengine/patches-luna/0002-WebEngineView-provide-additionnal-features-from-wind.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6b65e36653026b3f226b84c3335067c3f7836169
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0002-WebEngineView-provide-additionnal-features-from-wind.patch
@@ -0,0 +1,221 @@
+From 6b2af4e2c792469a15f53e6dd115357490a2b92a Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Mon, 28 Sep 2015 20:19:14 +0200
+Subject: [PATCH 02/18] WebEngineView: provide additionnal features from
+ window.open on the Qt side
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/core/web_contents_adapter_client.h              |  2 +-
+ src/core/web_contents_delegate_qt.cpp               | 17 ++++++++++++-----
+ src/core/web_contents_delegate_qt.h                 |  4 ++--
+ src/webengine/api/qquickwebenginenewviewrequest.cpp |  5 +++++
+ src/webengine/api/qquickwebenginenewviewrequest_p.h |  5 +++++
+ src/webengine/api/qquickwebengineview.cpp           |  3 ++-
+ src/webengine/api/qquickwebengineview_p_p.h         |  2 +-
+ src/webenginewidgets/api/qwebenginepage.cpp         |  3 ++-
+ src/webenginewidgets/api/qwebenginepage_p.h         |  2 +-
+ 9 files changed, 31 insertions(+), 12 deletions(-)
+
+diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
+index e1fb3dc..ad62397 100644
+--- a/src/core/web_contents_adapter_client.h
++++ b/src/core/web_contents_adapter_client.h
+@@ -330,7 +330,7 @@ public:
+     virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) = 0;
+     virtual void focusContainer() = 0;
+     virtual void unhandledKeyEvent(QKeyEvent *event) = 0;
+-    virtual void adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry, const QUrl &targetUrl) = 0;
++    virtual void adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry, const QUrl &targetUrl, const QStringList &additionalFeatures) = 0;
+     virtual bool isBeingAdopted() = 0;
+     virtual void close() = 0;
+     virtual void windowCloseRejected() = 0;
+diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
+index 86366ab..68d5abc 100644
+--- a/src/core/web_contents_delegate_qt.cpp
++++ b/src/core/web_contents_delegate_qt.cpp
+@@ -102,7 +102,8 @@ content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents
+ {
+     content::WebContents *target = source;
+     if (params.disposition != WindowOpenDisposition::CURRENT_TAB) {
+-        QSharedPointer<WebContentsAdapter> targetAdapter = createWindow(0, params.disposition, gfx::Rect(), params.user_gesture);
++        std::vector<base::string16> additional_features;
++        QSharedPointer<WebContentsAdapter> targetAdapter = createWindow(0, params.disposition, gfx::Rect(), params.user_gesture, additional_features);
+         if (targetAdapter)
+             target = targetAdapter->webContents();
+     }
+@@ -158,10 +159,10 @@ bool WebContentsDelegateQt::ShouldPreserveAbortedURLs(content::WebContents *sour
+     return false;
+ }
+ 
+-void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked)
++void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked, std::vector<base::string16> additional_features)
+ {
+     Q_UNUSED(source)
+-    QWeakPointer<WebContentsAdapter> newAdapter = createWindow(new_contents, disposition, initial_pos, user_gesture);
++    QWeakPointer<WebContentsAdapter> newAdapter = createWindow(new_contents, disposition, initial_pos, user_gesture, additional_features);
+     if (was_blocked)
+         *was_blocked = !newAdapter;
+ }
+@@ -423,11 +424,17 @@ void WebContentsDelegateQt::overrideWebPreferences(content::WebContents *, conte
+     m_viewClient->webEngineSettings()->overrideWebPreferences(webPreferences);
+ }
+ 
+-QWeakPointer<WebContentsAdapter> WebContentsDelegateQt::createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture)
++QWeakPointer<WebContentsAdapter> WebContentsDelegateQt::createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, std::vector<base::string16> additional_features)
+ {
+     QSharedPointer<WebContentsAdapter> newAdapter = QSharedPointer<WebContentsAdapter>::create(new_contents);
+ 
+-    m_viewClient->adoptNewWindow(newAdapter, static_cast<WebContentsAdapterClient::WindowOpenDisposition>(disposition), user_gesture, toQt(initial_pos), m_initialTargetUrl);
++    QStringList additionalFeaturesStringList;
++    std::vector<base::string16>::const_iterator iter;
++    for( iter = additional_features.begin(); iter != additional_features.end(); iter++ )
++    {
++        additionalFeaturesStringList << toQt(*iter);
++    }
++    m_viewClient->adoptNewWindow(newAdapter, static_cast<WebContentsAdapterClient::WindowOpenDisposition>(disposition), user_gesture, toQt(initial_pos), m_initialTargetUrl, additionalFeaturesStringList);
+ 
+     // If the client didn't reference the adapter, it will be deleted now, and the weak pointer zeroed.
+     return newAdapter;
+diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
+index 913bf35..a8db7b7 100644
+--- a/src/core/web_contents_delegate_qt.h
++++ b/src/core/web_contents_delegate_qt.h
+@@ -99,7 +99,7 @@ public:
+     // WebContentsDelegate overrides
+     content::WebContents *OpenURLFromTab(content::WebContents *source, const content::OpenURLParams &params) override;
+     void NavigationStateChanged(content::WebContents* source, content::InvalidateTypes changed_flags) override;
+-    void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) override;
++    void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked, std::vector<base::string16> additional_features) override;
+     void CloseContents(content::WebContents *source) override;
+     void LoadProgressChanged(content::WebContents* source, double progress) override;
+     void HandleKeyboardEvent(content::WebContents *source, const content::NativeWebKeyboardEvent &event) override;
+@@ -148,7 +148,7 @@ public:
+     const SavePageInfo &savePageInfo() { return m_savePageInfo; }
+ 
+ private:
+-    QWeakPointer<WebContentsAdapter> createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture);
++    QWeakPointer<WebContentsAdapter> createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, std::vector<base::string16> additional_features);
+ 
+     WebContentsAdapterClient *m_viewClient;
+     QString m_lastSearchedString;
+diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp
+index 0af943d..99e3794 100644
+--- a/src/webengine/api/qquickwebenginenewviewrequest.cpp
++++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp
+@@ -92,6 +92,11 @@ bool QQuickWebEngineNewViewRequest::isUserInitiated() const
+     return m_isUserInitiated;
+ }
+ 
++const QStringList &QQuickWebEngineNewViewRequest::additionalFeatures() const
++{
++    return m_additionalFeatures;
++}
++
+ /*!
+     \qmlmethod WebEngineNewViewRequest::openIn(WebEngineView view)
+ 
+diff --git a/src/webengine/api/qquickwebenginenewviewrequest_p.h b/src/webengine/api/qquickwebenginenewviewrequest_p.h
+index 9cc0f29..304c6c0 100644
+--- a/src/webengine/api/qquickwebenginenewviewrequest_p.h
++++ b/src/webengine/api/qquickwebenginenewviewrequest_p.h
+@@ -54,6 +54,8 @@
+ #include "qtwebengineglobal_p.h"
+ #include "qquickwebengineview_p.h"
+ 
++#include <QStringList>
++
+ namespace QtWebEngineCore {
+ class WebContentsAdapter;
+ }
+@@ -65,12 +67,14 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineNewViewRequest : public QObject
+     Q_PROPERTY(QQuickWebEngineView::NewViewDestination destination READ destination CONSTANT FINAL)
+     Q_PROPERTY(QUrl requestedUrl READ requestedUrl CONSTANT REVISION 1 FINAL)
+     Q_PROPERTY(bool userInitiated READ isUserInitiated CONSTANT FINAL)
++    Q_PROPERTY(QStringList additionalFeatures READ additionalFeatures CONSTANT FINAL)
+ public:
+     ~QQuickWebEngineNewViewRequest();
+ 
+     QQuickWebEngineView::NewViewDestination destination() const;
+     QUrl requestedUrl() const;
+     bool isUserInitiated() const;
++    const QStringList &additionalFeatures() const;
+     Q_INVOKABLE void openIn(QQuickWebEngineView *view);
+ 
+ private:
+@@ -80,6 +84,7 @@ private:
+     QSharedPointer<QtWebEngineCore::WebContentsAdapter> m_adapter;
+     QUrl m_requestedUrl;
+     friend class QQuickWebEngineView;
++    QStringList m_additionalFeatures;
+     friend class QQuickWebEngineViewPrivate;
+ };
+ 
+diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
+index ae75b7f..c8e9e51 100644
+--- a/src/webengine/api/qquickwebengineview.cpp
++++ b/src/webengine/api/qquickwebengineview.cpp
+@@ -588,7 +588,7 @@ void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event)
+         q->window()->sendEvent(q->parentItem(), event);
+ }
+ 
+-void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl)
++void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl, const QStringList &additionalFeaturesStringList)
+ {
+     Q_Q(QQuickWebEngineView);
+     QQuickWebEngineNewViewRequest request;
+@@ -597,6 +597,7 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapte
+     request.m_adapter = newWebContents;
+     request.m_isUserInitiated = userGesture;
+     request.m_requestedUrl = targetUrl;
++    request.m_additionalFeatures = additionalFeaturesStringList;
+ 
+     switch (disposition) {
+     case WebContentsAdapterClient::NewForegroundTabDisposition:
+diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
+index f6f638e..41178e0 100644
+--- a/src/webengine/api/qquickwebengineview_p_p.h
++++ b/src/webengine/api/qquickwebengineview_p_p.h
+@@ -109,7 +109,7 @@ public:
+     virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) Q_DECL_OVERRIDE;
+     virtual void focusContainer() Q_DECL_OVERRIDE;
+     virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+-    virtual void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) Q_DECL_OVERRIDE;
++    virtual void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl, const QStringList &additionalFeatures) Q_DECL_OVERRIDE;
+     virtual bool isBeingAdopted() Q_DECL_OVERRIDE;
+     virtual void close() Q_DECL_OVERRIDE;
+     virtual void windowCloseRejected() Q_DECL_OVERRIDE;
+diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
+index 5145612..db9baca 100644
+--- a/src/webenginewidgets/api/qwebenginepage.cpp
++++ b/src/webenginewidgets/api/qwebenginepage.cpp
+@@ -399,11 +399,12 @@ void QWebEnginePagePrivate::unhandledKeyEvent(QKeyEvent *event)
+         QGuiApplication::sendEvent(view->parentWidget(), event);
+ }
+ 
+-void QWebEnginePagePrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry, const QUrl &targetUrl)
++void QWebEnginePagePrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry, const QUrl &targetUrl, const QStringList &additionalFeatures)
+ {
+     Q_Q(QWebEnginePage);
+     Q_UNUSED(userGesture);
+     Q_UNUSED(targetUrl);
++    Q_UNUSED(additionalFeatures);
+ 
+     QWebEnginePage *newPage = q->createWindow(toWindowType(disposition));
+     if (!newPage)
+diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
+index ec84f05..2426e2c 100644
+--- a/src/webenginewidgets/api/qwebenginepage_p.h
++++ b/src/webenginewidgets/api/qwebenginepage_p.h
+@@ -100,7 +100,7 @@ public:
+     virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) Q_DECL_OVERRIDE;
+     virtual void focusContainer() Q_DECL_OVERRIDE;
+     virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+-    virtual void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry, const QUrl &targetUrl) Q_DECL_OVERRIDE;
++    virtual void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry, const QUrl &targetUrl, const QStringList &additionalFeatures) Q_DECL_OVERRIDE;
+     void adoptNewWindowImpl(QWebEnginePage *newPage,
+             const QSharedPointer<QtWebEngineCore::WebContentsAdapter> &newWebContents,
+             const QRect &initialGeometry);
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0003-WebContents-provide-additional-features-from-window..patch b/aports/main/qt5-qtwebengine/patches-luna/0003-WebContents-provide-additional-features-from-window..patch
new file mode 100644
index 0000000000000000000000000000000000000000..59bec239f50213189fd5af69b3a98d7ca6741544
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0003-WebContents-provide-additional-features-from-window..patch
@@ -0,0 +1,114 @@
+From 26439d820f1e976932185cbf9e1b377e2a7a96b7 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sun, 27 Sep 2015 21:39:56 +0200
+Subject: [PATCH 03/10] WebContents: provide additional features from
+ window.open to the client side
+
+* Also, parse these features in a way that take into account JSON values.
+* Also redirect calls to old AddNewContent to the new API, with empty additional features.
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ .../browser/web_contents/web_contents_impl.cc      |  2 +-
+ .../content/public/browser/web_contents_delegate.h | 21 ++++++++++++++++++-
+ .../WebKit/Source/core/page/WindowFeatures.cpp     | 24 +++++++++++++++++++---
+ 3 files changed, 42 insertions(+), 5 deletions(-)
+
+diff --git a/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc b/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
+index c7df36d..5eed7db 100644
+--- a/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
++++ b/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
+@@ -2163,7 +2163,7 @@ void WebContentsImpl::CreateNewWindow(
+       gfx::Rect initial_rect;
+       delegate_->AddNewContents(
+           this, new_contents, params.disposition, initial_rect,
+-          params.user_gesture, &was_blocked);
++          params.user_gesture, &was_blocked, params.additional_features);
+     }
+     if (!was_blocked) {
+       OpenURLParams open_params(params.target_url, params.referrer,
+diff --git a/src/3rdparty/chromium/content/public/browser/web_contents_delegate.h b/src/3rdparty/chromium/content/public/browser/web_contents_delegate.h
+index 2beb83c..aec4195 100644
+--- a/src/3rdparty/chromium/content/public/browser/web_contents_delegate.h
++++ b/src/3rdparty/chromium/content/public/browser/web_contents_delegate.h
+@@ -118,7 +118,26 @@ class CONTENT_EXPORT WebContentsDelegate {
+                               WindowOpenDisposition disposition,
+                               const gfx::Rect& initial_rect,
+                               bool user_gesture,
+-                              bool* was_blocked) {}
++                              bool* was_blocked) {
++      std::vector<base::string16> additional_features;
++      AddNewContents(source,new_contents,disposition,initial_rect,user_gesture,was_blocked, additional_features);
++  }
++
++  // Creates a new tab with the already-created WebContents 'new_contents'.
++  // The window for the added contents should be reparented correctly when this
++  // method returns.  If |disposition| is NEW_POPUP, |initial_rect| should hold
++  // the initial position. If |was_blocked| is non-NULL, then |*was_blocked|
++  // will be set to true if the popup gets blocked, and left unchanged
++  // otherwise.
++  virtual void AddNewContents(WebContents* source,
++                              WebContents* new_contents,
++                              WindowOpenDisposition disposition,
++                              const gfx::Rect& initial_rect,
++                              bool user_gesture,
++                              bool* was_blocked,
++                              std::vector<base::string16> additional_features) {
++      AddNewContents(source,new_contents,disposition,initial_rect,user_gesture,was_blocked);
++  }
+ 
+   // Selects the specified contents, bringing its container to the front.
+   virtual void ActivateContents(WebContents* contents) {}
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp
+index f1d78f9..82614af 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp
+@@ -89,7 +89,7 @@ WindowFeatures::WindowFeatures(const String& features)
+ 
+     // skip to first separator
+     while (i < length && !isWindowFeaturesSeparator(buffer[i]))
+-      i++;
++        i++;
+     keyEnd = i;
+ 
+     SECURITY_DCHECK(i <= length);
+@@ -115,8 +115,24 @@ WindowFeatures::WindowFeatures(const String& features)
+     SECURITY_DCHECK(i <= length);
+ 
+     // skip to first separator
+-    while (i < length && !isWindowFeaturesSeparator(buffer[i]))
+-      i++;
++    if (i < length && buffer[i] == '{') {
++        // json value: go to the matching '}'
++        int unmatchedBraceCount = 0;
++        while (i < length) {
++            if (buffer[i] == '{')
++                unmatchedBraceCount++;
++            else if (buffer[i] == '}')
++                unmatchedBraceCount--;
++            i++;
++            if (unmatchedBraceCount <= 0)
++                break;
++        }
++    }
++    else {
++        // classic case: skip to first separator
++        while (i < length && !isWindowFeaturesSeparator(buffer[i]))
++          i++;
++    }
+     valueEnd = i;
+ 
+     SECURITY_DCHECK(i <= length);
+@@ -166,6 +182,8 @@ void WindowFeatures::setWindowFeature(const String& keyString,
+     fullscreen = value;
+   } else if (keyString == "scrollbars") {
+     scrollbarsVisible = value;
++  } else if (keyString == "attributes") {
++    additionalFeatures.append(keyString+"="+valueString);
+   } else if (keyString == "noopener") {
+     noopener = true;
+   } else if (value == 1) {
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0003-WebEngineNewViewRequest-provide-the-requested-URL-as.patch b/aports/main/qt5-qtwebengine/patches-luna/0003-WebEngineNewViewRequest-provide-the-requested-URL-as.patch
new file mode 100644
index 0000000000000000000000000000000000000000..bcf89009bf7bff1c65306fb4f2b0d706734f556b
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0003-WebEngineNewViewRequest-provide-the-requested-URL-as.patch
@@ -0,0 +1,54 @@
+From f3eee55890c8a639c38244391936c8cb2a4a0479 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Mon, 28 Sep 2015 20:19:49 +0200
+Subject: [PATCH 03/18] WebEngineNewViewRequest: provide the requested URL as a
+ property
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/webengine/api/qquickwebenginenewviewrequest.cpp | 8 ++++++++
+ src/webengine/api/qquickwebenginenewviewrequest_p.h | 2 ++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp
+index 99e3794..a369889 100644
+--- a/src/webengine/api/qquickwebenginenewviewrequest.cpp
++++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp
+@@ -97,6 +97,14 @@ const QStringList &QQuickWebEngineNewViewRequest::additionalFeatures() const
+     return m_additionalFeatures;
+ }
+ 
++QUrl QQuickWebEngineNewViewRequest::url() const
++{
++    if (!m_adapter) {
++        return m_adapter->activeUrl();
++    }
++    return QUrl();
++}
++
+ /*!
+     \qmlmethod WebEngineNewViewRequest::openIn(WebEngineView view)
+ 
+diff --git a/src/webengine/api/qquickwebenginenewviewrequest_p.h b/src/webengine/api/qquickwebenginenewviewrequest_p.h
+index 304c6c0..591e983 100644
+--- a/src/webengine/api/qquickwebenginenewviewrequest_p.h
++++ b/src/webengine/api/qquickwebenginenewviewrequest_p.h
+@@ -68,6 +68,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineNewViewRequest : public QObject
+     Q_PROPERTY(QUrl requestedUrl READ requestedUrl CONSTANT REVISION 1 FINAL)
+     Q_PROPERTY(bool userInitiated READ isUserInitiated CONSTANT FINAL)
+     Q_PROPERTY(QStringList additionalFeatures READ additionalFeatures CONSTANT FINAL)
++    Q_PROPERTY(QUrl url READ url)
+ public:
+     ~QQuickWebEngineNewViewRequest();
+ 
+@@ -76,6 +77,7 @@ public:
+     bool isUserInitiated() const;
+     const QStringList &additionalFeatures() const;
+     Q_INVOKABLE void openIn(QQuickWebEngineView *view);
++    QUrl url() const;
+ 
+ private:
+     QQuickWebEngineNewViewRequest();
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0004-Implement-Sync-IPC-messaging-through-qt.webChannelTr.patch b/aports/main/qt5-qtwebengine/patches-luna/0004-Implement-Sync-IPC-messaging-through-qt.webChannelTr.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ce40f89c3bffa61db00bc69ef21c15a2f34f69e6
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0004-Implement-Sync-IPC-messaging-through-qt.webChannelTr.patch
@@ -0,0 +1,152 @@
+From 8a722631f3b59bee898e73aad299d9950bb70844 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Wed, 30 Sep 2015 19:48:02 +0200
+Subject: [PATCH 04/18] Implement Sync IPC messaging through
+ qt.webChannelTransport.sendSync
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/core/common/qt_messages.h                      |  2 ++
+ src/core/renderer/web_channel_ipc_transport.cpp    | 42 +++++++++++++++++++++-
+ .../web_channel_ipc_transport_host.cpp             | 17 ++++++++-
+ .../renderer_host/web_channel_ipc_transport_host.h |  3 ++
+ 4 files changed, 62 insertions(+), 2 deletions(-)
+
+diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h
+index d998db2..62642cd 100644
+--- a/src/core/common/qt_messages.h
++++ b/src/core/common/qt_messages.h
+@@ -69,6 +69,8 @@ IPC_MESSAGE_ROUTED0(RenderViewObserverHostQt_DidFirstVisuallyNonEmptyLayout)
+ 
+ IPC_MESSAGE_ROUTED1(WebChannelIPCTransportHost_SendMessage, std::vector<char> /*binaryJSON*/)
+ 
++IPC_SYNC_MESSAGE_ROUTED1_1(WebChannelIPCTransportHost_SendMessageSync, std::vector<char> /*binaryJSON*/, std::vector<char> /*binaryJSON*/)
++
+ //-----------------------------------------------------------------------------
+ // Misc messages
+ // These are messages sent from the renderer to the browser process.
+diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp
+index 161d6f4..18f6b31 100644
+--- a/src/core/renderer/web_channel_ipc_transport.cpp
++++ b/src/core/renderer/web_channel_ipc_transport.cpp
+@@ -89,6 +89,44 @@ private:
+         renderView->Send(new WebChannelIPCTransportHost_SendMessage(renderView->GetRoutingID(), std::vector<char>(rawData, rawData + size)));
+     }
+ 
++    void NativeQtSendMessageSync(gin::Arguments *args)
++    {
++        content::RenderView *renderView = GetRenderView(args->isolate());
++        if (!renderView || args->Length() != 1)
++            return;
++        v8::Handle<v8::Value> val;
++        args->GetNext(&val);
++        if (!val->IsString() && !val->IsStringObject())
++            return;
++        v8::String::Utf8Value utf8(val->ToString());
++
++        QByteArray valueData(*utf8, utf8.length());
++        QJsonParseError error;
++        QJsonDocument doc = QJsonDocument::fromJson(valueData, &error);
++        if (error.error != QJsonParseError::NoError)
++            qWarning("%s %d: Parsing error: %s",__FILE__, __LINE__, qPrintable(error.errorString()));
++        int size = 0;
++        const char *rawData = doc.rawData(&size);
++
++        std::vector<char> replyData;
++        WebChannelIPCTransportHost_SendMessageSync *message = new WebChannelIPCTransportHost_SendMessageSync(renderView->GetRoutingID(), std::vector<char>(rawData, rawData + size), &replyData);
++        // Enable the UI thread in browser to receive messages.
++        message->EnableMessagePumping();
++        renderView->Send(message);
++
++        QJsonDocument docReply = QJsonDocument::fromRawData(replyData.data(), replyData.size(), QJsonDocument::BypassValidation);
++        Q_ASSERT(docReply.isObject());
++        QByteArray jsonReply = docReply.toJson(QJsonDocument::Compact);
++
++        v8::Isolate *isolate = v8::Isolate::GetCurrent();
++        v8::Handle<v8::Object> replyObject(v8::Object::New(isolate));
++        replyObject->ForceSet(v8::String::NewFromUtf8(isolate, "data")
++                           , v8::String::NewFromUtf8(isolate, jsonReply.constData(), v8::String::kNormalString, jsonReply.size())
++                           , v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete));
++
++        args->Return(replyObject);
++    }
++
+     DISALLOW_COPY_AND_ASSIGN(WebChannelTransport);
+ };
+ 
+@@ -135,7 +173,9 @@ void WebChannelTransport::Uninstall(blink::WebFrame *frame, uint worldId)
+ 
+ gin::ObjectTemplateBuilder WebChannelTransport::GetObjectTemplateBuilder(v8::Isolate *isolate)
+ {
+-    return gin::Wrappable<WebChannelTransport>::GetObjectTemplateBuilder(isolate).SetMethod("send", &WebChannelTransport::NativeQtSendMessage);
++    return gin::Wrappable<WebChannelTransport>::GetObjectTemplateBuilder(isolate)
++                       .SetMethod("send", &WebChannelTransport::NativeQtSendMessage)
++                       .SetMethod("sendSync", &WebChannelTransport::NativeQtSendMessageSync);
+ }
+ 
+ content::RenderView *WebChannelTransport::GetRenderView(v8::Isolate *isolate)
+diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
+index aef16f0..7d0cfb0 100644
+--- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp
++++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
+@@ -53,6 +53,7 @@ WebChannelIPCTransportHost::WebChannelIPCTransportHost(content::WebContents *con
+     : QWebChannelAbstractTransport(parent)
+     , content::WebContentsObserver(contents)
+     , m_worldId(worldId)
++    ,_mWaitingReply(0)
+ {
+     Send(new WebChannelIPCTransport_Install(routing_id(), m_worldId));
+ }
+@@ -82,7 +83,14 @@ void WebChannelIPCTransportHost::sendMessage(const QJsonObject &message)
+     QJsonDocument doc(message);
+     int size = 0;
+     const char *rawData = doc.rawData(&size);
+-    Send(new WebChannelIPCTransport_Message(routing_id(), std::vector<char>(rawData, rawData + size), m_worldId));
++    if (_mWaitingReply) {
++        WebChannelIPCTransportHost_SendMessageSync::WriteReplyParams(_mWaitingReply, std::vector<char>(rawData, rawData + size));
++        Send(_mWaitingReply);
++        _mWaitingReply = 0;
++    }
++    else {
++        Send(new WebChannelIPCTransport_Message(routing_id(), std::vector<char>(rawData, rawData + size), m_worldId));
++    }
+ }
+ 
+ void WebChannelIPCTransportHost::onWebChannelMessage(const std::vector<char> &message)
+@@ -92,11 +100,18 @@ void WebChannelIPCTransportHost::onWebChannelMessage(const std::vector<char> &me
+     Q_EMIT messageReceived(doc.object(), this);
+ }
+ 
++void WebChannelIPCTransportHost::onWebChannelMessageSync(const std::vector<char> &message, IPC::Message *reply)
++{
++    _mWaitingReply = reply;
++    onWebChannelMessage(message);
++}
++
+ bool WebChannelIPCTransportHost::OnMessageReceived(const IPC::Message &message)
+ {
+     bool handled = true;
+     IPC_BEGIN_MESSAGE_MAP(WebChannelIPCTransportHost, message)
+         IPC_MESSAGE_HANDLER(WebChannelIPCTransportHost_SendMessage, onWebChannelMessage)
++        IPC_MESSAGE_HANDLER_DELAY_REPLY(WebChannelIPCTransportHost_SendMessageSync, onWebChannelMessageSync)
+         IPC_MESSAGE_UNHANDLED(handled = false)
+     IPC_END_MESSAGE_MAP()
+     return handled;
+diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.h b/src/core/renderer_host/web_channel_ipc_transport_host.h
+index aa40647..bfb0523 100644
+--- a/src/core/renderer_host/web_channel_ipc_transport_host.h
++++ b/src/core/renderer_host/web_channel_ipc_transport_host.h
+@@ -70,7 +70,10 @@ public:
+ private:
+     bool OnMessageReceived(const IPC::Message& message) override;
+     void onWebChannelMessage(const std::vector<char> &message);
++    void onWebChannelMessageSync(const std::vector<char> &message, IPC::Message *reply);
++
+     uint m_worldId;
++    IPC::Message *_mWaitingReply;
+ };
+ 
+ } // namespace
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0004-Store-the-additional-window-features-related-to-Lune.patch b/aports/main/qt5-qtwebengine/patches-luna/0004-Store-the-additional-window-features-related-to-Lune.patch
new file mode 100644
index 0000000000000000000000000000000000000000..e641edabe8f28391cf1eaea3aa8c5bc56bada497
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0004-Store-the-additional-window-features-related-to-Lune.patch
@@ -0,0 +1,71 @@
+From 7d6b6e9bae5f26dda876e4b5b465994fff7d3b5d Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Tue, 20 Oct 2015 20:33:24 +0200
+Subject: [PATCH 04/10] Store the additional window features related to LuneOS
+ in the WebContentsView object
+
+ - additional_features (from window.open parameter)
+ - initial target URL
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ chromium/content/browser/web_contents/web_contents_impl.cc | 8 +++++++-
+ chromium/content/browser/web_contents/web_contents_view.h  | 8 ++++++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc b/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
+index 5eed7db..228b62a 100644
+--- a/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
++++ b/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
+@@ -2136,6 +2136,11 @@ void WebContentsImpl::CreateNewWindow(
+     if (!is_guest) {
+       WebContentsView* new_view = new_contents->view_.get();
+ 
++      // set the additional features required by the LuneOS app
++      // (ideally this information should be propagated using the IPC messaging)
++      new_view->setWindowAdditionalFeatures(params.additional_features);
++      new_view->setInitialTargetURL(params.target_url);
++
+       // TODO(brettw): It seems bogus that we have to call this function on the
+       // newly created object and give it one of its own member variables.
+       new_view->CreateViewForWidget(
+@@ -2249,8 +2254,9 @@ void WebContentsImpl::ShowCreatedWindow(int process_id,
+       contents->ResumeLoadingCreatedWebContents();
+ 
+     if (delegate) {
++      std::vector<base::string16> additional_features = contents->view_.get()->getWindowAdditionalFeatures();
+       delegate->AddNewContents(
+-          this, contents, disposition, initial_rect, user_gesture, NULL);
++          this, contents, disposition, initial_rect, user_gesture, NULL, additional_features);
+     }
+   }
+ }
+diff --git a/src/3rdparty/chromium/content/browser/web_contents/web_contents_view.h b/src/3rdparty/chromium/content/browser/web_contents/web_contents_view.h
+index e4401f8..aa2f791 100644
+--- a/src/3rdparty/chromium/content/browser/web_contents/web_contents_view.h
++++ b/src/3rdparty/chromium/content/browser/web_contents/web_contents_view.h
+@@ -13,6 +13,7 @@
+ #include "ui/gfx/geometry/rect.h"
+ #include "ui/gfx/geometry/size.h"
+ #include "ui/gfx/native_widget_types.h"
++#include "url/gurl.h"
+ 
+ namespace content {
+ class RenderViewHost;
+@@ -131,6 +132,13 @@ class WebContentsView {
+   virtual bool IsEventTracking() const = 0;
+   virtual void CloseTabAfterEventTracking() = 0;
+ #endif
++
++  // Add accessors to set/get the window additional features wanted by the LuneOS apps
++  // The actual implementation is done in web_contents_view_qt.h
++  virtual void setWindowAdditionalFeatures(const std::vector<base::string16> &additional_features) {}
++  virtual std::vector<base::string16> getWindowAdditionalFeatures() {}
++  virtual void setInitialTargetURL(const GURL &initialURL) {}
++  virtual GURL getInitialTargetURL() {}
+ };
+ 
+ }  // namespace content
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0005-Make-properties-for-some-settings-for-PalmBridgeServ.patch b/aports/main/qt5-qtwebengine/patches-luna/0005-Make-properties-for-some-settings-for-PalmBridgeServ.patch
new file mode 100644
index 0000000000000000000000000000000000000000..646c62222c19931af8aadf677888feadafb52b8b
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0005-Make-properties-for-some-settings-for-PalmBridgeServ.patch
@@ -0,0 +1,202 @@
+From c6c3c2e0a787eb7245fb807ab37b82a0076d215c Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Wed, 30 Sep 2015 23:37:44 +0200
+Subject: [PATCH 05/18] Make properties for some settings for PalmBridgeService
+ management
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/core/web_engine_settings.cpp              | 19 +++++++++++++
+ src/core/web_engine_settings.h                |  8 +++++-
+ src/webengine/api/qquickwebenginesettings.cpp | 39 +++++++++++++++++++++++++++
+ src/webengine/api/qquickwebenginesettings_p.h | 12 +++++++++
+ 4 files changed, 77 insertions(+), 1 deletion(-)
+
+diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
+index 0079e02..7d7af2d 100644
+--- a/src/core/web_engine_settings.cpp
++++ b/src/core/web_engine_settings.cpp
+@@ -228,6 +228,19 @@ QString WebEngineSettings::defaultTextEncoding() const
+     return m_defaultEncoding.isEmpty()? parentSettings->defaultTextEncoding() : m_defaultEncoding;
+ }
+ 
++void WebEngineSettings::setLuneOSIdentifier(const QString &identifier)
++{
++    m_luneOSIdentifier = identifier;
++    scheduleApplyRecursively();
++}
++
++QString WebEngineSettings::luneOSIdentifier() const
++{
++    if (!parentSettings)
++        return m_luneOSIdentifier;
++    return m_luneOSIdentifier.isEmpty()? parentSettings->luneOSIdentifier() : m_luneOSIdentifier;
++}
++
+ void WebEngineSettings::initDefaults(bool offTheRecord)
+ {
+     if (s_defaultAttributes.isEmpty()) {
+@@ -267,6 +280,8 @@ void WebEngineSettings::initDefaults(bool offTheRecord)
+         s_defaultAttributes.insert(PrintElementBackgrounds, true);
+         s_defaultAttributes.insert(AllowRunningInsecureContent, allowRunningInsecureContent);
+         s_defaultAttributes.insert(AllowGeolocationOnInsecureOrigins, false);
++        s_defaultAttributes.insert(PalmServiceBridgeEnabled, false);
++        s_defaultAttributes.insert(LuneOSPrivileged, false);
+     }
+     if (offTheRecord)
+         m_attributes.insert(LocalStorageEnabled, false);
+@@ -299,6 +314,8 @@ void WebEngineSettings::initDefaults(bool offTheRecord)
+         s_defaultFontSizes.insert(DefaultFontSize, 16);
+     }
+ 
++    m_luneOSIdentifier = "";
++
+     m_defaultEncoding = QStringLiteral("ISO-8859-1");
+ }
+ 
+@@ -352,6 +369,8 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p
+     prefs->should_print_backgrounds = testAttribute(PrintElementBackgrounds);
+     prefs->allow_running_insecure_content = testAttribute(AllowRunningInsecureContent);
+     prefs->allow_geolocation_on_insecure_origins = testAttribute(AllowGeolocationOnInsecureOrigins);
++    prefs->luneosPriviledged = testAttribute(LuneOSPrivileged);
++    prefs->luneosAppIdentifier = luneOSIdentifier().toStdString();
+ 
+     // Fonts settings.
+     prefs->standard_font_family_map[content::kCommonScript] = toString16(fontFamily(StandardFont));
+diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h
+index 4b0ce7b..3a3a8d1 100644
+--- a/src/core/web_engine_settings.h
++++ b/src/core/web_engine_settings.h
+@@ -83,7 +83,9 @@ public:
+         FocusOnNavigationEnabled,
+         PrintElementBackgrounds,
+         AllowRunningInsecureContent,
+-        AllowGeolocationOnInsecureOrigins
++        AllowGeolocationOnInsecureOrigins,
++        PalmServiceBridgeEnabled,
++        LuneOSPrivileged
+     };
+ 
+     // Must match the values from the public API in qwebenginesettings.h.
+@@ -127,6 +129,9 @@ public:
+     void setDefaultTextEncoding(const QString &encoding);
+     QString defaultTextEncoding() const;
+ 
++    void setLuneOSIdentifier(const QString &identifier);
++    QString luneOSIdentifier() const;
++
+     void initDefaults(bool offTheRecord = false);
+     void scheduleApply();
+ 
+@@ -142,6 +147,7 @@ private:
+     QHash<FontFamily, QString> m_fontFamilies;
+     QHash<FontSize, int> m_fontSizes;
+     QString m_defaultEncoding;
++    QString m_luneOSIdentifier;
+     QScopedPointer<content::WebPreferences> webPreferences;
+     QScopedPointer<BatchTimer> m_batchTimer;
+ 
+diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
+index ff25413..bcc5326 100644
+--- a/src/webengine/api/qquickwebenginesettings.cpp
++++ b/src/webengine/api/qquickwebenginesettings.cpp
+@@ -376,6 +376,21 @@ QString QQuickWebEngineSettings::defaultTextEncoding() const
+     return d_ptr->defaultTextEncoding();
+ }
+ 
++bool QQuickWebEngineSettings::palmServiceBridgeEnabled() const
++{
++    return d_ptr->testAttribute(WebEngineSettings::PalmServiceBridgeEnabled);
++}
++
++bool QQuickWebEngineSettings::luneOSPrivileged() const
++{
++    return d_ptr->testAttribute(WebEngineSettings::LuneOSPrivileged);
++}
++
++QString QQuickWebEngineSettings::luneOSIdentifier() const
++{
++    return d_ptr->luneOSIdentifier();
++}
++
+ void QQuickWebEngineSettings::setAutoLoadImages(bool on)
+ {
+     bool wasOn = d_ptr->testAttribute(WebEngineSettings::AutoLoadImages);
+@@ -564,6 +579,30 @@ void QQuickWebEngineSettings::setAllowGeolocationOnInsecureOrigins(bool on)
+         Q_EMIT allowGeolocationOnInsecureOriginsChanged();
+ }
+ 
++void QQuickWebEngineSettings::setPalmServiceBridgeEnabled(bool on)
++{
++    bool wasOn = d_ptr->testAttribute(WebEngineSettings::PalmServiceBridgeEnabled);
++    d_ptr->setAttribute(WebEngineSettings::PalmServiceBridgeEnabled, on);
++    if (wasOn != on)
++        Q_EMIT palmServiceBridgeEnabledChanged();
++}
++
++void QQuickWebEngineSettings::setLuneOSPrivileged(bool on)
++{
++    bool wasOn = d_ptr->testAttribute(WebEngineSettings::LuneOSPrivileged);
++    d_ptr->setAttribute(WebEngineSettings::LuneOSPrivileged, on);
++    if (wasOn != on)
++        Q_EMIT luneOSPrivilegedChanged();
++}
++
++void QQuickWebEngineSettings::setLuneOSIdentifier(QString identifier)
++{
++    const QString oldLuneOSIdentifier = d_ptr->luneOSIdentifier();
++    d_ptr->setLuneOSIdentifier(identifier);
++    if (oldLuneOSIdentifier.compare(identifier))
++        Q_EMIT luneOSIdentifierChanged();
++}
++
+ void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentSettings)
+ {
+     d_ptr->setParentSettings(parentSettings->d_ptr.data());
+diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h
+index 10217c6..4893b34 100644
+--- a/src/webengine/api/qquickwebenginesettings_p.h
++++ b/src/webengine/api/qquickwebenginesettings_p.h
+@@ -86,6 +86,9 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
+     Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds NOTIFY printElementBackgroundsChanged REVISION 3 FINAL)
+     Q_PROPERTY(bool allowRunningInsecureContent READ allowRunningInsecureContent WRITE setAllowRunningInsecureContent NOTIFY allowRunningInsecureContentChanged REVISION 3 FINAL)
+     Q_PROPERTY(bool allowGeolocationOnInsecureOrigins READ allowGeolocationOnInsecureOrigins WRITE setAllowGeolocationOnInsecureOrigins NOTIFY allowGeolocationOnInsecureOriginsChanged REVISION 4 FINAL)
++    Q_PROPERTY(bool palmServiceBridgeEnabled READ palmServiceBridgeEnabled WRITE setPalmServiceBridgeEnabled NOTIFY palmServiceBridgeEnabledChanged)
++    Q_PROPERTY(bool luneOSPrivileged READ luneOSPrivileged WRITE setLuneOSPrivileged NOTIFY luneOSPrivilegedChanged)
++    Q_PROPERTY(QString luneOSIdentifier READ luneOSIdentifier WRITE setLuneOSIdentifier NOTIFY luneOSIdentifierChanged)
+ 
+ public:
+     ~QQuickWebEngineSettings();
+@@ -113,6 +116,9 @@ public:
+     bool printElementBackgrounds() const;
+     bool allowRunningInsecureContent() const;
+     bool allowGeolocationOnInsecureOrigins() const;
++    bool palmServiceBridgeEnabled() const;
++    bool luneOSPrivileged() const;
++    QString luneOSIdentifier() const;
+ 
+     void setAutoLoadImages(bool on);
+     void setJavascriptEnabled(bool on);
+@@ -137,6 +143,9 @@ public:
+     void setPrintElementBackgrounds(bool on);
+     void setAllowRunningInsecureContent(bool on);
+     void setAllowGeolocationOnInsecureOrigins(bool on);
++    void setPalmServiceBridgeEnabled(bool on);
++    void setLuneOSPrivileged(bool on);
++    void setLuneOSIdentifier(QString identifier);
+ 
+ signals:
+     void autoLoadImagesChanged();
+@@ -162,6 +171,9 @@ signals:
+     Q_REVISION(3) void printElementBackgroundsChanged();
+     Q_REVISION(3) void allowRunningInsecureContentChanged();
+     Q_REVISION(4) void allowGeolocationOnInsecureOriginsChanged();
++    void palmServiceBridgeEnabledChanged();
++    void luneOSPrivilegedChanged();
++    void luneOSIdentifierChanged();
+ 
+ private:
+     explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0);
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0005-WindowFeatures-Chrome-lower-the-minimum-height-to-5.patch b/aports/main/qt5-qtwebengine/patches-luna/0005-WindowFeatures-Chrome-lower-the-minimum-height-to-5.patch
new file mode 100644
index 0000000000000000000000000000000000000000..9cee6dd04e38796fe73523eafd516fde43cacc47
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0005-WindowFeatures-Chrome-lower-the-minimum-height-to-5.patch
@@ -0,0 +1,43 @@
+From 3b5a306323787c3e7b2bf33f9063e1d933527a27 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Wed, 28 Oct 2015 22:14:42 +0100
+Subject: [PATCH 05/10] WindowFeatures, Chrome: lower the minimum height to 5
+
+* In case the height is expressed in GridUnits, it means it won't be possible to create a window with a height lower than 5gu.
+* Chrome: lower minimum height to 5
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ chromium/third_party/WebKit/Source/core/page/ChromeClient.h     | 2 +-
+ chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/core/page/ChromeClient.h b/src/3rdparty/chromium/third_party/WebKit/Source/core/page/ChromeClient.h
+index 9ec4b22..19dce1f 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/core/page/ChromeClient.h
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/core/page/ChromeClient.h
+@@ -288,7 +288,7 @@ class CORE_EXPORT ChromeClient : public HostWindow {
+   virtual bool requestPointerLock(LocalFrame*) { return false; }
+   virtual void requestPointerUnlock(LocalFrame*) {}
+ 
+-  virtual IntSize minimumWindowSize() const { return IntSize(100, 100); }
++  virtual IntSize minimumWindowSize() const { return IntSize(100, 5); }
+ 
+   virtual bool isChromeClientImpl() const { return false; }
+ 
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp
+index 82614af..7ede5b6 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/core/page/WindowFeatures.cpp
+@@ -220,7 +220,7 @@ WindowFeatures::WindowFeatures(const String& dialogFeaturesString,
+   width = intFeature(features, "dialogwidth", 100, screenAvailableRect.width(),
+                      620);
+   // default here came from frame size of dialog in MacIE
+-  height = intFeature(features, "dialogheight", 100,
++  height = intFeature(features, "dialogheight", 5,
+                       screenAvailableRect.height(), 450);
+ 
+   x = intFeature(features, "dialogleft", screenAvailableRect.x(),
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0006-Enable-password-echo.patch b/aports/main/qt5-qtwebengine/patches-luna/0006-Enable-password-echo.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c565d23db5c8bf7d8d817a2cea70ef4d7dd1ce04
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0006-Enable-password-echo.patch
@@ -0,0 +1,25 @@
+From 12f0346614ed11ad9f1444c5c01218ccfe3e0790 Mon Sep 17 00:00:00 2001
+From: Herrie <Github.com@herrie.org>
+Date: Wed, 2 Mar 2016 16:13:07 +0100
+Subject: [PATCH 06/10] Enable password echo
+
+---
+ chromium/third_party/WebKit/Source/core/frame/Settings.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/Settings.in b/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/Settings.in
+index 5a50982..9789d19 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/Settings.in
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/core/frame/Settings.in
+@@ -29,7 +29,7 @@ defaultTextEncodingName type=String
+ # Do not hide chars typed in password fields immediately, but let the last char stay
+ # visible for N seconds, configured by the passwordEchoDurationInSeconds setting
+ # FIXME: Enable automatically if passwordEchoDurationInSeconds is set to a positive value.
+-passwordEchoEnabled initial=false
++passwordEchoEnabled initial=true
+ 
+ # Configure how long the last char should say visible in seconds.
+ passwordEchoDurationInSeconds type=double, initial=1
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0006-WebEngineSettings-Add-a-standardFontFamily-property-.patch b/aports/main/qt5-qtwebengine/patches-luna/0006-WebEngineSettings-Add-a-standardFontFamily-property-.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c45b726ae5a6ab8260530e72dee303fc2f5a2726
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0006-WebEngineSettings-Add-a-standardFontFamily-property-.patch
@@ -0,0 +1,82 @@
+From 6cc5bc3e008c48ca1ecfea640d84f11ccbfe7775 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sat, 17 Oct 2015 21:09:29 +0200
+Subject: [PATCH 06/18] WebEngineSettings: Add a "standardFontFamily" property
+ to be able to setup Prelude
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/webengine/api/qquickwebenginesettings.cpp | 13 +++++++++++++
+ src/webengine/api/qquickwebenginesettings_p.h |  4 ++++
+ 2 files changed, 17 insertions(+)
+
+diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
+index bcc5326..c0f1227 100644
+--- a/src/webengine/api/qquickwebenginesettings.cpp
++++ b/src/webengine/api/qquickwebenginesettings.cpp
+@@ -391,6 +391,11 @@ QString QQuickWebEngineSettings::luneOSIdentifier() const
+     return d_ptr->luneOSIdentifier();
+ }
+ 
++QString QQuickWebEngineSettings::standardFontFamily() const
++{
++    return d_ptr->fontFamily(WebEngineSettings::StandardFont);;
++}
++
+ void QQuickWebEngineSettings::setAutoLoadImages(bool on)
+ {
+     bool wasOn = d_ptr->testAttribute(WebEngineSettings::AutoLoadImages);
+@@ -603,6 +608,14 @@ void QQuickWebEngineSettings::setLuneOSIdentifier(QString identifier)
+         Q_EMIT luneOSIdentifierChanged();
+ }
+ 
++void QQuickWebEngineSettings::setStandardFontFamily(QString fontFamily)
++{
++    const QString oldStandardFontFamily = d_ptr->fontFamily(WebEngineSettings::StandardFont);
++    d_ptr->setFontFamily(WebEngineSettings::StandardFont, fontFamily);
++    if (oldStandardFontFamily.compare(fontFamily))
++        Q_EMIT standardFontFamilyChanged();
++}
++
+ void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentSettings)
+ {
+     d_ptr->setParentSettings(parentSettings->d_ptr.data());
+diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h
+index 4893b34..8b5cf49 100644
+--- a/src/webengine/api/qquickwebenginesettings_p.h
++++ b/src/webengine/api/qquickwebenginesettings_p.h
+@@ -89,6 +89,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
+     Q_PROPERTY(bool palmServiceBridgeEnabled READ palmServiceBridgeEnabled WRITE setPalmServiceBridgeEnabled NOTIFY palmServiceBridgeEnabledChanged)
+     Q_PROPERTY(bool luneOSPrivileged READ luneOSPrivileged WRITE setLuneOSPrivileged NOTIFY luneOSPrivilegedChanged)
+     Q_PROPERTY(QString luneOSIdentifier READ luneOSIdentifier WRITE setLuneOSIdentifier NOTIFY luneOSIdentifierChanged)
++    Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily NOTIFY standardFontFamilyChanged)
+ 
+ public:
+     ~QQuickWebEngineSettings();
+@@ -119,6 +120,7 @@ public:
+     bool palmServiceBridgeEnabled() const;
+     bool luneOSPrivileged() const;
+     QString luneOSIdentifier() const;
++    QString standardFontFamily() const;
+ 
+     void setAutoLoadImages(bool on);
+     void setJavascriptEnabled(bool on);
+@@ -146,6 +148,7 @@ public:
+     void setPalmServiceBridgeEnabled(bool on);
+     void setLuneOSPrivileged(bool on);
+     void setLuneOSIdentifier(QString identifier);
++    void setStandardFontFamily(QString fontFamily);
+ 
+ signals:
+     void autoLoadImagesChanged();
+@@ -174,6 +177,7 @@ signals:
+     void palmServiceBridgeEnabledChanged();
+     void luneOSPrivilegedChanged();
+     void luneOSIdentifierChanged();
++    void standardFontFamilyChanged();
+ 
+ private:
+     explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0);
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0007-WebEngineSettings-add-also-Serif-Fixed-and-Cursive-f.patch b/aports/main/qt5-qtwebengine/patches-luna/0007-WebEngineSettings-add-also-Serif-Fixed-and-Cursive-f.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ba66ce6fcc7e420317523ec64b5c454f1f8c7299
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0007-WebEngineSettings-add-also-Serif-Fixed-and-Cursive-f.patch
@@ -0,0 +1,147 @@
+From f9f47062768dbd6f4a131f630ceb6ad83ab9c0e5 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sat, 17 Oct 2015 22:13:32 +0200
+Subject: [PATCH 07/18] WebEngineSettings: add also Serif, Fixed and Cursive
+ font settings, and font size for normal and fixed fonts.
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/webengine/api/qquickwebenginesettings.cpp | 62 ++++++++++++++++++++++++++-
+ src/webengine/api/qquickwebenginesettings_p.h | 20 +++++++++
+ 2 files changed, 81 insertions(+), 1 deletion(-)
+
+diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
+index c0f1227..22adb28 100644
+--- a/src/webengine/api/qquickwebenginesettings.cpp
++++ b/src/webengine/api/qquickwebenginesettings.cpp
+@@ -393,7 +393,27 @@ QString QQuickWebEngineSettings::luneOSIdentifier() const
+ 
+ QString QQuickWebEngineSettings::standardFontFamily() const
+ {
+-    return d_ptr->fontFamily(WebEngineSettings::StandardFont);;
++    return d_ptr->fontFamily(WebEngineSettings::StandardFont);
++}
++QString QQuickWebEngineSettings::fixedFontFamily() const
++{
++    return d_ptr->fontFamily(WebEngineSettings::FixedFont);
++}
++QString QQuickWebEngineSettings::serifFontFamily() const
++{
++    return d_ptr->fontFamily(WebEngineSettings::SerifFont);
++}
++QString QQuickWebEngineSettings::cursiveFontFamily() const
++{
++    return d_ptr->fontFamily(WebEngineSettings::CursiveFont);
++}
++int QQuickWebEngineSettings::defaultFontSize() const
++{
++    return d_ptr->fontSize(WebEngineSettings::DefaultFontSize);
++}
++int QQuickWebEngineSettings::defaultFixedFontSize() const
++{
++    return d_ptr->fontSize(WebEngineSettings::DefaultFixedFontSize);
+ }
+ 
+ void QQuickWebEngineSettings::setAutoLoadImages(bool on)
+@@ -616,6 +636,46 @@ void QQuickWebEngineSettings::setStandardFontFamily(QString fontFamily)
+         Q_EMIT standardFontFamilyChanged();
+ }
+ 
++void QQuickWebEngineSettings::setFixedFontFamily(QString fontFamily)
++{
++    const QString oldFixedFontFamily = d_ptr->fontFamily(WebEngineSettings::FixedFont);
++    d_ptr->setFontFamily(WebEngineSettings::FixedFont, fontFamily);
++    if (oldFixedFontFamily.compare(fontFamily))
++        Q_EMIT fixedFontFamilyChanged();
++}
++
++void QQuickWebEngineSettings::setSerifFontFamily(QString fontFamily)
++{
++    const QString oldSerifFontFamily = d_ptr->fontFamily(WebEngineSettings::SerifFont);
++    d_ptr->setFontFamily(WebEngineSettings::SerifFont, fontFamily);
++    if (oldSerifFontFamily.compare(fontFamily))
++        Q_EMIT serifFontFamilyChanged();
++}
++
++void QQuickWebEngineSettings::setCursiveFontFamily(QString fontFamily)
++{
++    const QString oldCursiveFontFamily = d_ptr->fontFamily(WebEngineSettings::CursiveFont);
++    d_ptr->setFontFamily(WebEngineSettings::CursiveFont, fontFamily);
++    if (oldCursiveFontFamily.compare(fontFamily))
++        Q_EMIT standardFontFamilyChanged();
++}
++
++void QQuickWebEngineSettings::setDefaultFontSize(int fontSize)
++{
++    const int oldDefaultFontSize = d_ptr->fontSize(WebEngineSettings::DefaultFontSize);
++    d_ptr->setFontSize(WebEngineSettings::DefaultFontSize, fontSize);
++    if (oldDefaultFontSize!= fontSize)
++        Q_EMIT defaultFontSizeChanged();
++}
++
++void QQuickWebEngineSettings::setDefaultFixedFontSize(int fontSize)
++{
++    const int oldDefaultFixedFontSize = d_ptr->fontSize(WebEngineSettings::DefaultFixedFontSize);
++    d_ptr->setFontSize(WebEngineSettings::DefaultFixedFontSize, fontSize);
++    if (oldDefaultFixedFontSize != fontSize)
++        Q_EMIT defaultFixedFontSizeChanged();
++}
++
+ void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentSettings)
+ {
+     d_ptr->setParentSettings(parentSettings->d_ptr.data());
+diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h
+index 8b5cf49..e793089 100644
+--- a/src/webengine/api/qquickwebenginesettings_p.h
++++ b/src/webengine/api/qquickwebenginesettings_p.h
+@@ -90,6 +90,11 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
+     Q_PROPERTY(bool luneOSPrivileged READ luneOSPrivileged WRITE setLuneOSPrivileged NOTIFY luneOSPrivilegedChanged)
+     Q_PROPERTY(QString luneOSIdentifier READ luneOSIdentifier WRITE setLuneOSIdentifier NOTIFY luneOSIdentifierChanged)
+     Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily NOTIFY standardFontFamilyChanged)
++    Q_PROPERTY(QString fixedFontFamily READ standardFontFamily WRITE setFixedFontFamily NOTIFY fixedFontFamilyChanged)
++    Q_PROPERTY(QString serifFontFamily READ standardFontFamily WRITE setSerifFontFamily NOTIFY serifFontFamilyChanged)
++    Q_PROPERTY(QString cursiveFontFamily READ standardFontFamily WRITE setCursiveFontFamily NOTIFY cursiveFontFamilyChanged)
++    Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize NOTIFY defaultFontSizeChanged)
++    Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize NOTIFY defaultFixedFontSizeChanged)
+ 
+ public:
+     ~QQuickWebEngineSettings();
+@@ -121,6 +126,11 @@ public:
+     bool luneOSPrivileged() const;
+     QString luneOSIdentifier() const;
+     QString standardFontFamily() const;
++    QString fixedFontFamily() const;
++    QString serifFontFamily() const;
++    QString cursiveFontFamily() const;
++    int defaultFontSize() const;
++    int defaultFixedFontSize() const;
+ 
+     void setAutoLoadImages(bool on);
+     void setJavascriptEnabled(bool on);
+@@ -149,6 +159,11 @@ public:
+     void setLuneOSPrivileged(bool on);
+     void setLuneOSIdentifier(QString identifier);
+     void setStandardFontFamily(QString fontFamily);
++    void setFixedFontFamily(QString fontFamily);
++    void setSerifFontFamily(QString fontFamily);
++    void setCursiveFontFamily(QString fontFamily);
++    void setDefaultFontSize(int fontSize);
++    void setDefaultFixedFontSize(int fontSize);
+ 
+ signals:
+     void autoLoadImagesChanged();
+@@ -178,6 +193,11 @@ signals:
+     void luneOSPrivilegedChanged();
+     void luneOSIdentifierChanged();
+     void standardFontFamilyChanged();
++    void fixedFontFamilyChanged();
++    void serifFontFamilyChanged();
++    void cursiveFontFamilyChanged();
++    void defaultFontSizeChanged();
++    void defaultFixedFontSizeChanged();
+ 
+ private:
+     explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0);
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0007-storage-browser-quota-workaround-for-crash-on-cache-.patch b/aports/main/qt5-qtwebengine/patches-luna/0007-storage-browser-quota-workaround-for-crash-on-cache-.patch
new file mode 100644
index 0000000000000000000000000000000000000000..efe132d34483a2c29865f5c814aa78f319bf371c
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0007-storage-browser-quota-workaround-for-crash-on-cache-.patch
@@ -0,0 +1,47 @@
+From ffa591aa664fc8620ca387afa041a0a65b0339c6 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Tue, 10 May 2016 17:37:37 +0000
+Subject: [PATCH 07/10] storage browser quota: workaround for crash on cache
+ update
+
+When using GCC 5.3.0, we get a crash on the statement:
+"int64* usage = &cached_usage_by_host_[host][origin]"
+Apparently adding implicitely a new (GURL,int64) pair in
+the host cache results in incorrect code on armv7.
+This fix adds the pair more smoothly, step-by-step. The
+resulting binary code isn't faulty anymore.
+
+This could be related to the following bug:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69841
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ chromium/storage/browser/quota/client_usage_tracker.cc | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/chromium/storage/browser/quota/client_usage_tracker.cc b/src/3rdparty/chromium/storage/browser/quota/client_usage_tracker.cc
+index c9c46f6..c4e9585 100644
+--- a/src/3rdparty/chromium/storage/browser/quota/client_usage_tracker.cc
++++ b/src/3rdparty/chromium/storage/browser/quota/client_usage_tracker.cc
+@@ -358,7 +358,17 @@ void ClientUsageTracker::AddCachedOrigin(const GURL& origin,
+   DCHECK(IsUsageCacheEnabledForOrigin(origin));
+ 
+   std::string host = net::GetHostOrSpecFromURL(origin);
+-  int64_t* usage = &cached_usage_by_host_[host][origin];
++
++  UsageMap& cached_usage_for_host = cached_usage_by_host_[host];
++  UsageMap::iterator found = cached_usage_for_host.find(origin);
++  if (found == cached_usage_for_host.end()) {
++      // try to add it smoothly
++      std::pair<GURL, int64_t> newPair(origin,0);
++      cached_usage_for_host.insert(newPair);
++  }
++  int64_t* usage = &(cached_usage_for_host[origin]);
++
++  //int64* usage = &cached_usage_by_host_[host][origin];
+   int64_t delta = new_usage - *usage;
+   *usage = new_usage;
+   if (delta) {
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0008-Store-the-additional-window-features-required-by-the.patch b/aports/main/qt5-qtwebengine/patches-luna/0008-Store-the-additional-window-features-required-by-the.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f070ae2f0a590b11f57dfded816805179cef3fa3
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0008-Store-the-additional-window-features-required-by-the.patch
@@ -0,0 +1,36 @@
+From da88508d7cafe1f77c273c8c098eb310124a20f7 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sun, 18 Oct 2015 21:17:32 +0200
+Subject: [PATCH 08/18] Store the additional window features required by the
+ LuneOS apps in the WebContentsViewQt object
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/core/web_contents_view_qt.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h
+index 5db4e28..5f19b84 100644
+--- a/src/core/web_contents_view_qt.h
++++ b/src/core/web_contents_view_qt.h
+@@ -71,6 +71,9 @@ public:
+     void initialize(WebContentsAdapterClient* client);
+     WebContentsAdapterClient *client() { return m_client; }
+ 
++    virtual void setWindowAdditionalFeatures(const std::vector<base::string16> &additional_features) Q_DECL_OVERRIDE { m_additional_features = additional_features; }
++    virtual std::vector<base::string16> getWindowAdditionalFeatures() Q_DECL_OVERRIDE { return m_additional_features; }
++
+     content::RenderWidgetHostViewBase *CreateViewForWidget(content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override;
+ 
+     void CreateView(const gfx::Size& initial_size, gfx::NativeView context) override;
+@@ -132,6 +135,7 @@ private:
+     WebContentsAdapterClient *m_client;
+     WebContentsAdapterClient *m_factoryClient;
+     bool m_allowOtherViews;
++    std::vector<base::string16> m_additional_features;
+ };
+ 
+ } // namespace QtWebEngineCore
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0008-html.css-themeWin.css-Add-Prelude-as-default-font-in.patch b/aports/main/qt5-qtwebengine/patches-luna/0008-html.css-themeWin.css-Add-Prelude-as-default-font-in.patch
new file mode 100644
index 0000000000000000000000000000000000000000..78a31e647de81e2c6c3a81eeb5aba2d66a559cab
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0008-html.css-themeWin.css-Add-Prelude-as-default-font-in.patch
@@ -0,0 +1,59 @@
+From a710d3f2da3e80f153325bbb385a7e8789a7fea7 Mon Sep 17 00:00:00 2001
+From: Herrie <Github.com@herrie.org>
+Date: Wed, 29 Jun 2016 13:52:09 +0200
+Subject: [PATCH 08/10] html.css & themeWin.css: Add Prelude as default font
+ instead of monospace
+
+Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
+---
+ chromium/third_party/WebKit/Source/core/css/html.css     | 6 ++++--
+ chromium/third_party/WebKit/Source/core/css/themeWin.css | 2 +-
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/core/css/html.css b/src/3rdparty/chromium/third_party/WebKit/Source/core/css/html.css
+index 586eef8..8860768 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/core/css/html.css
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/core/css/html.css
+@@ -56,7 +56,8 @@ script {
+ 
+ body {
+     display: block;
+-    margin: 8px
++    margin: 8px;
++    font-family: Prelude;
+ }
+ 
+ body:-webkit-full-page-media {
+@@ -399,6 +400,7 @@ input, textarea, keygen, select, button {
+     margin: 0__qem;
+     font: -webkit-small-control;
+     text-rendering: auto; /* FIXME: Remove when tabs work with optimizeLegibility. */
++    font-family: Prelude;
+     color: initial;
+     letter-spacing: normal;
+     word-spacing: normal;
+@@ -921,7 +923,7 @@ i, cite, em, var, address, dfn {
+ }
+ 
+ tt, code, kbd, samp {
+-    font-family: monospace
++    font-family: monospace;
+ }
+ 
+ pre, xmp, plaintext, listing {
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/core/css/themeWin.css b/src/3rdparty/chromium/third_party/WebKit/Source/core/css/themeWin.css
+index 43cf9e1..1ac5fba 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/core/css/themeWin.css
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/core/css/themeWin.css
+@@ -114,7 +114,7 @@ select[size][multiple] {
+ }
+ 
+ textarea {
+-    font-family: monospace;
++    font-family: Prelude;
+     /* Same as native_theme_base. */
+     border-color: #a9a9a9;
+ }
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0009-QQuickWebEngineNewViewRequest-use-initialTargetUrl-f.patch b/aports/main/qt5-qtwebengine/patches-luna/0009-QQuickWebEngineNewViewRequest-use-initialTargetUrl-f.patch
new file mode 100644
index 0000000000000000000000000000000000000000..68d8bb2eed8a64dfc59416d2333cec251e65b9fe
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0009-QQuickWebEngineNewViewRequest-use-initialTargetUrl-f.patch
@@ -0,0 +1,97 @@
+From 65b63fdd3da0a11126c4fedc9f7d1c87f422707d Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Tue, 20 Oct 2015 20:32:08 +0200
+Subject: [PATCH 09/18] QQuickWebEngineNewViewRequest: use initialTargetUrl for
+ url()
+
+The initial target url is stored in the WebContentsView when the window creation is requested.
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/core/web_contents_adapter.cpp                   | 11 +++++++++++
+ src/core/web_contents_adapter.h                     |  1 +
+ src/core/web_contents_view_qt.h                     |  4 ++++
+ src/webengine/api/qquickwebenginenewviewrequest.cpp |  4 ++--
+ 4 files changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
+index 9c78d67..3761599 100644
+--- a/src/core/web_contents_adapter.cpp
++++ b/src/core/web_contents_adapter.cpp
+@@ -655,6 +655,17 @@ QUrl WebContentsAdapter::iconUrl() const
+     return QUrl();
+ }
+ 
++QUrl WebContentsAdapter::initialTargetUrl() const
++{
++    Q_D(const WebContentsAdapter);
++    content::WebContentsView *contentsView = static_cast<content::WebContentsImpl*>(d->webContents.get())->GetView();
++    if (contentsView) {
++        return toQt(contentsView->getInitialTargetURL());
++    }
++
++    return QUrl();
++}
++
+ QString WebContentsAdapter::pageTitle() const
+ {
+     Q_D(const WebContentsAdapter);
+diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
+index 46c8d26..bf5c969 100644
+--- a/src/core/web_contents_adapter.h
++++ b/src/core/web_contents_adapter.h
+@@ -94,6 +94,7 @@ public:
+     QString pageTitle() const;
+     QString selectedText() const;
+     QUrl iconUrl() const;
++    QUrl initialTargetUrl() const;
+ 
+     void undo();
+     void redo();
+diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h
+index 5f19b84..181b735 100644
+--- a/src/core/web_contents_view_qt.h
++++ b/src/core/web_contents_view_qt.h
+@@ -45,6 +45,7 @@
+ #include "content/browser/web_contents/web_contents_view.h"
+ #include "content/public/browser/render_view_host.h"
+ #include "content/public/browser/render_widget_host.h"
++#include "url/gurl.h"
+ 
+ #include "qtwebenginecoreglobal_p.h"
+ #include "render_widget_host_view_qt.h"
+@@ -73,6 +74,8 @@ public:
+ 
+     virtual void setWindowAdditionalFeatures(const std::vector<base::string16> &additional_features) Q_DECL_OVERRIDE { m_additional_features = additional_features; }
+     virtual std::vector<base::string16> getWindowAdditionalFeatures() Q_DECL_OVERRIDE { return m_additional_features; }
++    virtual void setInitialTargetURL(const GURL &initialURL) Q_DECL_OVERRIDE { m_initialURL = initialURL; }
++    virtual GURL getInitialTargetURL() Q_DECL_OVERRIDE { return m_initialURL; }
+ 
+     content::RenderWidgetHostViewBase *CreateViewForWidget(content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override;
+ 
+@@ -131,6 +134,7 @@ public:
+ #endif // defined(OS_MACOSX)
+ 
+ private:
++    GURL m_initialURL;
+     content::WebContents *m_webContents;
+     WebContentsAdapterClient *m_client;
+     WebContentsAdapterClient *m_factoryClient;
+diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp
+index a369889..2272aa1 100644
+--- a/src/webengine/api/qquickwebenginenewviewrequest.cpp
++++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp
+@@ -99,8 +99,8 @@ const QStringList &QQuickWebEngineNewViewRequest::additionalFeatures() const
+ 
+ QUrl QQuickWebEngineNewViewRequest::url() const
+ {
+-    if (!m_adapter) {
+-        return m_adapter->activeUrl();
++    if (m_adapter) {
++        return m_adapter->initialTargetUrl();
+     }
+     return QUrl();
+ }
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0010-Update-additional-params-from-Chromium-53-56.patch b/aports/main/qt5-qtwebengine/patches-luna/0010-Update-additional-params-from-Chromium-53-56.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a42d3c20f7affa327ae1023d894ec1630e988efa
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0010-Update-additional-params-from-Chromium-53-56.patch
@@ -0,0 +1,141 @@
+From 1a5e631c99d55da3fa3e3d2e469d4ab95a5af5eb Mon Sep 17 00:00:00 2001
+From: Herrie <github.com@herrie.org>
+Date: Fri, 25 Aug 2017 21:12:16 +0200
+Subject: [PATCH 10/10] Update additional params from Chromium 53->56
+
+---
+ .../content/browser/web_contents/web_contents_impl.cc     |  8 ++++++--
+ .../content/public/common/common_param_traits_macros.h    |  1 +
+ .../third_party/WebKit/public/web/WebWindowFeatures.h     | 15 +++++++++++----
+ .../WebKit/public/web/WindowFeaturesStructTraits.cpp      |  2 ++
+ .../WebKit/public/web/WindowFeaturesStructTraits.h        |  4 ++++
+ .../third_party/WebKit/public/web/window_features.mojom   |  2 ++
+ 6 files changed, 26 insertions(+), 6 deletions(-)
+
+diff --git a/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc b/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
+index 228b62a..c1a74a8 100644
+--- a/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
++++ b/src/3rdparty/chromium/content/browser/web_contents/web_contents_impl.cc
+@@ -2094,6 +2094,10 @@ void WebContentsImpl::CreateNewWindow(
+       rfh->Init();
+     return;
+   }
++  
++  std::vector<base::string16> additional_features;
++  for (auto webStr : params.features.additionalFeatures)
++    additional_features.push_back(webStr);
+ 
+   // Create the new web contents. This will automatically create the new
+   // WebContentsView. In the future, we may want to create the view separately.
+@@ -2138,7 +2142,7 @@ void WebContentsImpl::CreateNewWindow(
+ 
+       // set the additional features required by the LuneOS app
+       // (ideally this information should be propagated using the IPC messaging)
+-      new_view->setWindowAdditionalFeatures(params.additional_features);
++      new_view->setWindowAdditionalFeatures(additional_features);
+       new_view->setInitialTargetURL(params.target_url);
+ 
+       // TODO(brettw): It seems bogus that we have to call this function on the
+@@ -2168,7 +2172,7 @@ void WebContentsImpl::CreateNewWindow(
+       gfx::Rect initial_rect;
+       delegate_->AddNewContents(
+           this, new_contents, params.disposition, initial_rect,
+-          params.user_gesture, &was_blocked, params.additional_features);
++          params.user_gesture, &was_blocked, additional_features);
+     }
+     if (!was_blocked) {
+       OpenURLParams open_params(params.target_url, params.referrer,
+diff --git a/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h b/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
+index c4568af..457fd2d 100644
+--- a/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
++++ b/src/3rdparty/chromium/content/public/common/common_param_traits_macros.h
+@@ -267,6 +267,7 @@ IPC_STRUCT_TRAITS_BEGIN(blink::WebWindowFeatures)
+   IPC_STRUCT_TRAITS_MEMBER(resizable)
+   IPC_STRUCT_TRAITS_MEMBER(fullscreen)
+   IPC_STRUCT_TRAITS_MEMBER(dialog)
++  IPC_STRUCT_TRAITS_MEMBER(additionalFeatures)
+ IPC_STRUCT_TRAITS_END()
+ 
+ IPC_ENUM_TRAITS_MAX_VALUE(ui::AXEvent, ui::AX_EVENT_LAST)
+diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/WebWindowFeatures.h b/src/3rdparty/chromium/third_party/WebKit/public/web/WebWindowFeatures.h
+index a1f6743..7c11a7d 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/public/web/WebWindowFeatures.h
++++ b/src/3rdparty/chromium/third_party/WebKit/public/web/WebWindowFeatures.h
+@@ -60,7 +60,7 @@ struct WebWindowFeatures {
+ 
+   bool fullscreen;
+   bool dialog;
+-  WebVector<WebString> additionalFeatures;
++  std::vector<base::string16> additionalFeatures;
+ 
+   WebWindowFeatures()
+       : x(0),
+@@ -97,8 +97,15 @@ struct WebWindowFeatures {
+         scrollbarsVisible(f.scrollbarsVisible),
+         resizable(f.resizable),
+         fullscreen(f.fullscreen),
+-        dialog(f.dialog),
+-        additionalFeatures(f.additionalFeatures) {}
++        dialog(f.dialog) 
++    {
++        for(auto str: f.additionalFeatures) {
++            str.ensure16Bit();
++            base::string16 destStr((const base::char16*)str.characters16(), str.length());
++            
++            additionalFeatures.push_back(destStr);
++        }
++    }
+ 
+   operator WindowFeatures() const {
+     WindowFeatures result;
+@@ -119,7 +126,7 @@ struct WebWindowFeatures {
+     result.fullscreen = fullscreen;
+     result.dialog = dialog;
+     for (size_t i = 0; i < additionalFeatures.size(); ++i)
+-      result.additionalFeatures.append(additionalFeatures[i]);
++      result.additionalFeatures.append(WTF::String(additionalFeatures[i].data(), additionalFeatures[i].length()));
+     return result;
+   }
+ #endif
+diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.cpp b/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.cpp
+index 69dce5b..d4b83fc 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.cpp
++++ b/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.cpp
+@@ -27,6 +27,8 @@ bool StructTraits<::blink::mojom::WindowFeaturesDataView,
+   out->resizable = data.resizable();
+   out->fullscreen = data.fullscreen();
+   out->dialog = data.dialog();
++  
++  data.ReadAdditionalfeatures(&out->additionalFeatures);
+   return true;
+ }
+ 
+diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.h b/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.h
+index ca776ed..405fb498 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.h
++++ b/src/3rdparty/chromium/third_party/WebKit/public/web/WindowFeaturesStructTraits.h
+@@ -65,6 +65,10 @@ struct StructTraits<::blink::mojom::WindowFeaturesDataView,
+     return features.dialog;
+   }
+ 
++  static std::vector<base::string16> additionalFeatures(const ::blink::WebWindowFeatures& features) {
++    return features.additionalFeatures;
++  }
++
+   static bool Read(::blink::mojom::WindowFeaturesDataView,
+                    ::blink::WebWindowFeatures* out);
+ };
+diff --git a/src/3rdparty/chromium/third_party/WebKit/public/web/window_features.mojom b/src/3rdparty/chromium/third_party/WebKit/public/web/window_features.mojom
+index a26b8a3..cb21f15 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/public/web/window_features.mojom
++++ b/src/3rdparty/chromium/third_party/WebKit/public/web/window_features.mojom
+@@ -30,4 +30,6 @@ struct WindowFeatures {
+     // NOTE: WebWindowFeatures::additionalFeatures is not mirrored by this
+     // mojom struct as it's never used by the browser and therefore doesn't need
+     // to be sent.
++	// ... but webOS/LuneOS apps need that to send additional info to the OS
++    array<string> additionalFeatures;
+ };
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0010-WebEngineNewViewRequest-add-possibility-to-get-reque.patch b/aports/main/qt5-qtwebengine/patches-luna/0010-WebEngineNewViewRequest-add-possibility-to-get-reque.patch
new file mode 100644
index 0000000000000000000000000000000000000000..9331ed1436056aa85331e210fc860494f8e885a5
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0010-WebEngineNewViewRequest-add-possibility-to-get-reque.patch
@@ -0,0 +1,81 @@
+From 84363df1cb1891d532c010fa5ac3d3ec56045428 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Wed, 28 Oct 2015 20:17:02 +0100
+Subject: [PATCH 10/18] WebEngineNewViewRequest: add possibility to get
+ requested window geometry
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/webengine/api/qquickwebenginenewviewrequest.cpp | 5 +++++
+ src/webengine/api/qquickwebenginenewviewrequest_p.h | 3 +++
+ src/webengine/api/qquickwebengineview.cpp           | 3 ++-
+ 3 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp
+index 2272aa1..394064d 100644
+--- a/src/webengine/api/qquickwebenginenewviewrequest.cpp
++++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp
+@@ -105,6 +105,11 @@ QUrl QQuickWebEngineNewViewRequest::url() const
+     return QUrl();
+ }
+ 
++QRect QQuickWebEngineNewViewRequest::requestedGeometry() const
++{
++    return m_requestedGeometry;
++}
++
+ /*!
+     \qmlmethod WebEngineNewViewRequest::openIn(WebEngineView view)
+ 
+diff --git a/src/webengine/api/qquickwebenginenewviewrequest_p.h b/src/webengine/api/qquickwebenginenewviewrequest_p.h
+index 591e983..68f9255 100644
+--- a/src/webengine/api/qquickwebenginenewviewrequest_p.h
++++ b/src/webengine/api/qquickwebenginenewviewrequest_p.h
+@@ -69,6 +69,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineNewViewRequest : public QObject
+     Q_PROPERTY(bool userInitiated READ isUserInitiated CONSTANT FINAL)
+     Q_PROPERTY(QStringList additionalFeatures READ additionalFeatures CONSTANT FINAL)
+     Q_PROPERTY(QUrl url READ url)
++    Q_PROPERTY(QRect requestedGeometry READ requestedGeometry CONSTANT FINAL)
+ public:
+     ~QQuickWebEngineNewViewRequest();
+ 
+@@ -78,6 +79,7 @@ public:
+     const QStringList &additionalFeatures() const;
+     Q_INVOKABLE void openIn(QQuickWebEngineView *view);
+     QUrl url() const;
++    QRect requestedGeometry() const;
+ 
+ private:
+     QQuickWebEngineNewViewRequest();
+@@ -86,6 +88,7 @@ private:
+     QSharedPointer<QtWebEngineCore::WebContentsAdapter> m_adapter;
+     QUrl m_requestedUrl;
+     friend class QQuickWebEngineView;
++    QRect m_requestedGeometry;
+     QStringList m_additionalFeatures;
+     friend class QQuickWebEngineViewPrivate;
+ };
+diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
+index c8e9e51..2805240 100644
+--- a/src/webengine/api/qquickwebengineview.cpp
++++ b/src/webengine/api/qquickwebengineview.cpp
+@@ -588,7 +588,7 @@ void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event)
+         q->window()->sendEvent(q->parentItem(), event);
+ }
+ 
+-void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl, const QStringList &additionalFeaturesStringList)
++void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &requestedGeometry, const QStringList &additionalFeaturesStringList)
+ {
+     Q_Q(QQuickWebEngineView);
+     QQuickWebEngineNewViewRequest request;
+@@ -598,6 +598,7 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapte
+     request.m_isUserInitiated = userGesture;
+     request.m_requestedUrl = targetUrl;
+     request.m_additionalFeatures = additionalFeaturesStringList;
++    request.m_requestedGeometry = requestedGeometry;
+ 
+     switch (disposition) {
+     case WebContentsAdapterClient::NewForegroundTabDisposition:
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0011-Fix-WebGL2-Textures.patch b/aports/main/qt5-qtwebengine/patches-luna/0011-Fix-WebGL2-Textures.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4466edf05e0afdd4a39ee61c72c477de7f926bb6
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0011-Fix-WebGL2-Textures.patch
@@ -0,0 +1,23 @@
+diff --git a/src/3rdparty/chromium/gpu/command_buffer/service/texture_manager.cc b/src/3rdparty/chromium/gpu/command_buffer/service/texture_manager.cc
+index dd7d59c..dcdd8ba 100644
+--- a/src/3rdparty/chromium/gpu/command_buffer/service/texture_manager.cc
++++ b/src/3rdparty/chromium/gpu/command_buffer/service/texture_manager.cc
+@@ -1910,11 +1910,13 @@ bool TextureManager::Initialize() {
+   default_textures_[kCubeMap] = CreateDefaultAndBlackTextures(
+       GL_TEXTURE_CUBE_MAP, &black_texture_ids_[kCubeMap]);
+ 
+-  if (feature_info_->IsWebGL2OrES3Context()) {
+-    default_textures_[kTexture3D] = CreateDefaultAndBlackTextures(
+-        GL_TEXTURE_3D, &black_texture_ids_[kTexture3D]);
+-    default_textures_[kTexture2DArray] = CreateDefaultAndBlackTextures(
+-        GL_TEXTURE_2D_ARRAY, &black_texture_ids_[kTexture2DArray]);
++  if (feature_info_->gl_version_info().is_es3_capable) {
++      if (feature_info_->IsWebGL2OrES3Context()) {
++        default_textures_[kTexture3D] = CreateDefaultAndBlackTextures(
++            GL_TEXTURE_3D, &black_texture_ids_[kTexture3D]);
++        default_textures_[kTexture2DArray] = CreateDefaultAndBlackTextures(
++            GL_TEXTURE_2D_ARRAY, &black_texture_ids_[kTexture2DArray]);
++      }
+   }
+ 
+   if (feature_info_->feature_flags().oes_egl_image_external ||
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0011-GetScreenInfo-use-default-screen-when-no-window-is-a.patch b/aports/main/qt5-qtwebengine/patches-luna/0011-GetScreenInfo-use-default-screen-when-no-window-is-a.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ab2a919e146837f04770a1d908f32d1a7bc5c2b0
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0011-GetScreenInfo-use-default-screen-when-no-window-is-a.patch
@@ -0,0 +1,34 @@
+From d96b765b61661e88ece6229baa09cde04fe9ba61 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sat, 31 Oct 2015 16:04:01 +0100
+Subject: [PATCH 11/18] GetScreenInfo: use default screen when no window is
+ available
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/core/render_widget_host_view_qt.cpp | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
+index 958ff91..5105214 100644
+--- a/src/core/render_widget_host_view_qt.cpp
++++ b/src/core/render_widget_host_view_qt.cpp
+@@ -711,9 +711,12 @@ void RenderWidgetHostViewQt::OnSwapCompositorFrame(uint32_t output_surface_id, c
+ void RenderWidgetHostViewQt::GetScreenInfo(content::ScreenInfo* results)
+ {
+     QWindow* window = m_delegate->window();
+-    if (!window)
+-        return;
+-    GetScreenInfoFromNativeWindow(window, results);
++    if( window ) {
++        GetScreenInfoFromNativeWindow(window, results);
++    }
++    else {
++        GetDefaultScreenInfo(results);
++    }
+ 
+     // Support experimental.viewport.devicePixelRatio
+     results->device_scale_factor *= dpiScale();
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0012-Enable-password-echo.patch b/aports/main/qt5-qtwebengine/patches-luna/0012-Enable-password-echo.patch
new file mode 100644
index 0000000000000000000000000000000000000000..7fb6fc66b12a99bf3b2a051c8c556b1a96aad67b
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0012-Enable-password-echo.patch
@@ -0,0 +1,25 @@
+From 4b95efa1aaf55f3123000addb52963630a35194e Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Mon, 15 Aug 2016 09:26:04 +0000
+Subject: [PATCH 12/18] Enable password echo
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/core/web_engine_settings.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
+index 7d7af2d..a163fb5 100644
+--- a/src/core/web_engine_settings.cpp
++++ b/src/core/web_engine_settings.cpp
+@@ -341,6 +341,7 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p
+     // Override for now
+     prefs->touch_enabled = isTouchEventsAPIEnabled();
+     prefs->device_supports_touch = isTouchScreenAvailable();
++    prefs->password_echo_enabled = true;
+     if (prefs->viewport_enabled) {
+         // We should enable viewport and viewport-meta together, but since 5.7 we
+         // no longer have a command-line flag for viewport-meta.
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0013-Implement-RequestQuotePermission.patch b/aports/main/qt5-qtwebengine/patches-luna/0013-Implement-RequestQuotePermission.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f46bbc0768e16deddc763de99d12dbae4c32f52c
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0013-Implement-RequestQuotePermission.patch
@@ -0,0 +1,35 @@
+From 1c2d6d5507e49812a3e26763c651bca8c8df989e Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Thu, 29 Sep 2016 18:40:37 +0000
+Subject: [PATCH 13/18] Implement RequestQuotePermission
+
+Allows 64MB for local URL, and 5MB otherwise.
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/core/content_browser_client_qt.cpp | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
+index d446d8f..2e8a87f 100644
+--- a/src/core/content_browser_client_qt.cpp
++++ b/src/core/content_browser_client_qt.cpp
+@@ -377,9 +377,13 @@ class QuotaPermissionContextQt : public content::QuotaPermissionContext {
+ public:
+     void RequestQuotaPermission(const content::StorageQuotaParams &params, int render_process_id, const PermissionCallback &callback) override
+     {
+-        Q_UNUSED(params);
+         Q_UNUSED(render_process_id);
+-        callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
++        if((params.origin_url.SchemeIsFile() && params.requested_size < 64*1024*1024) ||  // local URL: 64MB
++            params.requested_size < 5*1024*1024) {                                        // remote URL: 5MB
++            callback.Run(QUOTA_PERMISSION_RESPONSE_ALLOW);
++        } else {
++            callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
++        }
+     }
+ };
+ 
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0014-WebEngineView-re-introduce-devicePixelRatio-property.patch b/aports/main/qt5-qtwebengine/patches-luna/0014-WebEngineView-re-introduce-devicePixelRatio-property.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5b4e517a6d00eca15a2f98ddf67e3f47f62ddee3
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0014-WebEngineView-re-introduce-devicePixelRatio-property.patch
@@ -0,0 +1,74 @@
+From 023512168cf0a9ddf6443a847c13b6b467f648bf Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sat, 22 Jul 2017 09:09:31 +0000
+Subject: [PATCH 14/18] WebEngineView: re-introduce devicePixelRatio property
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/webengine/api/qquickwebengineview.cpp | 20 ++++++++++++++++++++
+ src/webengine/api/qquickwebengineview_p.h |  4 ++++
+ 2 files changed, 24 insertions(+)
+
+diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
+index 2805240..f1e1b6e 100644
+--- a/src/webengine/api/qquickwebengineview.cpp
++++ b/src/webengine/api/qquickwebengineview.cpp
+@@ -1059,6 +1059,26 @@ void QQuickWebEngineViewPrivate::setProfile(QQuickWebEngineProfile *profile)
+     }
+ }
+ 
++qreal QQuickWebEngineView::devicePixelRatio() const
++{
++    Q_D(const QQuickWebEngineView);
++    return d->devicePixelRatio;
++}
++
++void QQuickWebEngineView::setDevicePixelRatio(qreal devicePixelRatio)
++{
++    Q_D(QQuickWebEngineView);
++    // Valid range is [1, inf)
++    devicePixelRatio = qMax(qreal(1.0), devicePixelRatio);
++    if (d->devicePixelRatio == devicePixelRatio)
++        return;
++    d->setDevicePixelRatio(devicePixelRatio);
++    if (!d->adapter)
++        return;
++    d->adapter->dpiScaleChanged();
++    Q_EMIT devicePixelRatioChanged();
++}
++
+ #ifdef ENABLE_QML_TESTSUPPORT_API
+ QQuickWebEngineTestSupport *QQuickWebEngineView::testSupport() const
+ {
+diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
+index 8112c76..2d6f101 100644
+--- a/src/webengine/api/qquickwebengineview_p.h
++++ b/src/webengine/api/qquickwebengineview_p.h
+@@ -121,6 +121,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
+     Q_PROPERTY(bool audioMuted READ isAudioMuted WRITE setAudioMuted NOTIFY audioMutedChanged FINAL REVISION 3)
+     Q_PROPERTY(bool recentlyAudible READ recentlyAudible NOTIFY recentlyAudibleChanged FINAL REVISION 3)
+     Q_PROPERTY(uint webChannelWorld READ webChannelWorld WRITE setWebChannelWorld NOTIFY webChannelWorldChanged REVISION 3 FINAL)
++    Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged REVISION 4)
+ 
+ #ifdef ENABLE_QML_TESTSUPPORT_API
+     Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport NOTIFY testSupportChanged FINAL)
+@@ -448,6 +449,8 @@ public:
+     bool isAudioMuted() const;
+     void setAudioMuted(bool muted);
+     bool recentlyAudible() const;
++    qreal devicePixelRatio() const;
++    void setDevicePixelRatio(qreal);
+ 
+ #ifdef ENABLE_QML_TESTSUPPORT_API
+     QQuickWebEngineTestSupport *testSupport() const;
+@@ -510,6 +513,7 @@ Q_SIGNALS:
+     Q_REVISION(4) void colorDialogRequested(QQuickWebEngineColorDialogRequest *request);
+     Q_REVISION(4) void fileDialogRequested(QQuickWebEngineFileDialogRequest *request);
+     Q_REVISION(4) void formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest *request);
++    Q_REVISION(4) void devicePixelRatioChanged();
+     Q_REVISION(5) void pdfPrintingFinished(const QString &filePath, bool success);
+ 
+ #ifdef ENABLE_QML_TESTSUPPORT_API
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0015-WebEngineView-add-extraContextMenuEntriesComponent-p.patch b/aports/main/qt5-qtwebengine/patches-luna/0015-WebEngineView-add-extraContextMenuEntriesComponent-p.patch
new file mode 100644
index 0000000000000000000000000000000000000000..888076a99266ed4eedf3c29ab6af3099435484a4
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0015-WebEngineView-add-extraContextMenuEntriesComponent-p.patch
@@ -0,0 +1,72 @@
+From 53ae66357e6e3ae0e6247cbe193cb32abbca9ae1 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Sat, 22 Jul 2017 09:41:45 +0000
+Subject: [PATCH 15/18] WebEngineView: add extraContextMenuEntriesComponent
+ property
+
+Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
+---
+ src/webengine/api/qquickwebengineview.cpp | 16 ++++++++++++++++
+ src/webengine/api/qquickwebengineview_p.h |  5 +++++
+ 2 files changed, 21 insertions(+)
+
+diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
+index f1e1b6e..8fdf30a 100644
+--- a/src/webengine/api/qquickwebengineview.cpp
++++ b/src/webengine/api/qquickwebengineview.cpp
+@@ -1079,6 +1079,22 @@ void QQuickWebEngineView::setDevicePixelRatio(qreal devicePixelRatio)
+     Q_EMIT devicePixelRatioChanged();
+ }
+ 
++void QQuickWebEngineView::setExtraContextMenuEntriesComponent(QQmlComponent *contextMenuExtras)
++{
++    Q_D(QQuickWebEngineView);
++    if (d->contextMenuExtraItems == contextMenuExtras)
++        return;
++    d->contextMenuExtraItems = contextMenuExtras;
++    Q_EMIT extraContextMenuEntriesComponentChanged();
++}
++
++QQmlComponent *QQuickWebEngineView::extraContextMenuEntriesComponent() const
++{
++    Q_D(const QQuickWebEngineView);
++    return d->contextMenuExtraItems;
++}
++
++
+ #ifdef ENABLE_QML_TESTSUPPORT_API
+ QQuickWebEngineTestSupport *QQuickWebEngineView::testSupport() const
+ {
+diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
+index 2d6f101..d068eb9 100644
+--- a/src/webengine/api/qquickwebengineview_p.h
++++ b/src/webengine/api/qquickwebengineview_p.h
+@@ -122,6 +122,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
+     Q_PROPERTY(bool recentlyAudible READ recentlyAudible NOTIFY recentlyAudibleChanged FINAL REVISION 3)
+     Q_PROPERTY(uint webChannelWorld READ webChannelWorld WRITE setWebChannelWorld NOTIFY webChannelWorldChanged REVISION 3 FINAL)
+     Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged REVISION 4)
++    Q_PROPERTY(QQmlComponent *extraContextMenuEntriesComponent READ extraContextMenuEntriesComponent WRITE setExtraContextMenuEntriesComponent NOTIFY extraContextMenuEntriesComponentChanged REVISION 4)
+ 
+ #ifdef ENABLE_QML_TESTSUPPORT_API
+     Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport NOTIFY testSupportChanged FINAL)
+@@ -452,6 +453,9 @@ public:
+     qreal devicePixelRatio() const;
+     void setDevicePixelRatio(qreal);
+ 
++    QQmlComponent *extraContextMenuEntriesComponent() const;
++    void setExtraContextMenuEntriesComponent(QQmlComponent *);
++
+ #ifdef ENABLE_QML_TESTSUPPORT_API
+     QQuickWebEngineTestSupport *testSupport() const;
+     void setTestSupport(QQuickWebEngineTestSupport *testSupport);
+@@ -514,6 +518,7 @@ Q_SIGNALS:
+     Q_REVISION(4) void fileDialogRequested(QQuickWebEngineFileDialogRequest *request);
+     Q_REVISION(4) void formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest *request);
+     Q_REVISION(4) void devicePixelRatioChanged();
++    Q_REVISION(4) void extraContextMenuEntriesComponentChanged();
+     Q_REVISION(5) void pdfPrintingFinished(const QString &filePath, bool success);
+ 
+ #ifdef ENABLE_QML_TESTSUPPORT_API
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0016-Fix-build-for-Qt5.9.patch b/aports/main/qt5-qtwebengine/patches-luna/0016-Fix-build-for-Qt5.9.patch
new file mode 100644
index 0000000000000000000000000000000000000000..07cfca00fa1a1494ccaa83cf764d397c4a217c05
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0016-Fix-build-for-Qt5.9.patch
@@ -0,0 +1,47 @@
+From fb88489ccd170c86fbcffd22d8ea4644cbdc40ed Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Thu, 31 Aug 2017 17:26:47 +0000
+Subject: [PATCH 16/18] Fix build for Qt5.9
+
+---
+ src/core/render_widget_host_view_qt.cpp   | 3 ++-
+ src/webengine/api/qquickwebengineview.cpp | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
+index 5105214..fea7313 100644
+--- a/src/core/render_widget_host_view_qt.cpp
++++ b/src/core/render_widget_host_view_qt.cpp
+@@ -43,6 +43,7 @@
+ #include "browser_accessibility_manager_qt.h"
+ #include "browser_accessibility_qt.h"
+ #include "chromium_overrides.h"
++#include "web_contents_view_qt.h"
+ #include "delegated_frame_node.h"
+ #include "qtwebenginecoreglobal_p.h"
+ #include "render_widget_host_view_qt_delegate.h"
+@@ -715,7 +716,7 @@ void RenderWidgetHostViewQt::GetScreenInfo(content::ScreenInfo* results)
+         GetScreenInfoFromNativeWindow(window, results);
+     }
+     else {
+-        GetDefaultScreenInfo(results);
++        content::WebContentsView::GetDefaultScreenInfo(results);
+     }
+ 
+     // Support experimental.viewport.devicePixelRatio
+diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
+index 8fdf30a..bf64956 100644
+--- a/src/webengine/api/qquickwebengineview.cpp
++++ b/src/webengine/api/qquickwebengineview.cpp
+@@ -588,7 +588,7 @@ void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event)
+         q->window()->sendEvent(q->parentItem(), event);
+ }
+ 
+-void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &requestedGeometry, const QStringList &additionalFeaturesStringList)
++void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &requestedGeometry, const QUrl &targetUrl, const QStringList &additionalFeaturesStringList)
+ {
+     Q_Q(QQuickWebEngineView);
+     QQuickWebEngineNewViewRequest request;
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0017-gn_generator-fix-debug-build.patch b/aports/main/qt5-qtwebengine/patches-luna/0017-gn_generator-fix-debug-build.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c62ed24af40a04868a30fa11f3e11cbe51b0f154
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0017-gn_generator-fix-debug-build.patch
@@ -0,0 +1,30 @@
+From 8696f304f1ef598301029baffdf4e8abdcb90fe3 Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Wed, 30 Aug 2017 17:23:26 +0000
+Subject: [PATCH 18/18] gn_generator: fix debug build
+
+Remove a duplicate CFLALGS value that contains spaces and
+which will cause issues when interpreted by gn.
+---
+ mkspecs/features/gn_generator.prf | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/mkspecs/features/gn_generator.prf b/mkspecs/features/gn_generator.prf
+index b2b7491..24561b8 100644
+--- a/mkspecs/features/gn_generator.prf
++++ b/mkspecs/features/gn_generator.prf
+@@ -19,6 +19,11 @@ defineReplace(filter_flag_values) {
+         # the architecture itself.
+         return("")
+     }
++    contains(value_to_check, ".*-g -feliminate-unused-debug-types.*") {
++        # in debug mode, eliminate this spurious value, which contains spaces and will not be interpreted
++        # correctly by gn.
++        return("")
++    }
+     return($$value_to_check)
+ }
+ 
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-luna/0018-Add-LuneOS-specific-switches.patch b/aports/main/qt5-qtwebengine/patches-luna/0018-Add-LuneOS-specific-switches.patch
new file mode 100644
index 0000000000000000000000000000000000000000..267cacfabfc2eb272c7b2abc275a558864947b19
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-luna/0018-Add-LuneOS-specific-switches.patch
@@ -0,0 +1,38 @@
+From 6943ba674949088b3db6830e58f748d1780885bf Mon Sep 17 00:00:00 2001
+From: Christophe Chapuis <chris.chapuis@gmail.com>
+Date: Thu, 7 Sep 2017 17:32:59 +0000
+Subject: [PATCH] Add LuneOS specific switches
+
+* Disable some sandbox capabilities, which are incompatible with our (old) kernels
+* Disable OpenGL ES 3, as Qt's shared context uses OpenGL ES 2
+* Enable flash/widevine plugins
+---
+ src/core/web_engine_context.cpp | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
+index 9d993b7..7f0382f 100644
+--- a/src/core/web_engine_context.cpp
++++ b/src/core/web_engine_context.cpp
+@@ -324,6 +324,18 @@ WebEngineContext::WebEngineContext()
+     // Enabled on OS X and Linux but currently not working. It worked in 5.7 on OS X.
+     parsedCommandLine->AppendSwitch(switches::kDisableGpuMemoryBufferVideoFrames);
+ 
++    //// LuneOS specific
++    // Disable some sandbox capabilities, which are incompatible with our (old) kernels
++    parsedCommandLine->AppendSwitch(switches::kDisableNamespaceSandbox);
++    parsedCommandLine->AppendSwitch(switches::kDisableSeccompFilterSandbox);
++    // Disable OpenGL ES 3, as Qt's shared context uses OpenGL ES 2
++    parsedCommandLine->AppendSwitch(switches::kDisableES3GLContext);
++    // Add switches to enable flash/widevine plugins
++    parsedCommandLine->AppendSwitchASCII("ppapi-flash-path", "/usr/lib/chromium/libpepflashplayer.so");
++    parsedCommandLine->AppendSwitchASCII("ppapi-flash-version", "26.0.0.151");
++    parsedCommandLine->AppendSwitchASCII(switches::kRegisterPepperPlugins, "/usr/lib/chromium/libwidevinecdmadapter.so;application/x-ppapi-widevine-cdm");
++    //// End of LuneOS specific
++
+ #if defined(Q_OS_MACOS)
+     // Accelerated decoding currently does not work on macOS due to issues with OpenGL Rectangle
+     // texture support. See QTBUG-60002.
+-- 
+2.7.4
+
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0001-chromium-Change-false-to-FALSE-and-1-to-TRUE-FIX-qtw.patch b/aports/main/qt5-qtwebengine/patches-musl/0001-chromium-Change-false-to-FALSE-and-1-to-TRUE-FIX-qtw.patch
new file mode 100644
index 0000000000000000000000000000000000000000..914c1ea5d4c26a7c0c83397ad94b197a3da66983
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0001-chromium-Change-false-to-FALSE-and-1-to-TRUE-FIX-qtw.patch
@@ -0,0 +1,63 @@
+From d559da6ab0834aeb7307008015b6232e586fea00 Mon Sep 17 00:00:00 2001
+From: Cleiton Bueno <cleitonrbueno@gmail.com>
+Date: Thu, 24 Dec 2015 12:46:58 -0200
+Subject: [PATCH] chromium: Change false to FALSE and 1 to TRUE, FIX
+ qtwebengine compile
+
+Signed-off-by: Cleiton Bueno <cleitonrbueno@gmail.com>
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ chromium/ui/gfx/codec/jpeg_codec.cc | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc b/src/3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc
+index 6d926378be..738d3fdedf 100644
+--- a/src/3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc
++++ b/src/3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc
+@@ -121,7 +121,7 @@ boolean EmptyOutputBuffer(jpeg_compress_struct* cinfo) {
+   // tell libjpeg where to write the next data
+   cinfo->dest->next_output_byte = &(*state->out)[state->image_buffer_used];
+   cinfo->dest->free_in_buffer = state->out->size() - state->image_buffer_used;
+-  return 1;
++  return TRUE;
+ }
+ 
+ // Cleans up the JpegEncoderState to prepare for returning in the final form.
+@@ -262,7 +262,7 @@ bool JPEGCodec::Encode(const unsigned char* input, ColorFormat format,
+   cinfo.data_precision = 8;
+ 
+   jpeg_set_defaults(&cinfo);
+-  jpeg_set_quality(&cinfo, quality, 1);  // quality here is 0-100
++  jpeg_set_quality(&cinfo, quality, TRUE);  // quality here is 0-100
+ 
+   // set up the destination manager
+   jpeg_destination_mgr destmgr;
+@@ -274,7 +274,7 @@ bool JPEGCodec::Encode(const unsigned char* input, ColorFormat format,
+   JpegEncoderState state(output);
+   cinfo.client_data = &state;
+ 
+-  jpeg_start_compress(&cinfo, 1);
++  jpeg_start_compress(&cinfo, TRUE);
+ 
+   // feed it the rows, doing necessary conversions for the color format
+ #ifdef JCS_EXTENSIONS
+@@ -360,7 +360,7 @@ void InitSource(j_decompress_ptr cinfo) {
+ //   set to a positive value if TRUE is returned. A FALSE return should only
+ //   be used when I/O suspension is desired."
+ boolean FillInputBuffer(j_decompress_ptr cinfo) {
+-  return false;
++  return FALSE;
+ }
+ 
+ // Skip data in the buffer. Since we have all the data at once, this operation
+@@ -488,8 +488,8 @@ bool JPEGCodec::Decode(const unsigned char* input, size_t input_size,
+   cinfo.client_data = &state;
+ 
+   // fill the file metadata into our buffer
+-  if (jpeg_read_header(&cinfo, true) != JPEG_HEADER_OK)
+-    return false;
++  if (jpeg_read_header(&cinfo, TRUE) != JPEG_HEADER_OK)
++    return FALSE;
+ 
+   // we want to always get RGB data out
+   switch (cinfo.jpeg_color_space) {
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0001-functions.prf-allow-build-for-linux-oe-g-platform.patch b/aports/main/qt5-qtwebengine/patches-musl/0001-functions.prf-allow-build-for-linux-oe-g-platform.patch
new file mode 100644
index 0000000000000000000000000000000000000000..275ef9e88cd8e39277e5fffe64218ba346476473
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0001-functions.prf-allow-build-for-linux-oe-g-platform.patch
@@ -0,0 +1,30 @@
+From 96746f09947cc36f6c9fc8631bc6a6e7f59efe24 Mon Sep 17 00:00:00 2001
+From: Frieder Schrempf <frieder.schrempf@online.de>
+Date: Mon, 1 Dec 2014 14:34:40 +0000
+Subject: [PATCH] functions.prf: allow build for linux-oe-g++ platform
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Frieder Schrempf <frieder.schrempf@online.de>
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ mkspecs/features/functions.prf | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
+index 56894e58..ef418a4c 100644
+--- a/mkspecs/features/functions.prf
++++ b/mkspecs/features/functions.prf
+@@ -21,6 +21,12 @@ defineTest(isPlatformSupported) {
+       return(false)
+     }
+     gcc:!clang:!isGCCVersionSupported(): return(false)
++  } else:linux-oe-g++* {
++    !gcc:!clang {
++      skipBuild("Qt WebEngine on Linux requires clang or GCC.")
++      return(false)
++    }
++    gcc:!clang:!isGCCVersionSupported(): return(false)
+   } else:win32 {
+     winrt {
+       skipBuild("WinRT is not supported.")
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0002-WebEngine-qquickwebengineview_p_p.h-add-include-QCol.patch b/aports/main/qt5-qtwebengine/patches-musl/0002-WebEngine-qquickwebengineview_p_p.h-add-include-QCol.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6ada3f94aaffb7ab33c9b5965acc43824d5b9858
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0002-WebEngine-qquickwebengineview_p_p.h-add-include-QCol.patch
@@ -0,0 +1,23 @@
+From 06e9e7844ffa2b6985e5fa7a1c475c8a54ca252a Mon Sep 17 00:00:00 2001
+From: Cleiton Bueno <cleitonrbueno@gmail.com>
+Date: Fri, 25 Dec 2015 18:16:05 -0200
+Subject: [PATCH] WebEngine qquickwebengineview_p_p.h add include QColor
+
+Signed-off-by: Cleiton Bueno <cleitonrbueno@gmail.com>
+---
+ src/webengine/api/qquickwebengineview_p_p.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
+index 19ecf5e1..f6f638ee 100644
+--- a/src/webengine/api/qquickwebengineview_p_p.h
++++ b/src/webengine/api/qquickwebengineview_p_p.h
+@@ -59,6 +59,8 @@
+ #include <QString>
+ #include <QtCore/qcompilerdetection.h>
+ #include <QtGui/qaccessibleobject.h>
++#include <QColor>
++
+ 
+ namespace QtWebEngineCore {
+ class WebContentsAdapter;
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0002-chromium-Force-host-toolchain-configuration.patch b/aports/main/qt5-qtwebengine/patches-musl/0002-chromium-Force-host-toolchain-configuration.patch
new file mode 100644
index 0000000000000000000000000000000000000000..124ee463e73bc1522fd2a7796dec18960e569cdf
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0002-chromium-Force-host-toolchain-configuration.patch
@@ -0,0 +1,40 @@
+From a0b1a742813d0846472fab4aada2388bf2d42d80 Mon Sep 17 00:00:00 2001
+From: Samuli Piippo <samuli.piippo@qt.io>
+Date: Wed, 15 Mar 2017 13:53:28 +0200
+Subject: [PATCH] chromium: Force host toolchain configuration
+
+Force gcc/g++ to be used for parts using host toolchain, since
+the option(host_build) does not work in yocto builds.
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Samuli Piippo <samuli.piippo@qt.io>
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ chromium/tools/gn/bootstrap/bootstrap.py | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py b/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py
+index 43d252b43e..e58347848e 100755
+--- a/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py
++++ b/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py
+@@ -298,14 +298,14 @@ def write_gn_ninja(path, root_gen_dir, options):
+     ld = os.environ.get('LD', 'link.exe')
+     ar = os.environ.get('AR', 'lib.exe')
+   else:
+-    cc = os.environ.get('CC', 'cc')
+-    cxx = os.environ.get('CXX', 'c++')
++    cc = os.environ.get('CC_host', 'gcc')
++    cxx = os.environ.get('CXX_host', 'g++')
+     ld = cxx
+-    ar = os.environ.get('AR', 'ar')
++    ar = os.environ.get('AR_host', 'ar')
+ 
+-  cflags = os.environ.get('CFLAGS', '').split()
+-  cflags_cc = os.environ.get('CXXFLAGS', '').split()
+-  ldflags = os.environ.get('LDFLAGS', '').split()
++  cflags = os.environ.get('CFLAGS_host', '').split()
++  cflags_cc = os.environ.get('CXXFLAGS_host', '').split()
++  ldflags = os.environ.get('LDFLAGS_host', '').split()
+   include_dirs = [root_gen_dir, SRC_ROOT]
+   libs = []
+ 
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0003-Include-dependency-to-QCoreApplication-translate.patch b/aports/main/qt5-qtwebengine/patches-musl/0003-Include-dependency-to-QCoreApplication-translate.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8c0484bd229a7ca35b43c0b7460de2b34850b0a7
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0003-Include-dependency-to-QCoreApplication-translate.patch
@@ -0,0 +1,23 @@
+From bfd5e19fea1315d10b3217acaf92dfc32018ad03 Mon Sep 17 00:00:00 2001
+From: Cleiton Bueno <cleitonrbueno@gmail.com>
+Date: Thu, 24 Dec 2015 15:59:51 -0200
+Subject: [PATCH] Include dependency to QCoreApplication::translate()
+
+Signed-off-by: Cleiton Bueno <cleitonrbueno@gmail.com>
+---
+ src/core/media_capture_devices_dispatcher.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/core/media_capture_devices_dispatcher.h b/src/core/media_capture_devices_dispatcher.h
+index c378c327..1d33d956 100644
+--- a/src/core/media_capture_devices_dispatcher.h
++++ b/src/core/media_capture_devices_dispatcher.h
+@@ -45,6 +45,8 @@
+ #include <list>
+ #include <map>
+ 
++#include <QCoreApplication>
++
+ #include "web_contents_adapter_client.h"
+ 
+ #include "base/callback.h"
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0003-chromium-workaround-for-too-long-.rps-file-name.patch b/aports/main/qt5-qtwebengine/patches-musl/0003-chromium-workaround-for-too-long-.rps-file-name.patch
new file mode 100644
index 0000000000000000000000000000000000000000..885026e8e1531bd9863e4c79c4bec6281cce8626
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0003-chromium-workaround-for-too-long-.rps-file-name.patch
@@ -0,0 +1,42 @@
+From 5c31bc4a7ae6133fe4cb60fa71465c6706a071c8 Mon Sep 17 00:00:00 2001
+From: Samuli Piippo <samuli.piippo@qt.io>
+Date: Thu, 30 Mar 2017 11:37:24 +0300
+Subject: [PATCH] chromium: workaround for too long .rps file name
+
+Ninja may fail when the build directory is too long:
+
+ninja: error: WriteFile(__third_party_WebKit_Source_bindings_modules_\
+interfaces_info_individual_modules__home_qt_work_build_build-nitrogen\
+6x_tmp_work_cortexa9hf-neon-mx6qdl-poky-linux-gnueabi_qtwebengine_5.9\
+.0_gitAUTOINC_29afdb0a34_049134677a-r0_build_src_toolchain_target__ru\
+le.rsp): Unable to create file. File name too long
+
+Task-number: QTBUG-59769
+Change-Id: I73c5e64ae5174412be2a675e35b0b6047f2bf4c1
+---
+ chromium/tools/gn/ninja_action_target_writer.cc | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/3rdparty/chromium/tools/gn/ninja_action_target_writer.cc b/src/3rdparty/chromium/tools/gn/ninja_action_target_writer.cc
+index a5bc6cd526..5cefbfe77c 100644
+--- a/src/3rdparty/chromium/tools/gn/ninja_action_target_writer.cc
++++ b/src/3rdparty/chromium/tools/gn/ninja_action_target_writer.cc
+@@ -115,9 +115,18 @@ std::string NinjaActionTargetWriter::WriteRuleDefinition() {
+     // strictly necessary for regular one-shot actions, but it's easier to
+     // just always define unique_name.
+     std::string rspfile = custom_rule_name;
++
++    //quick workaround if filename length > 255 - ".rsp", just cut the dirs starting from the end
++    //please note ".$unique_name" is not used at the moment
++    int pos = 0;
++    std::string delimiter("_");
++    while (rspfile.length() > 251 && (pos = rspfile.find_last_of(delimiter)) != std::string::npos)
++        rspfile = rspfile.substr(0,pos);
++
+     if (!target_->sources().empty())
+       rspfile += ".$unique_name";
+     rspfile += ".rsp";
++
+     out_ << "  rspfile = " << rspfile << std::endl;
+ 
+     // Response file contents.
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0004-chromium-musl-sandbox-Define-TEMP_FAILURE_RETRY-if-n.patch b/aports/main/qt5-qtwebengine/patches-musl/0004-chromium-musl-sandbox-Define-TEMP_FAILURE_RETRY-if-n.patch
new file mode 100644
index 0000000000000000000000000000000000000000..2ca703ac630e3b2211c3a87aa8ab5426d25e12ac
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0004-chromium-musl-sandbox-Define-TEMP_FAILURE_RETRY-if-n.patch
@@ -0,0 +1,33 @@
+From 71b3c3d4160c5e98cc0a0797710bdd121a79e8b8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 14:01:12 -0700
+Subject: [PATCH] chromium: musl: sandbox: Define TEMP_FAILURE_RETRY if not
+ defined
+
+Musl does not define this Macro
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/sandbox/linux/suid/sandbox.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/3rdparty/chromium/sandbox/linux/suid/sandbox.c b/src/3rdparty/chromium/sandbox/linux/suid/sandbox.c
+index b655d1c79c..3de34e36f2 100644
+--- a/src/3rdparty/chromium/sandbox/linux/suid/sandbox.c
++++ b/src/3rdparty/chromium/sandbox/linux/suid/sandbox.c
+@@ -44,6 +44,15 @@ static bool DropRoot();
+ 
+ #define HANDLE_EINTR(x) TEMP_FAILURE_RETRY(x)
+ 
++#ifndef TEMP_FAILURE_RETRY
++# define TEMP_FAILURE_RETRY(expression) \
++	(__extension__			\
++	 ({ long int __result;		\
++	  do __result = (long int) (expression); \
++	  while (__result == -1L && errno == EINTR); \
++	  __result; }))
++#endif
++
+ static void FatalError(const char* msg, ...)
+     __attribute__((noreturn, format(printf, 1, 2)));
+ 
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0005-chromium-musl-Avoid-mallinfo-APIs-on-non-glibc-linux.patch b/aports/main/qt5-qtwebengine/patches-musl/0005-chromium-musl-Avoid-mallinfo-APIs-on-non-glibc-linux.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5d5a5132caa1972fabaf8699a767cdf3c7732166
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0005-chromium-musl-Avoid-mallinfo-APIs-on-non-glibc-linux.patch
@@ -0,0 +1,45 @@
+From e695f37fc52defd1b96664b003444692e9b6cb65 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 14:09:06 -0700
+Subject: [PATCH] chromium: musl: Avoid mallinfo() APIs on non-glibc/linux
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/base/trace_event/malloc_dump_provider.cc | 3 ++-
+ chromium/content/child/content_child_helpers.cc   | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
+index 7d0cb57931..10be59ebad 100644
+--- a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
++++ b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc
+@@ -210,6 +210,7 @@ MallocDumpProvider::~MallocDumpProvider() {}
+ // the current process.
+ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+                                       ProcessMemoryDump* pmd) {
++#if defined(__GLIBC__)
+   size_t total_virtual_size = 0;
+   size_t resident_size = 0;
+   size_t allocated_objects_size = 0;
+@@ -321,7 +322,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+     pmd->DumpHeapUsage(metrics_by_context, overhead, "malloc");
+   }
+   tid_dumping_heap_ = kInvalidThreadId;
+-
++#endif // __GLIBC__
+   return true;
+ }
+ 
+diff --git a/src/3rdparty/chromium/content/child/content_child_helpers.cc b/src/3rdparty/chromium/content/child/content_child_helpers.cc
+index 7ddeb4d16a..b8c73b09c5 100644
+--- a/src/3rdparty/chromium/content/child/content_child_helpers.cc
++++ b/src/3rdparty/chromium/content/child/content_child_helpers.cc
+@@ -25,7 +25,7 @@ namespace content {
+ // though, this provides only a partial and misleading value.
+ // Unfortunately some telemetry benchmark rely on it and these need to
+ // be refactored before getting rid of this. See crbug.com/581365 .
+-#if defined(OS_LINUX) || defined(OS_ANDROID)
++#if defined(__GLIBC__) || defined(OS_ANDROID)
+ size_t GetMemoryUsageKB() {
+   struct mallinfo minfo = mallinfo();
+   uint64_t mem_usage =
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0006-chromium-musl-include-fcntl.h-for-loff_t.patch b/aports/main/qt5-qtwebengine/patches-musl/0006-chromium-musl-include-fcntl.h-for-loff_t.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4b5659597b6104ed801aac4f83bb975e67effed4
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0006-chromium-musl-include-fcntl.h-for-loff_t.patch
@@ -0,0 +1,22 @@
+From ee6aec4439a7ee320d7700d7f10cd3948a73f3e3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 14:37:49 -0700
+Subject: [PATCH] chromium: musl: include fcntl.h for loff_t
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h b/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
+index b29ec2d29a..91f77dd88d 100644
+--- a/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
++++ b/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
+@@ -150,6 +150,7 @@ extern "C" {
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <string.h>
++#include <fcntl.h>
+ #include <sys/ptrace.h>
+ #include <sys/resource.h>
+ #include <sys/time.h>
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0007-chromium-musl-use-off64_t-instead-of-the-internal-__.patch b/aports/main/qt5-qtwebengine/patches-musl/0007-chromium-musl-use-off64_t-instead-of-the-internal-__.patch
new file mode 100644
index 0000000000000000000000000000000000000000..51b00c78f9a50b35cfa6676dc6a603e66d7cf176
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0007-chromium-musl-use-off64_t-instead-of-the-internal-__.patch
@@ -0,0 +1,62 @@
+From 90ebe616e563ab1224234281ea7b1a478f42ca92 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 14:38:37 -0700
+Subject: [PATCH] chromium: musl: use off64_t instead of the internal __off64_t
+
+- only do the glibc 32-bit ABI check for mmap/mmap64 on gnu libc. musl
+  does not support the 32-bit ABI.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ .../third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h b/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
+index 715c045f66..edc8cf2db7 100644
+--- a/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
++++ b/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
+@@ -77,7 +77,7 @@ typedef off64_t __off64_t;
+ 
+ static inline void* do_mmap64(void *start, size_t length,
+                               int prot, int flags,
+-                              int fd, __off64_t offset) __THROW {
++                              int fd, off64_t offset) __THROW {
+   // The original gperftools uses sys_mmap() here.  But, it is not allowed by
+   // Chromium's sandbox.
+   return (void *)syscall(SYS_mmap, start, length, prot, flags, fd, offset);
+@@ -90,7 +90,7 @@ static inline void* do_mmap64(void *start, size_t length,
+ 
+ static inline void* do_mmap64(void *start, size_t length,
+                               int prot, int flags,
+-                              int fd, __off64_t offset) __THROW {
++                              int fd, off64_t offset) __THROW {
+   void *result;
+ 
+   // Try mmap2() unless it's not supported
+@@ -161,7 +161,7 @@ static inline void* do_mmap64(void *start, size_t length,
+ 
+ extern "C" {
+   void* mmap64(void *start, size_t length, int prot, int flags,
+-               int fd, __off64_t offset  ) __THROW
++               int fd, off64_t offset  ) __THROW
+     ATTRIBUTE_SECTION(malloc_hook);
+   void* mmap(void *start, size_t length,int prot, int flags,
+              int fd, off_t offset) __THROW
+@@ -178,7 +178,7 @@ extern "C" {
+ }
+ 
+ extern "C" void* mmap64(void *start, size_t length, int prot, int flags,
+-                        int fd, __off64_t offset) __THROW {
++                        int fd, off64_t offset) __THROW {
+   MallocHook::InvokePreMmapHook(start, length, prot, flags, fd, offset);
+   void *result;
+   if (!MallocHook::InvokeMmapReplacement(
+@@ -189,7 +189,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags,
+   return result;
+ }
+ 
+-# if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH)
++# if defined(__GLIBC__) && (!defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH))
+ 
+ extern "C" void* mmap(void *start, size_t length, int prot, int flags,
+                       int fd, off_t offset) __THROW {
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0008-chromium-musl-linux-glibc-make-the-distinction.patch b/aports/main/qt5-qtwebengine/patches-musl/0008-chromium-musl-linux-glibc-make-the-distinction.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c9ff623884f42950d28a079c7a355a96410aace2
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0008-chromium-musl-linux-glibc-make-the-distinction.patch
@@ -0,0 +1,23 @@
+From d0621f9278ddd04c05b6ab3ef638be65f96f1bd6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 14:54:38 -0700
+Subject: [PATCH] chromium: musl: linux != glibc, make the distinction
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/base/allocator/allocator_check.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/chromium/base/allocator/allocator_check.cc b/src/3rdparty/chromium/base/allocator/allocator_check.cc
+index 5a0564d2f3..8c2dc6491d 100644
+--- a/src/3rdparty/chromium/base/allocator/allocator_check.cc
++++ b/src/3rdparty/chromium/base/allocator/allocator_check.cc
+@@ -21,7 +21,7 @@ bool IsAllocatorInitialized() {
+ #if defined(OS_WIN) && defined(ALLOCATOR_SHIM)
+   // Set by allocator_shim_win.cc when the shimmed _set_new_mode() is called.
+   return g_is_win_shim_layer_initialized;
+-#elif defined(OS_LINUX) && defined(USE_TCMALLOC) && \
++#elif defined(__GLIBC__) && defined(USE_TCMALLOC) && \
+     !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ // From third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h.
+ // TODO(primiano): replace with an include once base can depend on allocator.
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0009-chromium-musl-allocator-Do-not-include-glibc_weak_sy.patch b/aports/main/qt5-qtwebengine/patches-musl/0009-chromium-musl-allocator-Do-not-include-glibc_weak_sy.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b4c55471c5955daf12767ae0369cfc629ec0141b
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0009-chromium-musl-allocator-Do-not-include-glibc_weak_sy.patch
@@ -0,0 +1,24 @@
+From e8f8e7aa48e97b9b91858ef94f1940464a9178a3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 15:09:02 -0700
+Subject: [PATCH] chromium: musl: allocator: Do not include glibc_weak_symbols
+ for musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/base/allocator/allocator_shim.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/chromium/base/allocator/allocator_shim.cc b/src/3rdparty/chromium/base/allocator/allocator_shim.cc
+index 95480ea4b6..1de3d1a532 100644
+--- a/src/3rdparty/chromium/base/allocator/allocator_shim.cc
++++ b/src/3rdparty/chromium/base/allocator/allocator_shim.cc
+@@ -266,7 +266,7 @@ void ShimFree(void* address) {
+ // In the case of tcmalloc we also want to plumb into the glibc hooks
+ // to avoid that allocations made in glibc itself (e.g., strdup()) get
+ // accidentally performed on the glibc heap instead of the tcmalloc one.
+-#if defined(USE_TCMALLOC)
++#if defined(USE_TCMALLOC) && defined(__GLIBC__)
+ #include "base/allocator/allocator_shim_override_glibc_weak_symbols.h"
+ #endif
+ 
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0010-chromium-musl-Use-correct-member-name-__si_fields-fr.patch b/aports/main/qt5-qtwebengine/patches-musl/0010-chromium-musl-Use-correct-member-name-__si_fields-fr.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6b8be23f6b0b434a8ca0b5472f2efe6fefaa60c5
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0010-chromium-musl-Use-correct-member-name-__si_fields-fr.patch
@@ -0,0 +1,24 @@
+From ab272bfc9aef6d50c44e1c1bdfdb8a325aebaefc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 15:12:39 -0700
+Subject: [PATCH] chromium: musl: Use correct member name __si_fields from
+ LinuxSigInfo
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/sandbox/linux/seccomp-bpf/trap.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc
+index 003708d2c8..0fef3148f9 100644
+--- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc
++++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc
+@@ -168,7 +168,7 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
+   // most versions of glibc don't include this information in siginfo_t. So,
+   // we need to explicitly copy it into a arch_sigsys structure.
+   struct arch_sigsys sigsys;
+-  memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
++  memcpy(&sigsys, &info->__si_fields, sizeof(sigsys));
+ 
+ #if defined(__mips__)
+   // When indirect syscall (syscall(__NR_foo, ...)) is made on Mips, the
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0011-chromium-musl-Match-syscalls-to-match-musl.patch b/aports/main/qt5-qtwebengine/patches-musl/0011-chromium-musl-Match-syscalls-to-match-musl.patch
new file mode 100644
index 0000000000000000000000000000000000000000..69523d48b9dcb8e48738a7bd2eabc03aad300242
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0011-chromium-musl-Match-syscalls-to-match-musl.patch
@@ -0,0 +1,44 @@
+From bd3d6bd46e792e312435897e925cca5ccedc1dda Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 15:24:49 -0700
+Subject: [PATCH] chromium: musl: Match syscalls to match musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/third_party/lss/linux_syscall_support.h | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h b/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
+index 9dbd2391b2..a715de177c 100644
+--- a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
++++ b/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
+@@ -793,6 +793,14 @@ struct kernel_statfs {
+ #endif
+ 
+ 
++#undef stat64
++#undef fstat64
++
++#ifndef __NR_fstatat
++#define __NR_fstatat __NR_fstatat64
++#endif
++
++
+ #if defined(__x86_64__)
+ #ifndef ARCH_SET_GS
+ #define ARCH_SET_GS             0x1001
+@@ -1210,6 +1218,14 @@ struct kernel_statfs {
+ #ifndef __NR_fallocate
+ #define __NR_fallocate          285
+ #endif
++
++#ifndef __NR_pread
++#define __NR_pread __NR_pread64
++#endif
++#ifndef __NR_pwrite
++#define __NR_pwrite __NR_pwrite64
++#endif
++
+ /* End of x86-64 definitions                                                 */
+ #elif defined(__mips__)
+ #if _MIPS_SIM == _MIPS_SIM_ABI32
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0012-chromium-musl-Define-res_ninit-and-res_nclose-for-no.patch b/aports/main/qt5-qtwebengine/patches-musl/0012-chromium-musl-Define-res_ninit-and-res_nclose-for-no.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b07c8711884c0da5903f20769d97c2d5efd6627d
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0012-chromium-musl-Define-res_ninit-and-res_nclose-for-no.patch
@@ -0,0 +1,79 @@
+From 505fcfa52c49c9975e63066f631244ace6061d3c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 15:27:50 -0700
+Subject: [PATCH] chromium: musl: Define res_ninit and res_nclose for non-glibc
+ platforms
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/net/dns/dns_config_service_posix.cc |  4 ++++
+ chromium/net/dns/dns_reloader.cc             |  4 ++++
+ chromium/net/dns/resolv_compat.h             | 29 ++++++++++++++++++++++++++++
+ 3 files changed, 37 insertions(+)
+ create mode 100644 chromium/net/dns/resolv_compat.h
+
+diff --git a/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc b/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc
+index ba8a369133..e9b40d07fc 100644
+--- a/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc
++++ b/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc
+@@ -25,6 +25,10 @@
+ #include "net/dns/notify_watcher_mac.h"
+ #include "net/dns/serial_worker.h"
+ 
++#if defined(OS_LINUX) && !defined(__GLIBC__)
++#include "net/dns/resolv_compat.h"
++#endif
++
+ #if defined(OS_MACOSX) && !defined(OS_IOS)
+ #include "net/dns/dns_config_watcher_mac.h"
+ #endif
+diff --git a/src/3rdparty/chromium/net/dns/dns_reloader.cc b/src/3rdparty/chromium/net/dns/dns_reloader.cc
+index 74534e6b1b..2780a776e4 100644
+--- a/src/3rdparty/chromium/net/dns/dns_reloader.cc
++++ b/src/3rdparty/chromium/net/dns/dns_reloader.cc
+@@ -9,6 +9,10 @@
+ 
+ #include <resolv.h>
+ 
++#if defined(OS_LINUX) && !defined(__GLIBC__)
++#include "net/dns/resolv_compat.h"
++#endif
++
+ #include "base/lazy_instance.h"
+ #include "base/logging.h"
+ #include "base/macros.h"
+diff --git a/src/3rdparty/chromium/net/dns/resolv_compat.h b/src/3rdparty/chromium/net/dns/resolv_compat.h
+new file mode 100644
+index 0000000000..4f0e852a19
+--- /dev/null
++++ b/src/3rdparty/chromium/net/dns/resolv_compat.h
+@@ -0,0 +1,29 @@
++#if !defined(__GLIBC__)
++/***************************************************************************
++ * resolv_compat.h
++ *
++ * Mimick GLIBC's res_ninit() and res_nclose() for musl libc
++ * Note: res_init() is actually deprecated according to
++ * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html
++ **************************************************************************/
++#include <string.h>
++
++static inline int res_ninit(res_state statp)
++{
++	int rc = res_init();
++	if (statp != &_res) {
++		memcpy(statp, &_res, sizeof(*statp));
++	}
++	return rc;
++}
++
++static inline int res_nclose(res_state statp)
++{
++	if (!statp)
++		return -1;
++	if (statp != &_res) {
++		memset(statp, 0, sizeof(*statp));
++	}
++	return 0;
++}
++#endif
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0013-chromium-musl-Do-not-define-__sbrk-on-musl.patch b/aports/main/qt5-qtwebengine/patches-musl/0013-chromium-musl-Do-not-define-__sbrk-on-musl.patch
new file mode 100644
index 0000000000000000000000000000000000000000..85e4e8e5946569fa859c73103fcd1f90f9744eb1
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0013-chromium-musl-Do-not-define-__sbrk-on-musl.patch
@@ -0,0 +1,26 @@
+From e4d5b6ccd77506edb7d52f3857c4a5f22bea2437 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 15:39:57 -0700
+Subject: [PATCH] chromium: musl: Do not define __sbrk on musl
+
+musl libc does not have sbrk. on musl libc will only work when called with 0 as
+argument, so we just let it out for now
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h b/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
+index edc8cf2db7..a868b50d30 100644
+--- a/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
++++ b/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
+@@ -233,7 +233,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size,
+ }
+ 
+ // Don't hook sbrk() in Android, since it doesn't expose __sbrk.
+-#if !defined(__ANDROID__)
++#if !defined(__ANDROID__) && defined(__GLIBC__)
+ // libc's version:
+ extern "C" void* __sbrk(ptrdiff_t increment);
+ 
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0014-chromium-musl-Adjust-default-pthread-stack-size.patch b/aports/main/qt5-qtwebengine/patches-musl/0014-chromium-musl-Adjust-default-pthread-stack-size.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b888c98f3e9160d7c7101de1541026c61dfd50d5
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0014-chromium-musl-Adjust-default-pthread-stack-size.patch
@@ -0,0 +1,47 @@
+From 72a77c994434ecb708b2790ba9efaf1decc02503 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 16:41:23 -0700
+Subject: [PATCH] chromium: musl: Adjust default pthread stack size
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/base/threading/platform_thread_linux.cc                     | 3 ++-
+ chromium/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp | 4 ++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/3rdparty/chromium/base/threading/platform_thread_linux.cc b/src/3rdparty/chromium/base/threading/platform_thread_linux.cc
+index 92fbda5ee1..c41579d4ed 100644
+--- a/src/3rdparty/chromium/base/threading/platform_thread_linux.cc
++++ b/src/3rdparty/chromium/base/threading/platform_thread_linux.cc
+@@ -175,7 +175,8 @@ void TerminateOnThread() {}
+ 
+ size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
+ #if !defined(THREAD_SANITIZER)
+-  return 0;
++  // use 8mb like glibc to avoid running out of space
++  return (1 << 23);
+ #else
+   // ThreadSanitizer bloats the stack heavily. Evidence has been that the
+   // default stack size isn't enough for some browser tests.
+diff --git a/src/3rdparty/chromium/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp
+index 1d164f510a..3358deb256 100644
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp
+@@ -68,7 +68,7 @@ size_t StackFrameDepth::getUnderestimatedStackSize() {
+ // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
+ // correctly for the main thread.
+ 
+-#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD)
++#if OS(LINUX) || OS(ANDROID) || OS(FREEBSD)
+   // pthread_getattr_np() can fail if the thread is not invoked by
+   // pthread_create() (e.g., the main thread of webkit_unit_tests).
+   // If so, a conservative size estimate is returned.
+@@ -135,7 +135,7 @@ size_t StackFrameDepth::getUnderestimatedStackSize() {
+ }
+ 
+ void* StackFrameDepth::getStackStart() {
+-#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD)
++#if OS(LINUX) || OS(ANDROID) || OS(FREEBSD)
+   pthread_attr_t attr;
+   int error;
+ #if OS(FREEBSD)
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0015-chromium-musl-include-asm-generic-ioctl.h-for-TCGETS.patch b/aports/main/qt5-qtwebengine/patches-musl/0015-chromium-musl-include-asm-generic-ioctl.h-for-TCGETS.patch
new file mode 100644
index 0000000000000000000000000000000000000000..160197f827b47e6c23805f2e8afaa403e90fe6bf
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0015-chromium-musl-include-asm-generic-ioctl.h-for-TCGETS.patch
@@ -0,0 +1,22 @@
+From f2e66acda4934e4c0f56a58ba107cc208f09b7ef Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Jul 2017 17:15:34 -0700
+Subject: [PATCH] chromium: musl: include asm-generic/ioctl.h for TCGETS2
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/device/serial/serial_io_handler_posix.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/3rdparty/chromium/device/serial/serial_io_handler_posix.cc b/src/3rdparty/chromium/device/serial/serial_io_handler_posix.cc
+index a2ca2e2309..e139cdf9e9 100644
+--- a/src/3rdparty/chromium/device/serial/serial_io_handler_posix.cc
++++ b/src/3rdparty/chromium/device/serial/serial_io_handler_posix.cc
+@@ -6,6 +6,7 @@
+ 
+ #include <sys/ioctl.h>
+ #include <termios.h>
++#include <asm-generic/ioctls.h>
+ 
+ #include "base/files/file_util.h"
+ #include "base/posix/eintr_wrapper.h"
diff --git a/aports/main/qt5-qtwebengine/patches-musl/0016-chromium-musl-tcmalloc-Use-off64_t-insread-of-__off6.patch b/aports/main/qt5-qtwebengine/patches-musl/0016-chromium-musl-tcmalloc-Use-off64_t-insread-of-__off6.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8ee046d4f3656a4238c35b9611974ad26ecc1119
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/0016-chromium-musl-tcmalloc-Use-off64_t-insread-of-__off6.patch
@@ -0,0 +1,23 @@
+From 2141914268b26507d52cc7541cf268478ddc0bdf Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 8 Jul 2017 09:08:23 -0700
+Subject: [PATCH] chromium: musl: tcmalloc: Use off64_t insread of __off64_t
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h b/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
+index 91f77dd88d..bb84a0b305 100644
+--- a/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
++++ b/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
+@@ -1929,7 +1929,7 @@ typedef unsigned long int ulong;
+   #if defined(__x86_64__)
+     /* Need to make sure __off64_t isn't truncated to 32-bits under x32.  */
+     LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
+-                                    __off64_t o) {
++                                    off64_t o) {
+       LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l),
+                                LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f),
+                                LSS_SYSCALL_ARG(d), (uint64_t)(o));
diff --git a/aports/main/qt5-qtwebengine/patches-musl/gn_bootstrap.patch b/aports/main/qt5-qtwebengine/patches-musl/gn_bootstrap.patch
new file mode 100644
index 0000000000000000000000000000000000000000..fe0aee615fbd5f2d2aca25d28bdcc3d62489ca05
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/gn_bootstrap.patch
@@ -0,0 +1,62 @@
+diff --git a/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py b/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py
+index 43d252b..e74b23f 100755
+--- a/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py
++++ b/src/3rdparty/chromium/tools/gn/bootstrap/bootstrap.py
+@@ -20,6 +20,7 @@ import errno
+ import logging
+ import optparse
+ import os
++import platform
+ import shutil
+ import subprocess
+ import sys
+@@ -31,6 +32,7 @@ SRC_ROOT = os.path.dirname(os.path.dirname(GN_ROOT))
+ 
+ is_win = sys.platform.startswith('win')
+ is_linux = sys.platform.startswith('linux')
++is_gnu_linux = is_linux and platform.libc_ver()[0].startswith('glibc')
+ is_mac = sys.platform.startswith('darwin')
+ is_posix = is_linux or is_mac
+ 
+@@ -168,7 +170,7 @@ def build_gn_with_ninja_manually(tempdir, options):
+   mkdir_p(root_gen_dir)
+ 
+   write_buildflag_header_manually(root_gen_dir, 'base/allocator/features.h',
+-      {'USE_EXPERIMENTAL_ALLOCATOR_SHIM': 'true' if is_linux else 'false'})
++      {'USE_EXPERIMENTAL_ALLOCATOR_SHIM': 'true' if is_gnu_linux else 'false'})
+ 
+   write_buildflag_header_manually(root_gen_dir, 'base/debug/debugging_flags.h',
+       {'ENABLE_PROFILING': 'false'})
+@@ -377,8 +379,6 @@ def write_gn_ninja(path, root_gen_dir, options):
+       'base/third_party/superfasthash/superfasthash.c',
+   ])
+   static_libraries['base']['sources'].extend([
+-      'base/allocator/allocator_check.cc',
+-      'base/allocator/allocator_extension.cc',
+       'base/at_exit.cc',
+       'base/base_paths.cc',
+       'base/base_switches.cc',
+@@ -421,6 +421,7 @@ def write_gn_ninja(path, root_gen_dir, options):
+       'base/metrics/histogram.cc',
+       'base/metrics/histogram_base.cc',
+       'base/metrics/histogram_samples.cc',
++      'base/metrics/histogram_snapshot_manager.cc',
+       'base/metrics/metrics_hashes.cc',
+       'base/metrics/persistent_histogram_allocator.cc',
+       'base/metrics/persistent_memory_allocator.cc',
+@@ -584,9 +585,13 @@ def write_gn_ninja(path, root_gen_dir, options):
+         ],
+         'tool': 'cxx',
+     }
++
++    if is_gnu_linux:
++        static_libraries['base']['sources'].extend([
++            'base/allocator/allocator_shim.cc',
++            'base/allocator/allocator_shim_default_dispatch_to_glibc.cc'
++        ])
+     static_libraries['base']['sources'].extend([
+-        'base/allocator/allocator_shim.cc',
+-        'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
+         'base/memory/shared_memory_posix.cc',
+         'base/nix/xdg_util.cc',
+         'base/process/internal_linux.cc',
diff --git a/aports/main/qt5-qtwebengine/patches-musl/no-pvalloc.patch b/aports/main/qt5-qtwebengine/patches-musl/no-pvalloc.patch
new file mode 100644
index 0000000000000000000000000000000000000000..13cc9d1f483bb912a1427dcd775a6e192121551e
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/no-pvalloc.patch
@@ -0,0 +1,13 @@
+diff --git a/src/core/api/qtbug-61521.cpp b/src/core/api/qtbug-61521.cpp
+index 708fcde..13b80a2 100644
+--- a/src/core/api/qtbug-61521.cpp
++++ b/src/core/api/qtbug-61521.cpp
+@@ -111,7 +111,7 @@ SHIM_HIDDEN void* ShimValloc(size_t size) {
+ }
+ 
+ SHIM_HIDDEN void* ShimPvalloc(size_t size) {
+-    return pvalloc(size);
++    return malloc(size);
+ }
+ 
+ SHIM_HIDDEN int ShimPosixMemalign(void** r, size_t a, size_t s) {
diff --git a/aports/main/qt5-qtwebengine/patches-musl/no_execinfo.patch b/aports/main/qt5-qtwebengine/patches-musl/no_execinfo.patch
new file mode 100644
index 0000000000000000000000000000000000000000..50aaaab149b51e45a56e1cfbd293fae0985f11a4
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/no_execinfo.patch
@@ -0,0 +1,193 @@
+diff -Naur a/src/3rdparty/chromium/base/debug/leak_tracker.h b/src/3rdparty/chromium/base/debug/leak_tracker.h
+--- a/src/3rdparty/chromium/base/debug/leak_tracker.h	2016-12-04 17:37:29.096306764 -0800
++++ b/src/3rdparty/chromium/base/debug/leak_tracker.h	2016-12-04 17:48:46.224517026 -0800
+@@ -10,7 +10,7 @@
+ #include "build/build_config.h"
+ 
+ // Only enable leak tracking in non-uClibc debug builds.
+-#if !defined(NDEBUG) && !defined(__UCLIBC__)
++#if !defined(NDEBUG) && defined(HAVE_BACKTRACE)
+ #define ENABLE_LEAK_TRACKER
+ #endif
+ 
+diff -Naur a/src/3rdparty/chromium/base/debug/stack_trace.cc b/src/3rdparty/chromium/base/debug/stack_trace.cc
+--- a/src/3rdparty/chromium/base/debug/stack_trace.cc	2016-12-04 17:37:29.096306764 -0800
++++ b/src/3rdparty/chromium/base/debug/stack_trace.cc	2016-12-04 17:49:03.734703480 -0800
+@@ -199,7 +199,7 @@
+ 
+ std::string StackTrace::ToString() const {
+   std::stringstream stream;
+-#if !defined(__UCLIBC__)
++#if defined(HAVE_BACKTRACE)
+   OutputToStream(&stream);
+ #endif
+   return stream.str();
+diff -Naur a/src/3rdparty/chromium/base/debug/stack_trace.h b/src/3rdparty/chromium/base/debug/stack_trace.h
+--- a/src/3rdparty/chromium/base/debug/stack_trace.h	2016-12-04 17:37:29.094306742 -0800
++++ b/src/3rdparty/chromium/base/debug/stack_trace.h	2016-12-04 17:49:21.906896983 -0800
+@@ -76,7 +76,7 @@
+   // Prints the stack trace to stderr.
+   void Print() const;
+ 
+-#if !defined(__UCLIBC__)
++#if defined(HAVE_BACKTRACE)
+   // Resolves backtrace to symbols and write to stream.
+   void OutputToStream(std::ostream* os) const;
+ #endif
+diff -Naur a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc
+--- a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc	2016-12-04 17:37:29.104306849 -0800
++++ b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc	2016-12-04 17:51:03.367977370 -0800
+@@ -25,7 +25,7 @@
+ #if defined(__GLIBCXX__)
+ #include <cxxabi.h>
+ #endif
+-#if !defined(__UCLIBC__)
++#if defined(HAVE_BACKTRACE)
+ #include <execinfo.h>
+ #endif
+ 
+@@ -76,7 +76,7 @@
+   // Note: code in this function is NOT async-signal safe (std::string uses
+   // malloc internally).
+ 
+-#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
++#if defined(__GLIBCXX__) && defined(HAVE_BACKTRACE)
+ 
+   std::string::size_type search_from = 0;
+   while (search_from < text->size()) {
+@@ -113,7 +113,7 @@
+     }
+   }
+ 
+-#endif  // defined(__GLIBCXX__) && !defined(__UCLIBC__)
++#endif  // defined(__GLIBCXX__) && defined(HAVE_BACKTRACE)
+ }
+ #endif  // !defined(USE_SYMBOLIZE)
+ 
+@@ -125,7 +125,7 @@
+   virtual ~BacktraceOutputHandler() {}
+ };
+ 
+-#if !defined(__UCLIBC__)
++#if defined(HAVE_BACKTRACE)
+ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
+   // This should be more than enough to store a 64-bit number in hex:
+   // 16 hex digits + 1 for null-terminator.
+@@ -202,7 +202,7 @@
+   }
+ #endif  // defined(USE_SYMBOLIZE)
+ }
+-#endif  // !defined(__UCLIBC__)
++#endif  // defined(HAVE_BACKTRACE)
+ 
+ void PrintToStderr(const char* output) {
+   // NOTE: This code MUST be async-signal safe (it's used by in-process
+@@ -718,7 +718,7 @@
+   // NOTE: This code MUST be async-signal safe (it's used by in-process
+   // stack dumping signal handler). NO malloc or stdio is allowed here.
+ 
+-#if !defined(__UCLIBC__)
++#if defined(HAVE_BACKTRACE)
+   // Though the backtrace API man page does not list any possible negative
+   // return values, we take no chance.
+   count_ = base::saturated_cast<size_t>(backtrace(trace_, arraysize(trace_)));
+@@ -731,13 +731,13 @@
+   // NOTE: This code MUST be async-signal safe (it's used by in-process
+   // stack dumping signal handler). NO malloc or stdio is allowed here.
+ 
+-#if !defined(__UCLIBC__)
++#if defined(HAVE_BACKTRACE)
+   PrintBacktraceOutputHandler handler;
+   ProcessBacktrace(trace_, count_, &handler);
+ #endif
+ }
+ 
+-#if !defined(__UCLIBC__)
++#if defined(HAVE_BACKTRACE)
+ void StackTrace::OutputToStream(std::ostream* os) const {
+   StreamBacktraceOutputHandler handler(os);
+   ProcessBacktrace(trace_, count_, &handler);
+diff -Naur a/src/3rdparty/chromium/base/debug/stack_trace_unittest.cc b/src/3rdparty/chromium/base/debug/stack_trace_unittest.cc
+--- a/src/3rdparty/chromium/base/debug/stack_trace_unittest.cc	2016-12-04 17:37:29.098306785 -0800
++++ b/src/3rdparty/chromium/base/debug/stack_trace_unittest.cc	2016-12-04 17:51:31.348275313 -0800
+@@ -38,7 +38,7 @@
+ #else
+ #define MAYBE_OutputToStream OutputToStream
+ #endif
+-#if !defined(__UCLIBC__)
++#if defined(HAVE_BACKTRACE)
+ TEST_F(StackTraceTest, MAYBE_OutputToStream) {
+   StackTrace trace;
+ 
+@@ -134,7 +134,7 @@
+ TEST_F(StackTraceTest, DebugPrintBacktrace) {
+   StackTrace().Print();
+ }
+-#endif  // !defined(__UCLIBC__)
++#endif  // defined(HAVE_BACKTRACE)
+ 
+ #if defined(OS_POSIX) && !defined(OS_ANDROID)
+ #if !defined(OS_IOS)
+diff -Naur a/src/3rdparty/chromium/base/logging.cc b/src/3rdparty/chromium/base/logging.cc
+--- a/src/3rdparty/chromium/base/logging.cc	2016-12-04 17:37:29.167307520 -0800
++++ b/src/3rdparty/chromium/base/logging.cc	2016-12-04 17:51:58.436563757 -0800
+@@ -526,7 +526,7 @@
+ }
+ 
+ LogMessage::~LogMessage() {
+-#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__)
++#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && defined(HAVE_BACKTRACE)
+   if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) {
+     // Include a stack trace on a fatal, unless a debugger is attached.
+     base::debug::StackTrace trace;
+diff -Naur a/src/3rdparty/chromium/third_party/WebKit/Source/wtf/Assertions.cpp b/src/3rdparty/chromium/third_party/WebKit/Source/wtf/Assertions.cpp
+--- a/src/3rdparty/chromium/third_party/WebKit/Source/wtf/Assertions.cpp	2016-12-04 17:37:40.112424067 -0800
++++ b/src/3rdparty/chromium/third_party/WebKit/Source/wtf/Assertions.cpp	2016-12-04 17:52:44.286051976 -0800
+@@ -60,7 +60,7 @@
+ #include <windows.h>
+ #endif
+ 
+-#if OS(MACOSX) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(MACOSX) || (OS(LINUX) && defined(HAVE_BACKTRACE))
+ #include <cxxabi.h>
+ #include <dlfcn.h>
+ #include <execinfo.h>
+@@ -164,7 +164,7 @@
+ }
+ 
+ void WTFGetBacktrace(void** stack, int* size) {
+-#if OS(MACOSX) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(MACOSX) || (OS(LINUX) && defined(HAVE_BACKTRACE))
+   *size = backtrace(stack, *size);
+ #elif OS(WIN)
+   // The CaptureStackBackTrace function is available in XP, but it is not
+@@ -215,7 +215,7 @@
+ };
+ 
+ FrameToNameScope::FrameToNameScope(void* addr) : m_name(0), m_cxaDemangled(0) {
+-#if OS(MACOSX) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(MACOSX) || (OS(LINUX) && defined(HAVE_BACKTRACE))
+   Dl_info info;
+   if (!dladdr(addr, &info) || !info.dli_sname)
+     return;
+diff -Naur a/src/3rdparty/chromium/third_party/webrtc/base/checks.cc b/src/3rdparty/chromium/third_party/webrtc/base/checks.cc
+--- a/src/3rdparty/chromium/third_party/webrtc/base/checks.cc	2016-12-04 17:38:06.144701266 -0800
++++ b/src/3rdparty/chromium/third_party/webrtc/base/checks.cc	2016-12-04 17:53:19.007413116 -0800
+@@ -16,7 +16,7 @@
+ #include <cstdio>
+ #include <cstdlib>
+ 
+-#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
++#if defined(__GLIBCXX__) && defined(HAVE_BACKTRACE)
+ #include <cxxabi.h>
+ #include <execinfo.h>
+ #endif
+@@ -60,7 +60,7 @@
+ // to get usable symbols on Linux. This is copied from V8. Chromium has a more
+ // advanced stace trace system; also more difficult to copy.
+ void DumpBacktrace() {
+-#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
++#if defined(__GLIBCXX__) && defined(HAVE_BACKTRACE)
+   void* trace[100];
+   int size = backtrace(trace, sizeof(trace) / sizeof(*trace));
+   char** symbols = backtrace_symbols(trace, size);
\ No newline at end of file
diff --git a/aports/main/qt5-qtwebengine/patches-musl/renderthread-mallinfo.patch b/aports/main/qt5-qtwebengine/patches-musl/renderthread-mallinfo.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a154cd315516bb8740edeaa4bc46ee5cdc8a318e
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/renderthread-mallinfo.patch
@@ -0,0 +1,64 @@
+diff --git a/src/3rdparty/chromium/content/renderer/render_thread_impl.cc b/src/3rdparty/chromium/content/renderer/render_thread_impl.cc
+index 2934f94..05fee20 100644
+--- a/src/3rdparty/chromium/content/renderer/render_thread_impl.cc
++++ b/src/3rdparty/chromium/content/renderer/render_thread_impl.cc
+@@ -1821,6 +1821,50 @@ static size_t GetMallocUsage() {
+   return stats.size_in_use;
+ }
+ 
++}  // namespace
++
++#elif defined(OS_LINUX) && !defined(__GLIBC__)
++namespace {
++
++static size_t GetMallocUsage() {
++  char *line=NULL;
++  size_t n,usage=0;
++  FILE *f = fopen("/proc/self/maps", "r");
++  char *path, *perm;
++  if (f == NULL) {
++    perror("/proc/self/maps");
++    return 0;
++  }
++  path = (char *)malloc(PATH_MAX+16);
++  if (path == NULL)
++    goto out;
++  perm = path + PATH_MAX;
++
++  while (getline(&line, &n, f) >=0) {
++    size_t start,end,offset,inode;
++    int devmaj, devmin, items;
++
++    items = sscanf(line, "%zx-%zx %s %zx %x:%x %zu %s",
++                   &start, &end, perm, &offset,
++                   &devmaj, &devmin, &inode, path);
++
++    if (items < 7)
++      continue;
++
++    if (items < 8)
++      path[0] = '\0';
++
++    if ((strcmp(perm, "rw-p") == 0 && devmaj+devmin == 0)
++        && (path[0] == '\0' || strcmp(path, "[heap]") == 0))
++      usage += end-start;
++  }
++  free(line);
++  free(path);
++out:
++  fclose(f);
++  return usage;
++}
++
+ }  // namespace
+ #endif
+ 
+@@ -1840,7 +1884,7 @@ void RenderThreadImpl::RecordPurgeAndSuspendMetrics() const {
+                           blink_stats.partitionAllocTotalAllocatedBytes / 1024);
+   UMA_HISTOGRAM_MEMORY_KB("PurgeAndSuspend.Memory.BlinkGCKB",
+                           blink_stats.blinkGCTotalAllocatedBytes / 1024);
+-#if defined(OS_LINUX) || defined(OS_ANDROID)
++#if (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_ANDROID)
+   struct mallinfo minfo = mallinfo();
+ #if defined(USE_TCMALLOC)
+   size_t malloc_usage = minfo.uordblks;
diff --git a/aports/main/qt5-qtwebengine/patches-musl/yasm_intl.patch b/aports/main/qt5-qtwebengine/patches-musl/yasm_intl.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b1fb66c2941a8f864d97ac13d09b5513859b1bbe
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/patches-musl/yasm_intl.patch
@@ -0,0 +1,13 @@
+diff --git a/src/3rdparty/chromium/third_party/yasm/BUILD.gn b/qtwebengine-opensource-src-5.9.1-patched/src/3rdparty/chromium/third_party/yasm/BUILD.gn
+index 6f49a02..0703793 100644
+--- a/src/3rdparty/chromium/third_party/yasm/BUILD.gn
++++ b/src/3rdparty/chromium/third_party/yasm/BUILD.gn
+@@ -317,7 +317,7 @@ if (current_toolchain == host_toolchain) {
+         "-pedantic",
+       ]
+     }
+-
++    libs = [ "intl" ]
+     # TODO(ajwong): This should take most of the generated output as
+     # inputs.
+     deps = [
diff --git a/aports/main/qt5-qtwebengine/use-ozone.patch b/aports/main/qt5-qtwebengine/use-ozone.patch
new file mode 100644
index 0000000000000000000000000000000000000000..da894af41c891d330f100c64288ca1e625ca4850
--- /dev/null
+++ b/aports/main/qt5-qtwebengine/use-ozone.patch
@@ -0,0 +1,18 @@
+diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
+index 076d8a3..22a894f 100644
+--- a/src/core/config/linux.pri
++++ b/src/core/config/linux.pri
+@@ -6,6 +6,13 @@ gn_args += \
+     use_cups=false \
+     use_gconf=false \
+     use_gio=false \
++    use_x11=false \
++    use_ozone=true \
++    ozone_auto_platforms=false \
++    ozone_platform_headless=true \
++    ozone_platform_external=true \
++    ozone_platform=\"qt\" \
++    enable_palmbridge=true \
+     use_gnome_keyring=false \
+     use_kerberos=false \
+     linux_use_bundled_binutils=false