From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../emberjs-debug/source/app/app.js | 18 +++++ .../source/app/components/todo-item.js | 49 ++++++++++++++ .../source/app/components/todo-list.js | 27 ++++++++ .../emberjs-debug/source/app/controllers/active.js | 5 ++ .../source/app/controllers/application.js | 20 ++++++ .../source/app/controllers/completed.js | 5 ++ .../emberjs-debug/source/app/helpers/gt.js | 7 ++ .../emberjs-debug/source/app/helpers/pluralize.js | 8 +++ .../emberjs-debug/source/app/index.html | 24 +++++++ .../source/app/instance-initializers/global.js | 10 +++ .../emberjs-debug/source/app/resolver.js | 3 + .../emberjs-debug/source/app/router.js | 13 ++++ .../emberjs-debug/source/app/routes/application.js | 8 +++ .../emberjs-debug/source/app/services/memory.js | 78 ++++++++++++++++++++++ .../emberjs-debug/source/app/services/repo.js | 27 ++++++++ .../emberjs-debug/source/app/templates/active.hbs | 1 + .../source/app/templates/application.hbs | 29 ++++++++ .../source/app/templates/completed.hbs | 1 + .../source/app/templates/components/todo-item.hbs | 6 ++ .../source/app/templates/components/todo-list.hbs | 10 +++ .../emberjs-debug/source/app/templates/index.hbs | 3 + 21 files changed, 352 insertions(+) create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/app.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/components/todo-item.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/components/todo-list.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/active.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/application.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/completed.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/helpers/gt.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/helpers/pluralize.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/index.html create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/instance-initializers/global.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/resolver.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/router.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/routes/application.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/services/memory.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/services/repo.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/active.hbs create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/application.hbs create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/completed.hbs create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/components/todo-item.hbs create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/components/todo-list.hbs create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/index.hbs (limited to 'third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app') diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/app.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/app.js new file mode 100644 index 0000000000..f260c4c706 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/app.js @@ -0,0 +1,18 @@ +import Ember from 'ember'; +import Resolver from './resolver'; +import loadInitializers from 'ember-load-initializers'; +import config from './config/environment'; + +let App; + +Ember.MODEL_FACTORY_INJECTIONS = true; + +App = Ember.Application.extend({ + modulePrefix: config.modulePrefix, + podModulePrefix: config.podModulePrefix, + Resolver +}); + +loadInitializers(App, config.modulePrefix); + +export default App; diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/components/todo-item.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/components/todo-item.js new file mode 100644 index 0000000000..0de7fbf116 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/components/todo-item.js @@ -0,0 +1,49 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + repo: Ember.inject.service(), + tagName: 'li', + editing: false, + classNameBindings: ['todo.completed', 'editing'], + + actions: { + startEditing() { + this.get('onStartEdit')(); + this.set('editing', true); + Ember.run.scheduleOnce('afterRender', this, 'focusInput'); + }, + + doneEditing(todoTitle) { + if (!this.get('editing')) { return; } + if (Ember.isBlank(todoTitle)) { + this.send('removeTodo'); + } else { + this.set('todo.title', todoTitle.trim()); + this.set('editing', false); + this.get('onEndEdit')(); + } + }, + + handleKeydown(e) { + if (e.keyCode === 13) { + e.target.blur(); + } else if (e.keyCode === 27) { + this.set('editing', false); + } + }, + + toggleCompleted(e) { + let todo = this.get('todo'); + Ember.set(todo, 'completed', e.target.checked); + this.get('repo').persist(); + }, + + removeTodo() { + this.get('repo').delete(this.get('todo')); + } + }, + + focusInput() { + this.element.querySelector('input.edit').focus(); + } +}); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/components/todo-list.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/components/todo-list.js new file mode 100644 index 0000000000..d84e0e3a1f --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/components/todo-list.js @@ -0,0 +1,27 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + repo: Ember.inject.service(), + tagName: 'section', + elementId: 'main', + canToggle: true, + allCompleted: Ember.computed('todos.@each.completed', function () { + return this.get('todos').isEvery('completed'); + }), + + actions: { + enableToggle() { + this.set('canToggle', true); + }, + + disableToggle() { + this.set('canToggle', false); + }, + + toggleAll() { + let allCompleted = this.get('allCompleted'); + this.get('todos').forEach(todo => Ember.set(todo, 'completed', !allCompleted)); + this.get('repo').persist(); + } + } +}); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/active.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/active.js new file mode 100644 index 0000000000..df03d40790 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/active.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +export default Ember.Controller.extend({ + todos: Ember.computed.filterBy('model', 'completed', false) +}); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/application.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/application.js new file mode 100644 index 0000000000..c814e5fa73 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/application.js @@ -0,0 +1,20 @@ +import Ember from 'ember'; + +export default Ember.Controller.extend({ + repo: Ember.inject.service(), + remaining: Ember.computed.filterBy('model', 'completed', false), + completed: Ember.computed.filterBy('model', 'completed'), + actions: { + createTodo(e) { + if (e.keyCode === 13 && !Ember.isBlank(e.target.value)) { + this.get('repo').add({ title: e.target.value.trim(), completed: false }); + e.target.value = ''; + } + }, + + clearCompleted() { + this.get('model').removeObjects(this.get('completed')); + this.get('repo').persist(); + } + } +}); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/completed.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/completed.js new file mode 100644 index 0000000000..634d00afef --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/controllers/completed.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +export default Ember.Controller.extend({ + todos: Ember.computed.filterBy('model', 'completed', true) +}); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/helpers/gt.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/helpers/gt.js new file mode 100644 index 0000000000..f370695a2f --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/helpers/gt.js @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export function gt([n1, n2]/*, hash*/) { + return n1 > n2; +} + +export default Ember.Helper.helper(gt); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/helpers/pluralize.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/helpers/pluralize.js new file mode 100644 index 0000000000..b1f1a2acc8 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/helpers/pluralize.js @@ -0,0 +1,8 @@ +import Ember from 'ember'; +import { pluralize } from 'ember-inflector'; + +export function pluralizeHelper([singular, count]/*, hash*/) { + return count === 1 ? singular : pluralize(singular); +} + +export default Ember.Helper.helper(pluralizeHelper); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/index.html b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/index.html new file mode 100644 index 0000000000..b1730fbb67 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/index.html @@ -0,0 +1,24 @@ + + + + + + Todomvc + + + {{content-for "head"}} + + + + + {{content-for "head-footer"}} + + + {{content-for "body"}} + + + + + {{content-for "body-footer"}} + + diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/instance-initializers/global.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/instance-initializers/global.js new file mode 100644 index 0000000000..34c9a9dade --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/instance-initializers/global.js @@ -0,0 +1,10 @@ +// app/instance-initializers/global.js + +export function initialize(application) { + window.App = application; // or window.Whatever +} + +export default { + name: 'global', + initialize: initialize +}; \ No newline at end of file diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/resolver.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/resolver.js new file mode 100644 index 0000000000..2fb563d6c0 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/resolver.js @@ -0,0 +1,3 @@ +import Resolver from 'ember-resolver'; + +export default Resolver; diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/router.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/router.js new file mode 100644 index 0000000000..4c60bf93fc --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/router.js @@ -0,0 +1,13 @@ +import Ember from 'ember'; +import config from './config/environment'; + +const Router = Ember.Router.extend({ + location: config.locationType +}); + +Router.map(function () { + this.route('active'); + this.route('completed'); +}); + +export default Router; diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/routes/application.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/routes/application.js new file mode 100644 index 0000000000..296a375ba2 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/routes/application.js @@ -0,0 +1,8 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + repo: Ember.inject.service(), + model() { + return this.get('repo').findAll(); + } +}); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/services/memory.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/services/memory.js new file mode 100644 index 0000000000..74c5cdf19f --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/services/memory.js @@ -0,0 +1,78 @@ +(function(root) { + var localStorageMemory = {}; + var cache = {}; + + /** + * number of stored items. + */ + localStorageMemory.length = 0; + + /** + * returns item for passed key, or null + * + * @para {String} key + * name of item to be returned + * @returns {String|null} + */ + localStorageMemory.getItem = function(key) { + return cache[key] || null; + }; + + /** + * sets item for key to passed value, as String + * + * @para {String} key + * name of item to be set + * @para {String} value + * value, will always be turned into a String + * @returns {undefined} + */ + localStorageMemory.setItem = function(key, value) { + if (typeof value === 'undefined') { + localStorageMemory.removeItem(key); + } else { + if (!(cache.hasOwnProperty(key))) { + localStorageMemory.length++; + } + + cache[key] = '' + value; + } + }; + + /** + * removes item for passed key + * + * @para {String} key + * name of item to be removed + * @returns {undefined} + */ + localStorageMemory.removeItem = function(key) { + if (cache.hasOwnProperty(key)) { + delete cache[key]; + localStorageMemory.length--; + } + }; + + /** + * returns name of key at passed index + * + * @para {Number} index + * Position for key to be returned (starts at 0) + * @returns {String|null} + */ + localStorageMemory.key = function(index) { + return Object.keys(cache)[index] || null; + }; + + /** + * removes all stored items and sets length to 0 + * + * @returns {undefined} + */ + localStorageMemory.clear = function() { + cache = {}; + localStorageMemory.length = 0; + }; + + root.localStorageMemory = localStorageMemory; +})(window); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/services/repo.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/services/repo.js new file mode 100644 index 0000000000..cffa3858fd --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/services/repo.js @@ -0,0 +1,27 @@ +import Ember from 'ember'; +import localStorageMemory from './memory'; + +export default Ember.Service.extend({ + lastId: 0, + data: null, + findAll() { + return this.get('data') || + this.set('data', JSON.parse(window.localStorageMemory.getItem('todos') || '[]')); + }, + + add(attrs) { + let todo = Object.assign({ id: this.incrementProperty('lastId') }, attrs); + this.get('data').pushObject(todo); + this.persist(); + return todo; + }, + + delete(todo) { + this.get('data').removeObject(todo); + this.persist(); + }, + + persist() { + window.localStorageMemory.setItem('todos', JSON.stringify(this.get('data'))); + } +}); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/active.hbs b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/active.hbs new file mode 100644 index 0000000000..de244f487d --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/active.hbs @@ -0,0 +1 @@ +{{todo-list todos=todos}} \ No newline at end of file diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/application.hbs b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/application.hbs new file mode 100644 index 0000000000..519b620cd6 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/application.hbs @@ -0,0 +1,29 @@ +
+ + {{outlet}} + {{#if (gt model.length 0)}} +
+ {{remaining.length}} {{pluralize 'item' remaining.length}} left +
    +
  • {{#link-to "index" activeClass="selected"}}All{{/link-to}}
  • +
  • {{#link-to "active" activeClass="selected"}}Active{{/link-to}}
  • +
  • {{#link-to "completed" activeClass="selected"}}Completed{{/link-to}}
  • +
+ {{#if completed.length}} + + {{/if}} +
+ {{/if}} +
+ \ No newline at end of file diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/completed.hbs b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/completed.hbs new file mode 100644 index 0000000000..de244f487d --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/completed.hbs @@ -0,0 +1 @@ +{{todo-list todos=todos}} \ No newline at end of file diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/components/todo-item.hbs b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/components/todo-item.hbs new file mode 100644 index 0000000000..c06975e865 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/components/todo-item.hbs @@ -0,0 +1,6 @@ +
+ + + +
+ \ No newline at end of file diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/components/todo-list.hbs b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/components/todo-list.hbs new file mode 100644 index 0000000000..309d07a1f4 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/components/todo-list.hbs @@ -0,0 +1,10 @@ +{{#if todos.length}} + {{#if canToggle}} + + {{/if}} + +{{/if}} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/index.hbs b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/index.hbs new file mode 100644 index 0000000000..7d5565c36a --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/emberjs-debug/source/app/templates/index.hbs @@ -0,0 +1,3 @@ +{{#if model.length}} + {{todo-list todos=model}} +{{/if}} -- cgit v1.2.3