Skip to content

Commit dfa6ffc

Browse files
committed
fix object-classid processing if the js engine is disabled
1 parent fbc628c commit dfa6ffc

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public void onAllChildrenAddedToPage(final boolean postponed) {
295295
}
296296

297297
final String clsId = getClassIdAttribute();
298-
if (ATTRIBUTE_NOT_DEFINED != clsId) {
298+
if (ATTRIBUTE_NOT_DEFINED != clsId && getPage().getWebClient().isJavaScriptEngineEnabled()) {
299299
((HTMLObjectElement) getScriptableObject()).setClassid(clsId);
300300
}
301301
}

src/test/java/com/gargoylesoftware/htmlunit/WebClient8Test.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,28 @@ public void link() throws Exception {
263263
webClient.getPage(URL_FIRST);
264264
}
265265
}
266+
267+
/**
268+
* @throws Exception if something goes wrong
269+
*/
270+
@Test
271+
public void object() throws Exception {
272+
final String html = "<html>\n"
273+
+ "<head>\n"
274+
+ " <title>foo</title>\n"
275+
+ "</head>\n"
276+
+ "<body>\n"
277+
+ "<object type='application/pdf' classid='cls12345'></object>\n"
278+
+ "</body></html>";
279+
280+
try (WebClient webClient = new WebClient(getBrowserVersion(), false, null, -1)) {
281+
final MockWebConnection webConnection = getMockWebConnection();
282+
webConnection.setResponse(URL_FIRST, html);
283+
webConnection.setResponse(new URL(URL_FIRST, "simple.css"), "");
284+
285+
webClient.setWebConnection(webConnection);
286+
287+
webClient.getPage(URL_FIRST);
288+
}
289+
}
266290
}

0 commit comments

Comments
 (0)