Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,33 @@
<artifactId>selenium-htmlunit-driver</artifactId>
<scope>test</scope>
</dependency>
<!-- Coerce sbt into honoring these dependency updates: -->
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit-core-js</artifactId>
<scope>test</scope>
</dependency>
<!-- at least just for tests, coerce SBT to use the updated httpcore/client version -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<scope>test</scope>
</dependency>
<!-- Added for selenium: -->
<dependency>
<groupId>xml-apis</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ $(document).ready(function() {
});

var historySummary = $("#history-summary");
var searchString = historySummary["context"]["location"]["search"];
var searchString = window.location.search;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also verified that this works in the same way.

var requestedIncomplete = getParameterByName("showIncomplete", searchString);
requestedIncomplete = (requestedIncomplete == "true" ? true : false);

Expand Down

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@
return obj != null && typeof obj === 'object' && (propName in obj);
}

/**
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are all from the source jquery.mustache.js, not custom modifications

Copy link
Member

@dongjoon-hyun dongjoon-hyun Jun 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also checked this. This file is identical with mustache.js v3.0.1. Only the trailing spaces are removed in a few lines.

* Safe way of detecting whether or not the given thing is a primitive and
* whether it has the given property
*/
function primitiveHasOwnProperty (primitive, propName) {
return (
primitive != null
&& typeof primitive !== 'object'
&& primitive.hasOwnProperty
&& primitive.hasOwnProperty(propName)
);
}

// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
// See https://github.com/janl/mustache.js/issues/189
var regExpTest = RegExp.prototype.test;
Expand Down Expand Up @@ -377,11 +390,11 @@
if (cache.hasOwnProperty(name)) {
value = cache[name];
} else {
var context = this, names, index, lookupHit = false;
var context = this, intermediateValue, names, index, lookupHit = false;

while (context) {
if (name.indexOf('.') > 0) {
value = context.view;
intermediateValue = context.view;
names = name.split('.');
index = 0;

Expand All @@ -395,20 +408,51 @@
*
* This is specially necessary for when the value has been set to
* `undefined` and we want to avoid looking up parent contexts.
*
* In the case where dot notation is used, we consider the lookup
* to be successful even if the last "object" in the path is
* not actually an object but a primitive (e.g., a string, or an
* integer), because it is sometimes useful to access a property
* of an autoboxed primitive, such as the length of a string.
**/
while (value != null && index < names.length) {
while (intermediateValue != null && index < names.length) {
if (index === names.length - 1)
lookupHit = hasProperty(value, names[index]);
lookupHit = (
hasProperty(intermediateValue, names[index])
|| primitiveHasOwnProperty(intermediateValue, names[index])
);

value = value[names[index++]];
intermediateValue = intermediateValue[names[index++]];
}
} else {
value = context.view[name];
intermediateValue = context.view[name];

/**
* Only checking against `hasProperty`, which always returns `false` if
* `context.view` is not an object. Deliberately omitting the check
* against `primitiveHasOwnProperty` if dot notation is not used.
*
* Consider this example:
* ```
* Mustache.render("The length of a football field is {{#length}}{{length}}{{/length}}.", {length: "100 yards"})
* ```
*
* If we were to check also against `primitiveHasOwnProperty`, as we do
* in the dot notation case, then render call would return:
*
* "The length of a football field is 9."
*
* rather than the expected:
*
* "The length of a football field is 100 yards."
**/
lookupHit = hasProperty(context.view, name);
}

if (lookupHit)
if (lookupHit) {
value = intermediateValue;
break;
}

context = context.parent;
}
Expand Down Expand Up @@ -439,15 +483,17 @@
};

/**
* Parses and caches the given `template` and returns the array of tokens
* Parses and caches the given `template` according to the given `tags` or
* `mustache.tags` if `tags` is omitted, and returns the array of tokens
* that is generated from the parse.
*/
Writer.prototype.parse = function parse (template, tags) {
var cache = this.cache;
var tokens = cache[template];
var cacheKey = template + ':' + (tags || mustache.tags).join(':');
var tokens = cache[cacheKey];

if (tokens == null)
tokens = cache[template] = parseTemplate(template, tags);
tokens = cache[cacheKey] = parseTemplate(template, tags);

return tokens;
};
Expand All @@ -460,11 +506,15 @@
* names and templates of partials that are used in the template. It may
* also be a function that is used to load partial templates on the fly
* that takes a single argument: the name of the partial.
*
* If the optional `tags` argument is given here it must be an array with two
* string values: the opening and closing tags used in the template (e.g.
* [ "<%", "%>" ]). The default is to mustache.tags.
*/
Writer.prototype.render = function render (template, view, partials) {
var tokens = this.parse(template);
Writer.prototype.render = function render (template, view, partials, tags) {
var tokens = this.parse(template, tags);
var context = (view instanceof Context) ? view : new Context(view);
return this.renderTokens(tokens, context, partials, template);
return this.renderTokens(tokens, context, partials, template, tags);
};

/**
Expand All @@ -476,7 +526,7 @@
* If the template doesn't use higher-order sections, this argument may
* be omitted.
*/
Writer.prototype.renderTokens = function renderTokens (tokens, context, partials, originalTemplate) {
Writer.prototype.renderTokens = function renderTokens (tokens, context, partials, originalTemplate, tags) {
var buffer = '';

var token, symbol, value;
Expand All @@ -487,7 +537,7 @@

if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate);
else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate);
else if (symbol === '>') value = this.renderPartial(token, context, partials, originalTemplate);
else if (symbol === '>') value = this.renderPartial(token, context, partials, tags);
else if (symbol === '&') value = this.unescapedValue(token, context);
else if (symbol === 'name') value = this.escapedValue(token, context);
else if (symbol === 'text') value = this.rawValue(token);
Expand Down Expand Up @@ -542,12 +592,12 @@
return this.renderTokens(token[4], context, partials, originalTemplate);
};

Writer.prototype.renderPartial = function renderPartial (token, context, partials) {
Writer.prototype.renderPartial = function renderPartial (token, context, partials, tags) {
if (!partials) return;

var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
if (value != null)
return this.renderTokens(this.parse(value), context, partials, value);
return this.renderTokens(this.parse(value, tags), context, partials, value);
};

Writer.prototype.unescapedValue = function unescapedValue (token, context) {
Expand All @@ -567,7 +617,7 @@
};

mustache.name = 'mustache.js';
mustache.version = '2.3.2';
mustache.version = '3.0.1';
mustache.tags = [ '{{', '}}' ];

// All high-level mustache.* functions use this writer.
Expand All @@ -591,16 +641,18 @@

/**
* Renders the `template` with the given `view` and `partials` using the
* default writer.
* default writer. If the optional `tags` argument is given here it must be an
* array with two string values: the opening and closing tags used in the
* template (e.g. [ "<%", "%>" ]). The default is to mustache.tags.
*/
mustache.render = function render (template, view, partials) {
mustache.render = function render (template, view, partials, tags) {
if (typeof template !== 'string') {
throw new TypeError('Invalid template! Template should be a "string" ' +
'but "' + typeStr(template) + '" was given as the first ' +
'argument for mustache#render(template, view, partials)');
}

return defaultWriter.render(template, view, partials);
return defaultWriter.render(template, view, partials, tags);
};

// This is here for backwards compatibility with 0.4.x.,
Expand All @@ -627,4 +679,4 @@
mustache.Writer = Writer;

return mustache;
}));
}));
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/ui/UIUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private[spark] object UIUtils extends Logging {
<link rel="stylesheet"
href={prependBaseUri(request, "/static/timeline-view.css")} type="text/css"/>
<script src={prependBaseUri(request, "/static/sorttable.js")} ></script>
<script src={prependBaseUri(request, "/static/jquery-1.12.4.min.js")}></script>
<script src={prependBaseUri(request, "/static/jquery-3.4.1.min.js")}></script>
<script src={prependBaseUri(request, "/static/vis.min.js")}></script>
<script src={prependBaseUri(request, "/static/bootstrap-tooltip.js")}></script>
<script src={prependBaseUri(request, "/static/initialize-tooltips.js")}></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import javax.servlet.http.{HttpServletRequest, HttpServletRequestWrapper, HttpSe
import scala.collection.JavaConverters._
import scala.concurrent.duration._

import com.gargoylesoftware.htmlunit.BrowserVersion
import com.google.common.io.{ByteStreams, Files}
import org.apache.commons.io.{FileUtils, IOUtils}
import org.apache.hadoop.fs.{FileStatus, FileSystem, Path}
Expand Down Expand Up @@ -366,9 +367,8 @@ class HistoryServerSuite extends SparkFunSuite with BeforeAndAfter with Matchers
contextHandler.addServlet(holder, "/")
server.attachHandler(contextHandler)

implicit val webDriver: WebDriver = new HtmlUnitDriver(true) {
getWebClient.getOptions.setThrowExceptionOnScriptError(false)
}
implicit val webDriver: WebDriver =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last clarifying comment: This change slightly improves the test to not ignore javascript errors, and as part of that, needed to test as a modern browser (IE 11 vs IE 8).

new HtmlUnitDriver(BrowserVersion.INTERNET_EXPLORER_11, true)

try {
val url = s"http://localhost:$port"
Expand Down
2 changes: 1 addition & 1 deletion dev/.rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ docs
slaves
spark-env.cmd
bootstrap-tooltip.js
jquery-1.12.4.min.js
jquery-3.4.1.min.js
d3.min.js
dagre-d3.min.js
graphlib-dot.min.js
Expand Down
2 changes: 1 addition & 1 deletion docs/_layouts/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h1 class="title">{{ page.title }}</h1>
<!-- /container -->
</div>

<script src="js/vendor/jquery-1.12.4.min.js"></script>
<script src="js/vendor/jquery-3.4.1.min.js"></script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="js/vendor/anchor.min.js"></script>
<script src="js/main.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@ $(function() {

// Scroll now too in case we had opened the page on a hash, but wait a bit because some browsers
// will try to do *their* initial scroll after running the onReady handler.
$(window).load(function() { setTimeout(function() { maybeScrollToHash(); }, 25); });
$(window).on('load', function() { setTimeout(function() { maybeScrollToHash(); }, 25); });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually the only change I seemed to need to make to the Spark javascript.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. This is the correct update based on the upgrade-guide.

});
5 changes: 0 additions & 5 deletions docs/js/vendor/jquery-1.12.4.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions docs/js/vendor/jquery-3.4.1.min.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
<antlr4.version>4.7.1</antlr4.version>
<jpam.version>1.1</jpam.version>
<selenium.version>2.52.0</selenium.version>
<htmlunit.version>2.22</htmlunit.version>
<!--
Managed up from older version from Avro; sync with jackson-module-paranamer dependency version
-->
Expand Down Expand Up @@ -549,6 +550,19 @@
<version>${selenium.version}</version>
<scope>test</scope>
</dependency>
<!-- Update htmlunit dependency that selenium uses for better JS support -->
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>${htmlunit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit-core-js</artifactId>
<version>${htmlunit.version}</version>
<scope>test</scope>
</dependency>
<!-- Added for selenium only, and should match its dependent version: -->
<dependency>
<groupId>xml-apis</groupId>
Expand Down