Skip to content

Commit

Permalink
Remove node URL parsing while bugs are being fixed (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny authored and ebidel committed Dec 21, 2016
1 parent 029e1f0 commit 8352aa8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lighthouse-core/lib/url-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@

/* global self */

module.exports = (typeof self !== 'undefined' && self.URL) ||
require('url').URL || require('whatwg-url').URL;
// TODO: Add back node require('url').URL parsing when bug is resolved:
// https://github.com/GoogleChrome/lighthouse/issues/1186
module.exports = (typeof self !== 'undefined' && self.URL) || require('whatwg-url').URL;
29 changes: 29 additions & 0 deletions lighthouse-core/test/lib/url-shim-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2016 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';

/* eslint-env mocha */

const URL = require('../../lib/url-shim');
const assert = require('assert');

describe('URL Shim', () => {
it('handles URLs beginning with multiple digits', () => {
// from https://github.com/GoogleChrome/lighthouse/issues/1186
const url = 'http://5321212.fls.doubleclick.net/activityi;src=5321212;type=unvsn_un;cat=unvsn_uv;ord=7762287885264.98?';
assert.doesNotThrow(_ => new URL(url));
});
});

0 comments on commit 8352aa8

Please sign in to comment.