From 0777fd90a968f7ad2689b6d9f436eff7741212fa Mon Sep 17 00:00:00 2001 From: jrburke Date: Sun, 13 Apr 2014 20:08:47 -0700 Subject: [PATCH] Rollup of changes: Fixes #66, fixes #77, fixes #85 --- LICENSE | 4 ++-- package.json | 2 +- text.js | 20 ++++++++++++-------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/LICENSE b/LICENSE index ffaf317..d3b4181 100644 --- a/LICENSE +++ b/LICENSE @@ -6,7 +6,7 @@ provided below. The "New" BSD License: ---------------------- -Copyright (c) 2010-2011, The Dojo Foundation +Copyright (c) 2010-2014, The Dojo Foundation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MIT License ----------- -Copyright (c) 2010-2011, The Dojo Foundation +Copyright (c) 2010-2014, The Dojo Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index a997e1d..971da5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "text", - "version": "2.0.10", + "version": "2.0.11", "description": "An AMD loader plugin for loading text resources.", "categories": [ "Loader plugins" diff --git a/text.js b/text.js index 1e4fc96..2750113 100644 --- a/text.js +++ b/text.js @@ -1,5 +1,5 @@ /** - * @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * @license RequireJS text 2.0.11 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/requirejs/text for details */ @@ -23,7 +23,7 @@ define(['module'], function (module) { masterConfig = (module.config && module.config()) || {}; text = { - version: '2.0.10', + version: '2.0.11', strip: function (content) { //Strips declarations so that external SVG and XML @@ -162,12 +162,12 @@ define(['module'], function (module) { // Do not bother with the work if a build and text will // not be inlined. - if (config.isBuild && !config.inlineText) { + if (config && config.isBuild && !config.inlineText) { onLoad(); return; } - masterConfig.isBuild = config.isBuild; + masterConfig.isBuild = config && config.isBuild; var parsed = text.parseName(name), nonStripName = parsed.moduleName + @@ -257,7 +257,9 @@ define(['module'], function (module) { } callback(file); } catch (e) { - errback(e); + if (errback) { + errback(e); + } } }; } else if (masterConfig.env === 'xhr' || (!masterConfig.env && @@ -286,11 +288,13 @@ define(['module'], function (module) { //visible via console output in the browser. if (xhr.readyState === 4) { status = xhr.status; - if (status > 399 && status < 600) { + if ((status > 399 && status < 600) || status === 0) { //An http 4xx or 5xx error. Signal an error. err = new Error(url + ' HTTP status: ' + status); err.xhr = xhr; - errback(err); + if (errback) { + errback(err); + } } else { callback(xhr.responseText); } @@ -347,7 +351,7 @@ define(['module'], function (module) { typeof Components !== 'undefined' && Components.classes && Components.interfaces)) { //Avert your gaze! - Cc = Components.classes, + Cc = Components.classes; Ci = Components.interfaces; Components.utils['import']('resource://gre/modules/FileUtils.jsm'); xpcIsWindows = ('@mozilla.org/windows-registry-key;1' in Cc);