OpenJDK / openjfx / 9-dev / rt
changeset 9745:1ec63f261e9f
8152420: [WebView] Icon font doesn't work if single page application will be loaded from jar
Reviewed-by: ddhill, kcr
author | ghb |
---|---|
date | Thu, 28 Apr 2016 15:07:51 +0530 |
parents | 2ba17bc472f7 |
children | 728d0c9a6446 |
files | build.gradle modules/web/src/main/native/Source/WebCore/platform/URL.cpp modules/web/src/test/java/test/javafx/scene/web/LoadTest.java modules/web/src/test/resources/test/html/archive-r0.js modules/web/src/test/resources/test/html/archive-root0.html modules/web/src/test/resources/test/html/archive-root1.html modules/web/src/test/resources/test/html/archive-root2.html modules/web/src/test/resources/test/html/c/archive-c0.js |
diffstat | 8 files changed, 55 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/build.gradle Wed Apr 27 16:35:56 2016 -0700 +++ b/build.gradle Thu Apr 28 15:07:51 2016 +0530 @@ -2627,6 +2627,14 @@ compileJava.dependsOn updateCacheIfNeeded + task webArchiveJar(type: Jar) { + from (project.file("$projectDir/src/test/resources/test/html")) { + include "**/archive-*.*" + } + archiveName = "webArchiveJar.jar" + destinationDir = file("$buildDir/testing/resources") + } + test { if (!IS_JIGSAW_TEST) { //TODO: support this in Jake @@ -2635,6 +2643,9 @@ systemProperty 'monocle.platform', 'Headless' systemProperty 'prism.order', 'sw' } + dependsOn webArchiveJar + def testResourceDir = file("$buildDir/testing/resources") + jvmArgs "-DWEB_ARCHIVE_JAR_TEST_DIR=$testResourceDir" } if (!IS_COMPILE_WEBKIT) {
--- a/modules/web/src/main/native/Source/WebCore/platform/URL.cpp Wed Apr 27 16:35:56 2016 -0700 +++ b/modules/web/src/main/native/Source/WebCore/platform/URL.cpp Thu Apr 28 15:07:51 2016 +0530 @@ -424,15 +424,14 @@ } else { // If the base is empty or opaque (e.g. data: or javascript:), then the URL is invalid // unless the relative URL is a single fragment. +#if PLATFORM(JAVA) + if (!base.isHierarchical() && !base.isJarFile()) { +#else if (!base.isHierarchical()) { +#endif if (str[0] == '#') { appendASCII(base.m_string.left(base.m_queryEnd), str, len, parseBuffer); parse(parseBuffer.data(), &relative); -#if PLATFORM(JAVA) - } else if(base.isJarFile()) { - appendASCII(base.m_string.left(base.m_pathAfterLastSlash), str, len, parseBuffer); - parse(parseBuffer.data(), &relative); -#endif } else { m_string = relative; invalidate();
--- a/modules/web/src/test/java/test/javafx/scene/web/LoadTest.java Wed Apr 27 16:35:56 2016 -0700 +++ b/modules/web/src/test/java/test/javafx/scene/web/LoadTest.java Thu Apr 28 15:07:51 2016 +0530 @@ -261,4 +261,39 @@ throw new AssertionError(ex); } } + + /** + * @test + * @bug 8152420 + * summary loading relative sub-resource from jar + */ + @Test public void loadJarFile() throws Exception { + + // archive-root0.html -- src archive-r0.js, c/archive-c0.js + load("jar:" + new File(System.getProperties().get("WEB_ARCHIVE_JAR_TEST_DIR").toString() + + "/webArchiveJar.jar").toURI().toASCIIString() + "!/archive-root0.html"); + assertEquals("archive-root0.html failed to load src='archive-r0.js'", + executeScript("jsr0()").toString(), "loaded"); + + assertEquals("archive-root0.html failed to load src='c/archive-c0.js'", + executeScript("jsc0()").toString(), "loaded"); + + // archive-root1.html -- src ./archive-r0.js, ./c/archive-c0.js + load("jar:" + new File(System.getProperties().get("WEB_ARCHIVE_JAR_TEST_DIR").toString() + + "/webArchiveJar.jar").toURI().toASCIIString() + "!/archive-root1.html"); + assertEquals("archive-root1.html failed to load src='./archive-r0.js'", + executeScript("jsr0()").toString(), "loaded"); + + assertEquals("archive-root1.html failed to load src='./c/archive-c0.js'", + executeScript("jsc0()").toString(), "loaded"); + + // archive-root2.html -- src ./c/../archive-r0.js, ./c/./././archive-c0.js + load("jar:" + new File(System.getProperties().get("WEB_ARCHIVE_JAR_TEST_DIR").toString() + + "/webArchiveJar.jar").toURI().toASCIIString() + "!/archive-root2.html"); + assertEquals("archive-root2.html failed to load src='./c/../archive-r0.js'", + executeScript("jsr0()").toString(), "loaded"); + + assertEquals("archive-root2.html failed to load src='./c/./././archive-c0.js'", + executeScript("jsc0()").toString(), "loaded"); + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/web/src/test/resources/test/html/archive-r0.js Thu Apr 28 15:07:51 2016 +0530 @@ -0,0 +1,1 @@ +function jsr0() { return 'loaded'}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/web/src/test/resources/test/html/archive-root0.html Thu Apr 28 15:07:51 2016 +0530 @@ -0,0 +1,1 @@ +<script src='archive-r0.js'> </script> <script src='c/archive-c0.js'> </script>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/web/src/test/resources/test/html/archive-root1.html Thu Apr 28 15:07:51 2016 +0530 @@ -0,0 +1,1 @@ +<script src='./archive-r0.js'> </script> <script src='./c/archive-c0.js'> </script>