<commit_before>var util = require('util'),
    extendWithGettersAndSetters = require('../util/extendWithGettersAndSetters'),
    replaceDescendantNode = require('../replaceDescendantNode'),
    Relation = require('./Relation');

function JavaScriptStaticUrl(config) {
    Relation.call(this, config);
}

util.inherits(JavaScriptStaticUrl, Relation);

extendWithGettersAndSetters(JavaScriptStaticUrl.prototype, {
    get href() {
        return this.argumentNode.value;
    },

    set href(href) {
        this.argumentNode.value = href;
    },

    inline: function () {
        throw new Error('Not implemented');
    },

    attach: function () {
        throw new Error('Not implemented');
    },

    detach: function () {
        throw new Error('Not implemented');
    },

    omitFunctionCall: function () {
        replaceDescendantNode(this.parentNode, this.node, this.argumentNode);
        this.from.markDirty();
    }
});

module.exports = JavaScriptStaticUrl;
<commit_msg>JavaScriptGetStaticUrl: Never issue absolute file:// urls.<commit_after>var util = require('util'),
    extendWithGettersAndSetters = require('../util/extendWithGettersAndSetters'),
    replaceDescendantNode = require('../replaceDescendantNode'),
    Relation = require('./Relation');

function JavaScriptStaticUrl(config) {
    Relation.call(this, config);
}

util.inherits(JavaScriptStaticUrl, Relation);

extendWithGettersAndSetters(JavaScriptStaticUrl.prototype, {
    get href() {
        return this.argumentNode.value;
    },

    set href(href) {
        if (this.assetGraph && /^file:/.test(this.assetGraph.root) && href.indexOf(this.assetGraph.root) === 0) {
            // Hack: Force a root-relative url instead of an absolute file url
            // when eg. pointing back into the root from eg. a CDN and we
            // don't know the canonical root:
            href = '/' + href.substr(this.assetGraph.root.length);
        }
        this.argumentNode.value = href;
    },

    inline: function () {
        throw new Error('Not implemented');
    },

    attach: function () {
        throw new Error('Not implemented');
    },

    detach: function () {
        throw new Error('Not implemented');
    },

    omitFunctionCall: function () {
        replaceDescendantNode(this.parentNode, this.node, this.argumentNode);
        this.from.markDirty();
    }
});

module.exports = JavaScriptStaticUrl;

{'fraction_non_alphanumeric': 0.129206481096801, 'fraction_numerical': 0.0004154549231408392, 'mean_word_length': 3.033500837520938, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2474951', 'n_tokens_mistral': 682, 'n_tokens_neox': 663, 'n_words': 141}